问题
I was using WAS as my application server for deploying ear project.Presently changed to Glassfish. I am using log4j.xml file for logging. Logging is not working in Glassfish.
Is there any dependency in using log4j.xml with glassfish.
Any suggestions/pointers is appreciated
回答1:
If your log4j library is included within your EAR file, then check your app server's JVM properties to ensure the log4j.configuration property is set:
- Login to the Glassfish Admin Console (http://[hostname]:4848/)
- For your server, navigate to Configuration > JVM Settings > JVM Options
- If an entry for -Dlog4j.configuration exists, verify that it contains the location of your log4j.xml file
- If an entry do not exist for -Dlog4j.configuration, create one. It must follow the following template: -Dlog4j.configuration=file:///path/to/your/log4j.xml
来源:https://stackoverflow.com/questions/17673670/logging-using-log4j-xml-in-glassfish