aspose file tools*
The moose likes Java in General and the fly likes Different level of log for different section in application 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 "Different level of log for different section in application" Watch "Different level of log for different section in application" New topic
Author

Different level of log for different section in application

Rob Chung
Ranch Hand

Joined: Oct 15, 2002
Posts: 46
Hi,
The application I work with has its own logging system which is very similar to Log4J. I have been asked to see if I can add function to the logging system so that logging not only varies in levels (debug, warning, error etc) but also in different application section. i.e. I can then have debug mode for section1, warning mode for section2 etc.
I am thinking of having a hashtable or something similar to hold the section indicator with its only logging switch.
Is there a better idea? Or is there any product thats already doing this I can download?
Also, is it advisable to switch to Log4J since its more of a standard?
Thanks in advance!
Rob Chung
Ranch Hand

Joined: Oct 15, 2002
Posts: 46
Anyone has any idea please?
Thanks!
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

If you have packaged your application to support it, you can do this in Log4J.
eg
set com.domain.application.database and everything under it to INFO
set com.domain.application.business and everything under it to WARN
set com.domain.application.presentation and everything under it to ERROR
As long as the code for these section are contained under the package, you've accomplished your goal.
Dave
Christopher Farnham
Greenhorn

Joined: Sep 18, 2002
Posts: 12
Where I'm working, they asked me to do some maintenance work on the in-house logging framework. I kept only the API from the legacy logging framework, turning it into a Log4J wrapper.
We gained a lot of functionality v quickly by doing that.
So I recommend replacing what you currently have with Log4J.


Christopher Farnham<br />Boston, MA<p>"Perfect is the Enemy of Good"
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Different level of log for different section in application
 
Similar Threads
Multiple log files with log4j
Card shuffling on ArrayList hangs..
What do you want from your logger?
logging
log4j:ERROR Could not read configuration file