Configurations for the WebSphere Application Server logger
You can configure an application to use the WebSphere® Application Server logger in several ways.
The type of configuration that best suits an application depends upon the following:
- Whether the Class loader order setting for the application is Classes loaded with parent class loader first (Parent First) or Classes loaded with application class loader first (Parent Last). You can set the class loader delegation mode on a console Class loading and update detection page.
- Whether Jakarta Commons Logging is bundled with the application configuration
- Whether Jakarta Commons Logging is provided within the application
The following tables describe the conditions required to enable an application to use the WebSphere Application Server logger.
Class loader mode is Parent First and Jakarta Commons Logging is bundled with the application
Jakarta Commons Logging configuration | LogFactory instance | Log instance | Comments |
---|---|---|---|
The application provides the configuration by
either of the following: • The properties file commons-logging.properties in the application classpath is not read by the LogFactory because the parent class loader finds the WebSphere properties file first. • The class name is read from
the file
|
除非配置是在应用程序或模块的 META-INF 文件中提供的,否则使用的日志工厂是在 WebSphere Application Server 缺省配置中指定的 LogFactory 实现。 | 使用的日志是下面任一项: • 在 WebSphere Application Server 缺省配置中指定的日志实现 • 如果使用了用来实例化另一日志实现的特定于应用程序的 LogFactory,那么使用的日志是特定于应用程序的日志实现。 |
应用程序父类装入器是要装入 Jakarta Commons Logging 代码的第一个类装入器。支持 Jakarta Commons Logging 的 WebSphere 束提供了用来查找 LogFactory 配置属性的 LogFactory 静态代码。 要让静态 LogFactory 代码实例化在应用程序配置中指定的 LogFactory 实例,该 LogFactory 实例必须位于父类装入器的类路径上。 |
不由应用程序提供 | 使用的日志工厂是在 WebSphere 缺省配置中指定的 LogFactory 实现。 | 使用的日志是在 WebSphere 缺省配置中指定的日志实现。 | 不使用与应用程序捆绑在一起的 Jakarta Commons Logging。 |
类装入器方式为父代最先和“Jakarta Commons Logging 不与应用程序捆绑在一起”
Jakarta Commons Logging 配置 | LogFactory 实例 | 日志实例 | 注释 |
---|---|---|---|
应用程序通过下面任一方法提供配置: • 因为父类装入器首先查找 WebSphere Application Server 属性文件,所以 LogFactory 不读取应用程序类路径中的 commons-logging.properties 属性文件。 • 从
文件中读取类名。 |
除非配置是在应用程序或模块的 META-INF 文件中提供的,否则使用的日志工厂是在 WebSphere Application Server 缺省配置中指定的 LogFactory 实现。 | 使用的日志是下面任一项: • 在 WebSphere Application Server 缺省配置中指定的日志实现 • 如果使用了用来实例化另一日志实现的特定于应用程序的 LogFactory,那么使用的日志是特定于应用程序的日志实现。 |
应用程序父类装入器是要装入 Jakarta Commons Logging 代码的第一个类装入器。支持 Jakarta Commons Logging 的 WebSphere 束提供了用来查找 LogFactory 配置属性的 LogFactory 静态代码。 要让静态 LogFactory 代码实例化在应用程序配置中指定的 LogFactory 实例,该 LogFactory 实例必须位于父类装入器的类路径上。 |
不由应用程序提供 | 使用的日志工厂是在 WebSphere Application Server 缺省配置中指定的 LogFactory 实现。 | 使用的日志是在 WebSphere Application Server 缺省配置中指定的日志实现。 | 同上 |
类装入器方式为父类最后而且 Jakarta Commons Logging 与应用程序捆绑在一起
Jakarta Commons Logging 配置 | LogFactory 实例 | 日志实例 | 注释 |
---|---|---|---|
应用程序通过下面任一方法提供配置: • 因为类装入器首先查找应用程序属性文件,所以 LogFactory 读取应用程序类路径中的 commons-logging.properties 属性文件。 •
从
文件中读取类名。 |
使用的日志工厂是下面任一项: • 缺省 Jakarta Commons Logging LogFactory • 在应用程序配置中指定的 LogFactory |
使用的日志是在应用程序配置中指定的日志实现。 如果使用的日志工厂是缺省 Jakarta Commons Logging LogFactory,那么日志实现必须位于应用程序类装入器的类路径上。 |
应用程序类装入器是要装入 Jakarta Commons Logging 代码的第一个类装入器。支持 Jakarta Commons Logging 的应用程序束提供了用来查找 LogFactory 配置属性的 LogFactory 静态代码。 要让静态 LogFactory 代码实例化在应用程序配置中指定的 LogFactory 实例,该 LogFactory 实例必须位于应用程序类装入器的类路径上。 |
不由应用程序提供 | 使用的日志工厂是在 WebSphere Application Server 缺省配置中指定的 LogFactory 实现。 | 使用的日志是在 WebSphere Application Server 缺省配置中指定的日志实现。 |
类装入器方式为父类最后和“Jakarta Commons Logging 不与应用程序捆绑在一起”
Jakarta Commons Logging 配置 | LogFactory 实例 | 日志实例 | 注释 |
---|---|---|---|
应用程序通过下面任一方法提供配置: • 因为类装入器首先查找应用程序属性文件,所以 LogFactory 读取应用程序类路径中的 commons-logging.properties 属性文件。 •
从
文件中读取类名。 |
使用的日志工厂是下面任一项: • 缺省 Jakarta Commons Logging LogFactory • 在应用程序配置中指定的 LogFactory |
使用的日志是在应用程序配置中指定的日志实现。 如果使用的日志工厂是缺省 Jakarta Commons Logging LogFactory,那么日志实现必须位于应用程序类装入器的类路径上。 |
应用程序类装入器中没有任何 Jakarta Commons Logging 代码。因此,支持 Jakarta Commons Logging 的 WebSphere 束提供了用来查找 LogFactory 配置属性的 LogFactory 静态代码。 要让静态 LogFactory 代码实例化在应用程序配置中指定的 LogFactory 实例,该 LogFactory 实例必须位于父类装入器的类路径上。 |
不由应用程序提供 | 使用的日志工厂是在 WebSphere Application Server 缺省配置中指定的 LogFactory 实现。 | 使用的日志是在 WebSphere Application Server 缺省配置中指定的日志实现。 |