ASP.NET - Issue in logging (Log4Net)  ASP.NET - Issue in logging (Log4Net)

Asked By Shatrunjay Shukla
10-Mar-11 06:43 AM
In my application, there is 4 layer
UI
Service
Business
Data Access

Now I am using Log4Net open source for logging the exception. Actually what happened,

when exception occurs on Data access layer is logged then throw the inner exception to business layer. On business layer, it has own inner exception and inner exception of Data access layer. So there is duplication of logging here 2 times logging of exception , first time on data access layer then on business layer. What should i do to stop the double logging of exception

 

Plz help me out. its urgent

Note: If question is not clear then post your comment

  Peter Bromberg replied to Shatrunjay Shukla
10-Mar-11 09:05 AM
You are probably getting duplicate log messages because your configuration is telling Log4Net to log twice.

here's a sample config that does not do this:

<root>
    <level value="WARN" />
    <appender-ref ref="Console" />
    <appender-ref ref="LogFile" />
</root>
<logger name="myprogram">
    <level value="INFO" />
</logger>
  Shatrunjay Shukla replied to Peter Bromberg
11-Mar-11 03:52 AM
My Config file is:

<root>
            <level value="track" />
            <!-- <appender-ref ref="RollingFile" /> -->
            <!-- <appender-ref ref="RollingFileTrack" /> -->
            <!-- <appender-ref ref="RollingFileError" /> -->
            <appender-ref ref="PegasusRollingFile" />
            <appender-ref ref="PegasusRollingFileTrack" />
            <appender-ref ref="PegasusRollingFileError" />
            <!-- <appender-ref ref="ADONetTrack" /> -->
            <!-- <appender-ref ref="ADONetError" /> -->
            <!-- <appender-ref ref="SMTPMail" /> -->
        </root>
        <logger name="Pegasus.Web">
            <level value="track" />
        </logger>
        <logger name="Pegasus.DataAccessLayer">
            <level value="info" />
        </logger>
        <logger name="Pegasus.DataAccessLayer.Common.SqlHelper">
            <level value="info" />
        </logger>
        <logger name="Pegasus.ServiceLayer">
            <level value="info" />
        </logger>
        <logger name="Pegasus.AssetServiceLayer">
            <level value="info" />
        </logger>
        <logger name="Pegasus.Cache.Core.CacheProviderFactory">
            <level value="info" />
        </logger>
        <logger name="Pegasus.Integration.Lms.LifRequestHandler">
            <level value="info" />
        </logger>
        <logger name="Pegasus.Integration.Lms.ProntoRequestHandler">
            <level value="debug" />
        </logger>
        <logger name="Pegasus.Integration.Tpi.Service">
            <level value="info" />
        </logger>
        <logger name="Pegasus.Integration.Rumba.Product.MessageInspectorDurationClient">
            <level value="debug" />
        </logger>
        <logger name="Pegasus.Integration.Rumba.IdentityV2">
            <level value="debug" />
        </logger>
        <logger name="Pegasus.Integration.Rumba.Identity">
            <level value="debug" />
        </logger>
        <logger name="Pegasus.Integration.Rumba.Product">
            <level value="debug" />
        </logger>
        <logger name="Pegasus.Integration.Rumba.ServiceFacade">
            <level value="debug" />
        </logger>
    <logger name="Pegasus.Integration.Common.MessageInspectorDurationCS">
    <level value="info" />
    </logger>
    <logger name="Pegasus.SystemFrameworks.PegasusStopWatch">
    <level value="info" />
    </logger>
    <logger name="Pegasus.ServiceLayer.PegasusSecurity.PegasusRequestPrincipal">
    <level value="debug" />
    </logger>
So now plz tell me what should I do to avoid duplication in logging
Create New Account
help
Net hi friends Any one send frequently asked Important questions in C# .Net, ADO .Net, Asp .Net and Sql Server. . . . . . . . tx in Advance. . . . . . Hi, Find this. . (B)What is an IL? (B is the difference between VB.NET and C#? (I) what is the difference between System exceptions and Application exceptions? (I)What is CODE Access security? (I)What is a satellite assembly? (A) How to prevent my .NET DLL to Daemon threads and how can a thread be created as Daemon? (A) How is shared data managed in threading? (I) Can we use events with threading? (A) How can we know the implementation to Remoting Client? (A) What are LeaseTime, SponsorshipTime, RenewonCallTime and LeaseManagerPollTime? (A) Which config file has all the supported channels / protocol? (A) How can you specify remoting parameters using Config files? (A) Can Non-Default constructors be used with Single Call SAO? (I) How can
those are in development or want to be a .net developer • To test a Web Service you must create a windows application or web application to consume this service? It is True / False? FALSE How many classes can a single.NET DLL contain? Answer1 replace the ADO Recordset object? The differences includes In ADO, the in-memory representation of data is the recordset. In ADO.net, it is the dataset A recordset looks like a collection of one or more tables in ADO.net ADO is designed primarily for connected access ADO.net the disconnected access to the database is used In ADO you communicate with the database by making calls to an OLE DB provider. In ADO.NET you communicate with the database through a data adapter (an OleDbDataAdapter, SqlDataAdapter, OdbcDataAdapter, or OracleDataAdapter object), which makes calls to an OLE DB provider or the APIs provided by the underlying data source. In ADO you cant update the database from the recordset. ADO.NET the data adapter allows you to control how the changes to the dataset are transmitted to the
I cannot find the control on the ui of the aspx page. case "NOC Ticket Email": / / Display everything in readonly { string state = GetVisiblePanelName ASP.secure_company_tickets_editticket_aspx 125577 0 0 ctl00 ASP.app_masterpages_sidwebclientmasterpage_master 125577 0 0 ctl00$ctl05 System.Web.UI.LiteralControl 172 0 0 ctl00$Head1 System.Web.UI.HtmlControls.HtmlHead 755 0 0 ctl00$ctl00 System.Web.UI.HtmlControls.HtmlTitle 34 0 0 ctl00$ctl01 System.Web.UI.HtmlControls.HtmlLink 84 0 0 ctl00$ctl02 System.Web UI.HtmlControls.HtmlLink 89 0 0 ctl00$ctl03 System.Web.UI.HtmlControls.HtmlLink 91 0 0 ctl00$ctl04 System.Web.UI.HtmlControls.HtmlMeta 70 0 0 ctl00$ctl06 System.Web.UI.ResourceBasedLiteralControl 263 0 0 ctl00