• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Changing log level on Logger

 
Jim Petersson
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im trying to figure out how the Logger works but ran into some problems.
I'm trying to use the entering and exiting methods. From the API they are said to be of FINER-level. So in order to have them displayed I reckoned all I'd have to do is call myLogger.setLevel(Level.FINER). Unfortunately this didn't make my entering and exiting messages show.
What am I doing wrong?

Thanks
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12007
215
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jim,

I'm betting on 2 things:
  • You are using the ConsoleHandler


  • The default level for the ConsileHandler is Level.INFO

  • You are setting the log level on the Logger instance


  • Setting the log level on the logger only tells the logger what level of messages are to be passed to the handler. It doesn't change anything on the handler.

    So, if I am right, your logger is correctly set such that it sends messages to the handler, however the handler then ignores them.

    Simple fix: set the level on the handler as well:
    With the output:

    Regards, Andrew
    [ June 19, 2008: Message edited by: Andrew Monkhouse ]
     
    Jim Petersson
    Ranch Hand
    Posts: 48
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    You were absolutely right. Changing level on the assosiated handlers aswell solved my problem. Thanks Andrew.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic