Class Loggable

  extended by weblogic.i18n.logging.Loggable
      extended by weblogic.logging.Loggable

public class Loggable
extends Loggable

Loggable objects are used when there is a need to collect log entry data without actually logging the message until a later time. Type casting is weak for the log parameters provided when constructing. The user must ensure that the arguments associated with a particular log message are of the appropriate type and in the correct order.

It is therefore preferable to not explicitly create Loggable objects, rather they should be defined through the relevant message catalog file as follows:

  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE message_catalog PUBLIC "weblogic-message-catalog-dtd" "">
        method="logExample(String arg1)"
           Test message with arg, {0}

The above catalog defines the logExample(String) method plus a logExampleLoggable(String) method. The latter is created due to the presence of the loggables="true" setting for the message_catalog element. The logExample(String) method logs the message and returns the id of the message. The logExampleLoggable(String) method does not log the message, and returns the appropriate Loggable object for the message. Loggable objects are convenient for logging messages and using the same text in a Throwable. For example,

 import examples.LoggableExampleLogger;
 import weblogic.logging.Loggable;
 // some error detected
 Loggable l = LoggableExampleLogger.logExampleLoggable("whatever");
 l.log();  // this logs the message
 throw new Exception(l.getMessage()); // creates exception with same text as logged

Constructor Summary
Loggable(String id, Object[] args)
          Creates an object that can be logged to the server log.
Method Summary
Methods inherited from class weblogic.i18n.logging.Loggable
getId, getMessage, getMessage, getMessageBody, getMessageText, getMessageText, log
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public Loggable(String id,
                Object[] args)
Creates an object that can be logged to the server log.

Documentation is available at
Copyright 1996,2008, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.