[logback-user] Exception Handler
Brian Moschel
brian.moschel at gmail.com
Tue May 12 01:32:33 CEST 2009
Hey guys,
I have a Jetty application that I configured with Logback. I am trying to
set it up so any errors that occur during execution are emailed to me. I am
a bit of a noobie, and so far I haven't had any luck with this. I can only
get exceptions emailed to me if I explicitly set a try/catch block in my
code everywhere and call logger.error(...). Is there an easy way to cause
all exceptions to be logged and emailed to me via my SMTPAppender?
Here is the config I have attempted to use so far:
<configuration debug="true">
<appender name="EMAIL" class="ch.qos.logback.classic.net.SMTPAppender">
<SMTPHost>smtp.gmail.com</SMTPHost>
<SMTPPort>465</SMTPPort>
<SSL>true</SSL>
<Username>myemail</Username>
<Password>my password</Password>
<To> myemail</To>
<From> myemail</From>
<Subject>TESTING: %logger{20} - %m</Subject>
<layout class="ch.qos.logback.classic.html.HTMLLayout"/>
</appender>
<root level="debug">
<appender-ref ref="EMAIL" />
</root>
<logger name="exception" level="ERROR">
<appender-ref ref="EMAIL"></appender-ref>
</logger>
<logger name="org.mortbay" level="error">
<appender-ref name="EMAIL">
</appender-ref></logger>
<logger name="developerworks.jetty6" level="error">
<appender-ref name="EMAIL">
</appender-ref></logger>
<logger name="jupiter.filters" level="error">
<appender-ref name="EMAIL">
</appender-ref></logger>
<logger name="jupiter.messaging" level="error">
<appender-ref name="EMAIL">
</appender-ref></logger>
</configuration>
Thanks,
Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/logback-user/attachments/20090511/4a2c4940/attachment.htm>
More information about the Logback-user
mailing list