简体   繁体   中英

How to log objects (structured data) with log4Net and Windsor Integration

In the past I have use the Log4Net ILog interface and custom database appenders to log objects to a database. This is very useful for capturing contextual information such as the machine name, current user, HTTP request details, etc, when logging certain kinds of events.

I am now looking at doing the same sort of thing but using IoC via Castle.Windsor. The problem is that Castle's ILogger abstraction does not support the logging of objects. Since I don't really need the abstraction nor support for other logging frameworks, is there another Log4Net integration facility out there that will support injecting ILog instances, or can I get ILog instances from the Windsor logging facility?

Ultimately, I solved this by implementing my own facility based on the Castle logging facility source code but returning the log4Net specific interface.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM