Mail Log-Handler

From Resin 3.0

Revision as of 17:38, 21 October 2011 by Pcowan (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


For critical log messages, you can be notified by email when the event occurs, rather than waiting until you check the logs.

The mail log is configured as a standard JDK log handler with Resin's <log-handler> tag.

resin.xml configuration

The resin.xml configuration for the logger adds a java.util.logging handler using Resin's <log-handler> tag, and sets the logger level with the <logger> tag.

In this case, we're having the MailLogHandler listen for logs under "mycom.foo" classes and at the warning level or higher. Mails are sent to caucho@localhost.

 <resin xmlns="http://caucho.com/ns/resin"
      xmlns:resin="urn:java:com.caucho.resin">

   <log-handler name="mycom.foo" level="warning">
      <resin:MailLogHandler>
        <to>caucho@localhost</to>
      </resin:MailLogHandler>
   </log-handler>

   <logger name="mycom.foo" level="info"/>
 
   <cluster id=""> 
     <resin:import path="${__DIR__}/app-default.xml"/>

     <server id="" port="6800">
        <http port="8080"/>
     </server>

     <host id="">
       <root-directory>/var/www/public-html</root-directory>

       <web-app id=""/>
     </host>
   </cluster>

 </resin>
Personal tools