Ole
Ole

Reputation: 46960

log4j2: Abbreviate / shorten package names

This question is the same question as this question (But for log4j2): log4j: abbreviate/shorten package names

Upvotes: 19

Views: 11211

Answers (1)

rgoers
rgoers

Reputation: 9141

This is quite simple and is documented at http://logging.apache.org/log4j/2.x/manual/layouts.html#PatternLayout. In your patternLayout just specify %c{1.} in the pattern to get the abbreviated Logger name. If you want the class name instead, use %C{1.}.

Upvotes: 33

Related Questions