dcsimg
redefining root appender shuts down logging output
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Pierce_Krouse
Posted On:   Wednesday, September 7, 2005 01:22 PM

My JBoss app logs to a database, but we need to log JBoss output from app startup, so we configure log4j at two different points. Our original log4j.xml looks like this: ... stuff deleted ... ... stuff deleted ... ... stuff deleted ... and it works great. After configuring log4j with that file, we start up a bunch of services, including our database. All the output from this startup code logs to the console and the system.log file, as specified with the root logger. So after starting all those services we call DOMConfigurator.configure() and pass it o   More>>

My JBoss app logs to a database, but we need to log JBoss output from app startup, so we configure log4j at two different points. Our original log4j.xml looks like this:



			



... stuff deleted ...









... stuff deleted ...

... stuff deleted ...










and it works great. After configuring log4j with that file, we start up a bunch of services, including our database. All the output from this startup code logs to the console and the system.log file, as specified with the root logger. So after starting all those services we call DOMConfigurator.configure() and pass it our follow-on config file that sets up the loggers used by the rest of the application. At this point we don't really want any more data to go to the system.log because JBoss is running already and all our pertinent logging output is being sent to the database. We tried to shut down this output by redefining our root logger in the follow-on config file like this:



			
... exact same CONSOLE appender is present, but deleted for clarity ...







Redeclaring the root appender this way shuts off all console logging. I understand that referencing the root appender in the follow-on config file like this will shut down all appenders attached to the root logger, but that's what I want. I want to shut down the file appender and re-initialize the root logger with just the console appender. Why does this shut down the console appender as well? I get nothing on the console when I redefine the root appender. If I leave this out of my follow-on config file, the console is fine, but I also get stuff in the system.log that I don't want.


--PK    <<Less
About | Sitemap | Contact