Mail Log-Handler

From Resin 3.0

(Difference between revisions)
Jump to: navigation, search
(New page: Category: Cookbook Category: Logging 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 ...)
 
 
(One intermediate revision by one user not shown)
Line 11: Line 11:
 
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.
 
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">
+
   <resin xmlns="http://caucho.com/ns/resin"
 +
      xmlns:resin="urn:java:com.caucho.resin">
 
   
 
   
 
     <log-handler name="mycom.foo" level="warning">
 
     <log-handler name="mycom.foo" level="warning">

Latest revision as of 17:38, 21 October 2011


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