Author: buildbot
Date: Mon Nov 18 07:02:36 2013
New Revision: 887052
Log:
Staging update by buildbot for sling
Modified:
websites/staging/sling/trunk/content/ (props changed)
websites/staging/sling/trunk/content/documentation/development/logging.html
Propchange: websites/staging/sling/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Mon Nov 18 07:02:36 2013
@@ -1 +1 @@
-1542744
+1542924
Modified:
websites/staging/sling/trunk/content/documentation/development/logging.html
==============================================================================
--- websites/staging/sling/trunk/content/documentation/development/logging.html
(original)
+++ websites/staging/sling/trunk/content/documentation/development/logging.html
Mon Nov 18 07:02:36 2013
@@ -91,6 +91,40 @@ This document is for new 4.x release of
to older version.
</div>
+<div class="toc">
+<ul>
+<li><a href="#introduction">Introduction</a></li>
+<li><a href="#initial-configuration">Initial Configuration</a></li>
+<li><a href="#user-configuration-osgi-based">User Configuration - OSGi
Based</a><ul>
+<li><a href="#logger-configuration">Logger Configuration</a></li>
+<li><a href="#log-writer-configuration">Log Writer Configuration</a><ul>
+<li><a href="#log-file-rotation">Log File Rotation</a><ul>
+<li><a href="#scheduled-rotation">Scheduled Rotation</a></li>
+<li><a href="#size-rotation">Size Rotation</a></li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+</li>
+<li><a href="#logback-integration">Logback Integration</a><ul>
+<li><a href="#turbofilters-as-osgi-service">TurboFilters as OSGi
Service</a></li>
+<li><a href="#filter-as-osgi-service">Filter as OSGi service</a></li>
+<li><a href="#appenders-as-osgi-service">Appenders as OSGi service</a></li>
+<li><a href="#logback-config-fragment-support">Logback Config Fragment
Support</a><ul>
+<li><a href="#exposing-fragment-as-string-objects">Exposing fragment as String
objects</a></li>
+<li><a href="#exposing-fragment-as-configprovider-instance">Exposing fragment
as ConfigProvider instance</a></li>
+</ul>
+</li>
+<li><a href="#external-config-file">External Config File</a></li>
+<li><a href="#java-util-logging-jul-integration">Java Util Logging (JUL)
Integration</a></li>
+<li><a
href="#wzxhzdk13wzxhzdk14configuring-osgi-based-appenders-in-logback-config"><a
name="config-override"></a>Configuring OSGi based appenders in Logback
Config</a></li>
+</ul>
+</li>
+<li><a href="#using-slf4j-api-17">Using Slf4j API 1.7</a></li>
+<li><a href="#webconsole-plugin">WebConsole Plugin</a></li>
+</ul>
+</div>
<h2 id="introduction">Introduction</h2>
<p>Logging in Sling is supported by the
<code>org.apache.sling.commons.log</code> bundle, which is one of the first
bundles installed
and started by the Sling Launcher. This bundle along with other bundles manage
the Sling Logging and provide following
@@ -447,14 +481,15 @@ needs to be done. This features allows r
<li>Set framework property
<code>org.apache.sling.commons.log.julenabled</code> to true</li>
<li>
<p>Set the <a
href="http://logback.qos.ch/manual/configuration.html#LevelChangePropagator">LevelChangePropagator</a>
in LogbackConfig</p>
-<p>:::xml
-<configuration>
- <contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator"/>
- ...
-</configuration></p>
+<div class="codehilite"><pre><span class="nt"><configuration></span>
+ <span class="nt"><contextListener</span> <span
class="na">class=</span><span
class="s">"ch.qos.logback.classic.jul.LevelChangePropagator"</span><span
class="nt">/></span>
+<span class="nt"></configuration></span>
+</pre></div>
+
+
</li>
</ol>
-<h3
id="wzxhzdk10wzxhzdk11configuring-osgi-based-appenders-in-logback-config"><a
name="config-override"></a>Configuring OSGi based appenders in Logback
Config</h3>
+<h3
id="wzxhzdk13wzxhzdk14configuring-osgi-based-appenders-in-logback-config"><a
name="config-override"></a>Configuring OSGi based appenders in Logback
Config</h3>
<p>So far Sling used to configure the appenders based on OSGi config. That
mode only provide a very limited
set to configuration options. To make use of other Logback features you can
override the OSGi config
from within the Logback config file. OSGi config based appenders are named
based on the file name</p>
@@ -481,8 +516,62 @@ create an appender with name <code>logs/
<p>In this case then Log module would create appender based on Logback config
instead of OSGi config. This can
be used to move the application from OSGi based config to Logback based config
easily</p>
-<h2 id="webconsole-plugin-enhancements">WebConsole Plugin enhancements</h2>
-<p>The web Console Plugin supports following features</p>
+<h2 id="using-slf4j-api-17">Using Slf4j API 1.7</h2>
+<p>With Slf4j API 1.7 onwards its possible to use logger methods with varargs
i.e. log n arguments without
+constructing an object array e.g. <code>log.info("This is a test {} , {}, {},
{}",1,2,3,4)</code>. Without var args
+you need to construct an object array <code>log.info("This is a test {} , {},
{}, {}",new Object[] {1,2,3,4})</code>.
+To make use of this API and still be able to use your bundle on Sling system
which package older version
+of API jar follow the steps below (See <a
href="https://issues.apache.org/jira/browse/SLING-3243">SLING-3243</a>) for
more details</p>
+<ol>
+<li>
+<p>Update the api version in pom dependency</p>
+<div class="codehilite"><pre><span class="nt"><dependencies></span>
+ <span class="nt"><dependency></span>
+ <span class="nt"><groupId></span>org.slf4j<span
class="nt"></groupId></span>
+ <span class="nt"><artifactId></span>slf4j-api<span
class="nt"></artifactId></span>
+ <span class="nt"><version></span>1.7.5<span
class="nt"></version></span>
+ <span class="nt"><scope></span>provided<span
class="nt"></scope></span>
+ <span class="nt"></dependency></span>
+ ...
+<span class="nt"></dependency></span>
+</pre></div>
+
+
+</li>
+<li>
+<p>Add <code>Import-Package</code> instruction with custom version range. </p>
+<div class="codehilite"><pre><span class="nt"><build></span>
+ <span class="nt"><plugins></span>
+ <span class="nt"><plugin></span>
+ <span class="nt"><groupId></span>org.apache.felix<span
class="nt"></groupId></span>
+ <span class="nt"><artifactId></span>maven-bundle-plugin<span
class="nt"></artifactId></span>
+ <span class="nt"><extensions></span>true<span
class="nt"></extensions></span>
+ <span class="nt"><configuration></span>
+ <span class="nt"><instructions></span>
+ ...
+ <span class="nt"><Import-Package></span>
+ org.slf4j;version="[1.5,2)",
+ *
+ <span class="nt"></Import-Package></span>
+ <span class="nt"></instructions></span>
+ <span class="nt"></configuration></span>
+ <span class="nt"></plugin></span>
+ ...
+ <span class="nt"></plugins></span>
+<span class="nt"></build></span>
+</pre></div>
+
+
+</li>
+</ol>
+<p>Above setup ensures following things</p>
+<ol>
+<li>Slf4j API bundle 1.7.x is binary compatible with 1.6.x.</li>
+<li>It allows bundle to make use of var args feature while making logging
calls</li>
+<li>Bundle can still be deployed on older system which package 1.6.4 version
of slf4j api</li>
+</ol>
+<h2 id="webconsole-plugin">WebConsole Plugin</h2>
+<p>The Web Console Plugin supports following features</p>
<ul>
<li>Displays list of loggers which have level or appender configured</li>
<li>List of File appenders with location of current active files</li>
@@ -492,7 +581,7 @@ be used to move the application from OSG
</ul>
<p><img src="sling-log-support.png" /></p>
<div class="timestamp" style="margin-top: 30px; font-size: 80%;
text-align: right;">
- Rev. 1542744 by chetanm on Sun, 17 Nov 2013 15:03:16 +0000
+ Rev. 1542924 by chetanm on Mon, 18 Nov 2013 07:01:51 +0000
</div>
<div class="trademarkFooter">
Apache Sling, Sling, Apache, the Apache feather logo, and the Apache
Sling project