I'll preface the following by saying I've read all the logging configuration type links from the JBoss as7 documentation, but still don't fully understand how logging is configured for my application. Suffice to say we had log4j working happily on JBoss 4.2.3.GA, and with one or two changes to the way log4j is initialised / configured (we removed all log4j.properties and log4j.xml files) it's been working reasonably with JBoss-as-7.0.2.Final with the following exception:
1) I don't seem to be able to prevent a more specialised logger from (also) logging to the parent logger - despite setting: use-parent-handlers="false" in standalone-preview.xml.
<logger category="com.myapp.wal" use-parent-handlers="false">
In order to prevent DEBUG logs from ALSO going to the main CONSOLE/FILE logs I have to set the appender level to INFO.
Has anyone else had success with the "use-parent-handlers" attribute?
2) Querrying the log level specifially doesn't seem to work on a specific logger (whose level has been specifically set in standlone-preview.xml).
a) org.apache.log4j.Logger.getLogger("myapp.MyClass-mylabel").getLevel() --> returns null
b) org.apache.log4j.Logger.getLogger("myapp.MyClass-mylabel").getEffectiveLevelLevel() --> returns DEBUG
c) org.apache.log4j.Logger.getLogger("myapp.MyClass-mylabel").isDebugEnabled() --> returns DEBUG
d) java.util.logging.Logger.getLogger("myapp.MyClass").getLevel() --> returns DEBUG
I'd expect null in a) above if the parent logger (only) was DEBUG.
The logger and correct log level is displayed in the logging component of the web console.
We make limited use of getLevel(), however in certain cases it's useful to get the actual log level of a particular category - not the inherited level.
We have a large number of classes with references to log4j - so we're not ready to start using JDK logger just yet.
Has anyone else encountered this problem?