Module org.snmp4j

Interface LogAdapter

All Known Implementing Classes:
ConsoleLogAdapter, JavaLogAdapter, LogProxy, NoLogger

public interface LogAdapter
The LogAdapter specifies the logging interface used by SNMP4J. To provide another logging mechanism as the default no-logging the static method LogFactory.setLogFactory(org.snmp4j.log.LogFactory) can be used to assign a different logging adapter factory.
Since:
1.2.1
Version:
3.4.1
Author:
Frank Fock
  • Method Details

    • isDebugEnabled

      boolean isDebugEnabled()
      Checks whether DEBUG level logging is activated for this log adapter.
      Returns:
      true if logging is enabled or false otherwise.
    • isInfoEnabled

      boolean isInfoEnabled()
      Checks whether INFO level logging is activated for this log adapter.
      Returns:
      true if logging is enabled or false otherwise.
    • isWarnEnabled

      boolean isWarnEnabled()
      Checks whether WARN level logging is activated for this log adapter.
      Returns:
      true if logging is enabled or false otherwise.
    • debug

      void debug(Serializable message)
      Logs a debug message.
      Parameters:
      message - the message to log.
    • info

      void info(CharSequence message)
      Logs an informational message.
      Parameters:
      message - the message to log.
    • warn

      void warn(Serializable message)
      Logs an warning message.
      Parameters:
      message - the message to log.
    • error

      void error(Serializable message)
      Logs an error message.
      Parameters:
      message - the message to log.
    • error

      void error(CharSequence message, Throwable throwable)
      Logs an error message.
      Parameters:
      message - the message to log.
      throwable - the exception that caused to error.
    • fatal

      void fatal(Object message)
      Logs a fatal message.
      Parameters:
      message - the message to log.
    • fatal

      void fatal(CharSequence message, Throwable throwable)
      Logs a fatal message.
      Parameters:
      message - the message to log.
      throwable - the exception that caused to error.
    • log

      default void log(LogLevel logLevel, CharSequence message, Throwable throwable)
      Log a message with the specified level.
      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.
    • isLogLevelEnabled

      default boolean isLogLevelEnabled(LogLevel logLevel)
      Checks whether there is logging enabled for the specified log level for this log adapter.
      Parameters:
      logLevel - the level at which the message will be logged.
      Returns:
      true if logging is enabled for the specified logLevel.
      Since:
      3.4.1
    • setLogLevel

      void setLogLevel(LogLevel level)
      Sets the log level for this log adapter (if applicable).
      Parameters:
      level - a LogLevel instance.
      Since:
      1.6.1
    • getLogLevel

      LogLevel getLogLevel()
      Returns the log level defined for this log adapter.
      Returns:
      a LogLevel instance.
      Since:
      1.6.1
    • getEffectiveLogLevel

      LogLevel getEffectiveLogLevel()
      Returns the log level that is effective for this log adapter. The effective log level is the first log level different from LogLevel.NONE to the root.
      Returns:
      a LogLevel different from LogLevel.NONE.
      Since:
      1.6.1
    • getName

      String getName()
      Returns the name of the logger.
      Returns:
      the name of the logger.
    • getLogHandler

      Iterator<?> getLogHandler()
      Returns the log handlers associated with this logger.
      Returns:
      an Iterator of log system dependent log handlers.
      Since:
      1.6.1
    • removeAllHandlers

      default void removeAllHandlers()
      Remove all log handlers from this log adapter.
      Since:
      3.4.1
    • setLogHandler

      default void setLogHandler(String logHandlerList)
      Sets the log handler reference list associated by this logger.
      Parameters:
      logHandlerList - a comma separated list of class names or other log handler IDs.
      Since:
      3.4.1