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.


   <!-- Logging properties for non-ODL loggers -->
      <property name="com.sun.mail.util.logging.MailHandler.level"
      <property name="com.sun.mail.util.logging.MailHandler.pushLevel"
      <property name="com.sun.mail.util.logging.MailHandler.mail.smtp.host"
      <property name="com.sun.mail.util.logging.MailHandler.mail.to"
      <property name="com.sun.mail.util.logging.MailHandler.mail.from"
      <property name="com.sun.mail.util.logging.MailHandler.mail.sender"
      <property name="com.sun.mail.util.logging.MailHandler.subject"
         value="Suitable subject"/>
      <!-- Standard handlers here, for example oc4j-handler -->

      <log_handler name="mail-notification-handler"
      <logger name="oracle" level="INFO" useParentHandlers="false">
         <handler name="oc4j-handler"/>
         <handler name="mail-notification-handler"/>

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

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.

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: