Is there a easy/lazy way (e.g a shell script etc) to convert a big log4j.xml file to log4j2.xml equivalent?
是否有一种简单/懒惰的方式(例如shell脚本等)将大型log4j.xml文件转换为log4j2.xml等效文件?
Or does everyone do this manually ?
或者每个人都手动完成此操作?
3 个解决方案
#1
2
There is currently no tool to automatically convert log4j-1.x configurations to log4j2 configurations.
目前没有工具可以自动将log4j-1.x配置转换为log4j2配置。
The log4j2 configuration is simpler however, and much, much better documented. The log4j2 manual provides lots of examples for the available lookups, appenders, layouts and filters.
然而,log4j2配置更简单,并且记录得更好。 log4j2手册提供了许多可用查找,追加器,布局和过滤器的示例。
#2
3
I started writing a script to migrate simple use cases from log4j.properties to log4j2.xml
. It is currently in a very early stage but can convert some simple configurations. It could be extended for similar log4j.xml
configurations.
我开始编写一个脚本,将简单的用例从log4j.properties迁移到log4j2.xml。它目前处于非常早期阶段,但可以转换一些简单的配置。它可以扩展为类似的log4j.xml配置。
#3
2
I've written a utility for converting XML to XML (log4j.xml to concise log4j2.xml). Using JAXB and FreeMarker, it makes a few assumptions about the input and doesn't support all features, but also saves comments assuming that the input file is reasonably formatted. It can hopefully be easily modified for your own requirements:
我编写了一个实用程序,用于将XML转换为XML(log4j.xml简化为log4j2.xml)。使用JAXB和FreeMarker,它对输入做了一些假设并且不支持所有功能,但是假设输入文件格式合理,也会保存注释。希望可以根据您自己的要求轻松修改它:
#1
2
There is currently no tool to automatically convert log4j-1.x configurations to log4j2 configurations.
目前没有工具可以自动将log4j-1.x配置转换为log4j2配置。
The log4j2 configuration is simpler however, and much, much better documented. The log4j2 manual provides lots of examples for the available lookups, appenders, layouts and filters.
然而,log4j2配置更简单,并且记录得更好。 log4j2手册提供了许多可用查找,追加器,布局和过滤器的示例。
#2
3
I started writing a script to migrate simple use cases from log4j.properties to log4j2.xml
. It is currently in a very early stage but can convert some simple configurations. It could be extended for similar log4j.xml
configurations.
我开始编写一个脚本,将简单的用例从log4j.properties迁移到log4j2.xml。它目前处于非常早期阶段,但可以转换一些简单的配置。它可以扩展为类似的log4j.xml配置。
#3
2
I've written a utility for converting XML to XML (log4j.xml to concise log4j2.xml). Using JAXB and FreeMarker, it makes a few assumptions about the input and doesn't support all features, but also saves comments assuming that the input file is reasonably formatted. It can hopefully be easily modified for your own requirements:
我编写了一个实用程序,用于将XML转换为XML(log4j.xml简化为log4j2.xml)。使用JAXB和FreeMarker,它对输入做了一些假设并且不支持所有功能,但是假设输入文件格式合理,也会保存注释。希望可以根据您自己的要求轻松修改它: