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 = "log4j.configuration"; private Logger log = null; public void start(BundleContext bundleContext) throws Exception { try { resetLog4j(bundleContext); } catch (Exception e) { //e.printStackTrace(); } log = 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 = 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 = getLoggingProperty(bundleContext); if (log4jprops != 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."); } } }