This document relates to JIRA issue JBAS-6097 which entails creating a POJO-based service for Logging for JBossAS 6.0.
Update: The implementation of these requirements has been merged into JBossAS and will appear in 6.0.
- The logging service will allow applications using any logging API to function as expected (reference: forum discussion). Included in this set of APIs are:
- JDK logging (java.util.logging)
- Clients using the Log4J API directly
- Clients using the old Apache commons-logging framework
- Clients using the SLF4J API
- Clients using the JBoss common logging API
- The logging service will allow deployments to have separate handing for stdout and stderr (reference: JBAS-2412) (TODO: this could be abstracted out of logging, and merged with the ability to have per-deployment stdin)
- The logging service should allow the user to specify log appenders and handlers from any of the following frameworks (reference: JBAS-2412):
- JDK logging Handlers
- Log4j Appenders
- Deployments should still be able to use the old log4j.xml/jboss-log4j.xml configuration style (reference: forum discussion).
- Appenders defined in this configuration format should be assumed to be Log4j Appenders. (Ed: there's probably no harm in just detecting the appender type programmatically and supporting all types)
- Log4j Filters should continue to be supported.
- Levels configured in log4j.xml should be supported for log4j level types.
- (..todo - other log4j config types..)
- A new, updated (JBossMC metadata-based) configuration format should be introduced which offers configuration support for the full range of features defined above.
- The management view (XMBean?) should retain largely the same (or similar) operations as the old logging service (some of the docs reference log4j-specific things; those will want updating).
- The service should produce a notification when a logging deployment is complete (similar to a reconfigure notification under Log4jService).
- A bootstrap configuration mechanism should be available that allows the primordial appenders to be set up, including:
- The console appender
- The boot log file appender
- When the "real" configuration service starts, the primordial appenders should be replaced with the new configured appenders. The bootstrap configuration mechanism is no longer needed at this point and can be unloaded.
- On shutdown, the appenders need to be retained until the moment of container shutdown or else some shutdown logs might be lost. the logging configuration will be retained until the logging deployments are all stopped, at which time the bootstrap logging configurations will be restored and remain in place until the container shuts down.
- The ability to support multiple backend logging frameworks (unless someone can demonstrate a good reason for this).
- The logging backend will use JDK logging by way of the enhanced JBoss LogManager.
- Logging deployments will be translated into Microcontainer bean deployments.
- As a result, no more than one logging deployment (log4j or otherwise) will be able to define the same logger (i.e. the same category name in the same logging context); such a deployment will trigger an error. (TODO: what about the root logger?)
- More than one log4j deployment may use the same name for appenders as their names will be private to a logger deployment. (TODO: this appears to be how DOMConfigurator works today; do we need a way for one deployment to reference appenders from another deployment? JBMC would then automatically create a dependency between the deployments... that could be good or bad)
- The JBoss Logging API should use the slf4j backend the backend provided with JBoss LogManager going forward, not the JDK logging backend, since it is more feature-complete.
- The log4j JAR (in whole or in part) will need to be a part of the logging service deployer (as opposed to using a minimal facade such as what is provided with slf4j) in order to support log4j appenders and filters and other structure. (TODO: what about NDC/MDC? These classes will have to forward to our versions.) (TODO: is log4j deployment compatibility really a requirement? Might be easier to just provide a logging repository implementation which bridges back to the core logmanager (opposite of the original logbridge) and let the regular log4j configurators do their thing).
- Bootstrap changes:
- Remove log4j-boot.jar - no longer needed.
- JBoss LogManager remains; the JDK LogManager has to be on the classpath at the time that logging is initialized.
- Remove jboss-logging-log4j.jar and jboss-logging-jdk.jar (the only backend which is needed at boot is included in the JBoss LogManager)
- jboss-logging-spi.jar remains to support the components which use JBoss Logging at boot (which is pretty much all of them).
- Remove jboss-logbridge.jar - no longer needed
- Add slf4j-api.jar - the 1.1.0 version of JBoss LogManager implements this API directly.