I\'m experimenting writing a java SE swing application using JBoss weld. Weld configures logging with log4j using the following log4j.xml file in the jar:
&l
If a log4j xml-format configuration file is present, it takes precedence over property files. That is log4j defined behavior. So you can put your configuration in log4j.xml and it should take effect.
I think the default log configuration for third part jars won`t print any message into STDOUT or FILE.
But if you want override the default log configuration without document, the best solution is de-compile the jar files and find out how it load the configuration.
Shortly after posting this question I discovered the answer. Create a log4j.xml file to override the defaults in the 3rd party JAR.
Here is an example specific to this thread:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd" >
<log4j:configuration>
<appender name="CA" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%m%n"/>
</layout>
</appender>
<!--
If you want to enable logging for the application
but wish to disable logging for a specific package
then use this, where org.jboss is the package
for which you wish to disable logging.
-->
<category name="org.jboss">
<priority value="off"/>
</category>
<root>
<priority value="off"/> <!--Notice this disables all logging-->
<appender-ref ref="CA"/>
</root>
</log4j:configuration>