I've created a custom logger,
inherited from FileLogger (I had to upgrade to 4.1.12 because
in 4.0.6 FileLogger is final)
I put a jar file with my logger in $TOMCAT_HOME/server/lib dir
and modified
$TOMCAT_HOME/server/lib/catalina.jar/org/apache/catalina/mbeans/mbeans-descriptors.xml
and registered an mbean with my logger. I copied a definition from
FileLogger (just changed a name)
I've overriden a method
public void log(String,Throwable)
{
sendMailToAdmins(str);
super.log(str, throwable);
}
and it worked.
Is this the best way to achieve such a tiny thing?
Especially I did not like to dig into the catalina.jar and modify
mbeans-descriptors.xml file.
If someone knows a better way please help
Thanks in advance
On Thu, 2003-02-13 at 08:50, John Trollinger wrote:
> You could crate a custom logger extending the tomcat loggers that would
> handle this for you.
>
> John
>
> > -----Original Message-----
> > From: Vano Beridze [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, February 13, 2003 3:15 PM
> > To: Tomcat Users List
> > Subject: log listener
> >
> >
> >
> > Hello
> >
> > I'have the following scenario
> >
> > I've got a web application that logs it's output using
> > standard tomcat mechanisms
> >
> > excerpt from server.xml
> >
> > ....
> > <Context path="/srm" docBase="/home/vanob/projects/SRM" debug="0"
> > reloadable="true" crossContext="true">
> > <Logger className="org.apache.catalina.logger.FileLogger"
> > prefix="localhost_srm_log." suffix=".txt"
> > timestamp="true"/>
> > <Resource name="mail/Session" auth="Container"
> > type="javax.mail.Session"/>
> > <ResourceParams name="mail/Session">
> > <parameter>
> > <name>mail.smtp.host</name>
> > <value>mail.silkroad.ge</value>
> > </parameter>
> > </ResourceParams>
> > </Context>
> > ....
> >
> >
> > I would like to intercept all exceptions logged in a logfile
> > and send mail to my email address. what is the best wat to
> > achieve this? thanks
> >
> > P.S. from my application I have centralized mechanism of
> > logging events (I have LogMan class). So it's not the problem
> > to solve the problem by sending mail from this class, but
> > there are still cases, for example NPE-s that are logged by
> > tomcat and I want to be able to have control on this events also
> > --
> > Vano Beridze <[EMAIL PROTECTED]>
> > Silkroad Corporation S.A.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
--
Vano Beridze <[EMAIL PROTECTED]>
Silkroad Corporation S.A.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]