log4net禁用问题

发布于 2024-09-30 05:33:47 字数 375 浏览 1 评论 0 原文

我目前正在编写一个非常大的项目,我已接近开发阶段的末尾,并已向消费者发送了评估版本,以便他可以检查错误等。 他告诉我,每次应用程序启动时都会创建一个很大的日志文件。 经过一番调查后,我发现日志文件是通过我在应用程序中使用的外部 DLL 使用 log4net 创建的。 我搜索了一下,发现您可以通过 app.config 文件禁用 log4net 日志并在其中添加几个值,我尝试了此操作,但没有成功,无论我在 xml 配置文件中使用哪个值,都会创建日志。

我无法访问外部 DLL 源代码,并且我已经搜索了 DLL 使用的 xml 配置文件 - 但没有找到任何内容。

我想完全禁用 log4net,日志对我来说毫无用处,因为我使用自己的日志引擎,我可以按照我想要的方式配置它。

感谢您的帮助

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

墨离汐 2024-10-07 05:33:47

当您调用 log4net 时,您可以指定配置文件。
检查应用程序中的 log4net 初始化,看看它从哪里获取指令。

另一种方法是将 log4net 配置为使用 Windows 事件日志而不是文件,并配置日志大小的限制。

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.

野却迷人 2024-10-07 05:33:47

您可以指定 log4Net 使用的配置文件;默认情况下,它名为 log4net.config

如果不是这种情况,我建议启动 进程监视器来检查它正在使用哪个文件。

[顺便说一句,我对使用我无法控制的第三方 DLL 有点好奇。]

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.]

好久不见√ 2024-10-07 05:33:47

Log4net 也可以通过编程方式进行配置。我想知道dll是否是这样做的?如果 dll 以编程方式配置 log4net,也许您可​​以使用 log4net api 将其关闭。我现在没有一个很好的例子来说明如何做到这一点,因为我正在使用手机。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文