Logging broken ?
Andrew Haley
aph@redhat.com
Tue Apr 5 14:43:00 GMT 2005
Andreas Grunewald writes:
> 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 ?
Well, it's hard for us without Windows platforms to know what the
cause of your problem might be. However, my guess is that you have
some kind of problem with stack traces.
Can you run this with gdb and let us know here the exception happens?
Do you get a stack trace?
Andrew.
> 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