public class JavaLogAdapter extends java.lang.Object implements LogAdapter
JavaLogAdapter log adapter provides logging for SNMP4J
through the Java logging (java.util.logging).| Modifier and Type | Field and Description |
|---|---|
private java.util.logging.Logger |
logger |
| Constructor and Description |
|---|
JavaLogAdapter(java.util.logging.Logger logger) |
| Modifier and Type | Method and Description |
|---|---|
void |
debug(java.io.Serializable message)
Logs a debug message.
|
void |
error(java.lang.CharSequence message,
java.lang.Throwable t)
Logs an error message.
|
void |
error(java.io.Serializable message)
Logs an error message.
|
void |
fatal(java.lang.CharSequence message,
java.lang.Throwable t)
Logs a fatal message.
|
void |
fatal(java.lang.Object message)
Logs a fatal message.
|
private static LogLevel |
fromJavaToSnmp4jLevel(java.util.logging.Level level)
Mapping from
java.util.logging.Level to
org.snmp4j.log.LogLevel. |
private static java.util.logging.Level |
fromSnmp4jToJdk(LogLevel logLevel)
Mapping from
org.snmp4j.log.LogLevel to
java.util.logging.Level. |
LogLevel |
getEffectiveLogLevel()
Returns the log level that is effective for this log adapter.
|
java.util.Iterator<java.util.logging.Handler> |
getLogHandler()
Returns the log handlers associated with this logger.
|
LogLevel |
getLogLevel()
Returns the log level defined for this log adapter.
|
java.lang.String |
getName()
Returns the name of the logger.
|
void |
info(java.lang.CharSequence message)
Logs an informational message.
|
boolean |
isDebugEnabled()
Checks whether DEBUG level logging is activated for this log adapter.
|
boolean |
isInfoEnabled()
Checks whether INFO level logging is activated for this log adapter.
|
private boolean |
isLoggable(LogLevel logLevel) |
boolean |
isWarnEnabled()
Checks whether WARN level logging is activated for this log adapter.
|
private void |
log(LogLevel logLevel,
java.lang.String msg,
java.lang.Throwable t) |
void |
setLogLevel(LogLevel logLevel)
Sets the log level for this log adapter (if applicable).
|
void |
warn(java.io.Serializable message)
Logs an warning message.
|
public boolean isDebugEnabled()
LogAdapterisDebugEnabled in interface LogAdaptertrue if logging is enabled or false otherwise.public boolean isInfoEnabled()
LogAdapterisInfoEnabled in interface LogAdaptertrue if logging is enabled or false otherwise.public boolean isWarnEnabled()
LogAdapterisWarnEnabled in interface LogAdaptertrue if logging is enabled or false otherwise.public void debug(java.io.Serializable message)
LogAdapterdebug in interface LogAdaptermessage - the message to log.public void info(java.lang.CharSequence message)
LogAdapterinfo in interface LogAdaptermessage - the message to log.public void warn(java.io.Serializable message)
LogAdapterwarn in interface LogAdaptermessage - the message to log.public void error(java.io.Serializable message)
LogAdaptererror in interface LogAdaptermessage - the message to log.public void error(java.lang.CharSequence message,
java.lang.Throwable t)
LogAdaptererror in interface LogAdaptermessage - the message to log.t - the exception that caused to error.public void fatal(java.lang.Object message)
LogAdapterfatal in interface LogAdaptermessage - the message to log.public void fatal(java.lang.CharSequence message,
java.lang.Throwable t)
LogAdapterfatal in interface LogAdaptermessage - the message to log.t - the exception that caused to error.public LogLevel getEffectiveLogLevel()
LogAdapterLogLevel.NONE to the root.getEffectiveLogLevel in interface LogAdapterLogLevel.NONE.public java.util.Iterator<java.util.logging.Handler> getLogHandler()
LogAdaptergetLogHandler in interface LogAdapterpublic LogLevel getLogLevel()
LogAdaptergetLogLevel in interface LogAdapterpublic java.lang.String getName()
LogAdaptergetName in interface LogAdapterpublic void setLogLevel(LogLevel logLevel)
LogAdaptersetLogLevel in interface LogAdapterlogLevel - a LogLevel instance.private boolean isLoggable(LogLevel logLevel)
private void log(LogLevel logLevel, java.lang.String msg, java.lang.Throwable t)
private static java.util.logging.Level fromSnmp4jToJdk(LogLevel logLevel)
org.snmp4j.log.LogLevel to
java.util.logging.Level.logLevel - The LogLevel to mappedLevel
mapped to or null if
null was specified as the parameter.private static LogLevel fromJavaToSnmp4jLevel(java.util.logging.Level level)
java.util.logging.Level to
org.snmp4j.log.LogLevel.level - The Level to mappedLogLevel mapped to or LogLevel.NONE if
null was specified as the parameter.