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 8900545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:07:23+00:00 2026-06-15T01:07:23+00:00

I am trying to use basic logging for a windows service. I added the

  • 0

I am trying to use basic logging for a windows service.

I added the reference to log4net.

I added the following in AssemblyInfo.cs:

[assembly: log4net.Config.XmlConfigurator(Watch = true)]

I added the following to my App.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821" requirePermission="false" />
  </configSections>

  <!-- Log4net Logging Setup -->
  <log4net>
    <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender,log4net">
      <file value="c:\\CGSD\\log\\logfile.txt" />
      <appendToFile value="true" />
      <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date [%thread] %level %logger - %message%newline" />
      </layout>
      <filter type="log4net.Filter.LevelRangeFilter">
        <levelMin value="INFO" />
        <levelMax value="FATAL" />
      </filter>
    </appender>

    <root>
      <level value="ALL"/>
      <appender-ref ref="RollingFileAppender"/>
    </root>
  </log4net>
</configuration>

I have the following code in my service:

    log4net.Config.XmlConfigurator.Configure();
    log4net.ILog log = log4net.LogManager.GetLogger(typeof(Program));

    log.Debug("test");

The file c:\CGSD\log\logfile.txt is created but nothing is ever written to it.

I’ve been through the forums all day trying to track this one down, but if I overlooked an already posted solution I apologize.

  • 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-06-15T01:07:24+00:00Added an answer on June 15, 2026 at 1:07 am

    Your filter level looks to be configured at <levelMin value="INFO" /> but you are testing a log.Debug message. Change your configuration to have <levelMin value="DEBUG" /> and try again. If that doesn’t fix it, there may be other config problems also.

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

Sidebar

Related Questions

I'm trying to use System.Diagnostics to do some very basic logging. I figure I'd
I'm trying to use basic .htaccess authentication in a subdirectory of the root where
We are trying to use a basic @OneToMany relationship: @Entity @Table(name = PARENT_MESSAGE) public
I'm trying to use operator overloading to define the basic operations (+,-,*,/) for my
I'm trying to use FireWatir (1.6.5) to access a site using Basic Authentication and
I am trying to use SpinLock, but even this most basic code in a
So, I'm trying to use Doctrine to retrieve some data. I have some basic
General use case I am trying to implement a basic shell. Description I need
I am trying to get a basic understanding on how to use fputc in
I'm trying to write my own logging class and use it as a stream:

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.