com.plumtree.remote.logging
Class LogFactory

java.lang.Object
  extended bycom.plumtree.remote.logging.LogFactory

public class LogFactory
extends java.lang.Object

The LogFactory is the starting point for the IDK Logging API, and offers static methods to configure logging, query configuration properties, and obtain ILogger instances.


Method Summary
static java.lang.String getApplicationName()
          Gets the logging application name initialized or configured into the IDK logging framework, or empty string if logging is not initialized.
static ILogger getLogger(java.lang.String componentName, java.lang.Class loggingClass)
          Returns a logger instance associated with the named component and the given class.
static ILogger getLogger(java.lang.String componentName, java.lang.String loggingLocation)
          Returns a logger instance associated with the named component and the named location.
static void initialize(java.lang.String loggingApplicationName, boolean logToNetwork)
          Initializes logging with the specified logging application name and whether or not to send log messages to receivers on the network.
static boolean isInitialized()
          Returns true if the IDK logging framework has been initialized either from the logging API or from external configuration.
static boolean isLoggingToNetwork()
          Returns true if the IDK logging framework is configured to send log messages to receivers on the local network, and false if messages are only sent to receivers on the local machine.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getLogger

public static ILogger getLogger(java.lang.String componentName,
                                java.lang.Class loggingClass)
Returns a logger instance associated with the named component and the given class.

If logging is not initialized, the framework will attempt to initialize logging from the external configuration file (web.xml). If a value is found for the logging application name, the logging framework will be initialized before the logger instance is returned.

Any log messages sent to the logger before the logging framework is initialized will be discarded.

Parameters:
componentName - a string identifying a category of related log messages
loggingClass - a class instance specifying the location for this logger's messages
Returns:
an ILogger instance associated with the named component and the given class
Throws:
java.lang.IllegalArgumentException - if logging is not already initialized and the underlying web configuration file has an invalid but non-empty logging application name

getLogger

public static ILogger getLogger(java.lang.String componentName,
                                java.lang.String loggingLocation)
Returns a logger instance associated with the named component and the named location. The named location may describe a class or other location within the code.

If logging is not initialized, the framework will attempt to initialize logging from the external configuration file (web.xml). If a value is found for the logging application name, the logging framework will be initialized before the logger instance is returned.

Any log messages sent to the logger before the logging framework is initialized will be discarded.

Parameters:
componentName - a string identifying a category of related log messages
loggingLocation - a name specifying a class or specific location for this logger's messages
Returns:
an ILogger instance associated with the named component and the named location
Throws:
java.lang.IllegalArgumentException - if logging is not already initialized and the underlying web configuration file has an invalid but non-empty logging application name

initialize

public static void initialize(java.lang.String loggingApplicationName,
                              boolean logToNetwork)
                       throws java.lang.IllegalArgumentException,
                              java.lang.IllegalStateException
Initializes logging with the specified logging application name and whether or not to send log messages to receivers on the network. Any logger instances obtained before the logging framework is initialized will be enabled to send messages after this method is called successfully.

If an external configuration file is present (web.xml), the values set in the configuration file take priority over values passed in the parameters.

Parameters:
loggingApplicationName - the identifier common to the log sender and receivers. Must be 1-32 characters selected from ASCII alphanumerics plus period, hyphen, underscore, and space.
logToNetwork - true if the log messages may be sent to remote receivers via the network false if only local receivers will get messages
Throws:
java.lang.IllegalArgumentException - if an improper value is passed for loggingApplicationName
java.lang.IllegalStateException - if the name and network logging parameters do not match the values previously initialized via initialize() or from external configuration

isInitialized

public static boolean isInitialized()
Returns true if the IDK logging framework has been initialized either from the logging API or from external configuration. Log messages sent to an uninitialized logger will be discarded.

Returns:
true if initialized, whether from API or from external configuration

isLoggingToNetwork

public static boolean isLoggingToNetwork()
Returns true if the IDK logging framework is configured to send log messages to receivers on the local network, and false if messages are only sent to receivers on the local machine.

Returns:
true if the logging framework is configured to send log messages to remote receivers over the network

getApplicationName

public static java.lang.String getApplicationName()
Gets the logging application name initialized or configured into the IDK logging framework, or empty string if logging is not initialized. This matches the "server" name required by ALI Logging Spy or the ALI Logger.

Returns:
the value of the logging application name, or an empty string if not configured with a value


For additional information on the Oracle® WebCenter Interaction Development Kit, including tutorials, blogs, code samples and more, see the Oracle Technology Network (http://www.oracle.com/technology/index.html).

Copyright ©2010 Oracle® Corporation. All Rights Reserved.