Forums Register Login
Logger.entering and exiting methods
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!

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 ]
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,

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.
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 ]
Ok, I see now! Thanks for the good explanation!


This thread has been viewed 4161 times.

All times above are in ranch (not your local) time.
The current ranch time is
Nov 17, 2018 22:56:56.