You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2004/03/02 18:14:59 UTC

DO NOT REPLY [Bug 27373] New: - NPE when running commons listener against log4J1.2.8

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27373>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27373

NPE when running commons listener against log4J1.2.8

           Summary: NPE when running commons listener against log4J1.2.8
           Product: Ant
           Version: 1.7Alpha (nightly)
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Other
        AssignedTo: dev@ant.apache.org
        ReportedBy: stevel@apache.org


This is actually an example in erik and my book; we should have regression
tested it.

1. Take a build file
<project default="fail">
	<target name="fail">
		<echo message="Hola" />
	</target>
</project>

2. run it with the listener:
ant -listener org.apache.tools.ant.listener.CommonsLoggingListener

3. observer the failure
BUILD FAILED
java.lang.NullPointerException
	at org.apache.log4j.helpers.LogLog.error(LogLog.java:120)
	at org.apache.log4j.Category.callAppenders(Category.java:264)
	at org.apache.log4j.Category.forcedLog(Category.java:445)
	at org.apache.log4j.Category.info(Category.java:704)
	at org.apache.commons.logging.impl.Log4JCategoryLog.info(Log4JCategoryLog.java:148)
	at
org.apache.tools.ant.listener.CommonsLoggingListener.realLog(CommonsLoggingListener.java:264)
	at
org.apache.tools.ant.listener.CommonsLoggingListener.buildStarted(CommonsLoggingListener.java:103)
	at org.apache.tools.ant.Project.fireBuildStarted(Project.java:1781)
	at org.apache.tools.ant.Main.runBuild(Main.java:622)
	at org.apache.tools.ant.Main.startAnt(Main.java:188)
	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)

4. Line #120 of LogLog is
    System.err.println(ERR_PREFIX+msg);
The problem is that the system.err error is not defined yet. Which is odd, as
that is just what the setup code is meant to do;

I am very confused by this, as I dont see on a look at the listener setup how we
can get a null system.err unless it is not assigned. We may want some extra
hooks and checks in the listener to catch this null-value state before handing
off to log4j, though a bug fix would be better.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org