未找到 Log4J NTEventLogAppender DLL
大家好,
我在尝试使用 Log4J 的 NTEventLogAppender 时遇到问题。
我已将 Log4J 属性设置为如下:
log4j.rootLogger=DEBUG, CA, NTEventLog
#Console Appender
log4j.appender.CA=org.apache.log4j.ConsoleAppender
log4j.appender.CA.layout=org.apache.log4j.PatternLayout
log4j.appender.CA.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
#File Appender
log4j.appender.FA=org.apache.log4j.FileAppender
log4j.appender.FA.File=sample.log
log4j.appender.FA.layout=org.apache.log4j.PatternLayout
log4j.appender.FA.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
#Event Log Appender
log4j.appender.NTEventLog=org.apache.log4j.nt.NTEventLogAppender
log4j.appender.NTEventLog.source=ESB Web Services
# Set the logger level of File Appender to WARN
log4j.appender.FA.Threshold = WARN
遵循建议 这里,我已将 NTEventLogAppender.amd64.dll 文件放在 System32 文件夹中,但是当我尝试实例化使用 Logger 的类时,出现此异常:
线程中的异常“main”java.lang.UnsatisfiedLinkError:NTEventLogAppender(在java.library.path中找不到)
这里出了什么问题?
Hy ppl,
I'm having a problem trying to use Log4J's NTEventLogAppender.
I've set my Log4J properties like this:
log4j.rootLogger=DEBUG, CA, NTEventLog
#Console Appender
log4j.appender.CA=org.apache.log4j.ConsoleAppender
log4j.appender.CA.layout=org.apache.log4j.PatternLayout
log4j.appender.CA.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
#File Appender
log4j.appender.FA=org.apache.log4j.FileAppender
log4j.appender.FA.File=sample.log
log4j.appender.FA.layout=org.apache.log4j.PatternLayout
log4j.appender.FA.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
#Event Log Appender
log4j.appender.NTEventLog=org.apache.log4j.nt.NTEventLogAppender
log4j.appender.NTEventLog.source=ESB Web Services
# Set the logger level of File Appender to WARN
log4j.appender.FA.Threshold = WARN
Following the advice here, I've placed NTEventLogAppender.amd64.dll file on my System32 Folder, but when I try to instance a class that uses a Logger I get this exception:
Exception in thread "main" java.lang.UnsatisfiedLinkError: NTEventLogAppender (Not found in java.library.path)
What's wrong here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是为了让您轻松调试:
如果您确实在 System32 文件夹中添加了 dll,请确保该目录也包含在 Java 的库路径
java.library.path
:测试(通过代码):
输出(部分):
This is to allow you to debug easily:
If you did add the dll in the System32 folder, make sure that the directory is also included in Java's library path
java.library.path
:To test (via code):
Output (partial):
尽管我的 java 构建路径上有 System32,但我将其放置在:
C:\Program Files (x86)\IBM\WID7_WTE\runtimes\bi_v7\java\jre\bin
这也在我的构建路径上并最终得到了它工作
谢谢!
Despite having the System32 on my java build path, I've placed it on:
C:\Program Files (x86)\IBM\WID7_WTE\runtimes\bi_v7\java\jre\bin
That also was on my build path and finally got it working
Thanks!