Solved

log4net not logging. why?

Posted on 2014-10-03
4
190 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
ID: 40361554
Does your log4net have rights to that folder?
0
 
LVL 25

Accepted Solution

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

Author Comment

by:jazzIIIlove
ID: 40363854
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
ID: 40363896
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

685 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