views:

46

answers:

1

Can anyone point me in the right direction here.

Is it possible to have separate log4net config files for each profile?

In that way I could have a production.log4net.config and a lite.log4net.config?

It would be even more cool if that configuration was on top of the programmatic configuration already build into the generic host.

+1  A: 

You'd have to override the profiles with your own, and then implement IConfigureLoggingForProfile and in there call:

NServiceBus.SetLoggingLibrary.Log4Net(() => log4net.Config.XmlConfigurator.Configure(File.OpenRead("production.log4net.config")));

Udi Dahan
When you say override the profiles do you then mean to create a new profile inheriting from the original?
mlarsen
You can inherit, yes, which will give you all the other behaviors of the profile except the logging which you'll override. Or, you could not inherit and define the specific behaviors yourself.
Udi Dahan
Works perfectly, thanks.
mlarsen