3 Replies Latest reply on Sep 6, 2011 6:04 AM by Gary Quinn

    Problems with JBoss 6 logging

    robinsri Newbie



      The logging in JBoss 6 has really changed. There are some good features in it but, unfortunately, the changes don't mix well with my application's logging. In fact the app's special trace logging now fails miserably.


      What is perhaps special about the app is that it uses an associated console which gives users the ability to turn off and on tracing on various subsystems as well as the ability to control the location of the log file. No changes to the XML config are needed. It does this by fetching log4j loggers, creating new appenders as needed and using the addAppender/removeAppender as well as seting levels to control the tracing and, when tracing is enabled, send error logging to the the regular error log file and duplicate it in a trace log file. When tracing is off then errors only go to the error log and the trace log is left alone. Users can also use API calls to the app to control the loging themselves if they don't want to use the console.


      I see two problems with the new JBoss 6 logging:


      1) The loggers appear to be adapters of the BridgeLogger class rather than real log4j Logger object and don't appear to implement all the features of log4j (e.g., addAppender)


      2) Initialization of the loggers is done during the time that the boot logging is in affect. That means that even if (1) was fixed, any changes made programmatically are made to the wrong logging configuration. That would be the case if tracing was enabled and JBoss was restarted and the code tried to initialize for tracing.


      Other than putting a copy of the log4j.jar in my EAR and changing the classloaders to load it rather than the JBoss instance is there anyway to get back the old log4j logging? Help!