JBoss LogManager is a replacement for the JDK logging system LogManager that fixes or works around many serious problems in the default implementation, and add the the feature functionality to bridge many logging frameworks like JBoss logging, log4j, slf4j, etc. There are 3 key steps to run JBoss LogManager in a standalone Java Application: |
|
* Add relevant libraries(both JBoss LogManager and bridging libraries) * Specify the alternate log manager as a system property(_\-Djava.util.logging.manager=org.jboss.logmanager.LogManager_) * Specify a logging configuration properties |
Teiid LogManager represents the interface to a single logging framework that is easily accessible by any component. Using the LogManager, a component can quickly submit a log message, and can rely upon the LogManager to determine |
... |
* where to send any recorded messages |
Teiid LogManager default use jdk logging framework, so if replace JDK logging system LogManager with JBoss LogManager, then use JBoss LogManager's bridge feature, it's easy to use many logging frameworks within Teiid Embedded. |
Teiid LogManager default use jdk logging framework, so if replace it with JBoss LogManager, then JBoss LogManager can be used to control the logging in Teiid Embedded. In addition, with JBoss LogManager's bridge functionality, it's easy to integrate Teiid Embedded with system which use many other logging frameworks, like JBoss logging, log4j, slf4j, etc. |
|
h1. Steps to use JBoss LogManager |
|
h1. Logging with JBoss Logging |
Using the following 3 steps to set up using JBoss LogManager in Teiid Embedded: |
|
Using the following steps to set up Logging with JBoss Logging: |
1. Add jboss-logmanager library to class path, if use Maven to pull dependency add dependencies as below: |
|
1. Add jboss-logmanager and jboss-logging libraries to class path, if use Maven to pull dependency add dependencies as below: |
{code}<dependency> |
{code} <dependency> |
<groupId>org.jboss.logmanager</groupId> <artifactId>jboss-logmanager</artifactId> |
</dependency>{code} |
<dependency> <groupId>org.jboss.logging</groupId> <artifactId>jboss-logging</artifactId> </dependency> |
|
{code} |
2. Specify the alternate log manager as a system property |
{code}-Djava.util.logging.manager=org.jboss.logmanager.LogManager{code} |
-Djava.util.logging.manager=org.jboss.logmanager.LogManager {code} |
|
3. Add a logging.properties to class path, or specify a system property point to logging.properties |
{code}-Dlogging.configuration=file:/path/to/logging.properties{code} |
-Dlogging.configuration=file:/path/to/logging.properties {code} [TeiidEmbeddedLogging|https://raw.githubusercontent.com/teiid/teiid-embedded-examples/master/embedded-logging/src/main/java/org/teiid/example/TeiidEmbeddedLogging.java] is a example for Logging with JBoss Logging. |
|
[TeiidEmbeddedLogging|https://raw.githubusercontent.com/teiid/teiid-embedded-examples/master/embedded-logging/src/main/java/org/teiid/example/TeiidEmbeddedLogging.java] is a example for Logging with JBoss LogManager. |
A sample logging.properties for Teiid Embedded: |
{code}loggers=sun.rmi,com.arjuna |
loggers=sun.rmi,com.arjuna |
logger.level=TRACE |
... |
handler.FILE.enabled=true handler.FILE.suffix=.yyyy-MM-dd |
handler.FILE.fileName=target/jboss-logging.log handler.FILE.fileName=target/teiid-embedded.log |
formatter.PATTERN=org.jboss.logmanager.formatters.PatternFormatter |
... |
formatter.COLOR-PATTERN=org.jboss.logmanager.formatters.PatternFormatter formatter.COLOR-PATTERN.properties=pattern |
formatter.COLOR-PATTERN.pattern=%K{level}%d{HH\:mm\:ss,SSS} %-5p \[%c\] (%t) %s%e%n{code} |
|
{code} |
|
h1. Bridging with JBoss Logging |
|
To bridge JBoss LogManager with JBoss Logging, the only need to do is add jboss-logging library to class path, if use Maven to pull dependency add dependencies as below: |
|
{code}<dependency> <groupId>org.jboss.logging</groupId> <artifactId>jboss-loggging</artifactId> </dependency>{code} |
|
h1. Logging with Log4j |
If your system use JBoss Logging as logging framework, with above JBoss LogManager bridge JBoss Logging functionality and steps in "Steps to use JBoss LogManager", it's easy to set up logging framework consistent between Teiid Embedded and your system. |
|
Using the following steps to set up Logging with Log4j: |
|
1. Add jboss-logmanager and log4j-jboss-logmanager libraries to class path, if use Maven to pull dependency add dependencies as below: |
|
{code} <dependency> <groupId>org.jboss.logmanager</groupId> <artifactId>jboss-logmanager</artifactId> </dependency> <dependency> <groupId>org.jboss.logmanager</groupId> <artifactId>log4j-jboss-logmanager</artifactId> </dependency> |
|
{code} |
|
2. Specify the alternate log manager as a system property |
|
{code} -Djava.util.logging.manager=org.jboss.logmanager.LogManager |
|
{code} |
h1. Bridging with Log4j |
|
To bridge JBoss LogManager with Log4j, the only need to do is add log4j-jboss-logmanagerlibrary to class path, if use Maven to pull dependency add dependencies as below: |
|
3. Add a log4j.properties to class path, or specify a system property point to log4j.properties |
{code} |
-Dlogging.configuration=[file:/path/to/log4j.properties |
<dependency> |
<groupId>org.jboss.logmanager</groupId> <artifactId>log4j-jboss-logmanager</artifactId> </dependency> |
{code} |
A sample log4j.properties for Teiid Embedded: |
|
//coming soon |
If your system use Log4j as logging framework, with above JBoss LogManager bridge Log4j functionality and steps in "Steps to use JBoss LogManager", it's easy to set up logging framework consistent between Teiid Embedded and your system. |
JBoss LogManager is a replacement for the JDK logging system LogManager that fixes or works around many serious problems in the default implementation, and add the the functionality to bridge many logging frameworks like JBoss logging, log4j, slf4j, etc.
Teiid LogManager represents the interface to a single logging framework that is easily accessible by any component. Using the LogManager, a component can quickly submit a log message, and can rely upon the LogManager to determine
Teiid LogManager default use jdk logging framework, so if replace it with JBoss LogManager, then JBoss LogManager can be used to control the logging in Teiid Embedded. In addition, with JBoss LogManager's bridge functionality, it's easy to integrate Teiid Embedded with system which use many other logging frameworks, like JBoss logging, log4j, slf4j, etc.
Using the following 3 steps to set up using JBoss LogManager in Teiid Embedded:
1. Add jboss-logmanager library to class path, if use Maven to pull dependency add dependencies as below:
<dependency> <groupId>org.jboss.logmanager</groupId> <artifactId>jboss-logmanager</artifactId> </dependency>
2. Specify the alternate log manager as a system property
-Djava.util.logging.manager=org.jboss.logmanager.LogManager
3. Add a logging.properties to class path, or specify a system property point to logging.properties
-Dlogging.configuration=file:/path/to/logging.properties
TeiidEmbeddedLogging is a example for Logging with JBoss LogManager.
A sample logging.properties for Teiid Embedded:
loggers=sun.rmi,com.arjuna logger.level=TRACE logger.handlers=FILE,CONSOLE logger.sun.rmi.level=WARN logger.sun.rmi.useParentHandlers=true logger.com.arjuna.level=WARN logger.com.arjuna.useParentHandlers=true handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler handler.CONSOLE.level=INFO handler.CONSOLE.formatter=COLOR-PATTERN handler.CONSOLE.properties=autoFlush,target,enabled handler.CONSOLE.autoFlush=true handler.CONSOLE.target=SYSTEM_OUT handler.CONSOLE.enabled=true handler.FILE=org.jboss.logmanager.handlers.PeriodicRotatingFileHandler handler.FILE.formatter=PATTERN handler.FILE.properties=append,autoFlush,enabled,suffix,fileName handler.FILE.constructorProperties=fileName,append handler.FILE.append=true handler.FILE.autoFlush=true handler.FILE.enabled=true handler.FILE.suffix=.yyyy-MM-dd handler.FILE.fileName=target/teiid-embedded.log formatter.PATTERN=org.jboss.logmanager.formatters.PatternFormatter formatter.PATTERN.properties=pattern formatter.PATTERN.pattern=%d{yyyy-MM-dd HH\:mm\:ss,SSS} %-5p \[%c\] (%t) %s%e%n formatter.COLOR-PATTERN=org.jboss.logmanager.formatters.PatternFormatter formatter.COLOR-PATTERN.properties=pattern formatter.COLOR-PATTERN.pattern=%K{level}%d{HH\:mm\:ss,SSS} %-5p \[%c\] (%t) %s%e%n
To bridge JBoss LogManager with JBoss Logging, the only need to do is add jboss-logging library to class path, if use Maven to pull dependency add dependencies as below:
<dependency> <groupId>org.jboss.logging</groupId> <artifactId>jboss-loggging</artifactId> </dependency>
If your system use JBoss Logging as logging framework, with above JBoss LogManager bridge JBoss Logging functionality and steps in "Steps to use JBoss LogManager", it's easy to set up logging framework consistent between Teiid Embedded and your system.
To bridge JBoss LogManager with Log4j, the only need to do is add log4j-jboss-logmanagerlibrary to class path, if use Maven to pull dependency add dependencies as below:
<dependency> <groupId>org.jboss.logmanager</groupId> <artifactId>log4j-jboss-logmanager</artifactId> </dependency>
If your system use Log4j as logging framework, with above JBoss LogManager bridge Log4j functionality and steps in "Steps to use JBoss LogManager", it's easy to set up logging framework consistent between Teiid Embedded and your system.