JBoss EAP 6.2 - setting up proper application logging (issues)
masterm1nd Jun 11, 2014 7:29 AMHello all,
currently i'm trying to properly setup "per application" logging using slf4j with log4j as underlying implementation. As stated application server in use is EAP 6.2 - we're using war projects with
frameworks like JSF 1.2 or 2.1, JPA/Hibernate (server dependencies .. so in maven these are configured as provided)
i tried the following but unfortunately nothing worked as expected:
1st approach)
custom log4j.properties located under /some/dir
jboss deployment structure with following exclusions:
<exclusions>
<module name="org.apache.log4j" />
<module name="org.apache.commons.logging" />
<module name="org.jboss.logging" />
<module name="org.jboss.logging.jul-to-slf4j-stub" />
<module name="org.jboss.logmanager" />
<module name="org.jboss.logmanager.log4j" />
<module name="org.slf4j" />
</exclusions>
following dependencies referenced via maven:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.7</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.7</version>
</dependency>
<dependency>
<groupId>com.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.7.7</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
(jul-to-slf4j dependency did nothing, tried with and without)
calling log4j property configurator in the application like this:
PropertyConfigurator.configure("/path/to/log4j.properties");
Result: logging does work for the application itself. but jsf / el / hibernate output is not written to my log file, neither am i able to receive errors of those frameworks via our log4j mailappender
(also tried setting according log4j properties like: log4j.logger.javax.faces=INFO ... ) ..
2nd approach)
set -Dorg.jboss.as.logging.per-deployment=true
put log4j.properties to the classpath (src/main/java)
following dependencies referenced via maven:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.7</version>
</dependency>
nothing excluded via jboss-deployment-structure
Result: does not work ... log4j.properties doesn't seem to be picked up
3rd approach)
set -Dorg.jboss.as.logging.per-deployment=true
put logging.properties to the classpath (src/main/java)
following dependencies referenced via maven:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.7</version>
</dependency>
Result: WORKING ... everything is picked up as expected and logged to the according file...nevertheless this approach is not feasible for us because we use log4j in all of our projects and logging.properties does not allow to specify a mail appender
What am i doing wrong? Maybe someone could point out things i missed or configured the wrong way.
Thanks!