RE: Error Log watcher

2003-02-14 Thread Shapira, Yoav
Howdy,

>Can you use these appenders as part of catching exceptions from within
>the Code? That is, if you catch a certain exception that is going to be
>logged, you set isTriggeringEvent on it and Log4J can then do what
needs
>to be done?

The way it works is like this:
- You define the appender (SMTP appender for emails)
- You define the class (a java class) of the TriggeringEventEvaluator
- The above two can be done in a configuration file, no coding needed
- You write the triggering event evaluator (have to write java for this)
- The application uses log4j to do its logging normally.  It doesn't
need to know about the triggering event evaluator at all.  Log4j will
automatically evaluate events sent to the mail appender and decide
whether to send emails or not.

>Using the SMTPAppender to email it my pager would be plenty.

Then you're pretty much all set.  I'll even attach a simple string match
evaluator for use as an example.  (Yes, I'm bored today ;))

Yoav Shapira
Millennium ChemInformatics



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


public class StringMatchEvaluator
  implements TriggeringEventEvaluator {
  /**
   * Interface method.
   * Returns true if the given
   * event should trigger 
   * the appender.
   *
   * This implementation checks for
   * the presence of the String "blah".
   * Add a setter for blah to customize
   * the match string.
   *
   * @param event The logging event
   * @return boolean
   */
   public boolean isTriggeringEvent(LoggingEvent event) {
 if(event == null) {
   return false;
 }

 String eventMessage = event.getMessage();
 if((eventMessage != null) &&
(eventMessage.indexOf("blah") > -1)) {
   return true;
 }

 ThrowableInformation ti = event.ThrowableInformation();
 if(ti != null) {
   String[] stackTrace = ti.getThrowableStrRep();
   if(stackTrace != null) {
 for(int i = 0; i < stackTrace.length; i++) {
   if(stackTrace[i].indexOf("blah") > -1) {
 return true;
   }
 }
   }
 }

 return false;
   }
}

// End of class: StringMatchEvaluator.java
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Error Log watcher

2003-02-14 Thread Ben Ricker
On Fri, 2003-02-14 at 09:57, Shapira, Yoav wrote:
> Howdy,
> 
> OK.  I actually went and looked at the Swatch page out of interest.
> Cool tool.

Yes it is. I use it on my Apache error logs and to security checks on
the access_logs. Easy to setup to boot.

> Here's an approach that may work for you: use log4j.  Implement a
> TriggeringEventEvaluator
> (http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/spi/Triggerin
> gEventEvaluator.html) to do the regex or whatever rules you want to
> decide required a page from a log message.  The evaluator will get every
> log message, including its complete stack trace and any details you want
> to add.  You can use log4j's MDC
> (http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/MDC.html) to
> provide any details needed in order to decide whether the event merits a
> message to your page or not.
> 
> Log4j comes with an SMTP appender that sends email and has all the logic
> you want: throttling and arbitrary rules for even evaluation.  See
> http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/net/SMTPAppend
> er.html for details.

Some more information about myself: I am a system administrator. The
extent of my programmin g experience ends at "Perl for System
Administrators". So I have a questions that may sound dumb:

Can you use these appenders as part of catching exceptions from within
the Code? That is, if you catch a certain exception that is going to be
logged, you set isTriggeringEvent on it and Log4J can then do what needs
to be done? 

> Log4j doesn't come with a pager appender right now.  You could use a JMS
> appender to send events (that pass the triggering event evaluator's
> criteria) to a JMS server somewhere, as there are J2EE servers that can
> handle paging.  Alternatively, you can write the pager appender yourself
> and maybe even donate it to us as a log4j contribution ;)  

Using the SMTPAppender to email it my pager would be plenty.

> This may seem like a lot, but it's really more work explaining the
> process than doing it ;)

If I understand it right, you are right. This would be easily added to
our existing exception handling.

Thanks for the info!

Ben Ricker

-- 
Ben Ricker <[EMAIL PROTECTED]>
Wellinx.com


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Error Log watcher

2003-02-14 Thread Shapira, Yoav

Howdy,

>Good question! Sorry I did not include it. I am looking for something
>similar to swatch, but can handle the multiple-lined errors. I would
>want the program to have some sort of rules setting functionality
>(preferably regex) and that allows actions based upon the specified
>rules.

OK.  I actually went and looked at the Swatch page out of interest.
Cool tool.

Here's an approach that may work for you: use log4j.  Implement a
TriggeringEventEvaluator
(http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/spi/Triggerin
gEventEvaluator.html) to do the regex or whatever rules you want to
decide required a page from a log message.  The evaluator will get every
log message, including its complete stack trace and any details you want
to add.  You can use log4j's MDC
(http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/MDC.html) to
provide any details needed in order to decide whether the event merits a
message to your page or not.

Log4j comes with an SMTP appender that sends email and has all the logic
you want: throttling and arbitrary rules for even evaluation.  See
http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/net/SMTPAppend
er.html for details.

Log4j doesn't come with a pager appender right now.  You could use a JMS
appender to send events (that pass the triggering event evaluator's
criteria) to a JMS server somewhere, as there are J2EE servers that can
handle paging.  Alternatively, you can write the pager appender yourself
and maybe even donate it to us as a log4j contribution ;)

This may seem like a lot, but it's really more work explaining the
process than doing it ;)

Yoav Shapira
Millennium ChemInformatics



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Error Log watcher

2003-02-14 Thread Ben Ricker
On Fri, 2003-02-14 at 09:16, Shapira, Yoav wrote:
> Howdy,
> What would you require from this "error log watcher" ?

Good question! Sorry I did not include it. I am looking for something
similar to swatch, but can handle the multiple-lined errors. I would
want the program to have some sort of rules setting functionality
(preferably regex) and that allows actions based upon the specified
rules.

The actions would basically be alpha pages which would include the error
message in the page. Some throttling would be nice, so multiple errors
would not flood my pager.

Ben Ricker


> >-Original Message-
> >From: Ben Ricker [mailto:[EMAIL PROTECTED]]
> >Sent: Friday, February 14, 2003 9:58 AM
> >To: Tomcat Users List
> >Subject: Error Log watcher
> >
> >I am wondering if anyone has found a good error log watcher for Tomcat?
> >Swatch does not work because it is made for syslog-type logs where an
> >error message occurs on one line. So, it views a java error as one
> line,
> >which really does not help.
> >
> >Anyone try any other programs?
> >
> >Ben Ricker
> >
> >--
> >Ben Ricker <[EMAIL PROTECTED]>
> >Wellinx.com
> >
> >
> >-
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 
> This e-mail, including any attachments, is a confidential business communication, 
>and may contain information that is confidential, proprietary and/or privileged.  
>This e-mail is intended only for the individual(s) to whom it is addressed, and may 
>not be saved, copied, printed, disclosed or used by anyone else.  If you are not 
>the(an) intended recipient, please immediately delete this e-mail from your computer 
>system and notify the sender.  Thank you.
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
-- 
Ben Ricker <[EMAIL PROTECTED]>
Wellinx.com


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Error Log watcher

2003-02-14 Thread Shapira, Yoav

Howdy,
What would you require from this "error log watcher" ?


Yoav Shapira
Millennium ChemInformatics


>-Original Message-
>From: Ben Ricker [mailto:[EMAIL PROTECTED]]
>Sent: Friday, February 14, 2003 9:58 AM
>To: Tomcat Users List
>Subject: Error Log watcher
>
>I am wondering if anyone has found a good error log watcher for Tomcat?
>Swatch does not work because it is made for syslog-type logs where an
>error message occurs on one line. So, it views a java error as one
line,
>which really does not help.
>
>Anyone try any other programs?
>
>Ben Ricker
>
>--
>Ben Ricker <[EMAIL PROTECTED]>
>Wellinx.com
>
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Error Log watcher

2003-02-14 Thread Ben Ricker
I am wondering if anyone has found a good error log watcher for Tomcat?
Swatch does not work because it is made for syslog-type logs where an
error message occurs on one line. So, it views a java error as one line,
which really does not help.

Anyone try any other programs?

Ben Ricker

-- 
Ben Ricker <[EMAIL PROTECTED]>
Wellinx.com


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]