[jboss-cvs] JBossAS SVN: r86379 - projects/jboss-osgi/trunk/build/docbook/en/modules.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Mar 26 08:31:59 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-03-26 08:31:59 -0400 (Thu, 26 Mar 2009)
New Revision: 86379

Modified:
   projects/jboss-osgi/trunk/build/docbook/en/modules/devguide.xml
Log:
docbook logging

Modified: projects/jboss-osgi/trunk/build/docbook/en/modules/devguide.xml
===================================================================
--- projects/jboss-osgi/trunk/build/docbook/en/modules/devguide.xml	2009-03-26 12:02:32 UTC (rev 86378)
+++ projects/jboss-osgi/trunk/build/docbook/en/modules/devguide.xml	2009-03-26 12:31:59 UTC (rev 86379)
@@ -251,15 +251,53 @@
     <note>
       <para>The JMX Console is <emphasis role="bold">not part</emphasis> of the <link linkend="SecRuntime">JBossOSGi Runtime</link>.</para>
     </note> 
-    
   </sect1>
   
   <sect1 xml:id="SecLoggingBridge">  
     <title>Logging Bridge</title>
     
-    <note>
-      <title>TODO: Document the Logging Bridge</title>
-    </note>
+    <para>The JBossOSGi <emphasis role="bold">jboss-osgi-service-logging.jar</emphasis> Bundle contains a simple Logging Bridge Service to
+    <ulink url="http://www.jboss.org/community/docs/DOC-11280">JBoss Logging</ulink>. It registers a trivial 
+    <ulink url="http://www.osgi.org/javadoc/r4v41/org/osgi/service/log/LogListener.html">LogListener</ulink> with the 
+    <ulink url="http://www.osgi.org/javadoc/r4v41/org/osgi/service/log/LogReaderService.html">LogReaderService</ulink> in case that service
+    is registered with the Framework.</para>
+    
+    <para>The <ulink url="http://www.osgi.org/javadoc/r4v41/org/osgi/service/log/LogReaderService.html">LogReaderService</ulink> is part of the 
+    standard <ulink url="http://www.osgi.org/Download/File?url=/download/r4v41/r4.cmpn.pdf">OSGi Compendium Services</ulink>. JBossOSGi currently
+    uses the (not yet released) LogService from <ulink url="http://felix.apache.org">Apache Felix</ulink>, which gets deployed as Bundle
+    <emphasis role="bold">org.apache.felix.log.jar</emphasis></para>
+    
+    <para>The <ulink url="http://www.osgi.org/javadoc/r4v41/org/osgi/service/log/LogListener.html">LogListener</ulink> itself logs messages 
+    under the Bundle's symbolic name.</para>
+    
+    <programlisting role="JAVA">
+    public class JBossLoggingLogListener implements LogListener
+    {
+       public void logged(LogEntry entry)
+       {
+          Bundle bundle = entry.getBundle();
+          int level = entry.getLevel();
+          Throwable throwable = entry.getException();
+    
+          String loggerName = bundle.getSymbolicName();
+          Logger log = Logger.getLogger(loggerName);
+          
+          if (level == LogService.LOG_DEBUG)
+             log.debug(entry.getMessage(), throwable);
+          
+          else if (level == LogService.LOG_INFO)
+             log.info(entry.getMessage(), throwable);
+          
+          else if (level == LogService.LOG_WARNING)
+             log.warn(entry.getMessage(), throwable);
+    
+          else if (level == LogService.LOG_ERROR)
+             log.error(entry.getMessage(), throwable);
+       }
+    }
+    </programlisting>
+    
+    <para>You can therefore change the logging for specific Bundles by <ulink url="http://www.jboss.org/community/docs/DOC-12490">setting the respective logging level</ulink>.</para>.  
   </sect1>
   
   <sect1 xml:id="SecMicrocontainerService">  




More information about the jboss-cvs-commits mailing list