logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Thornley" <thornley.da...@gmail.com>
Subject Properties at the Logger level.
Date Wed, 20 Feb 2008 22:06:37 GMT
Is it possible to have properties associated at the logger level. I noticed
they are available in the repository but not implemented in
LoggingEvent.CreateCompositeProperties().

Basically, I have a windows service that has several listening sockets
(implemented with asynchronous callbacks). I would like to track and log
session activity on the server for each of these listening sockets with
log4net.

My understanding is that the ThreadContext scope will not allow me to track
sessions in my case. The reason being that async callbacks are invoked on
whatever thread the pool decides. So there is no threadcontext=session
affinity.

What I am aiming to do is add a new Logger for each session, and then set a
group of properties relevant to that session for logging. The logger
hierarchy would look like this: -

Name.ServerA.[0x1234]
Name.ServerA.[0x1111]
Name.ServerB.[0x5679]
Name.ServerB.[0x2222]

So when I get a new logger for the session, I would like to be able to
assign properties to that logger.

Is this possible in log4net, after looking at the code it doesn't look that
way?

Would it be a major change to add properties at the logger level, and is
there another way of achieving this that I haven't considered.

Thanks in advance.

Regards,

David.

Mime
View raw message