Skip to main content

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 16:18
Daniel McGreal is currently offline Daniel McGrealFriend
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/ 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

Bundle Symbolic Name

Bundle Version

Export Version

Export Directives
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

Export Attributes

Any ideas?

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

Current Time: Tue May 22 23:43:52 GMT 2018

Powered by FUDForum. Page generated in 0.02008 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top