<html>
<head>
    <base href="https://docs.jboss.org/author">
            <link rel="stylesheet" href="/author/s/en/2172/19/5/_/styles/combined.css?spaceKey=TEIID&amp;forWysiwyg=true" type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://docs.jboss.org/author/display/TEIID/Using+JBoss+LogManager+with+Teiid+Embedded">Using JBoss LogManager with Teiid Embedded</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://docs.jboss.org/author/display/~shawkins">Steven Hawkins</a>
    </h4>
        <br/>
                         <h4>Changes (20)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">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. <br> <br> <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-changed-words">Teiid<span class="diff-added-chars"style="background-color: #dfd;">&#39;s</span></span> LogManager <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">represents the</span> <span class="diff-added-words"style="background-color: #dfd;">is an</span> 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 <br></td></tr>
            <tr><td class="diff-unchanged" >* whether that message is to be recorded or discarded <br>* where to send any recorded messages <br> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">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&#39;s bridge functionality, it&#39;s easy to integrate Teiid Embedded with system which use many other logging frameworks, like JBoss logging, log4j, slf4j, etc. <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">h1. JBoss Logging <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">h1. Steps to use JBoss LogManager <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">JBoss Logging is used by default.  The JBoss Logging jar is already in the kit and you just need to ensure the jboss-logging library is in your class path.  If you use Maven, add the dependency as shown below: <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">Using the following 3 steps to set up using JBoss LogManager in Teiid Embedded: <br> <br>1. Add jboss-logmanager library to class path, if use Maven to pull dependency add dependencies as below: <br> <br></td></tr>
            <tr><td class="diff-unchanged" >{code}&lt;dependency&gt; <br></td></tr>
            <tr><td class="diff-changed-lines" >    <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">&lt;groupId&gt;org.jboss.logmanager&lt;/groupId&gt;</span> <span class="diff-added-words"style="background-color: #dfd;">&lt;groupId&gt;org.jboss.logging&lt;/groupId&gt;</span> <br></td></tr>
            <tr><td class="diff-changed-lines" >    <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">&lt;artifactId&gt;jboss-logmanager&lt;/artifactId&gt;</span> <span class="diff-added-words"style="background-color: #dfd;">&lt;artifactId&gt;jboss-loggging&lt;/artifactId&gt;</span> <br></td></tr>
            <tr><td class="diff-unchanged" >&lt;/dependency&gt;{code} <br> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">2. Specify the alternate log manager as a system property <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">h1. Bridging with JBoss Logging  <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">{code}-Djava.util.logging.manager=org.jboss.logmanager.LogManager{code} <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">JBoss LogManager is a replacement for the JDK logging system LogManager that fixes or works around many serious problems in the default implementation.  To use JBoss LogManager with JBoss Logging, the only need to do is add jboss-logging library to class path. If use Maven to pull dependencies, add the dependency as shown below:  <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">3. Add a logging.properties to class path, or specify a system property point to logging.properties <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">{code}&lt;dependency&gt;  <br>    &lt;groupId&gt;org.jboss.logging&lt;/groupId&gt;  <br>    &lt;artifactId&gt;jboss-logmanager&lt;/artifactId&gt;  <br>&lt;/dependency&gt;{code}  <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">{code}-Dlogging.configuration=file:/path/to/logging.properties{code} <br> <br> <br></td></tr>
            <tr><td class="diff-unchanged" >[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. <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >formatter.COLOR-PATTERN.pattern=%K{level}%d{HH\:mm\:ss,SSS} %-5p \[%c\] (%t) %s%e%n{code} <br> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;"> <br> <br>h1. Bridging with JBoss Logging <br> <br>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: <br> <br>{code}&lt;dependency&gt; <br>    &lt;groupId&gt;org.jboss.logging&lt;/groupId&gt; <br>    &lt;artifactId&gt;jboss-loggging&lt;/artifactId&gt; <br>&lt;/dependency&gt;{code} <br> <br> <br>If your system use JBoss Logging as logging framework, with above JBoss LogManager bridge JBoss Logging functionality and steps in &quot;Steps to use JBoss LogManager&quot;, it&#39;s easy to set up logging framework consistent between Teiid Embedded and your system. <br> <br> <br> <br> <br> <br> <br> <br> <br> <br></td></tr>
            <tr><td class="diff-unchanged" >h1. Bridging with Log4j <br> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">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: <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">To bridge JBoss Logging with Log4j, the only need to do is have a 1.x log4j jar in your class path. <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;"> <br>{code} <br>&lt;dependency&gt; <br>    &lt;groupId&gt;org.jboss.logmanager&lt;/groupId&gt; <br>    &lt;artifactId&gt;log4j-jboss-logmanager&lt;/artifactId&gt; <br>&lt;/dependency&gt; <br>{code} <br> <br> <br> <br></td></tr>
            <tr><td class="diff-unchanged" >If your system use Log4j as logging framework, with above JBoss LogManager bridge Log4j functionality and steps in &quot;Steps to use JBoss LogManager&quot;, it&#39;s easy to set up logging framework consistent between Teiid Embedded and your system. <br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <p>Teiid's LogManager is an 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</p>
<ul>
        <li>whether that message is to be recorded or discarded</li>
        <li>where to send any recorded messages</li>
</ul>


<h1><a name="UsingJBossLogManagerwithTeiidEmbedded-JBossLogging"></a>JBoss Logging</h1>

<p>JBoss Logging is used by default.  The JBoss Logging jar is already in the kit and you just need to ensure the jboss-logging library is in your class path.  If you use Maven, add the dependency as shown below:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">&lt;dependency&gt;
    &lt;groupId&gt;org.jboss.logging&lt;/groupId&gt;
    &lt;artifactId&gt;jboss-loggging&lt;/artifactId&gt;
&lt;/dependency&gt;</pre>
</div></div>

<h1><a name="UsingJBossLogManagerwithTeiidEmbedded-BridgingwithJBossLogging"></a>Bridging with JBoss Logging </h1>

<p>JBoss LogManager is a replacement for the JDK logging system LogManager that fixes or works around many serious problems in the default implementation.  To use JBoss LogManager with JBoss Logging, the only need to do is add jboss-logging library to class path. If use Maven to pull dependencies, add the dependency as shown below: </p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">&lt;dependency&gt; 
    &lt;groupId&gt;org.jboss.logging&lt;/groupId&gt; 
    &lt;artifactId&gt;jboss-logmanager&lt;/artifactId&gt; 
&lt;/dependency&gt;</pre>
</div></div> 

<p><a href="https://raw.githubusercontent.com/teiid/teiid-embedded-examples/master/embedded-logging/src/main/java/org/teiid/example/TeiidEmbeddedLogging.java" class="external-link" rel="nofollow">TeiidEmbeddedLogging</a> is a example for Logging with JBoss LogManager.</p>

<p>A sample logging.properties for Teiid Embedded:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">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</pre>
</div></div>

<h1><a name="UsingJBossLogManagerwithTeiidEmbedded-BridgingwithLog4j"></a>Bridging with Log4j</h1>

<p>To bridge JBoss Logging with Log4j, the only need to do is have a 1.x log4j jar in your class path.</p>

<p>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.</p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;" class="grey">
                        <a href="https://docs.jboss.org/author/users/removespacenotification.action?spaceKey=TEIID">Stop watching space</a>
            <span style="padding: 0px 5px;">|</span>
                <a href="https://docs.jboss.org/author/users/editmyemailsettings.action">Change email notification preferences</a>
</div>
        <a href="https://docs.jboss.org/author/display/TEIID/Using+JBoss+LogManager+with+Teiid+Embedded">View Online</a>
        |
        <a href="https://docs.jboss.org/author/pages/diffpagesbyversion.action?pageId=94765145&revisedVersion=10&originalVersion=9">View Changes</a>
                |
        <a href="https://docs.jboss.org/author/display/TEIID/Using+JBoss+LogManager+with+Teiid+Embedded?showComments=true&amp;showCommentArea=true#addcomment">Add Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>