Couldn’t find logfile in NSB service?

According to the docs on NSB,, logfile should be in the exe folder. I got this working in command line mode but not in service mode.

The trick is, I need to manually pass the NServiceBus.Production parameter to the executable command of the NSB Service. (Is it supposed to be picked up by NSB Service automatically?)

To do this, open windows registry, locate the key of HKLM\SYSTEM\CurrentSet\services\<MyService>\ImagePath

Modify it’s value by appending NServiceBus.Production parameter at the end. Restart NSB service, the logfile is right in my exe folder.

Not sure is this a bug for NSB or windows service? Tried passing “NServiceBus.Production” as the start up parameter in service properties, no good.

Tried svn latest, too many new changes in trunk, app broken, had to rollback to stable version

Update: This bug has been fixed in

According to the document:

  • When running under the production profile, (all 3 profiles are set in when handler running in NT service mode),  the logs will be written to a file called ‘logfile’ in the same directory as the exe.
  • Setting log in code works, like this :
                    .Log4Net<ConsoleAppender>(x => { x.Threshold = Level.Info; }
                    ).Log4Net<FileAppender>(x =>
                        x.File = "build_trigger_log.txt";
                        x.Threshold = Level.Info;

    but better not to do it instead using profile to control log. In fact the production profile will create that “logfile” anyway no matter we set the log file name in code or not.

  • The log threshold set in code or in profile can both be override by app.config:
        <section name="Logging" type="NServiceBus.Config.Logging, NServiceBus.Core" />
      <Logging Threshold="ERROR" />

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s