Class LoggingDrain

  • All Implemented Interfaces:
    Drain

    public class LoggingDrain
    extends java.lang.Object
    implements Drain
    Drain implementation delegating all consumed lines to a Log4J Logger.
    • Constructor Summary

      Constructors 
      Constructor Description
      LoggingDrain​(java.lang.Class<?> clazz, org.apache.log4j.Level level)
      Creates a LoggingDrain using the given clazz to retrieve a Logger and the specified Level.
      LoggingDrain​(java.lang.String name, org.apache.log4j.Level level)
      Creates a LoggingDrain using the given name to retrieve a Logger and the given Level.
      LoggingDrain​(org.apache.log4j.Logger logger, org.apache.log4j.Level level)
      Creates a new LoggingDrain using the specified Logger and log Level.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void drain​(java.lang.String message)
      Callback method to process a line outputted by the process.
      org.apache.log4j.Level getLevel()  
      org.apache.log4j.Logger getLogger()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LoggingDrain

        public LoggingDrain​(java.lang.Class<?> clazz,
                            org.apache.log4j.Level level)
        Creates a LoggingDrain using the given clazz to retrieve a Logger and the specified Level.
        Parameters:
        clazz - the logger name to use.
        level - the log level to use.
      • LoggingDrain

        public LoggingDrain​(java.lang.String name,
                            org.apache.log4j.Level level)
        Creates a LoggingDrain using the given name to retrieve a Logger and the given Level.
        Parameters:
        name - the name of the Logger to use.
        level - the log level to use.
      • LoggingDrain

        public LoggingDrain​(org.apache.log4j.Logger logger,
                            org.apache.log4j.Level level)
        Creates a new LoggingDrain using the specified Logger and log Level.
        Parameters:
        logger - the Logger to log to
        level - the Level to log on
    • Method Detail

      • drain

        public void drain​(java.lang.String message)
        Callback method to process a line outputted by the process. A trailing newline character is truncated.
        Specified by:
        drain in interface Drain
        Parameters:
        message - the output line to process.
        See Also:
        Drain.drain(java.lang.String)
      • getLogger

        public org.apache.log4j.Logger getLogger()
      • getLevel

        public org.apache.log4j.Level getLevel()