logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Grobmeier <grobme...@gmail.com>
Subject Re: User-based logger level
Date Mon, 11 Jun 2012 16:28:19 GMT
In log4j 2.x there are tons of filters which might help here:
http://loggingtest.apache.org/log4j/2.x/manual/filters.html
(temporary domain)

Cheers
Christian

On Mon, Jun 11, 2012 at 5:28 PM, Jacob Kjome <hoju@visi.com> wrote:
>
> It's possible that Log4j2 supports this out of the box, but for Log4j1, the
> obvious way is to call logger.log() methods that accept an explicit
> Level/Priority [1].  Set a ThreadLocal with the Level to use and pass that
> Level to log() method.
>
> [1]
> http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Category.html#log%28org.apache.log4j.Priority,%20java.lang.Object%29
>
>
> Jake
>
>
> On Mon, 11 Jun 2012 17:55:10 +0800
>  yong.li@agfa.com wrote:
>>
>> Dear all,
>>
>> We're about to implement a logging strategy that for different users
>> different effective logger level are used. In particular, we are doing EJB,
>> and we have already pushed user info onto MDC to implement this strategy.
>> By default, the system will run using the following example logger levels
>> for all users:
>> root = INFO
>> com.my.ejb1=WARNING
>> com.my.ejb2=INFO // different ejbs may have different default levels
>> ...
>>
>> When a system setting is enabled at runtime, we want to change
>> com.my.ejb1=DEBUG, but only for a few selected users. That is, if user A
>> invokes ejb1, all ejb1 log messages with level >= DEBUG will be logged,
>> while if another user B invokes ejb1, it uses the default setting, and only
>> messages with level >= WARNING will be logged. (it also honors the logger
>> hierarchy, that is if we want to change the level for a package, all ejbs in
>> that package behave in the same way)
>>
>> We will do this on our production systems, so performance is critical.
>>
>> What would be a good way to achieve this?
>>
>> Kind Regards,
>>
>> Yong
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>



-- 
http://www.grobmeier.de
https://www.timeandbill.de

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message