|HOW-TO: Logging with the logback Consoleappender and/or custom appenders? [message #782851]
||Tue, 24 January 2012 15:21
|| Jochen Szostek
Registered: January 2011
I'm experimenting with logging in Virgo, and I'm trying to route the console output of my bundles into the main logging console (like in this thread is mentioned)
But I get:
org.eclipse.virgo.medic.log.impl.logback.LoggerContextConfigurationFailedException: Configuration failed with the following problems: [Could not create an Appender of type [ch.qos.logback.core.Consoleappender]. Caused by java.lang.ClassNotFoundException: ch.qos.logback.core.Consoleappender., ActionException in Action for tag [appender] Caused by ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.core.Consoleappender.]
Do I have to edit the default logback jar MANIFEST.MF (provided by Virgo) and add a fragment host in there? Seems odd as this is a quite default appender type.
I got the idea from reading this btw:
Finally, if your appenders are 'static' and you want to guarantee them to be available from the very start, logback does the loading of appenders from its classpath and the appenders need to be on the bundle classpath of the medic bundle. Without modifying medic what you do is to put the appender code in a fragment bundle and define medic as the host fragment. The fragment bundle is then deployed by putting it in the kernel region launch list. This effectively makes it part of the kernel.
If you want to dynamically add your appender to logback (using the addappender api on Logger) then there is no need to have a fragment bundle, just make sure that the appender is added when the appender bundle is started. In this last case, it is still necessary to put the appender code in the kernel launch list -- after the medic bundle.
in the thread here
"The fragment bundle is then deployed by putting it in the kernel region launch list." => does that mean add it to the org.eclipse.virgo.kernel.userregion.properties file? (because logback is already in there)
One last question, if I want to deploy a fully custom appender, would I have to (1) add it to the virgo lib folder and (2) add it to the classpath + (3) add fragment host + (4) add to kernel region launch list?
Thanks a whole lot in advance!
Powered by FUDForum
. Page generated in 0.03019 seconds