Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Logger not logging.

807603Feb 5 2008 — edited Feb 18 2008
I'm trying to use the java.util.logging API to do logging, but it never logs anything less than INFO level. I've tried explicitly setting the levels and overriding the filters on the logger and it's Handler(s), but it hasn't worked. This is what I've done. Please tell me I'm missing something simple...
Logger l = Logger.getLogger("TestingLogger");
l.setFilter(new Filter() {
    public boolean isLoggable(LogRecord record) {
        return true;
    }
});
for(Handler h : l.getHandlers()) {
    h.setFilter(new Filter() {
        public boolean isLoggable(LogRecord record) {
            return true;
        }
    });
    h.setLevel(Level.ALL);
}

l.setLevel(Level.ALL);
l.info("test");  // this is the only one that gets printed
l.fine("test");
l.finer("test");
l.finest("test");
for(Handler h : l.getHandlers())
    h.flush();
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 17 2008
Added on Feb 5 2008
3 comments
129 views