logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Magnusson <andreas.ch.magnus...@gmail.com>
Subject [LOG4J 2] log4j-1.2-api hardcoded against log4j-core?
Date Thu, 07 Nov 2013 11:45:12 GMT
Hi all, I'm currently prototyping a move from our proprietary logging
framework to log4j 2.0.
I've taken the route of creating a bridge from our API to log4j-api
(inspired by log4j-slf4j-impl) and a "server" bridge in the same way (via
LoggerContextFactory).

I then created a test application that used log4j-api, log4j-slf4j-impl,
log4j-jcl , jul (through slf4j), log4j-1.2-api and our own api all at once
to make sure that everything was translated correctly.
That's when I got the following exception when getting a logger through
log4j-1.2-api:
java.lang.ClassCastException: com.example.InternalContext cannot be cast to
org.apache.logging.log4j.core.LoggerContext
    at org.apache.log4j.LogManager.getLogger(LogManager.java:77)
    at com.example.loggingTest.Module.log4jLog(Module.java:71)
    at com.example.loggingTest.Module.startModule(Module.java:23)
    at
com.example.node.application.ModuleLoader$4.run(ModuleLoader.java:735)

Is this by design? The reason I'm asking is that the other bridges (i.e.
log4j-jcl and log4j-slf4j-impl) are fine with my own defined
LoggingContext, it's only log4j-1.2-api that has this problem. Of course
the plan is to use log4j-core as the framework, so it's not that big a deal
for me personally.

Other than that, great work!

Regards,
Andreas Magnusson

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message