aspose file tools*
The moose likes Java in General and the fly likes Logger.entering and exiting methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Logger.entering and exiting methods" Watch "Logger.entering and exiting methods" New topic
Author

Logger.entering and exiting methods

Barry Andrews
Ranch Hand

Joined: Sep 05, 2000
Posts: 523

Hi,
Has anyone used the entering() and exiting() methods from java.util.logging.Logger class. I cannot seem to get these to work. I have my LoggerHandler level set to Level.ALL, yet I do not get anything from these traces in the console. Other traces are working fine, Logger.info(), Logger.fine(), etc.,etc. Any help is appreciated!

thanks,
Barry
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
You have the Handler set to ALL but what about the Logger itself? It needs to be set to ALL also.
entering and exiting are at the FINER level. Can you publish FINER log messages?
[ February 19, 2003: Message edited by: Thomas Paul ]

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Barry Andrews
Ranch Hand

Joined: Sep 05, 2000
Posts: 523

Hmmmmmm... I guess I don't quite understand what the Handler is doing. If I set the Level for the Handler to Level.OFF, then I get no traces and if I set it to Level.ALL I get INFO traces (which is all I have) So I just assumed that if I set the Level for the Handler, then all of my Loggers that are using this Handler would use this level. But, I see that is not the case. I tried what you said, i.e. I set the Logger itself to Level.ALL and now I get the entering/exiting traces. Can you explain why this is?
many thanks,

Barry
hennie louw
Ranch Hand

Joined: Jul 03, 2001
Posts: 56
The reason why the Logger and Handler has a level is this allows mutiple Logger's to have the same handler and also mutiple handler's to the same logger.
Eg.
Situation 1: you have one Hanlder that writes to a file, and this handler level is set to ALL. You also have two Loggers that are set to ALL, now we chnage the one logger to only log WARNING logs because we know there is no unresolved problems for the one logger, but we need to get all the logs of the other logger. now both loggers can have diffrent log levels that are published to the same file.
Situation 2: You have on logger that accepts all logging levels, and two handler, one goes to a file and the other one to the console. now we can set one logger's level to ALL and have a detailed logging to file and the console handler is set to INFO, so in the console we only see runtime logs and no trace logging.
In both situations we could have used two logger and two handler objects, but with this design we can remove one of the hander/logger and save memory usage. and just Imagine if you had to set up 50 logger's with the same log message for 50 handler's that published to logs to diffrent locations, now we can do it with one logger and just 50 handler's , that saves us 49 objects form being created.
[ February 20, 2003: Message edited by: hennie louw ]

Any Body can be paid to write good code, but brilliant code can only come from passion
Barry Andrews
Ranch Hand

Joined: Sep 05, 2000
Posts: 523

Ok, I see now! Thanks for the good explanation!

Barry
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Logger.entering and exiting methods
 
Similar Threads
Java In Genearal
Servlets-Help(servlet.properties)
How to findout invoking class
Event logging of a Web Service
Request Entity Too Large