JBoss & Log4J
tomsimmons Feb 10, 2011 11:57 AMI'm afraid I'm having a bit of trouble understanding Log4J in JBoss and how to achieve what I want.
Previously with GlassFish and Tomcat in my project I had a prperties file that defines appenders and loggers, I had one appender and then lots of loggers so I could have a logger for each area of the system and control their logging level independently. That was as things matured I could reduce the logging, then when a new feature was added, or a problem was reported, I could turn the logging up for that area rather than drowning in output from the whole system.
Now as I understand in the jboss-log4j.xml file has a file and console appender, various JBoss sub systems have their logging level set in the here, and the last section in the file the 'root' bit catches all the logging from all the apps and sends it to both the appenders. I can change the root logging level, but this affects the level for all apps hosted on the instance.
First question...is the logging level assigned to root hot changeable? ie Can it be sat at WARN, then if a problem occurs change it to DEBUG and see more out put without having to restart JBoss?
The application I'm working on I inheritted. At the top of a class there is a line
static final Logger logger = Logger.getLogger(<class name>.class);
This I'm assuming is basically setting up a logger for this class, rather than having the logger defined in a properties file?
Did you see question sneakily hidden there?!
The final question. I would like (unless there is a better way) to set up logging similar to how I used to work it under Tomcat as described above. How would I go about doing this?
Sorry if these are daft questions, I'm afraid I'm not very proficient with JBoss - hence the next discussion I'm about to create...
Thanks for any help...
Tom
PS I should probably have said, I'm using JBOss 5.1.0 GA