[logback-user] JoranConfigurator + LoggerContext dont find classes
Pepe Caballero
jose.caballero at tecnova.es
Thu Feb 2 09:44:03 CET 2012
I solved it changed code of logback-core.
Class ch.qos.logback.core.joran.action.NestedComplexPropertyIA
line 100
Change
componentClass = Loader.loadClass(className,context);
for
componentClass = Loader.loadClass(className);
and all works correctly
¿why?
Pepe Caballero wrote:
>
> I am using joran Configurator to load muy logback.xml. I do this:
>
> LoggerContext context = (LoggerContext)
> LoggerFactory.getILoggerFactory();
> JoranConfigurator configurator = new JoranConfigurator();
> configurator.setContext(context);
> context.reset();
> if (logbackfile != null) {
> InputStream fis =
>
> getServletContext().getResourceAsStream(logbackfile);
> configurator.doConfigure(fis);
> }
>
> In my integrated WebLogic Server it works perfect but when i deploy it in
> a production server it can find my classes that i configured in
> logback.xml as a evaluator. You can see on the end.
>
> It looks LoggerContext dont load class correctly. I have try to use
> ch.qos.logback.core.util.Loader.loadClass("util.log.LogSMTPEvaluator") and
> works perfectly but when i use
> ch.qos.logback.core.util.Loader.loadClass("util.log.LogSMTPEvaluator",context)
> it doenst works.
>
> ¿any idea please?
>
>
> ----------------------------------------------
> I generated a smtp appender with my evaluator.
> in logBack.xml I have
>
> <appender name="Email"
> class="ch.qos.logback.classic.net.SMTPAppender">
> <evaluator class="util.log.LogSMTPEvaluator"/>
> <smtpHost>${correo.name.direccionSMTP}</smtpHost>
> <to>${correo.name.to}</to>
> <from>${correo.name.from}</from>
> <username>${correo.name.usuario}</username>
> <password>${correo.name.clave}</password>
> <layout class="ch.qos.logback.classic.html.HTMLLayout">
> <pattern>%d{yyyy-MM-dd HH:mm:ss}==> %m%n</pattern>
> </layout>
> </appender>
>
> When I deploy in integrated Weblogic Server with Jdeveloper11 it works
> fine. But, when i generated ear and deploy over my Weblogic Server i get:
> 12:32:57,830 |-ERROR in
> ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Could not
> create component [evaluator] of type [util.log.LogSMTPEvaluator]
> java.lang.ClassNotFoundException: util.log.LogSMTPEvaluator
> at java.lang.ClassNotFoundException: util.log.LogSMTPEvaluator
> at at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
> at at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
> at at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
> at at ch.qos.logback.core.util.Loader.loadClass(Loader.java:123)
> at at
> ch.qos.logback.core.joran.action.NestedComplexPropertyIA.begin(NestedComplexPropertyIA.java:100)
> My aplication.ear have:
> - model.jar
> - logback-access-1.0.0.jar
> - logback-classic-1.0.0.jar
> - logback-core-1.0.0.jar
> - anothers jar libraries
> - view.war
>
> logback.xml is in view.war/WEB-INF/log-back.xml and
> util.log.LogSMTPEvaluator in model.jar.
> LogBack is initialize in a servlet init in view.war
>
>
--
View this message in context: http://old.nabble.com/JoranConfigurator-%2B-LoggerContext-dont-find-classes-tp33243148p33248534.html
Sent from the Logback User mailing list archive at Nabble.com.
More information about the Logback-user
mailing list