https://issues.apache.org/bugzilla/show_bug.cgi?id=53536
Priority: P2
Bug ID: 53536
CC: [email protected]
Assignee: [email protected]
Summary: RollingFileAppender with TimeBasedRolling policy
doesn't create parent-path if FileNamePattern contains
date pattern as directory
Severity: major
Classification: Unclassified
Reporter: [email protected]
Hardware: PC
Status: NEW
Version: 1.2.17
Component: Companions
Product: Log4j
Created attachment 29048
--> https://issues.apache.org/bugzilla/attachment.cgi?id=29048&action=edit
Log4j XML configuration
I'm using org.apache.log4j.rolling.RollingFileAppender together with
org.apache.log4j.rolling.TimeBasedRollingPolicy to rotate log files
periodically. I need log files to be placed in directories based on date
pattern.
Unfortunately, the first log file is created properly, while after rollover
RollingFileAppender doesn't check if for newly calculated log file path the
whole directory path exists and tries to create FileOutputStream directly,
which causes FileNotFoundException:
log4j:WARN Exception during rollover, rollover deferred.
java.io.FileNotFoundException: c:\ssr\log\20120711_1336\ssr.log (The system
cannot find the path specified)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:194)
at java.io.FileOutputStream.<init>(FileOutputStream.java:116)
at
org.apache.log4j.rolling.RollingFileAppender.rollover(RollingFileAppender.java:286)
at
org.apache.log4j.rolling.RollingFileAppender.subAppend(RollingFileAppender.java:353)
at org.apache.log4j.WriterAppender.append(WriterAppender.java:162)
at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
at
org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
at org.apache.log4j.Category.callAppenders(Category.java:206)
at org.apache.log4j.Category.forcedLog(Category.java:391)
at org.apache.log4j.Category.info(Category.java:666)
at asseco.ssr.common.Log4jTests.main(Log4jTests.java:21)
The similar bug 9150 was filled for base Log4J FileAppender class and it is now
fixed. That's why first log file is created successfully. But during rollover()
in RollingFileAppender new FileOutputStream is created without creating a new
parent directory, which results in the above exception and the file is not
rolled.
--
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]