Skip to content

Instantly share code, notes, and snippets.

@colin-haber
Created April 28, 2012 21:22
Show Gist options
  • Save colin-haber/2522150 to your computer and use it in GitHub Desktop.
Save colin-haber/2522150 to your computer and use it in GitHub Desktop.
Any ideas why Line 18 doesn't execute properly? Java 7u4 x64, Windows 8 x64.
package com.n1nja;
import java.util.logging.*;
public class Test {
public static void main(String[] args) {
new Test();
}
private Logger logger = Logger.getLogger(this.getClass().getCanonicalName());
private Test() {
System.out.println("System.out functional");
System.err.println("System.err functional");
this.logger.addHandler(new ConsoleHandler());
for (Handler h : this.logger.getHandlers()) {
System.out.println("Handler: " + h.getClass().getCanonicalName() + " (" + h.getFormatter().getClass().getCanonicalName() + ")");
}
this.logger.setLevel(Level.ALL);
System.out.println("Level: " + this.logger.getLevel().getLocalizedName());
if (this.logger.isLoggable(Level.CONFIG)) {
this.logger.config("This should be logged."); //WHY IS THIS NOT WORKING?
}
System.out.println("Done");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment