Class ConsoleLogFactory

java.lang.Object
org.snmp4j.log.LogFactory
org.snmp4j.log.ConsoleLogFactory

public class ConsoleLogFactory extends LogFactory
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
  • Constructor Details

    • ConsoleLogFactory

      public ConsoleLogFactory()
    • ConsoleLogFactory

      public ConsoleLogFactory(PrintStream outStream, PrintStream errStream)
      Constructs a ConsoleLogFactory instance using the specified PrintStream. This allows log messages to be directed to a custom output stream. Default is System.out if the default constructor is used.
      Parameters:
      outStream - the PrintStream where log messages will be written.
      errStream - the PrintStream where error messages will be written.
      Since:
      3.9.7
  • Method Details

    • createLogger

      protected LogAdapter createLogger(Class<?> c)
      Description copied from class: LogFactory
      Creates a Logger for the specified class. This method returns the NoLogger logger instance which disables logging. Overwrite this method the return a custom logger to enable logging for SNMP4J.
      Overrides:
      createLogger in class LogFactory
      Parameters:
      c - the class for which a logger needs to be created.
      Returns:
      the LogAdapter instance.
    • createLogger

      protected LogAdapter createLogger(String className)
      Description copied from class: LogFactory
      Creates a Logger for the specified class. This method returns the NoLogger logger instance which disables logging. Overwrite this method the return a custom logger to enable logging for SNMP4J.
      Overrides:
      createLogger in class LogFactory
      Parameters:
      className - the class name for which a logger needs to be created.
      Returns:
      the LogAdapter instance.
    • getRootLogger

      public LogAdapter getRootLogger()
      Description copied from class: LogFactory
      Returns the top level logger.
      Overrides:
      getRootLogger in class LogFactory
      Returns:
      a LogAdapter instance.