From dev-return-11802-apmail-directory-dev-archive=directory.apache.org@directory.apache.org Thu Apr 27 15:25:02 2006 Return-Path: Delivered-To: apmail-directory-dev-archive@www.apache.org Received: (qmail 2569 invoked from network); 27 Apr 2006 15:22:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 27 Apr 2006 15:22:52 -0000 Received: (qmail 13223 invoked by uid 500); 27 Apr 2006 15:22:17 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 13193 invoked by uid 500); 27 Apr 2006 15:22:17 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 13178 invoked by uid 99); 27 Apr 2006 15:22:16 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Apr 2006 08:22:16 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [212.74.184.209] (HELO mail.qos.ch) (212.74.184.209) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Apr 2006 08:22:12 -0700 Received: from kal.qos.ch (unknown [138.81.5.13]) by mail.qos.ch (Postfix) with ESMTP id 48555129D80 for ; Thu, 27 Apr 2006 17:21:50 +0200 (CEST) Message-Id: <6.0.0.22.0.20060427171958.01ef9e28@mail.qos.ch> X-Sender: blocked@mail.qos.ch (Unverified) X-Mailer: QUALCOMM Windows Eudora Version 6.0.0.22 Date: Thu, 27 Apr 2006 17:21:33 +0200 To: "Apache Directory Developers List" From: Ceki =?iso-8859-1?Q?G=FClc=FC?= Subject: Re: Upgrading the OSGi In-Reply-To: <1146150965.3663.29.camel@trout> References: <1145394893.3696.43.camel@trout> <44455B7A.5020707@apache.org> <1145479264.3691.44.camel@trout> <4449FCAE.1070409@apache.org> <1145931473.3649.58.camel@trout> <444E9C43.4030707@apache.org> <1146091499.3935.19.camel@trout> <568753d90604261641m3c3bf31dqbd92ba5a0e27a6ce@mail.gmail.com> <1146150965.3663.29.camel@trout> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1"; format=flowed Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N I recently read part of the OSGI spec to become familiar with it. Is there= =20 any support you would like to see included directly in SLF4J that could=20 make life easier for you? Cheers, At 05:16 PM 4/27/2006, you wrote: >On Wed, 2006-04-26 at 19:41 -0400, Enrique Rodriguez wrote: > > On 4/26/06, John E. Conlon wrote: > > > On Tue, 2006-04-25 at 18:01 -0400, Enrique Rodriguez wrote: > > ... > > > > I made a 'main' module that will > > > > assemble ApacheDS deps with the Felix runtime and startup with an > > > > ApacheDS Felix "profile." I just committed this on rev 396981. > > > > > > Yes I see it. Very nice. > > > > > > But, why the new org.apache.directory.server.Main class? Couldn't you > > > have reused Felix's main? > > > > Hmm, good point. I copied it as a start and, in retrospect, it ended > > up unchanged. I'll update to copy in the Felix main jar and test. > > > > ... > > > Should the log4j.properties file go in the conf directory with the= other > > > the properties files? > > > > Sure. That would be consistent with Felix convention. > > > > > Regarding logging, I needed to create a similar logging bundle to= yours > > > because some of my other bundles had transitive dependencies on= commons- > > > logging as well, so I added jcl104-over-slf4j. While at it, I added = an > > > Activator that reset the configuration at start time. Now no need to > > > restart the framework after changing the log4j.properties file, just > > > stop and start the log bundle. > > > > That's a nice feature. I did my POM wrapper to get things working. I > > don't plan on making any logging breakthroughs. At some point we can > > check out how any logging bundles out there turn out. > >Too many choices for logging - Commons-Logging vs slf4j vs OSGi >logService it is as bad as choosing an American Health Care plan. > >For what it's worth, below is a copy of the logging bundle Activator. > >-------------------------------------------- >import java.io.FileNotFoundException; >import java.net.MalformedURLException; >import java.net.URL; > >import org.apache.log4j.LogManager; >import org.apache.log4j.PropertyConfigurator; >import org.osgi.framework.BundleActivator; >import org.osgi.framework.BundleContext; >import org.slf4j.Logger; >import org.slf4j.LoggerFactory; > >public class Activator implements BundleActivator { > private static final String LOG_PROPERTIES_LOCATION =3D > "log4j.configuration"; > > private Logger log =3D null; > > public void start(BundleContext bundleContext) throws Exception { > try { > resetLog4j(bundleContext); > } catch (Exception e) { > //e.printStackTrace(); > } > log =3D LoggerFactory.getLogger(Activator.class); > log.debug("Reset log configuration."); > } > > public void stop(BundleContext arg0) throws Exception {} > > /** > * @return url of the log4j.properties configuration file > * > * @throws MalformedURLException > * > */ > private URL getLoggingProperty(BundleContext bundleContext) > throws MalformedURLException { > final String logPropertiesLocation =3D bundleContext > .getProperty(LOG_PROPERTIES_LOCATION); > return new URL(logPropertiesLocation); > } > > /** > * Reset the log4j configuration. > * @param bundleContext > * @throws MalformedURLException > * @throws FileNotFoundException > */ > private void resetLog4j(BundleContext bundleContext) > throws MalformedURLException, > FileNotFoundException { > > LogManager.resetConfiguration(); > URL log4jprops =3D getLoggingProperty(bundleContext); > > if (log4jprops !=3D null) { > PropertyConfigurator.configure(log4jprops); > } else { > throw new FileNotFoundException(bundleContext > .getProperty(LOG_PROPERTIES_LOCATION) > + " could not be found. " > + "Please specify add the file and restart the " > + bundleContext.getBundle().getLocation() + " bundle."); > } > } > >} --=20 Ceki G=FClc=FC http://ceki.blogspot.com/