尽管使用 jna.debug_load=true jna 库似乎没有打印其 dll 搜索的步骤。有什么问题吗?

Despite using jna.debug_load=true jna library doesn't seem to print the steps of its dll search. What could be wrong?

我们正在使用一个依赖于 jna 的第 3 方库。我们设置了 jna.debug_load=true 但我们在任何地方都看不到相关日志。即使在通过 cmd 提示符启动我们的程序并将控制台日志定向到文件后,也看不到日志。关于这方面的文档不多,所以请帮忙。

有没有办法让它们显示在我们的应用程序日志中(我们使用 log4j 1.2.x)。

具体来说,我们想知道它在哪里找到 jnidispatch.dll

jna.debug_load=true 设置用于 JNA 加载的外部 libraries/DLLs,而不是它自己的本机 jnidispatch.dll。每 the JNA FAQ 你需要 jna.debug_load.jna 为此:

Set the system property jna.debug_load=true, and JNA will print its library search steps to the console. jna.debug_load.jna will trace the search for JNA's own native support.

至于日志记录本身,JNA 记录到 java.util.logging。您需要使用答案 to this question

中概述的解决方案之一将其重定向到 log4j