Initializing Log4J with Spring?

前端 未结 5 1981
说谎
说谎 2020-11-28 06:30

I have a web app that uses Spring\'s Log4jConfigurer class to initialize my Log4J log factory. Basically it initializes Log4J with a config file that is off th

5条回答
  •  余生分开走
    2020-11-28 07:09

    Rather than configuring log4j yourself in code, why not just point log4j at your (custom) configuration file's location by adding

    -Dlog4j.configuration=.../conf/log4j.xml
    

    to your server's startup properties?

    Even better, just move log4j.xml to the default location - on the classpath - and let log4j configure itself automatically.

提交回复
热议问题