Is there a method to capture log events with an external jar?
I have a jar in the ext directory and I would like to have it monitor events from the log. For example if "session.logError" is called I'd like to have the external library handle a specific task, maybe send an email.
I could go into the screen-scraper session and add some code which triggers the external library, however I have several hundred sessions that I would have to update and it would be much easier to hook into the log events if that's possible.
Thanks, Jeremy
There currently isn't a hook
There currently isn't a hook to allow for that, though there are lots of ways to monitor for errors. I'd need to know more what you're watching for, but I'm sure something could be done.
Try/Catch
Hi Jason,
I currently use a Try/Catch statement like this:
try{
do some work here
...
}
catch( Exception e )
{
session.logError( "LOG:ERROR, MSG: " + e.getMessage() );
}
Instead of having to open the log and check for this after the session finished I was hoping to get an event when the error occurred. Sometimes I have the software run for a few days and I want to react faster. Also I want to log errors in a database for review later.
If I have to make a direct call to the external lib I can make it work, but picking up the existing events would be a more natural fit.
Any help or suggestions would be great!
Thanks, Jeremy
If you have enterprise
If you have enterprise edition, you could use sutil.sendMail. Otherwise, I like to use sutil.writeValueToFile to make an error file, and then I have a cron to monitor for that file.