<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi Christopher,<br>
<br>
We did a Prove Of Concept today and I like a lot what we got...<br>
<br>
We created our own implementation of LogService and
ExtendendLogService using Logback in the back stage.<br>
<br>
Then, we create a DS component implementing ILoggerFactory and
another DS factory component implementing Logger...<br>
<br>
then in our abstract service component we bind a reference of the
Logger service instead to use the Static factory:<br>
@Reference()<br>
protected void bindLogger(Logger logger) {}<br>
<br>
and we use Config Admin to setup programmatically the Root log
level, appenders and its string pattern.<br>
<br>
well, now we just need to learn how to use MDC and Markers...<br>
<br>
But we agree to use Logback in our OSGi application...<br>
<br>
Many thanks for your tips !<br>
<br>
cheers,<br>
<br>
John<br>
<br>
On 29/06/13 05:41, Christopher BROWN wrote:<br>
</div>
<blockquote
cite="mid:CAHL_zcNX=nD_8rQUsTgaRHqDQ75FVPASN9SGS-40O1PFiD7zKA@mail.gmail.com"
type="cite">
<p dir="ltr">Hi,</p>
<p dir="ltr">Wé use SLF4J and the LogService with OSGi. We provide
an implementation of LogService that uses SLF4J to perform
logging, instead of using any other implementation (which keeps
things consistent).</p>
<p dir="ltr">I find the MDC (Mapped Diagnostic Context) to be very
helpful for distinguishing log messages relating to specific
transactions, a big win over the basic LogService (which
benefits from MDC too in this scenario).</p>
<p dir="ltr">Specifically:<br>
- we use an embedded instance of Apache Felix<br>
- the host application uses native file watching to handle
bundle updates and detect runtime configuration changes... And
configures logging<br>
- therefore, SLF4J is NOT deployed as a bundle, because we want
to log the host application's activity before the framework
starts.<br>
- the host application exports the SLF4J packages, but NOT
Logback, it's the host application that binds LogBack and SLF4J,
so that applications do not see the implementation.<br>
- we configure SLF4J programmatically, using our own
configuration in the host application (avoids headaches finding
the configuration in the classpath for OSGi bundles).<br>
- the only disadvantage being the inability to update SLF4J /
Logback without an application restart, but it's outweighed by
not having any period without a logger available.</p>
<p dir="ltr">For implementing the LogService with SLF4J, look into
LocationAwareLogger. Implement it in the host application and
register it as a service from the framework's BundleContext.
Also, export SLF4J (but not logback) using the "system packages
extra" property.</p>
<p dir="ltr">That way, you can mix SLF4J and LogService without
any inconsistency.</p>
<p dir="ltr">Hope that helps.<br>
</p>
<div class="gmail_quote">Le 29 juin 2013 03:54, "John Shooab" <<a
moz-do-not-send="true" href="mailto:jshooab@gmail.com">jshooab@gmail.com</a>>
a écrit :<br type="attribution">
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
In our company we develop OSGi based applications and use
LogService to logging. We use a Log Reader service that writes
the logging of all bundles to a group of files.<br>
<br>
But there are some coworkers that vote to use SLF4J and
Logback in a new application because it has a interface with
more intuitive methods. but I'm reluctant. I don't see with
good yes the use of the static factory method in OSGi.<br>
<br>
I would appreciate if anyone using Logback on OSGi share any
experience and point any advantage of its use instead of the
LogService.<br>
<br>
thanks a lot,<br>
<br>
John<br>
_______________________________________________<br>
Logback-user mailing list<br>
<a moz-do-not-send="true" href="mailto:Logback-user@qos.ch"
target="_blank">Logback-user@qos.ch</a><br>
<a moz-do-not-send="true"
href="http://mailman.qos.ch/mailman/listinfo/logback-user"
target="_blank">http://mailman.qos.ch/mailman/listinfo/logback-user</a><br>
</blockquote>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Logback-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Logback-user@qos.ch">Logback-user@qos.ch</a>
<a class="moz-txt-link-freetext" href="http://mailman.qos.ch/mailman/listinfo/logback-user">http://mailman.qos.ch/mailman/listinfo/logback-user</a></pre>
</blockquote>
<br>
</body>
</html>