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/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: Fri Apr 26 23:59:31 GMT 2024

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

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

Back to the top