First of all, if you want to have a working logging with Karaf, use the
logging provided by it.
Karaf uses Pax Logging which supports a wide range of logging frameworks.
So don't embed log4j in your bundles. It's not needed and just doesn't work
that way!
You also should check the way you do your logging. Either you have a custom
appender which needs to be registered in a different way.
Or you doing something else strange.
Cause usually a logging like the following is sufficient:
LoggerFactory.getLogger(LoggingClass.class);
log.error("this is my error message with content {}", content); //slf4j
style logging
For using a custom appender (or something similar), you either might check
the mailing-list or take a look at [1].
regards, Achim
[1] -
http://notizblog.nierbeck.de/2011/08/adding-custom-log-appender-to-pax-logging/
2014-08-13 20:35 GMT+02:00 bane73 <[email protected]>:
> Not really the most correct answer, but try modifying your export section
> to
> export everything.
> That SHOULD work, I believe, because your project is using that JAR (thus,
> it's contained inside of it) but you are not telling OSGI that you want to
> use it and so it is blocking it from your JAR's classpath.
>
> IOW, in your POM right below the <Bundle-ClassPath> section you should have
> a <Export-Package> section. Delete everything and replace with a wildcard:
>
> ie: <Export-Package>*</Export-Package>
>
> That should do the trick. If it does, don't settle for that though. The
> correct answer is, I think, to install org.apache.log4j either as it's own
> bundle or as a part of a "dependency"-bundle. I'm still pretty new to
> OSGI,
> though, so I could be wrong.
>
>
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/No-appenders-could-be-found-for-logger-log4j-related-tp4034739p4034748.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>
--
Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Software Architect / Project Manager / Scrum Master