Solved

log4net not logging. why?

Posted on 2014-10-03
4
187 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

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.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

919 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

16 Experts available now in Live!

Get 1:1 Help Now