Couldn’t find logfile in NSB service?

According to the docs on NSB, http://www.nservicebus.com/Profiles.aspx, 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 2.0.0.1145.

Update: This bug has been fixed in 2.5.0.1446.

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 :
    Configure.With()
                    .Log4Net<ConsoleAppender>(x => { x.Threshold = Level.Info; }
                    ).Log4Net<FileAppender>(x =>
                    {
                        x.File = "build_trigger_log.txt";
                        x.Threshold = Level.Info;
                    }
                    )
                    .NinjectBuilder()
                    .XmlSerializer();
    

    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:
      <configSections>
        <section name="Logging" type="NServiceBus.Config.Logging, NServiceBus.Core" />
      </configSections>
    
      <Logging Threshold="ERROR" />
    
Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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