• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Changing log level on Logger

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    You were absolutely right. Changing level on the assosiated handlers aswell solved my problem. Thanks Andrew.
     
    Consider Paul's rocket mass heater.
    reply
      Bookmark Topic Watch Topic
    • New Topic