NLog 不会通过混淆发出消息

发布于 2024-10-10 15:19:27 字数 622 浏览 7 评论 0原文

我有一个试图混淆的应用程序。未混淆时,程序会发出 NLog 日志消息,但混淆后,即使应用程序的其余部分按预期运行,它也根本不会生成任何消息。我已经尝试了几种混淆器,它们都有相同的症状。有没有人有什么可以看的地方的建议。我生成了 NLog 内部日志记录工具,它们看起来相同。我的配置非常简单:

        // enable internal logging to the console
        InternalLogger.LogToConsole = true;

        // enable internal logging to a file
        InternalLogger.LogFile = "log.txt";

        // set internal log level
        InternalLogger.LogLevel = LogLevel.Trace;

        LogTarget = new MemoryTarget();
        LogTarget.Layout = "${message}";
        NLog.Config.SimpleConfigurator.ConfigureForTargetLogging(LogTarget, LogLevel.Trace);

I have an application that I'm trying to obfuscate. When unobfuscated, the program emits NLog logging messages, but after obfuscation, it doesn't generate any messages at all even though the rest of the application operates as expected. I've tried several obfuscators and they have the same symptoms. Does anyone have any suggestions of places to look. I generated the NLog internal logging facilities and they appear identical. My configuration is quite simple:

        // enable internal logging to the console
        InternalLogger.LogToConsole = true;

        // enable internal logging to a file
        InternalLogger.LogFile = "log.txt";

        // set internal log level
        InternalLogger.LogLevel = LogLevel.Trace;

        LogTarget = new MemoryTarget();
        LogTarget.Layout = "${message}";
        NLog.Config.SimpleConfigurator.ConfigureForTargetLogging(LogTarget, LogLevel.Trace);

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

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

发布评论

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

评论(1

迎风吟唱 2024-10-17 15:19:27

最有可能的是,NLog 以某种方式使用反射,导致混淆的程序集无法记录。

您是否也混淆了 NLog 程序集,或者只是混淆了您自己的程序集?

尝试在混淆工具中打开“符号重命名”,看看是否有影响。如果它有效,那么您就知道原因,并且可以深入了解以排除重命名相关类/成员。

Most probably, NLog is using Reflection in some way which is causing the obfuscated assembly to fail to log.

Are you obfuscating the NLog assembly as well or just your own assembly?

Try turning of "Symbol Renaming" in your obfuscation tool to see if it makes a difference. If it works, then you know the cause and you can drill down to exclude from renaming the relevant classes/members.

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