简体   繁体   中英

log4net disable question

I am currently coding a very large project, I am near the end of the development stage and have sent out an evaluation version to the consumer so he can check for bugs and what not. He told me that there was a large log file being created every time the application starts up. After some investigation I found out that the log file was created using log4net via an external DLL which I use in my application. I have searched a bit and found you can disable log4net logs through an app.config file and adding several values there, I tried this but with no success, the logs are being created no matter which value I use in the xml config file.

I have no access to the external DLL source code and I have searched for an xml configuration file that the DLL uses - but have not found anything.

I would like to disable log4net completely, the Logs are pretty useless for me since I use my own log engine, which i can configure any way I want it.

Thanks for any help

When you call for log4net you can specify the config file. check the log4net initialization in your app to see where it gets the instructions.

another way is to configure log4net to use windows event log rather than a file and configure a limit on the log size.

You can specify the config file that log4Net uses; by default it is named log4net.config

If that's not the case, I would suggest firing up Process Monitor to check which file it is using.

[BTW, I would be slightly curious about using a third-party DLL that I didn't have control over.]

Log4net can also be configured programmatically. I wonder if the dll is doing that? If the dll is configuring log4net programmatically maybe you could use the log4net api to turn it off. I don't have a good example of how to do that now because I am on my phone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM