[ 
https://issues.apache.org/jira/browse/LOG4J2-1152?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14946491#comment-14946491
 ] 

Christian Möller edited comment on LOG4J2-1152 at 10/7/15 8:22 AM:
-------------------------------------------------------------------

Thanks for your advise regarding %replace converter - don't know why I have not 
got it before. Let me see how I can use it as a base for the code. The %oneLine 
converter might have it's own right to exist because it's name is more 
expressive than the equivalent %replace\{...\}\{[\r\n]\{1,2\}\}\{ |>> \}, isn't 
it?
OK, the name %oneLine might be argueable, but it does not simply remove some 
chars but marks/escapes line breaks produced by the enclosed expression.
Your concerns regarding performance: I expect that most of similar converters 
get hit by it ... what about IO? OK, I think not really the right place to 
discuss it here.
Extending the %throwable converter would catch processing of stack traces only; 
applying a more general approach you are able to oneline/mark/escape line 
breaks if you are logging program input/output, for example (think of 
pretty-printed XML or JSON or the like).


was (Author: cmoeller):
Thanks for your advise regarding %replace converter - don't know why I have not 
got it before. Let me see how I can use it as a base for the code. The %oneLine 
converter might have it's own right to exist because it's name is more 
expressive than the equivalent %replace{...}{[\r\n]{1,2}}{ |>> }, isn't it?
OK, the name %oneLine might be argueable, but it does not simply remove some 
chars but marks/escapes line breaks produced by the enclosed expression.
Your concerns regarding performance: I expect that most of similar converters 
get hit by it ... what about IO? OK, I think not really the right place to 
discuss it here.
Extending the %throwable converter would catch processing of stack traces only; 
applying a more general approach you are able to oneline/mark/escape line 
breaks if you are logging program input/output, for example (think of 
pretty-printed XML or JSON or the like).

> Add %oneLine to PatternLayout to mask line breaks for easier processing of 
> log messages
> ---------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-1152
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1152
>             Project: Log4j 2
>          Issue Type: New Feature
>          Components: Pattern Converters
>            Reporter: Christian Möller
>            Assignee: Gary Gregory
>         Attachments: OneLinePatternConverter.java
>
>
> Adding %oneLine\{...\} to PatternLayout will mask line breaks of enclosed 
> Strings as " |>> ". For instance, %oneline{%exception{full}} will convert 
> stack traces to a one-liner easier to handle with tools like grep. Based on 
> an idea of Heinz Kabutz: http://www.javaspecialists.eu/archive/Issue177.html



--
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

Reply via email to