Re: How to use a second log4j.properties file for a special java program?
On Sun, 29 Aug 2010 02:40:43 -0700 (PDT) BenXS bxsto...@yahoo.co.uk wrote: Jacob Kjome wrote: 1. If you deploy your app as a WAR file, then you can utilize child-first classloading. As long as you include log4j.jar in WEB-INF/lib and log4j.properties (or log4j.xml) in WEB-INF/classes, then you will end up using your own config rather than the server's. Ok, thank you. Can I omit the own, second log4j.jar and use only the own,second log4j.properties file? Or is my own, private log4j.properties file not recognized if I do not attach my own log4j.jar ? You need to follow the instructions completely 1. Set your webapp to child-first (otherwise known as parent-last) classloading. This is the default classloading behavior in Tomcat 4/5/6/7 standalone, BTW. You'll have to set it explicitly when using other containers. Check the documentation of the container you are using for further info. 2. Add log4j.jar to WEB-INF/lib 3. Add log4j.properties to WEB-INF/classes Jake Ben -- View this message in context: http://old.nabble.com/How-to-use-a-second-log4j.properties-file-for-a-special-java-program--tp29540603p29564582.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: How to use a second log4j.properties file for a special java program?
Jacob Kjome wrote: 1. If you deploy your app as a WAR file, then you can utilize child-first classloading. As long as you include log4j.jar in WEB-INF/lib and log4j.properties (or log4j.xml) in WEB-INF/classes, then you will end up using your own config rather than the server's. Ok, thank you. Can I omit the own, second log4j.jar and use only the own,second log4j.properties file? Or is my own, private log4j.properties file not recognized if I do not attach my own log4j.jar ? Ben -- View this message in context: http://old.nabble.com/How-to-use-a-second-log4j.properties-file-for-a-special-java-program--tp29540603p29564582.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
How to use a second log4j.properties file for a special java program?
Assume a default log4j.properties file is setup for a whole application server. Now I deploy a new, own java program into the application server which contains logging statements like log.info(); as well. Currently the log output go to the default log file defined in the overall log4j.properties file. But I want to use another, different logfile. This should be defined (as far as I can see) in a second log4j.properties file. But how can I access this jog4j.properties file when creating the logger in the java program? Resp. how can I tell the environment to use another log4j.properties file ? Ben - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: How to use a second log4j.properties file for a special java program?
2 ways (both assuming you don't want to blow away the configuration for the server, but still use custom configuration for your application) 1. If you deploy your app as a WAR file, then you can utilize child-first classloading. As long as you include log4j.jar in WEB-INF/lib and log4j.properties (or log4j.xml) in WEB-INF/classes, then you will end up using your own config rather than the server's. 2. Use a Repository Selector. For more info, see http://wiki.apache.org/logging-log4j/AppContainerLogging Jake On Thu, 26 Aug 2010 11:49:08 +0200 Ben Stover bxsto...@yahoo.co.uk wrote: Assume a default log4j.properties file is setup for a whole application server. Now I deploy a new, own java program into the application server which contains logging statements like log.info(); as well. Currently the log output go to the default log file defined in the overall log4j.properties file. But I want to use another, different logfile. This should be defined (as far as I can see) in a second log4j.properties file. But how can I access this jog4j.properties file when creating the logger in the java program? Resp. how can I tell the environment to use another log4j.properties file ? Ben - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org