You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by "Burger, Erik" <Er...@Gpxs.net> on 2005/09/22 12:21:39 UTC

Logging based on userID

Hi,
 
I know I have asked this question before in a long distant past and saved
the response for when I had more time. Now that I have, I cannot find the
response. Typical.
 
Anyway, I have written an extension to the log4net framework to add a
'userID' field. This works great. What I would like to do now (or, to be
precise, what my Support team would like to do now) is be able to switch
logging levels based on userID. That is, I would like to be able to have
Info as my standard logging level for all users but be able to turn on the
Debug level for particular users in response to Support calls.
 
How would I go about doing that? Is there something I can do using Filters
or do I need to extend my extension in some way??
 
Thanks in advance,
Erik

------------------------------- 
Lead Developer 
Research and Development Group 
GPXS Wireless Ltd. 
Phone: +31 (0) 20 4621 988 
Fax:   +31 (0) 20 7507 301 
Email: erik.burger@gpxs.net 

 

This e-mail (including all attachments) is confidential and may be
privileged. It is for the exclusive use of the addressee only. If you are
not the addressee, you are hereby notified that any dissemination of this
communication is strictly prohibited. If you have received this
communication in error, please erase all copies of the message and its
attachments and notify us immediately at support@gpxs.net
<ma...@gpxs.net>. Thank You.

RE: how can i add my custom infomaition

Posted by Georg Jansen <Ge...@FaktNet.com>.
Hi,

One approach to this issue is to takes advantage of Log4net's
Thread.Context.Properties

For example 
log4net.ThreadContext.Properties["UserName"] = UserName
                   
And then use the PatternLayout:
  <layout type="log4net.Layout.PatternLayout">
     <conversionPattern value="%thread User=%property{UserName}"/>
  </layout>

I have written a short article about this method on:
www.l4ndash.com/Articles/Trackingusersessionsinlog4net/tabid/59/Default.aspx

Georg
L4NDash - Log4Net Dashboard www.l4ndash.com


-----Original Message-----
From: Johnny [mailto:danjingxiu@gmail.com] 
Sent: 23. september 2005 11:08
To: 'Log4NET User'
Subject: how can i add my custom infomaition

Hi,
	When I using log4net's AdoAppender,I have a problem, because the
log4net framework default provide logger,logtime,logLevel,message,etc,but I
want to adds extra information like the username, department, etc.so what
can I do? I don't know how to implement it .can you help me ? thanks very
much.




how can i add my custom infomaition

Posted by Johnny <da...@gmail.com>.
Hi,
	When I using log4net's AdoAppender,I have a problem, because the
log4net framework default provide logger,logtime,logLevel,message,etc,but I
want to adds extra information like the username, department, etc.so what
can I do? I don’t know how to implement it .can you help me ? thanks very
much.


Re: Logging based on userID

Posted by Ron Grabowski <ro...@yahoo.com>.
Filtering on custom parameter
Burger, Erik
21 Apr 2005 11:45:48 -0000

http://www.mail-archive.com/log4net-user@logging.apache.org/msg01561.html

--- "Burger, Erik" <Er...@Gpxs.net> wrote:

> Hi,
>  
> I know I have asked this question before in a long distant past and
> saved
> the response for when I had more time. Now that I have, I cannot find
> the
> response. Typical.
>  
> Anyway, I have written an extension to the log4net framework to add a
> 'userID' field. This works great. What I would like to do now (or, to
> be
> precise, what my Support team would like to do now) is be able to
> switch
> logging levels based on userID. That is, I would like to be able to
> have
> Info as my standard logging level for all users but be able to turn
> on the
> Debug level for particular users in response to Support calls.
>  
> How would I go about doing that? Is there something I can do using
> Filters
> or do I need to extend my extension in some way??
>  
> Thanks in advance,
> Erik
> 
> ------------------------------- 
> Lead Developer 
> Research and Development Group 
> GPXS Wireless Ltd. 
> Phone: +31 (0) 20 4621 988 
> Fax:   +31 (0) 20 7507 301 
> Email: erik.burger@gpxs.net 
> 
>  
> 
> This e-mail (including all attachments) is confidential and may be
> privileged. It is for the exclusive use of the addressee only. If you
> are
> not the addressee, you are hereby notified that any dissemination of
> this
> communication is strictly prohibited. If you have received this
> communication in error, please erase all copies of the message and
> its
> attachments and notify us immediately at support@gpxs.net
> <ma...@gpxs.net>. Thank You.
>