Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 382331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:10:19+00:00 2026-05-12T15:10:19+00:00

I didn’t want to make the title too long but this question specifically refers

  • 0

I didn’t want to make the title too long but this question specifically refers to running an NServiceBus Generic Host as a Windows Service (thanks to TopShelf) configured to run as Local System (on a Vista machine)

In a previous question I explain why I decided to adapt the PubSub sample to run as a Windows Service so that I can easily stop and start the service to fully prove to myself that NServiceBus was doing what it was supposed to do.

For some reason I can’t get Log4Net to log anything to disk, so this could well just be a Log4Net (newbie) configuration problem?

Below is my brute-force attempt to get some sort of tracing going – all I’m getting so far is files writen as follows:

C:\logs\<-GUID->log4net.log

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="MsmqTransportConfig" type="NServiceBus.Config.MsmqTransportConfig, NServiceBus.Core" />
    <section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core" />
    <sectionGroup name="common">
      <section name="logging" type="Common.Logging.ConfigurationSectionHandler, NServiceBus.Core"/>
    </sectionGroup>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
  </configSections>

  <!-- in order to configure remote endpoints use the format: "queue@machine" 
       input queue must be on the same machine as the process feeding off of it.
       error queue can (and often should) be on a different machine.
  -->

  <MsmqTransportConfig
    InputQueue="worker2"
    ErrorQueue="error"
    NumberOfWorkerThreads="1"
    MaxRetries="5"
  />

  <UnicastBusConfig>
    <MessageEndpointMappings>
      <add Messages="Messages" Endpoint="messagebus" />
    </MessageEndpointMappings>
  </UnicastBusConfig>

  <common>
    <logging>
      <factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, NServiceBus.Core">
        <arg key="configType" value="INLINE"/>
      </factoryAdapter>
    </logging>
  </common>

  <log4net debug="true">
    <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender,log4net">
      <param name="File" value="c:\logs\Subscriber2.log" />
      <param name="AppendToFile" value="true" />
      <rollingStyle value="Size" />
      <maxSizeRollBackups value="2" />
      <maximumFileSize value="100KB" />
      <staticLogFileName value="true" />
      <datePattern value="yyyyMMdd" />
      <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
      </layout>
    </appender>

    <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
      <layout type="log4net.Layout.PatternLayout">
        <conversionpattern value="%date [%thread] %-5level %logger - %message%newline" />
      </layout>
    </appender>

    <appender name="EventLogAppender" type="log4net.appender.eventlogappender">
      <applicationname value="Subscriber2.EndPointConfig_v1.0.0.0" />
      <layout type="log4net.layout.patternlayout">
        <conversionpattern value="%date [%thread] %-5level %logger - %message%newline" />
      </layout>
    </appender>

    <appender name="TraceAppender" type="log4net.Appender.TraceAppender">
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
      </layout>
    </appender>


    <root>
      <level value="ALL" />
      <appender-ref ref="RollingLogFileAppender" />
      <appender-ref ref="EventLogAppender" />
      <appender-ref ref="ConsoleAppender" />
      <appender-ref ref="TraceAppender" />
    </root>

  </log4net>

  <appSettings>
    <add key="log4net.Internal.Debug" value="true"/>
  </appSettings>

  <system.diagnostics>
    <trace autoflush="true">
      <listeners>
        <add
          name="textWriterTraceListener"
          type="System.Diagnostics.TextWriterTraceListener"
          initializeData="c:\logs\log4net.log" />
      </listeners>
    </trace>
  </system.diagnostics>

</configuration>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T15:10:20+00:00Added an answer on May 12, 2026 at 3:10 pm

    NSB will not pick up log settings from config files as default. To do this implement IConfigureLogging in your endpoint config class.

    More info here:

    http://tech.groups.yahoo.com/group/nservicebus/message/3655

    Hope this helps!

    /Andreas

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I didn't find a better way to phrase this question in the title. If
Didn't see a question similar to this, so here goes: Let's say I'm running
Didn't even know how to exactly phrase this question, but here is the the
I didn't find an answer to this question because I don't know if I'm
I didn't design this table, and I would redesign it if I could, but
I didn't find an exact answer to this question so either it's a stupid
I didn't find an answer on the net and i hope this question have
i didn't tested this code on iPhone but i'm sure (tested) it doesn't works
Didn't really know how to title this. First time writing a gem so not
I didn't realize this, and just want to confirm. If I have a html

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.