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

  • Home
  • SEARCH
  • 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 1051527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:56:52+00:00 2026-05-16T16:56:52+00:00

So I’ve got a website and a console app that runs daily. They both

  • 0

So I’ve got a website and a console app that runs daily.

They both call a Function called ProcessIncident(). The website allows you to do it manually for an individual incident and the console app does a batch every night.

Within the function I have various log4net Log.InfoFormat() and Log.DebugFormat() calls

When I run from the website it logs fine

when I run from the console app it doesn’t log at all

The path specified definatly exists

The console app config is as follows

<?xml version="1.0" encoding="utf-8" ?>
<log4net xmlns="urn:log4net">



  <logger name="NHibernate">
    <level value="OFF" />
    <appender-ref ref="NHibernateFileAppender" />
  </logger>


  <logger name="SMS">
    <level value="ALL" />
    <appender-ref ref="SmsFileAppender" />
  </logger>




<appender name="SmsFileAppender" type="log4net.Appender.RollingFileAppender">  
    <file value="D:\XXXX\SMS.IncidentBilling.log" />  
    <appendToFile value="true" />  
    <rollingStyle value="Size" />  
    <maxSizeRollBackups value="2" />  
    <maximumFileSize value="1MB" />  
    <staticLogFileName value="true" />  
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="[%date]  %-5level %logger %message %newline" />
    </layout>
    <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
</appender>  







  <appender name="NHibernateFileAppender" type="log4net.Appender.FileAppender">
    <file type="log4net.Util.PatternString" value="D:\Dev\SMS\Main\Source\SMS.Website\Logs\nhibernate.log" />
    <appendToFile value="true" />
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="[%date] %appdomain %-5level %c %message %newline" />
    </layout>
    <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
  </appender>








</log4net>

In the console app I have refereneced log4net dll and am declareing amember as

private  ILog Log = LogManager.GetLogger(typeof(Task));

Can anyone see anything stupid that I am doing. THere are no actual errors, just nothing is gettign logged via the console app

  • 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-16T16:56:52+00:00Added an answer on May 16, 2026 at 4:56 pm

    I don’t remember exactly what I did, but I think you should initialize log4net before using it.

    Something like this line:

    log4net.Config.XmlConfigurator.Configure();
    

    Take a look here for more info:

    Have log4net use application config file for configuration data.

    See this one too (he’s calling log4net.Config.BasicConfigurator.Configure();) :

    Log4Net Tutorial in C# .net (How can I show log in a file?)

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I am trying to loop through a bunch of documents I have to put
I'm making a simple page using Google Maps API 3. My first. One marker
I have some data like this: 1 2 3 4 5 9 2 6

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.