Class ConsoleLogEventObserver

  • All Implemented Interfaces:
    LogEventObserver

    public class ConsoleLogEventObserver
    extends AbstractFilteredLogEventObserver
    Log messages to the system out with suitable formatter. Ansi colors will be used if running on a non-Windows shell or if JANSI is in class path. (Color on Windows is supported in IntelliJ, Cygwin and Ubuntu for Windows).

    Example configuration (not usually needed, default configuration should serve most purposes)

     observer.console.threshold=WARN
     observer.console.outputToSyserr=true
     observer.console.includedMdcKeys=clientIp
     observer.console.suppressMarkers=UNINTERESTING, PERSONAL_DATA
     observer.console.packageFilter=sun.www, com.example.uninteresting
     observer.console.logFilenameForPackages=com.example.myapp
     
    To add custom pattern format to the observer (shorthand for ...formatter=PatternLogEventFormatter and ...formatter.pattern=...):
     observer.console.pattern=%time [%thread] [%coloredLevel] [%bold(%location)]%mdc: %message
     
    To override ANSI formatting in ConsoleLogEventFormatter, use:
     observer.console.formatter.colors=false
     
    Author:
    Johannes Brodwall