如何在 Eclipse 中使用 DataNucleus 2.x 进行日志记录

发布于 2024-09-23 23:56:20 字数 287 浏览 2 评论 0原文

我在 Eclipse RCP(当前是 Helios)上有 DN 2.x。

我在打开 DN LOG 时遇到问题。

我使用 log4j.properties,在其中定义所有 DataNucleus 类别日志级别。

它与“外部”增强器的日志记录良好(我只是在运行配置的“VM 参数”上传递参数 -Dlog4j.configuration=file:"...\log4j.properties"),但无法获取日志开发主应用程序...尝试了相同的方法但没有成功。

有人在 eclipse 中使用 DN 吗?

I have DN 2.x on Eclipse RCP (currently Helios).

I'm having trouble Turning the DN LOG on.

I use log4j.properties, where i define all the DataNucleus Categories LOG levels.

It LOGS fine with the "external" enhancer (i just pass the argument on the "VM Arguments" of the RUN configurations -Dlog4j.configuration=file:"...\log4j.properties"), but can't get the log to work on the main app... tried the same approach with no success.

Anyone using DN with eclipse?

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

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

发布评论

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

评论(1

再浓的妆也掩不了殇 2024-09-30 23:56:20

我不使用DN。所以我无法直接解决你的问题。我可以说,一般来说,如果您有一个使用 Log4j 的应用程序,它将在类路径中搜索名为 log4j.properties 和 log4j.xml 的文件。对于您的情况,请尝试将 log4j.properties 文件移动到您 100% 确定位于类路径中的位置(例如所有包的根文件夹)。

从那里开始,如果您的日志记录打开,那么您就知道您的属性文件不在类路径中。但是,如果您的文件肯定在类路径中,那么罪魁祸首很可能是在应用程序范围内关闭日志记录的其他东西。您看到日志记录了吗?如果不是,那么这可能就是问题所在。此时您需要弄清楚您正在使用哪种 Facade:apache commons 还是 SLF4J。两者都可以用 NOOP 记录器替换记录器实现,NOOP 记录器会忽略所有日志请求。

使用 Commons,您必须检查 commons-logging.properties 文件。使用 SLF4J,您必须检查项目依赖项(通常在某个 lib 目录中),确保列表中没有 NO-OP jar。

I don't use DN. So I can't address your problem, directly. I can say, in general, if you have an application using Log4j, it will search the classpath for files named log4j.properties and log4j.xml. In your case, try moving your log4j.properties file to a place you are 100% certain is in the classpath (like the root folder of all your packages).

From there, if your logging turns on, then you know your properties file isn't in the classpath. However, if your file is definitely in the classpath, then the culprit is likely something else turning off logging application-wide. Do you see logging at all? If not, then this is likely the problem. At that point you need to figure out which Facade you're using: apache commons or SLF4J. Both have the power to replace the logger implementation with NOOP loggers, which ignore all log requests.

With Commons, you have to check the commons-logging.properties file. With SLF4J, you have to check the project dependencies (usually in a lib directory somewhere), insuring that there isn't a NO-OP jar in the list.

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