PaxLogging inside PDE
How to configure pax logging (for Eclipse PDE users)
Working solution discovered in experiments.
Any comments will be appreciated.
Get Pax Logging
Get pax-logging-api and pax-logging-service bundles and put in your target platform.
Use Configuration Admin for setting up logging
Install Configuration Admin implementation
from Equinox
Either, get ready bundle
download bundle org.eclipse.equinox.cm_3.2.0.v20070116.jar from http://europa-mirror1.eclipse.org/eclipse/equinox/drops/R-3.3-200706251500/index.php
add to target platform
Or, build from source:
get
org.eclipse.equinox.cmfrom CVS:
CVSROOT::pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse
module:equinox-incubator/org.eclipse.equinox.cmImport project to Eclipse.
or from Knopflerfish
put
org.knopflerfish.bundle.cm-cm_all-2.0.0.jarin your target platform dir
Install and configure propsloader
Get propsloader bundle and put in your target platform.
check (or set) your working dir for OSGi Framework Run configuration
In that directory create subdir
configurationsand nestedfactoriesandservices
In
servicesdir create fileorg.ops4j.pax.logging.propertieswith setting in Log4j properties format, for example:log4j.rootLogger=DEBUG, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout #default layout: #log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n log4j.appender.A1.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p [%-30.30t] %-40.40c %x - %m%n log4j.logger.org.springframework.osgi=DEBUG log4j.logger.org.springframework=INFO log4j.logger.org.apache.wicket=INFO log4j.logger.org.mortbay=INFO log4j.logger.org.apache.wicket.util.thread=INFO log4j.logger.org.compass.core.lucene.engine.optimizer.ScheduledLuceneSearchEngineOptimizer=INFO log4j.logger.org.springframework.osgi.extender.internal.support.NamespaceManager=INFO log4j.logger.org.springframework.osgi.extender.internal.support.NamespacePlugins=INFO
set lowest (for example 1) start level for bundle:
org.eclipse.equinox.cmand one higher (for example 2) start level for bundles:
org.ops4j.pax.logging.* org.ops4j.pax.confman.propsloaderto make sure that logging is correct set up, before other bundles will log.
if you want to change logging settings at runtime, simply change your
org.ops4j.pax.logging.propertiesfile and from osgi console updateorg.ops4j.pax.confman.propsloaderbundle.