Class ConsoleLogFactory
java.lang.Object
org.snmp4j.log.LogFactory
org.snmp4j.log.ConsoleLogFactory
The
ConsoleLogFactory implements a SNMP4J LogFactory for
system out. In order to use simple stdout logging for SNMP4J, the
static LogFactory.setLogFactory(LogFactory) method has to be used before
any SNMP4J class is referenced or instantiated.- Since:
- 1.6
- Version:
- 3.9.7
- Author:
- Frank Fock
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionConsoleLogFactory(PrintStream outStream, PrintStream errStream) Constructs aConsoleLogFactoryinstance using the specifiedPrintStream. -
Method Summary
Modifier and TypeMethodDescriptionprotected LogAdaptercreateLogger(Class<?> c) Creates a Logger for the specified class.protected LogAdaptercreateLogger(String className) Creates a Logger for the specified class.Returns the top level logger.Methods inherited from class LogFactory
addHandler, getLogFactory, getLogger, getLogger, getLoggerConfigPrefix, getLogHandlerConfigPrefix, loggers, removeAllHandlers, reset, resetLogger, setLogFactory, setLoggerConfigPrefix, setLogHandlerConfigPrefix, updateConfiguration, updateLogger, writeConfiguration, writeConfiguration, writeConfiguration
-
Constructor Details
-
ConsoleLogFactory
public ConsoleLogFactory() -
ConsoleLogFactory
Constructs aConsoleLogFactoryinstance using the specifiedPrintStream. This allows log messages to be directed to a custom output stream. Default isSystem.outif the default constructor is used.- Parameters:
outStream- thePrintStreamwhere log messages will be written.errStream- thePrintStreamwhere error messages will be written.- Since:
- 3.9.7
-
-
Method Details
-
createLogger
Description copied from class:LogFactoryCreates a Logger for the specified class. This method returns theNoLoggerlogger instance which disables logging. Overwrite this method the return a custom logger to enable logging for SNMP4J.- Overrides:
createLoggerin classLogFactory- Parameters:
c- the class for which a logger needs to be created.- Returns:
- the
LogAdapterinstance.
-
createLogger
Description copied from class:LogFactoryCreates a Logger for the specified class. This method returns theNoLoggerlogger instance which disables logging. Overwrite this method the return a custom logger to enable logging for SNMP4J.- Overrides:
createLoggerin classLogFactory- Parameters:
className- the class name for which a logger needs to be created.- Returns:
- the
LogAdapterinstance.
-
getRootLogger
Description copied from class:LogFactoryReturns the top level logger.- Overrides:
getRootLoggerin classLogFactory- Returns:
- a LogAdapter instance.
-