TimeBasedRollingPolicy doesn't seem to like file names with '(' in them
-----------------------------------------------------------------------
Key: LBCORE-75
URL: http://jira.qos.ch/browse/LBCORE-75
Project: logback-core
Issue Type: Improvement
Components: Appender
Affects Versions: 0.9.11
Environment: Windows XP (x64). Java 6 (32 bit), Tomcat6 (in case you
care)
Reporter: Rod Widdowson
Assignee: Logback dev list
Apologies if this is PEBKAC
I configured up my appender like this:
<appender name="DS_LOG"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>/discoveryService.log</File>
<ImmediateFlush>true</ImmediateFlush>
<rollingPolicy
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>C:\Program Files
(x86)\DS/logs/discovery-%d{yyyy-MM-dd}.log</FileNamePattern>
</rollingPolicy>
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%date{HH:mm:ss.SSS} %level [%logger]
%msg%n%ex{full}%n</Pattern>
</layout>
</appender>
The slightly odd "C:\Program Files (x86)\" is where Windows64 puts 32 bit
executable (and it things that Tomcat it). This failed. Due to my own
programs limitations it took me a while to get there, but this was because of
this statement:
DateTokenConverter dtc = fileNamePattern.getDateTokenConverter();
if (dtc == null) {
throw new IllegalStateException("FileNamePattern ["
+ fileNamePattern.getPattern()
+ "] does not contain a valid DateToken");
}
when I poked into fileNamePattern.getDateTokenConverter(); I see this:
this FileNamePattern (id=159)
context LoggerContext (id=80)
headTokenConverter LiteralConverter<E> (id=160)
literal "C:\Program Files (x86"
next null
noContextWarning 0 [0x0]
pattern "C:\Program Files (x86)\DS/logs/discovery-%d{yyyy-MM-dd}.log"
Note that headTokenConverter is malformed, and so we end up with a null dtc.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
logback-dev mailing list
[email protected]
http://qos.ch/mailman/listinfo/logback-dev