Hello,
I have a problem concerning the creation of output files.
Apparently, if the directory of the output file specified in the
configuration file does not exist, log4j does not create it but throws
an Exception.
As it would be useful in our project to have these directories created
automatically, I tried to change this. Here's my suggestion:
public
synchronized
void setFile(String fileName, boolean append)
throws IOException {
reset();
// modifications from here
File fi = new File(fileName);
if ( !(fi.getParentFile().exists() )){
if (!(fi.getParentFile().mkdirs()))
return; // ? not sure if we can return safely here
}
// until here
this.setQWForFiles(new FileWriter(fileName, append));
this.tp = new TracerPrintWriter(qw);
this.fileName = fileName;
this.qwIsOurs = true;
}
has anyone had the same problem, or an idea why it would be not
recommended to do so?
thanks
Elisabeth
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]