[ https://issues.apache.org/jira/browse/LOG4J2-382?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15030500#comment-15030500 ]
Paul Nyheim commented on LOG4J2-382: ------------------------------------ The level/p is a special case - as it is possible to set the length property. So in your case, the {{%-1}} modifier actually has no effect - as length already has it truncated down to 1 character. Now for the more generic use-case for any conversion pattern, truncating from the end was fixed in v2.3 in LOG4J2-926. So to achieve the same with this modifier, one could write {{%.-1level}} See documentation of format modifiers after the table of conversion patterns here. http://logging.apache.org/log4j/2.x/manual/layouts.html#PatternLayout This issue should be closed as duplicate. > PatternLayout: truncating from the end > -------------------------------------- > > Key: LOG4J2-382 > URL: https://issues.apache.org/jira/browse/LOG4J2-382 > Project: Log4j 2 > Issue Type: Improvement > Components: Layouts > Reporter: Alexey Pomelov > > The first case I've met: I'd like to print only first letter of the log > record priority. %1.1p leads to R,N,O,G,E letters (not very friendly). > For example it will be nice to specify a negative number after dot and > truncate token from the end. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org