Using Log4net in class libraries

Source: Internet
Author: User
Tags log4net

Recently in a class library, written in C #, in order to debug the need for convenient log output, and then found log4net this tool for log output;

Because call this class library is C + +, and I am not very familiar with C + +, so can not be configured in the App. config or Web. config log4net parameters, in addition to Google or Baidu, also did not find a good solution;

Finally found a Baidu library of a detailed log4net document to see, their own reference to other information toss good.

1, create a new XML document Log4net.xml, the configuration of log4net parameters inside;

2, the project AssemblyInfo.cs inside add [assembly:log4net. Config. domconfigurator (configfile= "Log4net.xml", watch=true)], so project Engineering and Log4net have established the association;

This allows you to write your own class library when you need the log output, directly to the Log4net.dll and Log4net.xml, and your library copy to other people can be. Without the need for the caller to go to the additional configuration;

Using Log4net in class libraries

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.