Log-Formatter for JSON using fields specified within GELF. This formatter will produce a JSON object for each log event.
Example:
{
"timestamp": "1439319236.722",
"SourceClassName": "biz.paluch.logging.gelf.wildfly.WildFlyGelfLogFormatterTest",
"SourceMethodName": "testDefaults",
"level": "6",
"SourceSimpleClassName": "WildFlyGelfLogFormatterTest",
"facility": "logstash-gelf",
"full_message": "foo bar test log message",
"short_message": "foo bar test log message",
"MySeverity": "INFO",
"LoggerName": "biz.paluch.logging.gelf.wildfly.WildFlyGelfLogFormatterTest",
"Thread": "main",
"Time": "2015-08-11 20:53:56,0722"
}
Following parameters are supported/needed:
- lineBreak (Optional): End of line, platform dependent default value, see
System.getProperty("line.separator")
- fields (Optional): Comma-separated list of log event fields that should be included in the JSON. Defaults to
Time, Severity, ThreadName, SourceClassName, SourceMethodName, SourceSimpleClassName, LoggerName
- originHost (Optional): Originating Hostname, default FQDN Hostname
- extractStackTrace (Optional): Post Stack-Trace to StackTrace field (true/false/throwable reference [0 = throwable, 1 =
throwable.cause, -1 = root cause]), default false
- filterStackTrace (Optional): Perform Stack-Trace filtering (true/false), default false
- includeLocation (Optional): Include source code location, default true
- includeLogMessageParameters (Optional): Include message parameters from the log event (see
LogRecord.getParameters()
, default true
- facility (Optional): Name of the Facility, default gelf-java
- additionalFields(number) (Optional): Post additional fields. Eg. fieldName=Value,field2=value2
- additionalFieldTypes (Optional): Type specification for additional and MDC fields. Supported types: String, long, Long,
double, Double and discover (default if not specified, discover field type on parseability). Eg. field=String,field2=double