java - Limit max message size in log4j2 pattern -
in log4j 2, trim the end of messages written console appender when size above specified threshold.
i looked @ http://logging.apache.org/log4j/2.0/manual/layouts.html#patternlayout docs can see no option truncate end of "msg" field.
"%.1000msg" leave last 1000 chars of message.
this not me because in java inner frames in stack trace printed @ beginning of message.
any idea?
i think looking for: %.-1000m
here complete example console logger:
<configuration status="warn" monitorinterval="60" name="development"> <properties> <property name="basedir">logs</property> </properties> <appenders> <console name="console"> <patternlayout pattern="%p{length=1} | %-10.-10t | %d{hh:mm:ss,sss} | %.-1000m (%c{2}:%l) %n"/> </console> </appenders> <loggers> <root level="trace"> <appenderref ref="console" level="debug"/> </root> </loggers> </configuration>
Comments
Post a Comment