[ 
https://issues.apache.org/jira/browse/LOG4J2-939?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gary Gregory updated LOG4J2-939:
--------------------------------
    Attachment: LOG4J2-939.diff

Patch for described solution.

> end of line not handled correctly by ThrowableProxy
> ---------------------------------------------------
>
>                 Key: LOG4J2-939
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-939
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.1
>         Environment: Windows 7
>            Reporter: Mika Riekkinen
>            Priority: Minor
>         Attachments: LOG4J2-939.diff
>
>
> Noticed that EOL is not handled correctly on stacktraces. If a logfile is 
> opened with notepad, stacktraces are all printed on one line only, wihtout
> linebreaks after each stacktrace element.
> Made some digging, and indeed there seems to be some inconsistency how EOL is 
> handled.
> ExtendedThrowablePatternConverter uses Constants.LINE_SEPARATOR to split 
> stacktrace into lines:
>    final String[] array = trace.split(Constants.LINE_SEPARATOR);
> But a ThrowableProxy, that generates the trace above uses hardocoded
> '\n' character throughout the source code.
> Compiled a new version of ThrowableProxy, where each '\n' is replaced 
> with Constants.LINE_SEPARATOR, and stacktraces started to work ok.
> I also had to change ExtendedThrowablePatternConverterTest, so that
> generation of expected variable does not strip '\r' character:
> final String expected = sw.toString();//.replaceAll("\r", Strings.EMPTY);



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to