I have a MVC3 web application. I am using Ninject 2 for dependency injection and the Ninject logging extension with log4net for logging.
My client wants to be able to “trace” a user session in Production to troubleshoot possible problems. The way we wanted to implement it is by dynamically changing the log level for that user, for example by storing a cookie so when Ninject.logging provides the logger instance, it knows to provide a log instance with level set to Debug.
I didn’t find any way to do this, either by using Ninject logging or plain log4net.
Any suggestions?
I have a MVC3 web application. I am using Ninject 2 for dependency injection
Share
We ended up modifying the ninject.extension.logging in this way:
– In LoggerFactoryBase we modified the
GetLogger(IContext context)method to retrieve a cookie from the HttpContext– If this value is set, we get or create the logger with “Tracing.” + type name
– In log4net config we have a logger called “Tracing” set to Debug