Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » Creating logback logger, programatically.(Class cast exception on LoggerContext, caused by multiple bundles exporting the same packages)
Creating logback logger, programatically. [message #1110261] Mon, 16 September 2013 12:18
Daniel McGreal is currently offline Daniel McGreal
Messages: 12
Registered: January 2013
Junior Member
Hi Virgorians,

I'd like to progrmmatically create a logback logger. In the first instance I get a ClassCastException on the following line:

ch.qos.logback.core.LoggerContext context = (ch.qos.logback.core.LoggerContext) LoggerFactory.getILoggerFactory();

which tells me that ch.qos.logback.core.LoggerContext cannot be cast to ch.qos.logback.core.LoggerContext.

Fine, I think to myself, I understand this - the one from the LoggerFactory is made by the kernel, and I've somehow linked to a logback that isn't the same class. Investigating further, I find the culprits and remove them. Only now, my bundle's dependencies are unsatisfactory, with errors importing ch.qos.logback.core, etc.

I found "packageImports" in configuration/org.eclipse.virgo.kernel.userregion.properties which has ch.qos.logback.* inside, the admin console tells me that ch.qos.logback.core is available to be imported, e.g:

--
Bundle Id
3

Bundle Symbolic Name
ch.qos.logback.core

Bundle Version
1.0.0.v20111214-2030

Export Version
1.0.0

Export Directives
x-equinox-ee:=-1
uses:=ch.qos.logback.core.spi, ch.qos.logback.core.status, ch.qos.logback.core.helpers, ch.qos.logback.core.filter, ch.qos.logback.core.encoder, ch.qos.logback.core.joran.spi
x-internal:=false

Export Attributes
--


Any ideas?

Many thanks, Dan.
Previous Topic:Custom OSGi Container vs Virgo
Next Topic:hibernate.cfg issues
Goto Forum:
  


Current Time: Mon Sep 01 17:04:00 EDT 2014

Powered by FUDForum. Page generated in 0.01583 seconds