logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Wechner <michael.wech...@wyona.com>
Subject Re: Logging only particular users
Date Thu, 25 Jul 2013 07:21:32 GMT
Hi Curt
Hi Nick

Thanks very much for the pointer to "fish tagging" and the explanations 
accordingly.

Best wishes

Michael

Am 24.07.13 16:53, schrieb Nick Williams:
> On Jul 24, 2013, at 9:35 AM, Michael Wechner wrote:
>
>> Hi
>>
>> We are using log4j for many years now for our open source CMS www.yanel.org and it
works really great
>> and I really would like to thank everyone who contributed to log4j.
>>
>> Over the years we are experiencing that more and more people are using our software,
which is very nice, but
>> it also makes it harder to debug. Hence I had the idea that it would be nice if one
could filter the log file, such that one
>> would see only the log statements generated by requests of a particular user.
>>
>> I guess a simple way to accomplish this would be to add the user or session id to
the log statement and then to grep for this user or session id.
> That's exactly what we do. We have a filter that intercepts each request before any other
filter, and it adds the username to the MDC. The we add that MDC value to the log output.
>
> Another thing we do is generate a unique ID for each request and add that to the MDC,
logging it in the output along with the username. This enables us to not only filter log events
by user, but actually examine everything that happened in a particular request. This is called
fish tagging: http://logging.apache.org/log4j/2.x/manual/thread-context.html.
>
> grep is a crude but effective tool to filter these log contents. Another thing you could
do is log events to a database and query events that way.
>
> Nick
>
>> But it seems to me a bit crude and hence I wanted to ask if somebody might have tried
something similar?
>>
>> Thanks
>>
>> Michael
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>
>


---------------------------------------------------------------------
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