Search code examples
wildflywildfly-10

Wildfly logging pattern elements - Is there a documentation?


I am using Wildfly 10.1 and I would really like to know what logging pattern elements i could use.

I found this documentation here: https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html referenced by a Wildfly book.

But this can not be the whole truth, because there are more elements than mentioned there, for example the %s or %E Elements.

I also found this https://logging.apache.org/log4j/2.x/manual/layouts.html but that cant be the truth eiter, because the mentioned %throwable{short.className} does not work.

Also the Wildfly Documentation at https://docs.jboss.org/author/display/WFLY10/Handlers#Handlers-formatter does not say a word about what pattern elements are available.

I try to create a logging pattern which will generate only one line per exception (no stack trace) but still contain the Message of the exception and the Class, Method and Line Number.


Solution

  • Now there is a document for logging formatters. Wildfly Logging Formatters

    You could use %l for location information, but there is no pattern for exception message without stacktrace.

    Here is the relevant parts from the document;

    %l: The location information. This includes the callers class name, method name, file name and line number.

    %m: The formatted message including any stack traces.

    %s: The simple formatted message. This will not include the stack trace if a cause was logged.

    %e: Prints the full stack trace.

    %e{0}: Prints the stack trace ignoring any suppressed messages.

    %e{1}: Prints the stack trace with a maximum of one suppressed message.