org.owasp.esapi.reference
Class ExampleExtendedLog4JLogFactory

java.lang.Object
  extended by org.owasp.esapi.reference.Log4JLogFactory
      extended by org.owasp.esapi.reference.ExampleExtendedLog4JLogFactory
All Implemented Interfaces:
LogFactory

public class ExampleExtendedLog4JLogFactory
extends Log4JLogFactory

This class demonstrates how to override the ESAPI Log4JLogFactory user-specific message so implementors can utilize their individual user object implementations. Please copy this code, rename and repackage it, and change public String getUserInfo() { return "-EXTENDEDUSERINFO-"; } .. so that is uses your own user implementation. Account name, IP address, and a "safe" version of the session ID should be considered. This implementation uses the Apache Log4J package. At class initialization time, the file log4j.properties or log4j.xml file will be loaded from the classpath. This configuration file is fundamental to make log4j work for you. Please see http://logging.apache.org/log4j/1.2/manual.html for more information.

Author:
Jim Manico ([email protected]) manico.net
See Also:
LogFactory, Log4JLogFactory

Nested Class Summary
protected static class ExampleExtendedLog4JLogFactory.ExampleExtendedLog4JLogger
           
 
Nested classes/interfaces inherited from class org.owasp.esapi.reference.Log4JLogFactory
Log4JLogFactory.Log4JLogger
 
Field Summary
 
Fields inherited from class org.owasp.esapi.reference.Log4JLogFactory
loggersMap
 
Constructor Summary
ExampleExtendedLog4JLogFactory()
           
 
Method Summary
 Logger getLogger(java.lang.String moduleName)
          Gets the logger associated with the specified module name. The module name is used by the logger to log which module is generating the log events. The implementation of this method should return any preexisting Logger associated with this module name, rather than creating a new Logger.

The JavaLogFactory reference implementation meets these requirements.
 
Methods inherited from class org.owasp.esapi.reference.Log4JLogFactory
getInstance, getLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExampleExtendedLog4JLogFactory

public ExampleExtendedLog4JLogFactory()
Method Detail

getLogger

public Logger getLogger(java.lang.String moduleName)
Gets the logger associated with the specified module name. The module name is used by the logger to log which module is generating the log events. The implementation of this method should return any preexisting Logger associated with this module name, rather than creating a new Logger.

The JavaLogFactory reference implementation meets these requirements.

Specified by:
getLogger in interface LogFactory
Overrides:
getLogger in class Log4JLogFactory
Parameters:
moduleName - The name of the module requesting the logger.
Returns:
The Logger associated with this module.


Copyright © 2010 The Open Web Application Security Project (OWASP). All Rights Reserved.