Initializing Log4J with Spring?

前端 未结 5 1970
说谎
说谎 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:21

    If you are using Jetty you can add extra classpaths on a per application basis:

    http://wiki.eclipse.org/Jetty/Reference/Jetty_Classloading#Adding_Extra_Classpaths_to_Jetty

    This will allow you to load your log4 properties in a standard manner (from the classpath:)

    in web.xml:

           
               org.springframework.web.util.Log4jWebConfigurer
           
           
               log4jConfigLocation
               classpath:${project.artifactId}-log4j.properties
           
    

    in jetty-web.xml:

            
                /contexts/log4j
            
    

提交回复
热议问题