0
votes

Never worked with log4j before, that's why I may ask some stupid questions. I got a multi-module Maven Web Application that runs on Glassfish 3.1. Every module is more or less independent. Well, I set up the log4j configurations (log4j.properties), put it in the Dist "module" config folder. Also, every pom.xml of every module has a log4j dependency. Added the classpaths. Also, added in the domain.xml the jvm option, referencing the log4j.property:

<jvm-options>-Dlog4j.configuration=file:///${com.sun.aas.instanceRoot}/log4j.properties</jvm-options>     

In the Glassfish Admin panel, i added Configuration option referencing to the log4j.properties file (Configuration -> severf-config -> JVM General Settings -> JVM Options).

-Dlog4j.configuration=file:///${com.sun.aas.instanceRoot}/log4j.properties

I found This stuff out reading a lot on the Internet about log4j. So, now my problem is that when I start the Maven Build, the build executes the Unit Test, and the framework works just fine, ut it doesn't log any activity from the application. What could it be?

Does every module needs its own log4j.property (I guess not, because it's logging already entries from methods called from the unit test from modules that don't have the log4j.propertie).

Is it possible that the log4j has to bi initialized before/during the start of the application?

Again, it logs unit test and maven build, but not during runtime, that's what I don't get. Am I missing something?

1
Is this an EAR deployment or multiple WAR files?Steve C
It's an EAR deployment..Lazar Zoltan

1 Answers

0
votes

The solution was to put the log4j.properties file into the persist Maven module (src/main/resources). Now, it logs the activities..