org.snmp4j.log
Class LogFactory

java.lang.Object
  extended by org.snmp4j.log.LogFactory
Direct Known Subclasses:
ConsoleLogFactory, JavaLogFactory, Log4jLogFactory

public class LogFactory
extends java.lang.Object

The LogFactory singleton is used by SNMP4J to determine the logging framework used to process SNMP4J log messages. By default NoLogger instances are used.

Since:
1.2.1
Version:
1.8
Author:
Frank Fock

Field Summary
static java.lang.String SNMP4J_LOG_FACTORY_SYSTEM_PROPERTY
           
 
Constructor Summary
LogFactory()
           
 
Method Summary
protected  LogAdapter createLogger(java.lang.Class c)
          Creates a Logger for the specified class.
protected  LogAdapter createLogger(java.lang.String className)
          Creates a Logger for the specified class.
static LogFactory getLogFactory()
          Gets the log factory to be used by SNMP4J.
static LogAdapter getLogger(java.lang.Class c)
          Gets the logger for the supplied class.
static LogAdapter getLogger(java.lang.String className)
          Gets the logger for the supplied class name.
 LogAdapter getRootLogger()
          Returns the top level logger.
 java.util.Iterator loggers()
          Returns all available LogAdapters in depth first order.
static void setLogFactory(LogFactory factory)
          Sets the log factory to be used by SNMP4J.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SNMP4J_LOG_FACTORY_SYSTEM_PROPERTY

public static final java.lang.String SNMP4J_LOG_FACTORY_SYSTEM_PROPERTY
See Also:
Constant Field Values
Constructor Detail

LogFactory

public LogFactory()
Method Detail

getLogger

public static LogAdapter getLogger(java.lang.Class c)
Gets the logger for the supplied class.

Parameters:
c - the class for which a logger needs to be created.
Returns:
the LogAdapter instance.

getRootLogger

public LogAdapter getRootLogger()
Returns the top level logger.

Returns:
a LogAdapter instance.
Since:
1.7

getLogger

public static LogAdapter getLogger(java.lang.String className)
Gets the logger for the supplied class name.

Parameters:
className - the class name for which a logger needs to be created.
Returns:
the LogAdapter instance.
Since:
1.7

createLogger

protected LogAdapter createLogger(java.lang.Class c)
Creates a Logger for the specified class. This method returns the NoLogger logger instance which disables logging. Overwrite this method the return a custom logger to enable logging for SNMP4J.

Parameters:
c - the class for which a logger needs to be created.
Returns:
the LogAdapter instance.

createLogger

protected LogAdapter createLogger(java.lang.String className)
Creates a Logger for the specified class. This method returns the NoLogger logger instance which disables logging. Overwrite this method the return a custom logger to enable logging for SNMP4J.

Parameters:
className - the class name for which a logger needs to be created.
Returns:
the LogAdapter instance.
Since:
1.7

setLogFactory

public static void setLogFactory(LogFactory factory)
Sets the log factory to be used by SNMP4J. Call this method before any other SNMP4J class is referenced or created to set and use a custom log factory.

Parameters:
factory - a LogFactory instance.

getLogFactory

public static LogFactory getLogFactory()
Gets the log factory to be used by SNMP4J. If the log factory has not been initialized by setLogFactory(org.snmp4j.log.LogFactory) a new instance of LogFactory is returned.

Returns:
a LogFactory instance.
Since:
1.7

loggers

public java.util.Iterator loggers()
Returns all available LogAdapters in depth first order.

Returns:
a read-only Iterator.
Since:
1.7

Copyright 2005-2010 Frank Fock (SNMP4J.org)

Copyright © 2011 SNMP4J.org. All Rights Reserved.