configurable logging in Log4j
1 posts in topic
Flat View  Flat View

Posted By:   java2rhyme_java2rhyme
Posted On:   Tuesday, January 31, 2006 04:01 PM

How to do fine grained logging within a level using log4j. For example I want to log some thing to the info log file based on some configurable conditions, say NEVER, ALWAYS etc.

If the configuration for a particular log message of a class is NEVER it should not log that statement. But at the same time I should be able to log some thing if the configuraion is ALWAYS. I won't be able to turn off the logging since I have some thing to be logged and some thing not to be logged.

Please help

Re: configurable logging in Log4j

Posted By:   ankush_purwar  
Posted On:   Tuesday, January 31, 2006 10:39 PM

I don't know exact ur requirement.But the similar kind of stuff hava already been provided by Log-4j.
Look at the Threshold property of logger and appeanders.
If you have defined threshold say as warn, it means there will be no logging at debug and info level.

So why not you try to map your configuration conditions to log-4j levels and let rest thing by Log-4j.
About | Sitemap | Contact