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 "Delphin (JIRA)" <ji...@apache.org> on 2016/04/13 14:53:25 UTC
[jira] [Updated] (LOG4J2-1364) PatternLayout can't put newline in
substitution
[ https://issues.apache.org/jira/browse/LOG4J2-1364?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Delphin updated LOG4J2-1364:
----------------------------
Description:
I try this configuration:
{noformat}
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %replace{%m}{\n}{\n\t}%n"/>
{noformat}
And log message like this:
{noformat}
LOG.error("This\n" +
"is\n" +
"multiline\n" +
"log\n" +
"message");
{noformat}
Result:
{noformat}
15:42:11.364 [main] ERROR com.company.test.Main - Thisntisntmultilinentlogntmessage
{noformat}
Is there a possibility to get this result:
{noformat}
15:42:11.364 [main] ERROR com.company.test.Main - This
is
multiline
log
message
{noformat}
was:
I try this configuration:
{noformat}
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %replace{%m}{\n}{\n\t}%n"/>
{noformat}
And log message like this:
{noformat}
LOG.error("This\n" +
"is\n" +
"multiline\n" +
"log\n" +
"message");
{noformat}
Result:
{noformat}
15:42:11.364 [main] ERROR com.company.test.Main - Thisntisntmultilinentlogntmessage
{noformat}
Is there a possibility to get this result:
{noformat}
15:42:11.364 [main] ERROR com.company.test.Main - This
is
multiline
log
message
{noformat}
> PatternLayout can't put newline in substitution
> -----------------------------------------------
>
> Key: LOG4J2-1364
> URL: https://issues.apache.org/jira/browse/LOG4J2-1364
> Project: Log4j 2
> Issue Type: Bug
> Reporter: Delphin
>
> I try this configuration:
> {noformat}
> <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %replace{%m}{\n}{\n\t}%n"/>
> {noformat}
> And log message like this:
> {noformat}
> LOG.error("This\n" +
> "is\n" +
> "multiline\n" +
> "log\n" +
> "message");
> {noformat}
> Result:
> {noformat}
> 15:42:11.364 [main] ERROR com.company.test.Main - Thisntisntmultilinentlogntmessage
> {noformat}
> Is there a possibility to get this result:
> {noformat}
> 15:42:11.364 [main] ERROR com.company.test.Main - This
> is
> multiline
> log
> message
> {noformat}
--
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