Logging broken ?

Andreas Grunewald gruni@users.sourceforge.net
Tue Apr 5 12:40:00 GMT 2005


Ok it'S me again I eliminated my Nullpoiinter Exceptiona dn it comes 
back to the Logging framework.
I wrote a little test application that should just log one line into a 
debug.log file. It crashes with a Nullpointerexception.
Is this known or new or normal ?
Should I file a Bugreport ?
Is there a workaround with standard Java tools besides writing my own 
Logging framework or using Log4J ?

-Andreas

PS: Here my Testapplication

import java.io.IOException;
import java.util.logging.FileHandler;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;

public class Hello {

     public static void main(String[] args) throws SecurityException, 
IOException {
       Handler logfile = new FileHandler("debug.log");
       logfile.setFormatter(new SimpleFormatter());
       Logger tLog = Logger.getLogger("");
       tLog.addHandler(logfile);
       System.out.println("Now starting to LOG");
       tLog.log(Level.SEVERE,"Simple log test");
       System.out.println("Method END");
     }
}



More information about the Java mailing list