You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2015/06/02 05:04:17 UTC
[jira] [Comment Edited] (LOG4J2-926) Truncate from the end of text
format modifier
[ https://issues.apache.org/jira/browse/LOG4J2-926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14568440#comment-14568440 ]
Gary Gregory edited comment on LOG4J2-926 at 6/2/15 3:03 AM:
-------------------------------------------------------------
>From https://logging.apache.org/log4j/2.x/manual/layouts.html#PatternLayout
{noformat}
Format modifier left justify minimum width maximum width comment
%-20.-30c true 20 30 Right pad with spaces if the category name is shorter than 20 characters. However, if category name is longer than 30 characters, then truncate from the end.
{noformat}
But I do not see a simple 'truncate from the end' option.
was (Author: garydgregory):
>From https://logging.apache.org/log4j/2.x/manual/layouts.html#PatternLayout
Format modifier left justify minimum width maximum width comment
%-20.-30c true 20 30 Right pad with spaces if the category name is shorter than 20 characters. However, if category name is longer than 30 characters, then truncate from the end.
> Truncate from the end of text format modifier
> ---------------------------------------------
>
> Key: LOG4J2-926
> URL: https://issues.apache.org/jira/browse/LOG4J2-926
> Project: Log4j 2
> Issue Type: Improvement
> Components: Pattern Converters
> Affects Versions: 2.1
> Reporter: David Ohana
> Fix For: 2.3
>
> Attachments: 0001-LOG4J2-926-Implemented-Truncate-from-end-using-the-m.patch
>
>
> In log4j 2, I would like to trim the end of messages written to the console appender when size is above a specified threshold.
> I looked at the http://logging.apache.org/log4j/2.0/manual/layouts.html#PatternLayout docs but can see no option to truncate the end of the "msg" field.
> "%.1000msg" will leave only the last 1000 chars of the message.
> This is not good for me because in Java the most inner frames in stack trace are printed at the beginning of the message.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org