Propagating Log Messages to the Root Logger Best Practice: Use Generic Overrides to Insert Logging Properties File

Understanding WebLogic Logging Services 2-15 If no logger name exists in the LoggingEvent, the message is published to the root logger. To use the Server Logging Bridge appender, create a log4j.properties file to be included in the application classpath. The log4j.properties file registers the Server Logging Bridge appender in the applications logger tree. For detailed information about configuring Log4j logging, see the following Logging Services documentation published by logging.apache.org: http:logging.apache.orglog4j1.2manual.html Example 2–2 shows an example log4j.properties file for an application that uses Log4J Logging. Example 2–2 Example log4j.properties File Using the ServerLoggingAppender log4j.rootLogger=debug, stdout, server stdout is set to be a ConsoleAppender. log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=5p [t] F:L - mn log4j.appender.server=weblogic.logging.log4j.ServerLoggingAppender

2.8.3 Propagating Log Messages to the Root Logger

By default, log messages originating from loggers with the com.oracle.wls namespace that are redirected by the Server Logging Bridge are not propagated to the application’s root logger. However, you can propagate messages to the application’s root logger by enabling the LogMBean.ServerLoggingBridgeUseParentLoggersEnabled attribute. For more information, see the description of Server Logging Bridge Uses Parent Loggers in Servers: Logging: General in Oracle WebLogic Server Administration Console Help.

2.8.4 Best Practice: Use Generic Overrides to Insert Logging Properties File

If you are using Log4j for application logging, the log4j.properties file can use the generic overrides feature in WebLogic Server to have this file inserted into your existing deployment plan directory structure. The generic overrides feature provides a convenient means to insert, or make changes to, specific resources types used by an application and to continue using the existing ClassLoader and resource loading rules and behaviors for the application, without having to revise the application JAR files. For more information, see Generic File Loading Overrides in Deploying Applications to Oracle WebLogic Server. Note: As a best practice, configuring the Logger Severity level in the LogMBean.LoggerSeverityProperties attribute is recommended because it is dynamic and can be persisted in the domain’s config.xml file. For more information, see Section 3.6.1.1, Specifying Severity Level for WebLogic Server Subsystem Loggers. 2-16 Configuring Log Files and Filtering Log Messages for Oracle WebLogic Server 3 Configuring WebLogic Logging Services 3-1 3 Configuring WebLogic Logging Services The following sections describe WebLogic Server logging scenarios and basic configuration tasks. For detailed instructions on filtering and subscribing to messages, see Chapter 4, Filtering WebLogic Server Log Messages, and Chapter 5, Subscribing to Messages. ■ Section 3.1, Configuration Scenarios