 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
qdnguyen
Joined: 29 Sep 2009 Posts: 10 Country: United States |
|
Does 24x7 scheduler record messages sent to stdout? |
|
Hello,
We have our own logging system written in Java, and when it logs some message it also sends the message to the stdout. So if a job is run from the command line, the user should be able to see what is being sent to the log.
Does 24x7 listen to the stdout and keep the messages that was sent to the stdout anywhere?
Thanks
|
|
Thu Oct 01, 2009 1:26 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7952
|
|
|
|
If you want to capture the output, you can specify output redirection on the command line, for example,
CMD /C myprogram.bat > c:\Logs\myprogram_@T"yyyymmdd_hhmmss".log
If you want both stdout and stderror
CMD /C myprogram.bat > c:\Logs\myprogram_@T"yyyymmdd_hhmmss".log 2>&1
You can also capture separately stdout and stderr; write to separate log files for every job instance, or append them to existing log files; or implement daily logs with rotation by using correct macro-parameters for file names and correct redirection symbols.
CMD /C myprogram.bat >> c:\Logs\myprogram_@T"yyyymmdd".log
To control the log history depth, you can use the FileDir utility http://www.softtreetech.com/24x7/archive/46.htm or something similar to periodically delete old log files, perhaps automatically delete job logs that are over 30 days old.
|
|
Thu Oct 01, 2009 2:11 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7952
|
|
|
|
If you are running it on non-Windows system, you can use similar methods, using sh / c instead of cmd /C.
To automatically check the text captured from stdout, convert job to JavaScript job, read the log file after job run and scan it for errors, for example,
Process.runAndWait( ... );
log = File.readAll( ... );
if ( log.search( ... ) != -1 ) Mail.mailSend( ... ) or alternatively Scheduler.raiseError( ... )
If you need to do that for many jobs, I recommend to create a template and then use that template to quickly create the jobs.,
|
|
Thu Oct 01, 2009 2:19 pm |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|