【发布时间】:2013-07-23 15:05:03
【问题描述】:
是否可以使用 Log4Perl 将所有消息/级别直接记录到 OutputDebugString(Windows 系统)中?
我有一些已经使用 log4perl 的模块,但现在我想在所有日志消息都是 OutputDebugStrings 的环境中使用这些模块 - 在这种环境中,消息是用 DbgView 读取的,我也想读取我的模块的输出使用 DbgView。我不想将 Log4Perl 日志文件与 DbgView 输出合并。
我使用以下 perl 代码直接从 Perl 编写 OutputDebugStrings:
use Win32::API::OutputDebugString qw(OutputDebugString DStr);
OutputDebugString("Foo bar", "baz\n"); # sends Foo barbaz\n to the debugger
我找到了 log4net.Appender.OutputDebugStringAppender - 我怎样才能为 Perl 实现同样的功能
提前致谢。
【问题讨论】:
-
您好,我知道如何编写OutputDebugStrings,但我希望所有log4perl 日志消息都通过OutputDebugStrings,Win32::API 如何帮助我?
-
嗨,我更新了我的问题。使用 Win32::API::OutputDebugString qw(OutputDebugString DStr); OutputDebugString("Foo bar", "baz\n"); # 发送 Foo barbaz\n 到调试器
标签: perl log4perl outputdebugstring