Hi Vincent I do it this way (and I am really happy with it):
org.apache.log.Logger rootLogger = org.apache.log.Hierarchy.getDefaultHierarchy().getLoggerFor("MyApp"); MyApp main = new MyApp(args[0]); main.setLogger(rootLogger); main.initialize(); (later...) DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder(); Configuration cfg = cfgBuilder.buildFromFile(cfgFile); getLogger().setPriority(org.apache.log.Priority.getPriorityForName(cfg.getAttribute("log", "INFO"))); //Log Manager this.logmanager = new DefaultLogKitManager(); setupLogger(logmanager, "logmanager"); ((Configurable)logmanager).configure(cfg.getChild("logkit")); //Configuration this.manager = new ExcaliburComponentManager(); this.manager.setLogger(logmanager.getLogger("environment")); this.manager.setLogKitManager(logmanager); this.manager.configure(cfg.getChild("environment")); this.manager.initialize(); The config file looks approximately like this: <config log="INFO"> <logkit> <factories> <factory type="stream" class="org.apache.avalon.excalibur.logger.factory.StreamTargetFactory"/> <factory type="file" class="org.apache.avalon.excalibur.logger.factory.FileTargetFactory"/> <factory type="priority-filter" class="org.apache.avalon.excalibur.logger.factory.PriorityFilterTargetFactory"/> </factories> <targets> <stream id="console"> <stream>System.out</stream> <format type="avalon">%19.19{time:yyyy-MM-dd'T'HH:mm:ss.SSS} %5.5{priority}[%-15.15{category}]: %{message}\n%{throwable}</format> </stream> </targets> <categories> <category name="environment" log-level="INFO"> <log-target id-ref="console"/> </category> <category name="XML" log-level="DEBUG"> <log-target id-ref="console"/> <category name="XPath" log-level="DEBUG"> <log-target id-ref="console"/> </category> </category> </categories> </logkit> <components> <component role="com.outline.util.vfs.VFSManager" class="com.outline.util.vfs.DefaultVFSManager"> <vfs name="test" class="com.outline.util.vfs.os.OSFileSystem"> <root>../../test</root> </vfs> </component> <component role="com.outline.outputcenter.util.JNDIProviderSelector" class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector"> <component-instance name="default" class="com.outline.outputcenter.util.DefaultJNDIProvider" logger="JNDI"/> <component-instance name="jboss" class="com.outline.outputcenter.util.DefaultJNDIProvider" logger="JNDI"> <java.naming.factory.initial>org.jnp.interfaces.NamingContextFactory</java.naming.factory.initial> <java.naming.provider.url>localhost</java.naming.provider.url> <java.naming.factory.url.pkgs>org.jboss.naming</java.naming.factory.url.pkgs> </component-instance> </component> <!-- more config... --> </components> </config> Of course, I also have the chicken/egg problem until the logmanager has been started, but I can live with that since until this instant nothing important happens anyway. On Fri, 11 Jan 2002 08:17:58 -0000 Vincent Massol wrote: > Hi, > > I'm using ExcaliburComponentManager to manage my components. It needs a > LogKit logger to work. I am using something like : > > manager.setLogger(Hierarchy.getDefaultHierarchy().getLoggerFor("systemCo > nfig")); > > This works fine. However, the logs are printed on the console and I > would like to know how to configure it with other > appender/filters/format etc. I would like this configuration to be > externalized in a configuration file (same a log4j.properties or > log4j.xml one for Log4j). > > It is my understanding that logkit does not provide a configuration file > abstraction, is that right ? It is also my understanding that there is > an excalibur DefaultLogKitManager component that does this, is that > correct ? > > Looking at the source code for DefaultLogKitManager, I can see that : > * it is itself a component. So I'll have to manually initialize it as > there is no component manager at this stage, > * it itself needs a LogKit logger to work ... This is the chicken and > egg problem. > > What is the recommended way to do this ? Can someone provide some > pointers to me ? > > Thanks > -Vincent Cheers, Jeremias Märki mailto:[EMAIL PROTECTED] OUTLINE AG Postfach 3954 - Rhynauerstr. 15 - CH-6002 Luzern Fon +41 (41) 317 2020 - Fax +41 (41) 317 2029 Internet http://www.outline.ch -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>