简体   繁体   English

perl:将自定义追加程序与log4perl结合使用

[英]perl:using custom appender with log4perl

I have a custom log4j appender that writes log messages into a JMS queue. 我有一个自定义的log4j附加程序,可将日志消息写入JMS队列。 How can I use that appender in my log4perl config file. 如何在我的log4perl配置文件中使用该附加程序。 Can anyone send me the sample code please. 任何人都可以将示例代码发送给我。

Thanks for your help. 谢谢你的帮助。

While Log4perl is based on log4j, and can use log4j syntax in its config files, it's a separate implementation written in Perl. 虽然Log4perl基于log4j,并且可以在其配置文件中使用log4j语法,但它是用Perl编写的独立实现。 It can't use log4j appenders. 它不能使用log4j附加程序。 You'd have to write a Perl class with the same behavior. 您必须编写具有相同行为的Perl类。 Once you've done that, you can use Log::Log4perl::JavaMap to tell Log4perl's config reader to map the Java name of your appender to the corresponding Perl class. 完成此操作后,可以使用Log :: Log4perl :: JavaMap告诉Log4perl的配置读取器将您的附加程序的Java名称映射到相应的Perl类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM