Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 25th, 2006, 04:22 PM
Registered User
Join Date: Apr 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to prerak_v_shah Send a message via Yahoo to prerak_v_shah
Default Log4Net EventLog Problem

Hi Friends,

I have doubt about log4Net. It is not working the way I am looking for. Actually I want:

- If log.debug(“”) is called, it should make entry only in Rolling Log file.

- If log.error(“”) is called, it should make entry in Rolling Log file as well as in Windows Event Log.

Now, With the following web.config setting, It works fine for log.debg(“”). But, If log.error(“”) is called, It makes entry in Rolling Log file but doesn’t make any entry in EventLog.


      <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">

            <file value="Testweb.log" />

            <appendToFile value="true" />

            <rollingStyle value="Size" />

            <maxSizeRollBackups value="10" />

            <maximumFileSize value="100KB" />

            <staticLogFileName value="true" />

            <layout type="log4net.Layout.PatternLayout">

                  <conversionPattern value="%date [%thread] %-5levelÀ%logger [%property{NDC}] - %message%newline" />




    <appender name="EventLogAppender" type="log4net.Appender.EventLogAppender" >

            <applicationName value="MyApp" />

            <layout type="log4net.Layout.PatternLayout">

                  <conversionPattern value="%date [%thread] %-5levelÀ%logger [%property{NDC}] - %message%newline" />




            <level value=" DEBUG" />

            <appender-ref ref=" RollingFileAppender" />


    <logger name="ExManager" additivity="false">

            <level value="ERROR" />

            <appender-ref ref=" EventLogAppender" />



Note: Here I would like to mention that my <appender> tags are correct and it makes entry in Event Log if I set EventLogAppender in root level.

Hope, I have explained the problem properly. Please let me know if I have missed out anything.

Thanks in Advance
Prerak V. Shah

Similar Threads
Thread Thread Starter Forum Replies Last Post
Session expires at logging messages using Log4Net nadigadda .NET Framework 1.x 0 May 2nd, 2007 04:32 PM
Session expires at logging messages using Log4Net nadigadda .NET Framework 2.0 0 May 2nd, 2007 04:29 PM
EventLog error Bob Bedell ASP.NET 1.0 and 1.1 Professional 0 November 26th, 2006 09:59 PM
log4net.appender piyushnu C# 1 April 14th, 2006 06:13 AM
EventLog.CreateEventSource cjo ASP.NET 1.0 and 1.1 Basics 2 December 7th, 2003 05:41 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.