This project has moved and is read-only. For the latest updates, please go here.

How to replace the default LoggerFactory whicle hosting with OwinHost.exe

Sep 9, 2013 at 1:56 PM

How can we replace the default LoggerFactory with a custom one while hosting with OwinHost.exe? I looked at the code and I can see the HostingEngine.EnableTracing method has the below code:


I looked at the setting file and thought it might support this configuration but I guess not. I also couldn't find anywhere to get in there. Should I just reset the app.Properties["server.LoggerFactory"] on the app Startup inside the Configuration method?

Sep 9, 2013 at 3:42 PM
Are you trying to replace where startup logs go? Or do you just want to replace the logger for middleware? If the latter then yes, just reset app.Properties["server.LoggerFactory"] in your config method.
Sep 10, 2013 at 8:06 AM
Thanks Chris!

I would love to able to replace this through the settings file that I pass to OwinHost.exe with the --settings switch. Is this possible for the future release?
Sep 10, 2013 at 4:41 PM
It's not already? That's a good idea.
Sep 10, 2013 at 5:20 PM
Sep 10, 2013 at 5:45 PM
Nice! thanks guys!
Dec 5, 2013 at 12:18 AM