Package org.logevents.formatters
Class ConsoleLogEventFormatter
- java.lang.Object
-
- org.logevents.formatters.ConsoleLogEventFormatter
-
- All Implemented Interfaces:
Function<LogEvent,String>
,LogEventFormatter
public class ConsoleLogEventFormatter extends Object implements LogEventFormatter
A simple formatter used byConsoleLogEventObserver
by default. Suitable for overridingapply(LogEvent)
This is equivalent toobserver...formatter=PatternLogEventFormatter observer...formatter.pattern=%time [%thread] [%coloredLevel] [%bold(%location)]%mdc: %message
Example configuration
observer.*.packageFilter=sun.www, com.example.uninteresting observer.console.includedMdcKeys=clientIp observer.console.showMarkers=true observer.console.multipleLines=false observer.console.color=true observer.console.logFilenameForPackages=com.example.myapp
- Author:
- Johannes Brodwall
-
-
Field Summary
Fields Modifier and Type Field Description protected ExceptionFormatter
exceptionFormatter
protected ConsoleFormatting
format
protected MdcFilter
mdcFilter
protected MessageFormatter
messageFormatter
protected DateTimeFormatter
timeOnlyFormatter
-
Constructor Summary
Constructors Constructor Description ConsoleLogEventFormatter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
apply(LogEvent e)
protected String
colorizedLevel(LogEvent e)
String
colorizedLevel(org.slf4j.event.Level level)
Output ANSI color coded level string, where ERROR is bold red, WARN is red, INFO is blue and other levels are default color.void
configure(Configuration configuration)
Optional<ExceptionFormatter>
getExceptionFormatter()
String
toString()
-
-
-
Field Detail
-
format
protected ConsoleFormatting format
-
messageFormatter
protected MessageFormatter messageFormatter
-
exceptionFormatter
protected final ExceptionFormatter exceptionFormatter
-
timeOnlyFormatter
protected final DateTimeFormatter timeOnlyFormatter
-
mdcFilter
protected MdcFilter mdcFilter
-
-
Method Detail
-
getExceptionFormatter
public Optional<ExceptionFormatter> getExceptionFormatter()
- Specified by:
getExceptionFormatter
in interfaceLogEventFormatter
-
colorizedLevel
public String colorizedLevel(org.slf4j.event.Level level)
Output ANSI color coded level string, where ERROR is bold red, WARN is red, INFO is blue and other levels are default color.
-
configure
public void configure(Configuration configuration)
- Specified by:
configure
in interfaceLogEventFormatter
-
-