Reputation: 1
I have tried the followings but none works - My SAR deploys fine but I do not see any log4j message, as if log4j initialization never happens.
A) Put exclusion of org.apache.log4j
in my jboss-deployment-descriptor.xml
B) Included a copy of log4j.xml
in my $JBOSS_HOME/standalone/configuration
sub-directory
C) Set the -Dlog4j.configuration
option in my standalone.sh
.
I also tried to include the log4j.xml directly under the META-INF of my 'SAR', along with the log4j-1.2.15.jar
that I use with my apps. In addition, I also tried to zip up my log4j.xml
into a jar file and place it in my SAR along with other jars. (I have added the name of these jars in my deployment descriptor) All efforts failed.
Thanks in advance for your help!
Matthew
Update: I have added the follow flag to standalone.sh
-Dorg.jboss.as.logging.per-deployment=false
and now I see the following error:
18:44:31,989 ERROR [stderr] (MSC service thread 1-6) log4j:WARN No appenders could be found for logger (com.abc.mbean.listenerImpl). 18:44:31,990 ERROR [stderr] (MSC service thread 1-6) log4j:WARN Please initialize the log4j system properly.
Since I have placed the log4j.xml
under my standalone/configuration + pack the log4j.xml with my log4j.jar in my SAR already, now can I let JBoss know my log4j configuration?
Many Thanks!
Matthew
Upvotes: 0
Views: 1595
Reputation: 103
Tried both the ways mentioned in the thread below. Worked fine for me.
https://community.jboss.org/thread/219871
Upvotes: 0
Reputation: 17780
The $JBOSS_HOME/standalone/configuration
directory is not on your class path so log4j will not see a configuration file there. You'll need to package your log4j.xml in the SAR. Probably in the META-INF
directory of the SAR.
Upvotes: 0