Solved

log4net not logging. why?

Posted on 2014-10-03
4
181 Views
Last Modified: 2014-10-28
Hi;

I have the following log segment in my web.config:

<log4net>
    <appender name="A1" type="log4net.Appender.RollingFileAppender" >
      <file value="logs/jazz.log" />
      <appendToFile value="true" />
      <rollingStyle value="Size" />
      <maxSizeRollBackups value="10" />
      <maximumFileSize value="10MB" />
      <staticLogFileName value="true" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%d [%t] %-5p %c - %m%n" />
      </layout>
    </appender>
    <root>
      <level value="ALL" />
      <appender-ref ref="A1" />
    </root>
  </log4net>

Open in new window


I changed log level to ALL from but it's not logging anything. But the log lines are invoked during the debug. Logs directory is there but jazz.log is empty. What would be the reason?

Regards.
0
Comment
Question by:jazzIIIlove
  • 2
4 Comments
 
LVL 96

Expert Comment

by:Bob Learned
Comment Utility
Does your log4net have rights to that folder?
0
 
LVL 25

Accepted Solution

by:
apeter earned 500 total points
Comment Utility
you have configsection referring to log4net ? Did you call XmlConfigurator.Configure before logging ?
0
 
LVL 12

Author Comment

by:jazzIIIlove
Comment Utility
Hi guys;

Yes, everyone has full rights on the given folder.

  <configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
  </configSections>

Open in new window


No, I don't call, XmlConfigurator.Configure before logging. Where to call? I don't have AssemblyInfo.cs in my asp.net web application.

Regards.
0
 
LVL 25

Expert Comment

by:apeter
Comment Utility
You can call in global.ascs file.  Also can we we see how you are instantiating ilog instance and how you are using that to log please?
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now