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/10/06 18:55:27 UTC

[jira] [Commented] (LOG4J2-1152) Add %oneLine to PatternLayout to mask line breaks for easier processing of log messages

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

Gary Gregory commented on LOG4J2-1152:
--------------------------------------

You should be able to do this today with the {{%replace}} converter. I would be OK with a specialized converter.

I do not link the name {{oneLine}} because it implies that an end-of-line character should be produced, which it should not.

I might do this: create a %removeChars (and %removeString) converter that takes a set characters and then a %removeLineSeparators that is just a specialization of %removeChars.

The issue with this kind of converter is that you're scanning ALL log messages, which could slow things down.

All of this to say that we would be better served with a {{%throwable}} option that specifies an EOL string override, then we can be optimal about this process.





> 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
>         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-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org