Earlier we’ve gone through on how one can modify the NServiceBus FullDuplex sample so that the NServiceBus debug-messages aren’t shown on the console. The change we did allowed us to change the whole log4net configuration. But, if we only care about hiding the debug-messages, there’s an easier way.

NServiceBus.Host.exe has a support for different profiles.  Profiles are meant to easy the path from moving your application from the development into the production. The profiles allow you to change some aspects of your application (like logging) without making any code or configuration changes. NServiceBus comes with three different profiles and you can build your own. The built-in profiles are:

  • Lite
  • Integration
  • Production

You can find more information about the built-in profiles through the NServiceBus documentation.

If you’re using the generic host (NServiceBus.Host.exe) and you want to remove the NServiceBus debug messages from your console, you can easily do that with the help of the built-in profiles. If you start your host with an Integration-profile, the debug-messages will not print on the console.

To start the host with a specified profile, add the profile’s class name as an argument to the host. In our case we want to start the host with an integration-profile and here’s how we do that:

NServiceBus.Host.exe NServiceBus.Integration

And as you can see, the debug messages are gone.