Log4cxx 多重输出
我在 utility.dll 中有 log4cxx 实现。该dll由application1.dll和application2.dll使用
Application1将日志文件名定义为“c:\application1\applog.log”; Application2 定义日志文件名为“c:\application2\applog.log”。
如果我单独运行这两个应用程序,则会在相应的文件中正确创建日志。如果我尝试同时运行这两个应用程序,则会在最新打开的应用程序的日志文件中创建日志。
我打开了 application1,第一个日志是在“application1\applog.log”文件中创建的。同时我打开了Application2。现在,两个应用程序的日志都附加在“application2\applog.log”中
注意:我的两个应用程序都是充当驱动程序的 dll)两者都充当单独的应用程序,我需要将日志放在不同的输出文件中。两个 dll 将在同一个 exe 下运行。
如何使用相同的 log4cxx 实现来记录每个应用程序的不同日志文件?
I have log4cxx implementation in utility.dll. This dll is used by application1.dll and application2.dll
Application1 defines log file name as "c:\application1\applog.log"; Application2 defines log file name as "c:\application2\applog.log".
If I run both the applications seperately, logs are created in the corresponding files properly. If I try to run both the applications simultaneously the logs are created in latest opened application's log file.
I have opened application1 first logs are created in "application1\applog.log" file. At same time I opened Application2. Now both application's logs are appended in "application2\applog.log"
Note: Both of my applications are dlls acting like a drivers) Both are acting as a seperate application I need logs to be in different output files. Both dlls will run under same exe.
How to make the the same log4cxx implementation to log in different log files per application?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我遇到过类似的情况,我的应用程序和 dll 记录到同一个文件。这只是一个有根据的猜测,但请尝试更改 dll 和应用程序中记录器的名称。
假设您使用的是固定配置。 applicagtion1.config 和 application2.config 可以相同,但
application1.config
和 application2.config 中的
log4j.appender.File.File=
行除外I had a similar situation where my app and dll were logging to the same file. This is just an educated guess, but try changing the name of the logger in the dlls and app.
Assuming you are using a canned configuration. applicagtion1.config and application2.config could be identical except for the
log4j.appender.File.File=
linein application1.config
and in application2.config