Home > SOA Suite > Logging OC4J errors to mail

Logging OC4J errors to mail

A common problem customers face with ESB and BPEL in OC4J is how to find and react to low-level errors. Most errors can be handled and are visible in the consoles, but some types of fatal errors are only reported to the log files. For example, if an inbound FTP-adapter fails to delete a file it will log the error and shutdown. If the server is restarted it will process the file again, causing a duplicate.

One solution is to monitor the log files, either manually or with tools. However, without tool support the operators may have a hard time keeping up with the logs. Fortunately the logging framework can be configured to send mail for serious errors.

JavaMail comes with a logging handler starting with version 1.4.3. Replace the existing file $ORACLE_HOME/j2ee/home/lib/mail.jar with the one from JavaMail 1.4.3 if necessary, then edit $ORACLE_HOME/j2ee/oc4j_soa/config/j2ee-logging.xml (assuming that the OC4J-container is oc4j_soa).
The mail handler should be configured in a logging_properties section. Add a new log_handler using com.sun.mail.util.logging.MailHandler. Modify the existing logger for "oracle" to use both the old oc4j-handler and the new mail handler.

Example:


<logging_configuration>
   <!-- Logging properties for non-ODL loggers -->
   <logging_properties>
      <property name="com.sun.mail.util.logging.MailHandler.level"
         value="SEVERE"/>
      <property name="com.sun.mail.util.logging.MailHandler.pushLevel"
         value="SEVERE"/>
      <property name="com.sun.mail.util.logging.MailHandler.mail.smtp.host"
         value="mailserver-host-or-ip"/>
      <property name="com.sun.mail.util.logging.MailHandler.mail.to"
         value="operator@some.com"/>
      <property name="com.sun.mail.util.logging.MailHandler.mail.from"
         value="noreply@some.com"/>
      <property name="com.sun.mail.util.logging.MailHandler.mail.sender"
         value="oc4j@some.com"/>
      <property name="com.sun.mail.util.logging.MailHandler.subject"
         value="Suitable subject"/>
   </logging_properties>
   <log_handlers>
      <!-- Standard handlers here, for example oc4j-handler -->

      <log_handler name="mail-notification-handler"
         class="com.sun.mail.util.logging.MailHandler"/>
   </log_handlers>
   <loggers>
      <logger name="oracle" level="INFO" useParentHandlers="false">
         <handler name="oc4j-handler"/>
         <handler name="mail-notification-handler"/>
      </logger>

      <!-- Other loggers here, no changes -->
   </loggers>
</logging_configuration>

With this configuration messages are sent for errors (level SEVERE), warnings and other messages are only logged to the standard log files. Obviously the mail server and all the addresses must be replaced.

Advertisements
Categories: SOA Suite
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: