Thursday, June 4, 2009

Configuring log4j in Glassfish

I've found several links on how to configure log4j in Glassfish but it didn't work for me.

Here's what worked:

1. Copy the following jars to glassfish\lib:
log4j-1.2.15.jar
commons-logging-1.1.1.jar

2. Create a directory called logging under \glassfish\domains\domain1\lib

3. Copy log4j.properties to the logging directory created in Step 2

4. Login to admin console of Glassfish and navigate to:
Application Server > JVM Settings > Path Settings

5. Add the logging subdirectory created in Step 2 to System Classpath

6. Click Save and Restart Glassfish

7. Check that the logs are created

8. If the logs are not created:
- check your log4j.properties (class names must match)
- exit from asadmin after you stop domain (if you are in asadmin)

No comments:

Post a Comment