Hello Ranchers,
I'd like to share my logging approach with you and see if it is any good.
I decided to use
java logging utility not only as a handy debugging tool, but also as a part of my final application. So, once the app is ready, all errors and warnings should be logged into a "suncertify.log" file in a simple text format.
To support this I created a class in my db package with a static method getLogger(). This method takes a name of a logger as a parameter, and then dynamically changes the default settings (formatting, log file name, level etc) and returns the resulting logger. If an IO exception occurs, it returns a default logger as per logging.properties.
My initial thought was to go with a property file to be able change logger settings without having to recompile the code. But:
1. we are allowed only one property file
2. we can't ask examinator to change any files manually
3. our own logging.properties file can be only provided at run time, which would contradict requirements of starting the application
In my class I created a couple of constants - level, log file name, etc. which may be changed when the app is deployed. This way these properties may be relatively easily changed, but the code would still require to be recompiled.
What do you think about this direction for logging? I'd love to hear your thoughts!
[ February 13, 2006: Message edited by: Svitlana Dukhovna ]