将 log4j.properties 转换为 log4j2.xml
我从未处理过此类问题,现在我应该将 log4j.properties 文件移植到 log4j2.xml 中,但我遇到了很多问题。
有什么工具可以用于此目的吗?或者任何指南,因为我真的被困在这里了。
我必须转移的一些 Log4j.properties 列表:
log4j.additivity.com.company.areas.audit.config.auditors.TransactionAuditor=false;
(Bunch of lines like these below, with different paths)
log4j.logger.net.sf=WARN, FILE,FILE_ERROR,CONSOLE
log4j.logger.xxxx.yyyy.zzzz = ERROR,FILE,FILE_ERROR,CONSOLE
log4j.logger.aaaa.bbbb.cccc = INFO, FILE,FILE_ERROR,CONSOLE
log4j.appender.CONSOLE.Threshold=OFF
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%t] %-5p - %m%n
log4j.appender.FILE=org.apache.log4j.RollingFileAppender
log4j.appender.FILE.File=${base.path}/logs/application.log
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%t] %-5p - %m%n
log4j.appender.FILE.MaxFileSize=100000KB
log4j.appender.FILE.MaxBackupIndex=5
log4j.appender.FILE_PERFORMANCE=org.apache.log4j.RollingFileAppender
log4j.appender.FILE_PERFORMANCE.File=${base.path}/logs/application_performance.log
log4j.appender.FILE_PERFORMANCE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE_PERFORMANCE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%t] %-5p - %m%n
log4j.appender.FILE_PERFORMANCE.MaxFileSize=10000KB
log4j.appender.FILE_PERFORMANCE.MaxBackupIndex=2
(and bunch of similar stuff but for example instead of FILE_PERFORMACE I have things like: "FILE_ERROR" -> log4j.appender.FILE_ERROR = org.apache.log4j.RollingFileAppender", "FILE_INTEGRATION" etc"
如果有人可以帮我翻译上面的这些属性,我相信我可以自己翻译其他属性,因为它们与这些属性类似。
提前致谢!
I never worked with this type of issue and now I'm supposed to port log4j.properties file into log4j2.xml and I'm having bunch of problems.
Is there any tool that I could use for this? Or any guide because I'm really stuck here.
List of some Log4j.properties that I have to transfer:
log4j.additivity.com.company.areas.audit.config.auditors.TransactionAuditor=false;
(Bunch of lines like these below, with different paths)
log4j.logger.net.sf=WARN, FILE,FILE_ERROR,CONSOLE
log4j.logger.xxxx.yyyy.zzzz = ERROR,FILE,FILE_ERROR,CONSOLE
log4j.logger.aaaa.bbbb.cccc = INFO, FILE,FILE_ERROR,CONSOLE
log4j.appender.CONSOLE.Threshold=OFF
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%t] %-5p - %m%n
log4j.appender.FILE=org.apache.log4j.RollingFileAppender
log4j.appender.FILE.File=${base.path}/logs/application.log
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%t] %-5p - %m%n
log4j.appender.FILE.MaxFileSize=100000KB
log4j.appender.FILE.MaxBackupIndex=5
log4j.appender.FILE_PERFORMANCE=org.apache.log4j.RollingFileAppender
log4j.appender.FILE_PERFORMANCE.File=${base.path}/logs/application_performance.log
log4j.appender.FILE_PERFORMANCE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE_PERFORMANCE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%t] %-5p - %m%n
log4j.appender.FILE_PERFORMANCE.MaxFileSize=10000KB
log4j.appender.FILE_PERFORMANCE.MaxBackupIndex=2
(and bunch of similar stuff but for example instead of FILE_PERFORMACE I have things like: "FILE_ERROR" -> log4j.appender.FILE_ERROR = org.apache.log4j.RollingFileAppender", "FILE_INTEGRATION" etc"
If someone could help me translate these properties from above, I believe I would be able to translate others by myself because they're similar to these.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我没有找到可以将 log4j.properties 文件翻译为 log4j2.xml 的工具,但手动翻译最终非常简单。
记录器示例:
将变为:
附加程序示例:
将变为:
因此基于此示例的整个 log4j2.xml 文件应如下所示:
I didn't find tool that would translate log4j.properties file into log4j2.xml but manual translation ended up being quite simple.
Example for loggers:
Will become:
Example for appenders:
Will become:
So entire log4j2.xml file based on this example should look like this: