The data changes per request. I’d rather not have the caller be responsible for adding this info to the logs—we need to make sure it’s always there and I thought adding it to the log method was the best way to do that.
I could always write a wrapper around the log and pass properties to the underlying implementation, but that doesn’t feel as clean to me. It would mean calling logManager.getLogger on every log request, and even though I know it’s a singleton, that still feels like too much overhead. Especially if the log level is turned down. Since it uses a nice factory pattern, I had hoped that log4net might use dependency injection for its concrete class. But I can’t find it documented anywhere, so I guess not. Oh, well. Thanks for your help with it! Julie From: Rob Prouse [mailto:r...@prouse.org] Sent: Thursday, August 19, 2010 12:56 PM To: 'Log4NET User' Subject: RE: Using my own implementation of ILog Extension methods can’t override existing methods, so you would need to create/use new methods on ILog that chain to the underlying methods. For example DebugWithProperties(…) -> Debug() Do these properties change much? Is there a reason you can’t set them on a global or thread context before the log calls and have them logged out that way? Rob From: Sheffield, Julie [mailto:julie_sheffi...@intuit.com] Sent: Thursday, August 19, 2010 12:47 PM To: Log4NET User Subject: RE: Using my own implementation of ILog I have some custom properties I want to stick in LoggingEvent.Properties. Can I do that with extension methods? From: Rob Prouse [mailto:r...@prouse.org] Sent: Thursday, August 19, 2010 12:38 PM To: 'Log4NET User' Subject: RE: Using my own implementation of ILog Before you go to too much work, what do you hope to achieve with your custom ILog? Can you achieve what you want another way like writing or extending an appender, or possibly with extension methods? From: Sheffield, Julie [mailto:julie_sheffi...@intuit.com] Sent: Thursday, August 19, 2010 12:20 PM To: log4net-user@logging.apache.org Subject: Using my own implementation of ILog I see examples for extending the ILog interface that involve a custom version of the LogManager. However, is it possible simply to provide my own implementation of the standard ILog interface and configure the LogManager to return it? If so, how? I can certainly follow the examples and write my own LogManager, but I’d hate to do so unnecessarily. Thanks very much! Julie