I had the same problem, so I have done a little workaround to achieve a lazy initialized log file, I have used an instance of my own LazyFileOutputStream(http://code.google.com/p/log4j-additions/source/browse/src/org/pollerosoftware/file/LazyFileOutputStream.java) already implemented for log4j in my log4j-additions package(http://code.google.com/p/log4j-additions/) .


Basically I have subclassed the RollingFileAppender logback class in this way :


public class LazyRollingFileAppender<E> extends RollingFileAppender<E> {

/**
* Sets and <i>opens</i> the file where the log output will go. The specified
* file must be writable.
*
* @param file_name
* The path to the log file.
*
* @author Alessio Pollero
*/
@Override
public void openFile(String file_name) throws IOException {
synchronized (lock) {
File file = new File(file_name);

LazyFileOutputStream lazyFos = new LazyFileOutputStream(file, append);
setOutputStream(lazyFos);
}
}

}


I hope this will helps someone ...
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira