cannot use lift-util in OSGi environment w/out log4j
Hi,
I'd like to use lift-utils in an OSGi environment with LogBack (SLF4J) used for logging.
Unfortunately lift-utils requires log4j:
Now if one adds the log4j bridge from SLF4J ( Bridging legacy APIs ) one still has errors:
So one's stuck and cannot use LogBack or any other SLF4J backend.
@@@@
For a quick test do the following:
Download/install Pax-Construct ( http://www.ops4j.org/projects/pax/construct/ )
Then issue the following commands:
Start OSGi framework:
Install log4j bridge:
Start OSGi framework again:
I'd like to use lift-utils in an OSGi environment with LogBack (SLF4J) used for logging.
Unfortunately lift-utils requires log4j:
osgi> ss
Framework is launched.
id State Bundle
0 ACTIVE org.eclipse.osgi_3.5.1.R35x_v20090827
1 ACTIVE slf4j.api_1.5.10
2 ACTIVE ch.qos.logback.core_0.9.18
3 ACTIVE ch.qos.logback.classic_0.9.18
4 ACTIVE org.scala-lang-osgi.scala-library_2.7.7
5 ACTIVE com.springsource.org.apache.commons.codec_1.4.0
6 ACTIVE com.springsource.javax.mail_1.4.1
7 INSTALLED net.liftweb.lift-util_2.0.0.M2
8 ACTIVE net.liftweb.lift-actor_2.0.0.M2
9 ACTIVE net.liftweb.lift-common_2.0.0.M2
osgi> diag 7
initial@reference:file:../bundles/net.liftweb.lift-util_2.0.0.M2.jar/ [7]
Direct constraints which are unresolved:
Missing imported package net.liftweb.util_[2.0.0.M2,2.1.0).
Missing imported package org.apache.log4j_0.0.0.
Missing imported package org.apache.log4j.spi_0.0.0.
Missing imported package org.apache.log4j.xml_0.0.0.
Now if one adds the log4j bridge from SLF4J ( Bridging legacy APIs ) one still has errors:
osgi> ss
Framework is launched.
id State Bundle
0 ACTIVE org.eclipse.osgi_3.5.1.R35x_v20090827
1 ACTIVE slf4j.api_1.5.10
2 ACTIVE log4j.over.slf4j_1.5.10
3 ACTIVE ch.qos.logback.core_0.9.18
4 ACTIVE ch.qos.logback.classic_0.9.18
5 ACTIVE org.scala-lang-osgi.scala-library_2.7.7
6 ACTIVE com.springsource.org.apache.commons.codec_1.4.0
7 ACTIVE com.springsource.javax.mail_1.4.1
8 INSTALLED net.liftweb.lift-util_2.0.0.M2
9 ACTIVE net.liftweb.lift-actor_2.0.0.M2
10 ACTIVE net.liftweb.lift-common_2.0.0.M2
osgi> diag 8
initial@reference:file:../bundles/net.liftweb.lift-util_2.0.0.M2.jar/ [8]
Direct constraints which are unresolved:
Missing imported package net.liftweb.util_[2.0.0.M2,2.1.0).
Missing imported package org.apache.log4j.spi_0.0.0.
Missing imported package org.apache.log4j.xml_0.0.0.
osgi> packages 2
org.apache.log4j; version="0.0.0"<log4j.over.slf4j_1.5.10 [2]>
So one's stuck and cannot use LogBack or any other SLF4J backend.
@@@@
For a quick test do the following:
Download/install Pax-Construct ( http://www.ops4j.org/projects/pax/construct/ )
Then issue the following commands:
pax-create-project -g test -a test -v 1.0-SNAPSHOT
cd test
sed -i -e "s/--platform=felix/--platform=equinox/g" pom.xml
rm pom.xml-e
pax-add-repository -i com.springsource.repository.bundles.release -u http://repository.springsource.com/maven/bundles/release
pax-add-repository -i scala-tools.org -u http://scala-tools.org/repo-releases
pax-import-bundle -g org.scala-lang-osgi -a scala-library -v 2.7.7
pax-import-bundle -g org.slf4j -a slf4j-api -v 1.5.10
pax-import-bundle -g ch.qos.logback -a logback-core -v 0.9.18
pax-import-bundle -g ch.qos.logback -a logback-classic -v 0.9.18
pax-import-bundle -g org.apache.commons -a com.springsource.org.apache.commons.codec -v 1.4.0
pax-import-bundle -g javax.mail -a com.springsource.javax.mail -v 1.4.1
pax-import-bundle -g net.liftweb -a lift-common -v 2.0-M2
pax-import-bundle -g net.liftweb -a lift-actor -v 2.0-M2
pax-import-bundle -g net.liftweb -a lift-util -v 2.0-M2
Start OSGi framework:
pax-provision
Install log4j bridge:
pax-import-bundle -g org.slf4j -a log4j-over-slf4j -v 1.5.10
Start OSGi framework again:
pax-provision
Leave a comment