2

I am trying to set logging in scout application, so I am trying to set PAX-logger.

I add pax-logging-api-1.7.0.jar, pax-logging-service-1.7.0.jar and pax-confman-propsloader-0.2.1.jar into my target.

I import all three into rap product. In config.ini I add

### Logging

log4j.rootLogger=DEBUG, A2
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.appender.A2=org.apache.log4j.FileAppender
log4j.appender.FILE.File=/Users/marko/Desktop/log.out
log4j.appender.X.layout=org.apache.log4j.PatternLayout

#A2 layout:
log4j.appender.X.layout.conversionPattern=%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

also in config.ini I add

osgi.bundles=org.eclipse.equinox.cm@1\:start,org.ops4j.pax.logger.*@2\:start,org.ops4j.pax.confman.propsloader@2\:start

If I start application logs are logged into console but not in file. And loggs inside console is not formatted as it is set in config.ini. Then I discover that I haven't include org.service.cm in in product. When I add this in product I have error :

org.osgi.framework.BundleException: Could not resolve module: org.eclipse.equinox.cm [1]
 Unresolved requirement: Import-Package: org.osgi.service.cm; version="[1.5.0,1.6.0)

Even if I have this package inside org.apache.felix.configadmin.

I follow instruction on : https://ops4j1.jira.com/wiki/display/paxlogging/PaxLogging+inside+PDE

and

https://ops4j1.jira.com/wiki/display/paxlogging/How+to+use+Pax+Logging+in+my+bundles.

What worries me is :

ensure that log4j.jar, commons-logging.jar, and any other legacy API that you want to use, are NOT included in your bundle jar.

and I am not shore if this is posible. (docx4j use log4j)

Marko Zadravec
  • 8,298
  • 10
  • 55
  • 97

0 Answers0