将 java 项目转换为 .Net 后如何访问 System.getProperties()

发布于 2024-12-29 12:41:24 字数 623 浏览 1 评论 0原文

我正在尝试在 .Net 中使用 HTMLUnit 我遵循 Steven Sanderson 博客中的示例 http://blog.stevensanderson.com/2010/03/30/using-htmlunit-on-net-for-headless-browser-automation/ 效果很好。但是我遇到了如何禁用java中的运行时警告? 我想降低 Log4J 的噪音。

如前所述,我需要执行以下操作:-

System.getProperties().put("org.apache.commons.logging.simplelog.defaultlog","fatal");

但我不知道如何在 .Net 中执行此操作。任何帮助将不胜感激。

西蒙

I am trying to use HTMLUnit in .Net I followed the example in Steven Sanderson's blog http://blog.stevensanderson.com/2010/03/30/using-htmlunit-on-net-for-headless-browser-automation/ which works well. However I have encontered the problem mentioned in How to disable runtime warnings in java? where I want to turn down the noise from Log4J.

As stated I need to do the following:-

System.getProperties().put("org.apache.commons.logging.simplelog.defaultlog","fatal");

But I have no idea how to do this in .Net. Any help would be much appreciated.

Simon

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

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

发布评论

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

评论(1

↙厌世 2025-01-05 12:41:24

.NET 的配置系统与 Java 的配置系统有很大不同(他说,他已经 10 多年没有编写任何 Java 了!)。请查看此处以开始使用:http://msdn。 microsoft.com/en-us/library/system.configuration.configurationsettings.aspx

您还可以为更复杂的定制配置方案编写自定义配置部分/处理程序。 http://msdn.microsoft.com/en-us/library/ie /2tw134k3.aspx

The config system is .NET considerably different to that in Java (he said, not having written any Java for over 10 years!). Take a look here to get you started : http://msdn.microsoft.com/en-us/library/system.configuration.configurationsettings.aspx

You can also write custom config sections/handler for more complex bespoke config scenarios. http://msdn.microsoft.com/en-us/library/ie/2tw134k3.aspx

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