I have a great application running on JBoss 5.1 and using log4j via slf4j. When I test in the local docker container, I see the usual .class package name in the log:
03 Dec 15 09:45:39, DEBUG my.fancy.app.filters.TicketValidationFilter:doFilter:30 Ticket was verified with data: uniqueID=gfd, idnumber=sdf, mid=11246986.
03 Dec 15 09:45:39, DEBUG my.fancy.app.MyServlet:doGet:30 Request for secret data with uniqueId=gfd
03 Dec 15 09:45:39, WARN my.fancy.app.MyServlet:doGet:36 Could not retrieve SecretData with uniqueId=gfd
However, when I deploy the same code in a dev environment (which may not be so clean ...), I get:
03 dec 15 10:45:22, DEBUG org.jboss.logging.Logger:debug:228 Ticket was verified with data: uniqueID=sdg, idnumber=sdf, mid=11738149.
03 dec 15 10:45:22, DEBUG org.jboss.logging.Logger:debug:228 Request for secret data with uniqueId=sdg
03 dec 15 10:45:22, WARN org.jboss.logging.Logger:warn:352 Could not retrieve SecretData with uniqueId=sdg
I compared jboss-log4j.xml in both environments and they are identical. I also checked the launch flags to see if the log provider is installed, but it is in none of these environments.
Where should I look next?
Update
, log4j , log4j, . , , log4j, , , slf4j . , slf4j . , ?
2
appender:
<appender name="MYAPP_FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
<param name="File" value="${jboss.server.log.dir}/myapp.log" />
<param name="Append" value="true" />
<param name="DatePattern" value="'.'yyyy-MM-dd"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{dd MMM yyy HH:mm:ss}, %-6p %C:%M:%L %m %n" />
</layout>
</appender>
:
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
...
public class MyServlet extends HttpServlet {
private Logger log = LoggerFactory.getLogger(MyServlet.class.getName());
...
log.debug("Request for secret data with uniqueId={}", secretDataVO.getUniqueId());
...
}
pom.xml :
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.5.10</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.10</version>
<scope>provided</scope>
</dependency>
log4j , log4j. slf4j-log4j12 , jboss.
3
jboss :
2015-12-07 16:16:50,127 ERROR [STDERR] log4j:ERROR A "org.jboss.logging.appender.FileAppender" object is not assignable to a "org.apache.log4j.Appender" variable.
2015-12-07 16:16:50,127 ERROR [STDERR] log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
2015-12-07 16:16:50,127 ERROR [STDERR] log4j:ERROR [BaseClassLoader@14a33aa{vfszip:/my-jboss-root/jboss/server/default/deploy/fancyApp.ear/fancyApp-web.war/}] whereas object of type
2015-12-07 16:16:50,127 ERROR [STDERR] log4j:ERROR "org.jboss.logging.appender.FileAppender" was loaded by [org.jboss.bootstrap.NoAnnotationURLClassLoader@15b0afd].
2015-12-07 16:16:50,127 ERROR [STDERR] log4j:ERROR Could not instantiate appender named "FILE".
fancyApp-web.war - slf4j-log4j12. , , (), dev ( prod, ...)