| Author |
logger for multi threaded multi class application
|
glen croteau
Greenhorn
Joined: Apr 10, 2008
Posts: 15
|
|
Hello,
I have a multi threaded multi class application. I wish to write thread safe output to the console.
i have added a logger and set its level for each class.
I can set the formatter for each class also, however I would like to know if I can set the formatter once at a lower level instead of in each class.
This seems a bit much to do in each class. I would like to keep it simple. Even a config file which could be programmatically loaded at start up woudl be good.
Thanks
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32611
|
|
|
Too difficult a question for "beginning". Moving thread.
|
 |
glen croteau
Greenhorn
Joined: Apr 10, 2008
Posts: 15
|
|
Hello,
I am now setting the formatter on the default logger and this appears to work.
now i would like to move this to a config file as stated above.
In each class I call a static setup method which handles the config. is there a cleaner solution?
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
Please UseCodeTags. You can edit your post to add them.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Hebert Coelho
Ranch Hand
Joined: Jul 14, 2010
Posts: 754
|
|
glen croteau wrote:Hello,
I am now setting the formatter on the default logger and this appears to work.
now i would like to move this to a config file as stated above.
In each class I call a static setup method which handles the config. is there a cleaner solution?
If your classes names are really "A" ou "B", you could name it "DEBUG_LEVEL_B_CLASS" and then logger.setLevel(className).
And if its not, you might create a method do encapsulate that if sequence.
|
[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
|
 |
 |
|
|
subject: logger for multi threaded multi class application
|
|
|