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 bu...@apache.org on 2005/02/15 22:29:20 UTC
DO NOT REPLY [Bug 33596] New: -
Log file not created.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=33596>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=33596
Summary: Log file not created.
Product: Log4j
Version: 1.2
Platform: PC
OS/Version: Windows 2000
Status: NEW
Severity: normal
Priority: P2
Component: Appender
AssignedTo: log4j-dev@logging.apache.org
ReportedBy: dennis@bevocal.com
When a FileAppender (or derived) is used and the directory to which the file is
targeted does not exist, the log file will not be created. If the base
FileAppender class would attempt to create the desired directory, file logging
would be much friendlier.
I found that it only took a small change to FileAppender.setFile() method...
from:
Writer fw = createWriter(new FileOutputStream(fileName, append));
to:
File f = new File(filename);
File p = (new File(f.getCanonicalPath())).getParentFile();
if (!p.exists()) {
p.mkdirs();
}
p = null;
Writer fw = createWriter(new FileOutputStream(f, append));
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org