- java.lang.Object
-
- org.snmp4j.log.LogProxy
-
- All Implemented Interfaces:
LogAdapter
public class LogProxy extends java.lang.Object implements LogAdapter
ALogProxycan be used for late binding loggers. A proxy does not log anything, if its logger member isnull. Otherwise it forwards all its messages to that logger. Even if the proxy logger is not set, theLogProxyhas a name.- Version:
- 3.4.1
- Author:
- Frank Fock
-
-
Constructor Summary
Constructors Constructor Description LogProxy(java.lang.String name)LogProxy(LogAdapter logger)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddebug(java.io.Serializable message)Logs a debug message.voiderror(java.io.Serializable message)Logs an error message.voiderror(java.lang.CharSequence message, java.lang.Throwable throwable)Logs an error message.voidfatal(java.lang.CharSequence message, java.lang.Throwable throwable)Logs a fatal message.voidfatal(java.lang.Object message)Logs a fatal message.LogLevelgetEffectiveLogLevel()Returns the log level that is effective for this log adapter.LogAdaptergetLogger()Gets the proxied logger.java.util.Iterator<?>getLogHandler()Returns the log handlers associated with this logger.LogLevelgetLogLevel()Returns the log level defined for this log adapter.java.lang.StringgetName()Returns the name of the logger.voidinfo(java.lang.CharSequence message)Logs an informational message.booleanisDebugEnabled()Checks whether DEBUG level logging is activated for this log adapter.booleanisInfoEnabled()Checks whether INFO level logging is activated for this log adapter.booleanisWarnEnabled()Checks whether WARN level logging is activated for this log adapter.voidlog(LogLevel logLevel, java.lang.CharSequence message, java.lang.Throwable throwable)Log a message with the specified level.voidsetLogger(LogAdapter logger)Sets the logger that logs the log messages logged with this proxy.voidsetLogLevel(LogLevel level)Sets the log level for this log adapter (if applicable).voidwarn(java.io.Serializable message)Logs an warning message.-
Methods inherited from interface org.snmp4j.log.LogAdapter
isLogLevelEnabled, removeAllHandlers, setLogHandler
-
-
-
-
Constructor Detail
-
LogProxy
public LogProxy(java.lang.String name)
-
LogProxy
public LogProxy(LogAdapter logger)
-
-
Method Detail
-
debug
public void debug(java.io.Serializable message)
Description copied from interface:LogAdapterLogs a debug message.- Specified by:
debugin interfaceLogAdapter- Parameters:
message- the message to log.
-
error
public void error(java.io.Serializable message)
Description copied from interface:LogAdapterLogs an error message.- Specified by:
errorin interfaceLogAdapter- Parameters:
message- the message to log.
-
error
public void error(java.lang.CharSequence message, java.lang.Throwable throwable)Description copied from interface:LogAdapterLogs an error message.- Specified by:
errorin interfaceLogAdapter- Parameters:
message- the message to log.throwable- the exception that caused to error.
-
fatal
public void fatal(java.lang.Object message)
Description copied from interface:LogAdapterLogs a fatal message.- Specified by:
fatalin interfaceLogAdapter- Parameters:
message- the message to log.
-
fatal
public void fatal(java.lang.CharSequence message, java.lang.Throwable throwable)Description copied from interface:LogAdapterLogs a fatal message.- Specified by:
fatalin interfaceLogAdapter- Parameters:
message- the message to log.throwable- the exception that caused to error.
-
getEffectiveLogLevel
public LogLevel getEffectiveLogLevel()
Description copied from interface:LogAdapterReturns the log level that is effective for this log adapter. The effective log level is the first log level different fromLogLevel.NONEto the root.- Specified by:
getEffectiveLogLevelin interfaceLogAdapter- Returns:
- a LogLevel different than
LogLevel.NONE.
-
getLogHandler
public java.util.Iterator<?> getLogHandler()
Description copied from interface:LogAdapterReturns the log handlers associated with this logger.- Specified by:
getLogHandlerin interfaceLogAdapter- Returns:
- an Iterator of log system dependent log handlers.
-
getLogLevel
public LogLevel getLogLevel()
Description copied from interface:LogAdapterReturns the log level defined for this log adapter.- Specified by:
getLogLevelin interfaceLogAdapter- Returns:
- a LogLevel instance.
-
getName
public java.lang.String getName()
Description copied from interface:LogAdapterReturns the name of the logger.- Specified by:
getNamein interfaceLogAdapter- Returns:
- the name of the logger.
-
info
public void info(java.lang.CharSequence message)
Description copied from interface:LogAdapterLogs an informational message.- Specified by:
infoin interfaceLogAdapter- Parameters:
message- the message to log.
-
isDebugEnabled
public boolean isDebugEnabled()
Description copied from interface:LogAdapterChecks whether DEBUG level logging is activated for this log adapter.- Specified by:
isDebugEnabledin interfaceLogAdapter- Returns:
trueif logging is enabled orfalseotherwise.
-
isInfoEnabled
public boolean isInfoEnabled()
Description copied from interface:LogAdapterChecks whether INFO level logging is activated for this log adapter.- Specified by:
isInfoEnabledin interfaceLogAdapter- Returns:
trueif logging is enabled orfalseotherwise.
-
isWarnEnabled
public boolean isWarnEnabled()
Description copied from interface:LogAdapterChecks whether WARN level logging is activated for this log adapter.- Specified by:
isWarnEnabledin interfaceLogAdapter- Returns:
trueif logging is enabled orfalseotherwise.
-
setLogLevel
public void setLogLevel(LogLevel level)
Description copied from interface:LogAdapterSets the log level for this log adapter (if applicable).- Specified by:
setLogLevelin interfaceLogAdapter- Parameters:
level- a LogLevel instance.
-
warn
public void warn(java.io.Serializable message)
Description copied from interface:LogAdapterLogs an warning message.- Specified by:
warnin interfaceLogAdapter- Parameters:
message- the message to log.
-
getLogger
public LogAdapter getLogger()
Gets the proxied logger.- Returns:
- a LogAdapter the actually logs the messages.
-
setLogger
public void setLogger(LogAdapter logger)
Sets the logger that logs the log messages logged with this proxy.- Parameters:
logger- a LogAdapter.
-
log
public void log(LogLevel logLevel, java.lang.CharSequence message, java.lang.Throwable throwable)
Description copied from interface:LogAdapterLog a message with the specified level.- Specified by:
login interfaceLogAdapter- Parameters:
logLevel- the level at which the message will be logged.message- the message to log.throwable- an optional exception associated with the log event.
-
-