Package org.owasp.esapi.reference
Class Log4JLogFactory
- java.lang.Object
-
- org.owasp.esapi.reference.Log4JLogFactory
-
- All Implemented Interfaces:
LogFactory
public class Log4JLogFactory extends java.lang.Object implements LogFactory
Reference implementation of the LogFactory interface. This implementation uses the Apache Log4J package, and marks each log message with the currently logged in user and the word "SECURITY" for security related events. See the JavaLogFactory.JavaLogger Javadocs for the details on the JavaLogger reference implementation. 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. Note that you must specify the LogFactory in either log4j.properties:log4j.loggerFactory=org.owasp.esapi.reference.Log4JLoggerFactory
or log4j.xml:<loggerFactory class="org.owasp.esapi.reference.Log4JLoggerFactory"/>
- Since:
- June 1, 2007
- Author:
- Mike H. Fauzy (mike.fauzy@aspectsecurity.com) Aspect Security, Jim Manico (jim@manico.net) Manico.net, Jeff Williams (jeff.williams .at. aspectsecurity.com) Aspect Security, August Detlefsen (augustd at codemagi dot com) CodeMagi, Inc.
- See Also:
LogFactory
,Log4JLogger
,Log4JLoggerFactory
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Log4JLogFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static LogFactory
getInstance()
Logger
getLogger(java.lang.Class clazz)
Gets the logger associated with the specified class.Logger
getLogger(java.lang.String moduleName)
Gets the logger associated with the specified module name.
-
-
-
Method Detail
-
getInstance
public static LogFactory getInstance()
-
getLogger
public Logger getLogger(java.lang.Class clazz)
Gets the logger associated with the specified class. The class is used by the logger to log which class is generating the log events. The implementation of this method should return any preexisting Logger associated with this class name, rather than creating a new Logger.
The JavaLogFactory reference implementation meets these requirements.- Specified by:
getLogger
in interfaceLogFactory
- Parameters:
clazz
- The name of the class requesting the logger.- Returns:
- The Logger associated with this class.
-
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 interfaceLogFactory
- Parameters:
moduleName
- The name of the module requesting the logger.- Returns:
- The Logger associated with this module.
-
-