[
https://issues.apache.org/jira/browse/LOG4J2-829?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14140641#comment-14140641
]
Remko Popma commented on LOG4J2-829:
------------------------------------
I think I have a solution.
The intention of LOG4J2-682 was not for special characters to be used in file
paths, it was mainly for the PatternLayout of log events in the log file. It's
just that the code where the special character sequences are converted is also
used by the RollingFileManager.
So, when used by the RollingFileManager, we _don't_ want backslashes to be
treated as escape characters, but _otherwise we do_.
The easiest way to fix this is to add another boolean parameter to
{{PatternParser.parse(String, List<PatternConverter>, List<FormattingInfo>,
boolean)}} and to the {{LiteralPatternConverter}} constructor. This boolean
would control whether {{OptionConverter.convertSpecialChars}} is invoked or not.
> Error replace slash in pattern file when rolling file appender
> --------------------------------------------------------------
>
> Key: LOG4J2-829
> URL: https://issues.apache.org/jira/browse/LOG4J2-829
> Project: Log4j 2
> Issue Type: Bug
> Components: Appenders
> Affects Versions: 2.0.2
> Environment: Development machine Windows 7
> Reporter: Pablo Vidal Otero
> Assignee: Remko Popma
> Labels: appender, file-pattern, slashes
>
> With following log configuration
> {code}
> <RollingFile name="RollingFile" fileName="${sys:user.home}/logs/app.log"
> filePattern="${sys:user.home}/logs/app-%d{MM-dd-yyyy}.log">
> <PatternLayout>
> <pattern>%d %p %c{1.} [%t] %m%n</pattern>
> </PatternLayout>
> <TimeBasedTriggeringPolicy />
> </RollingFile>
> {code}
> When start, the file name is created correctly (C:\user/logs/app.log) but
> when the file will rotate with file pattern, the path name is wrong. The
> system property user.home doesn't has slashes. C:user/logs/app-0915-2014.log
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]