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 2004/09/01 22:07:23 UTC
DO NOT REPLY [Bug 31003] New: -
RollingFileAppender, if removed can cause null pointer exceptions
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=31003>.
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=31003
RollingFileAppender, if removed can cause null pointer exceptions
Summary: RollingFileAppender, if removed can cause null pointer
exceptions
Product: Log4j
Version: 1.2
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: Other
Component: Appender
AssignedTo: log4j-dev@logging.apache.org
ReportedBy: eross@m-qube.com
Steps to reproduce:
Layout layout = new PatternLayout(this.logfileLayout);
RollingFileAppender rfa = new RollingFileAppender(layout, filename, true);
Logger.getRootLogger().addAppender(rfa);
Logger.getRootLogger().removeAllAppenders();
rfa.rollOver();
Results:
[junit] java.lang.NullPointerException
[junit] at
org.apache.log4j.RollingFileAppender.rollOver(RollingFileAppender.java:112)
Cause:
cw is null:
src/java/org/apache/log4j/RollingFileAppender.java
public // synchronization not necessary since doAppend is alreasy synched
void rollOver() {
File target;
File file;
LogLog.debug("rolling over count=" + ((CountingQuietWriter) qw).getCount());
LogLog.debug("maxBackupIndex="+maxBackupIndex);
Suggestion:
Either do nothing if the appender is closed or throw a better exception.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org