Log4net Open Internal Commissioning

Source: Internet
Author: User
Tags log4net

Everyone is using log4net, but this is packaged well, sometimes we can not find the reason to think of whether it happened in the inside, for example, the configuration of logging to the database (Mysql, Oracle, SQL Server), etc., but is not recorded, and cannot find the reason, Just want to be log4net can follow up, here we may use log4net source code, but also to the source code in the more troublesome, in fact, do not, open log4net internal debugging good, can also record to a file convenient for us to find the reason:

Add the name "Log4net" to the appsettings node. Internal.debug ", and ensure that the value is" true "

<configuration>          <appSettings>              <add key="log4net. Internal.debug" value="true"/>          </appSettings>      </configuration>  

confirm permission to read and write files

 <system.diagnostics> <trace autoflush= true   > <listeners> <add name  = textwritertrace Listener    type  =
       
         "
        system.diagnostics.textwritertracelistener    initializedata  ="  Span style= "color: #800000;" >c:\tmp\log4net.txt  /> </listeners> </trace > </system.diagnostics> 

You can then view the system log in "C:\tmp\log4net.txt" to find the cause of the problem.

Note: initializedata= "C:\tmp\log4net.txt" should not be placed on the C-drive, may not have permission

Log4net Open Internal Commissioning

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.