Double logging output in JBoss 7
haukegulich Dec 8, 2011 1:18 AMHello everyone,
I have, hopefully, a tiny problem with my application deployed on JBoss 7.0.2 (and older versions as well).
I have a class snippet like this
{code}
package de.hauke.server.jms;
import org.apache.log4j.Logger;
public class JMSWatcher implements MessageListener {
private static final Logger LOG = Logger.getLogger(JMSWatcher.class);
public void onMessage(){
LOG.debug("Der Server hat eine JMS Nachricht empfangen auf (toServer)");
....
}
{code}
If I look at the log output when I start the jboss (standalone.bat) I will see this
07:00:10,192 INFO (stdout) (T h r e a d - 1 (group:HornetQ-client-global-threads-823604252)) 07:00:10,192 INFO (JMSWatcher | ) | Der Server hat eine JMS Nachricht empfangen auf (toServer) |
The right side of the log output
07:00:10,192 INFO [JMSWatcher ] | ....
is like I defined the output in my log4j.xml inside the resource folder from my application. Here is my log4j.xml (just the important part)
{code:xml}
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="Threshold" value="DEBUG" />
<param name="Target" value="System.out" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%-30.30c{1}] | %m%n"/>
</layout>
</appender>{code}
Then I looked in the standalone.xml configuration and found this line:
{code:xml}
<console-handler name="CONSOLE" autoflush="true"> | |
<level name="INFO"/> | |
<formatter> | |
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/> | |
</formatter> | |
</console-handler> |
{code}
------------------------------------------------------------------------------------
Now I modified the log4j.xml to the pattern
%m%n
and inside the standalone.xml the pattern to
pattern="%d{HH:mm:ss,SSS} %-5p [%-30.30c{1}] | %s%E%n
with the result of
07:14:50,229 INFO [stdout | ] | Der Server hat eine JMS Nachricht empfangen auf (toServer) |
This looks better, but I always get the log level as INFO and the class name as stdout.
What do I have to do to get that working?
Thanks and greetings,
Hauke