java.lang.Object
org.snmp4j.log.LogFactory
org.snmp4j.log.JavaLogFactory
The
JavaLogFactory implements a SNMP4J LogFactory for
Java logging. In order to use Java's java.util.logging
for logging SNMP4J log messages the static LogFactory.setLogFactory(org.snmp4j.log.LogFactory)
method has to be used before any SNMP4J class is referenced or instantiated.- Version:
- 3.4.1
- Author:
- Frank Fock
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class org.snmp4j.log.LogFactory
SNMP4J_LOG_FACTORY_LOG_HANDLER_DEFAULT_PREFIX, SNMP4J_LOG_FACTORY_LOGGER_DEFAULT_PREFIX, SNMP4J_LOG_FACTORY_SYSTEM_PROPERTY, SNMP4J_LOG_HANDLER, SNMP4J_LOG_HANDLER_LIST, SNMP4J_LOG_ID, SNMP4J_LOG_LEVEL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddHandler(LogAdapter logAdapter, String handlerName, Map<String, String> handlerConfig) protected 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.loggers()Returns all available LogAdapters in depth first order.protected voidremoveAllHandlers(LogAdapter logAdapter) Methods inherited from class org.snmp4j.log.LogFactory
getLogFactory, getLogger, getLogger, getLoggerConfigPrefix, getLogHandlerConfigPrefix, reset, resetLogger, setLogFactory, setLoggerConfigPrefix, setLogHandlerConfigPrefix, updateConfiguration, updateLogger, writeConfiguration, writeConfiguration, writeConfiguration
-
Field Details
-
JAVA_CONSOLE_HANDLER
- See Also:
-
JAVA_FILE_HANDLER
- See Also:
-
FH_ATTR_PATTERN
- See Also:
-
DEFAULT_PATTERN
- See Also:
-
FH_ATTR_COUNT
- See Also:
-
DEFAULT_COUNT
- See Also:
-
FH_ATTR_APPEND
- See Also:
-
FH_ATTR_LIMIT
- See Also:
-
DEFAULT_LIMIT
- See Also:
-
FH_ATTR_FORMATTER
- See Also:
-
SF_ATTR_FORMAT
- See Also:
-
-
Constructor Details
-
JavaLogFactory
public JavaLogFactory() -
JavaLogFactory
public JavaLogFactory(boolean removeExistingHandlers)
-
-
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.
-
loggers
Description copied from class:LogFactoryReturns all available LogAdapters in depth first order.- Overrides:
loggersin classLogFactory- Returns:
- a read-only Iterator.
-
addHandler
protected void addHandler(LogAdapter logAdapter, String handlerName, Map<String, String> handlerConfig) - Overrides:
addHandlerin classLogFactory
-
removeAllHandlers
- Overrides:
removeAllHandlersin classLogFactory
-