Log4jConfigurer in Spring 5.0.2

前端 未结 1 1163
青春惊慌失措
青春惊慌失措 2021-01-18 03:11

I was using Spring 4.X.X and used the below setup to configure Log4j. Now am upgrading it to Spring 5.0.2 where the Log4jConfigurer class has been removed. How

相关标签:
1条回答
  • 2021-01-18 03:30

    The Log4JConfigurer was required for non default Log4j initialisation e.g. if using a custom config file name/location but your config file is located in the default location: classpath:log4j.properties so you can simply remove the Log4jConfigurer declaration and Spring will auto discover your log4j.properties.

    There is one possible caveat here; Spring 5 uses Log4j v2 (following Apache's EOL declaration for log4j 1.x) so as long as you are using Log4j v2 then Spring 5 will auto detect it and your log4j.properties file without any need to declare a Log4JConfigurer. If you are not currently using Log4j v2 then I think you'll need to upgrade since Spring 5 does not support the use of Log4j v1.x.

    0 讨论(0)
提交回复
热议问题