Actually, I'd very much appreciate you NOT going back to log4j 1 and working through this.
LogManager calls ProviderUtils.getProviders(). ProviderUtil has a static initializer that calls the ClassLoader's getResources method looking for all instances of the file "META-INF/log4j-provider.properties". A Log4j 2 implementation will have one of these files and specify what version of the Log4j 2 API it is compatible with, the LoggerContextFactory class name and the "priority" of the factory. What you are experiencing indicates that when the ProviderUtils class is loaded the Log4j 2 implementation is somehow not yet present. Ralph On Aug 16, 2013, at 2:17 AM, Roland wrote: > some trace > > LogManager line 58: factoryClass is null > line 76: hasProviders() returns false > > lb > START LEVEL 4 > ID|State |Level|Name > 0|Active | 0|System Bundle (4.2.1) > 4|Active | 2|Apache Felix Bundle Repository (1.6.6) > 5|Active | 2|Apache Felix Configuration Admin Service (1.6.0) > 6|Active | 2|Apache Felix Gogo Command (0.12.0) > 7|Active | 2|Apache Felix Gogo Runtime (0.10.0) > 8|Active | 2|Apache Felix Gogo Shell (0.10.0) > 9|Resolved | 2|Apache Felix Security Provider (2.2.0) > 10|Active | 2|Apache Felix Shell Service (1.4.3) > 11|Active | 2|Apache Log4j 1.x Compatibility API > (2.0.0.beta9-SNAPSHOT) > 12|Active | 2|Apache Log4j API (2.0.0.beta9-SNAPSHOT) > 13|Active | 2|Apache Log4j Commons Logging Bridge > (2.0.0.beta9-SNAPSHOT) > 14|Resolved | 2|Apache Log4j Core (2.0.0.beta9-SNAPSHOT) > 15|Active | 2|Apache Log4j SLF4J Binding (2.0.0.beta9-SNAPSHOT) > 16|Active | 2|cal10n-api (0.7.4) > 17|Active | 2|Commons IO (2.4.0) > 18|Active | 2|Commons Lang (2.6.0) > 19|Active | 2|Disruptor Framework (3.1.1) > 20|Active | 2|Jackson-annotations (2.2.2) > 21|Active | 2|Jackson-core (2.2.2) > 22|Active | 2|jackson-databind (2.2.2) > 23|Active | 2|JSON.simple (1.1.1) > 24|Active | 2|MongoDB Java Driver (2.11.2.RELEASE) > 25|Active | 2|slf4j-api (1.7.5) > 26|Active | 2|slf4j-ext (1.7.5) > > > g! inspect req * 14 > org.apache.logging.log4j-core [14] requires: > -------------------------------------------- > osgi.wiring.host; > (&(osgi.wiring.host=org.apache.logging.log4j-api)(bundle-version>=2.0.0.beta9-SNAPSHOT)) > resolved by: > osgi.wiring.host; org.apache.logging.log4j-api 2.0.0.beta9-SNAPSHOT from > org.apache.logging.log4j-api [12] > > g! inspect cap * 12 > org.apache.logging.log4j-api [12] provides: > ------------------------------------------- > osgi.wiring.bundle; org.apache.logging.log4j-api 2.0.0.beta9-SNAPSHOT > [UNUSED] > osgi.wiring.host; org.apache.logging.log4j-api 2.0.0.beta9-SNAPSHOT required > by: > org.apache.logging.log4j-core [14] > my.package.my-log4j2-config [1] > osgi.wiring.package; org.apache.logging.log4j.message 2.0.0.beta9-SNAPSHOT > required by: > org.apache.logging.log4j-1.2-api [11] > osgi.wiring.package; org.apache.logging.log4j.util 2.0.0.beta9-SNAPSHOT > [UNUSED] > osgi.wiring.package; org.apache.logging.log4j.simple 2.0.0.beta9-SNAPSHOT > [UNUSED] > osgi.wiring.package; org.apache.logging.log4j.status 2.0.0.beta9-SNAPSHOT > [UNUSED] > osgi.wiring.package; org.apache.logging.log4j 2.0.0.beta9-SNAPSHOT required > by: > de.ids.acos.rtu.osgi.bundles.acos-rtu-logservice [2] > org.apache.logging.log4j-1.2-api [11] > osgi.wiring.package; org.apache.logging.log4j.spi 2.0.0.beta9-SNAPSHOT > required by: > org.apache.logging.log4j-1.2-api [11] > osgi.wiring.package; org.apache.logging.log4j.core.appender.rewrite > 2.0.0.beta9-SNAPSHOT [UNUSED] > osgi.wiring.package; org.apache.logging.log4j.core.impl 2.0.0.beta9-SNAPSHOT > [UNUSED] > osgi.wiring.package; org.apache.logging.log4j.core.pattern > 2.0.0.beta9-SNAPSHOT [UNUSED] > osgi.wiring.package; org.apache.logging.log4j.core.appender.db.jpa.converter > 2.0.0.beta9-SNAPSHOT [UNUSED] > osgi.wiring.package; org.apache.logging.log4j.core.web 2.0.0.beta9-SNAPSHOT > [UNUSED] > osgi.wiring.package; org.apache.logging.log4j.core.filter > 2.0.0.beta9-SNAPSHOT [UNUSED] > osgi.wiring.package; org.apache.logging.log4j.core 2.0.0.beta9-SNAPSHOT > required by: > org.apache.logging.log4j-1.2-api [11] > osgi.wiring.package; org.apache.logging.log4j.core.lookup > 2.0.0.beta9-SNAPSHOT [UNUSED] > osgi.wiring.package; org.apache.logging.log4j.core.appender.db.nosql > 2.0.0.beta9-SNAPSHOT [UNUSED] > osgi.wiring.package; org.apache.logging.log4j.core.appender.db.jdbc > 2.0.0.beta9-SNAPSHOT [UNUSED] > osgi.wiring.package; org.apache.logging.log4j.core.appender > 2.0.0.beta9-SNAPSHOT [UNUSED] > osgi.wiring.package; org.apache.logging.log4j.core.appender.db > 2.0.0.beta9-SNAPSHOT [UNUSED] > osgi.wiring.package; org.apache.logging.log4j.core.selector > 2.0.0.beta9-SNAPSHOT [UNUSED] > osgi.wiring.package; org.apache.logging.log4j.core.jmx 2.0.0.beta9-SNAPSHOT > [UNUSED] > osgi.wiring.package; org.apache.logging.log4j.core.appender.db.nosql.couch > 2.0.0.beta9-SNAPSHOT [UNUSED] > osgi.wiring.package; org.apache.logging.log4j.core.async > 2.0.0.beta9-SNAPSHOT [UNUSED] > osgi.wiring.package; org.apache.logging.log4j.core.helpers > 2.0.0.beta9-SNAPSHOT required by: > org.apache.logging.log4j-1.2-api [11] > osgi.wiring.package; org.apache.logging.log4j.core.config.plugins > 2.0.0.beta9-SNAPSHOT [UNUSED] > osgi.wiring.package; org.apache.logging.log4j.core.layout > 2.0.0.beta9-SNAPSHOT [UNUSED] > osgi.wiring.package; org.apache.logging.log4j.core.net 2.0.0.beta9-SNAPSHOT > [UNUSED] > osgi.wiring.package; org.apache.logging.log4j.core.config > 2.0.0.beta9-SNAPSHOT [UNUSED] > osgi.wiring.package; org.apache.logging.log4j.core.appender.rolling.helper > 2.0.0.beta9-SNAPSHOT [UNUSED] > osgi.wiring.package; org.apache.logging.log4j.core.appender.db.nosql.mongo > 2.0.0.beta9-SNAPSHOT [UNUSED] > osgi.wiring.package; org.apache.logging.log4j.core.appender.db.jpa > 2.0.0.beta9-SNAPSHOT [UNUSED] > osgi.wiring.package; org.apache.logging.log4j.core.appender.rolling > 2.0.0.beta9-SNAPSHOT [UNUSED] > osgi.wiring.package; org.apache.logging.log4j.core.appender.routing > 2.0.0.beta9-SNAPSHOT [UNUSED] > > > How does the LogManager seek the implementation? As you can see > org.apache.logging.log4j.core.impl is unused. > I'm running out of ideas...I'm thinking about switching back to the old > log4j. Keep it simple, stupid. > > > > -- > View this message in context: > http://apache-logging.6191.n7.nabble.com/Discussion-about-correct-initialization-of-log4j2-in-OSGi-context-tp39733p39760.html > Sent from the Log4j - Users mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
