
Hi Rathnadhar, I can run config file finr. It runs without generating a java.lang.VerifyError. Which JDK are you using? -- Ceki On 28.02.2011 09:13, rathnadhar.kolar@wipro.com wrote:
Namasthe,
I have switched from log4j to logback. For configuration, I initially worked with logback.xml which worked fine. I wanted to get rid of xml so re-wrote the logback.xml in groovy.
The logback.groovy is as below:
*import*ch.qos.logback.classic.PatternLayout
*import*ch.qos.logback.classic.filter.ThresholdFilter
*import*ch.qos.logback.classic.net.SMTPAppender
*import*ch.qos.logback.core.ConsoleAppender
*import*ch.qos.logback.core.rolling.FixedWindowRollingPolicy
*import*ch.qos.logback.core.rolling.RollingFileAppender
*import*ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy
*import**static*ch.qos.logback.classic.Level.ERROR
*import**static*ch.qos.logback.classic.Level.INFO
appender("RootFileAppender", RollingFileAppender) {
file = "project"
append = *true*
filter(ThresholdFilter) {
level = INFO
}
rollingPolicy(FixedWindowRollingPolicy) {
fileNamePattern = "project_log.%i"
maxIndex = 1
}
triggeringPolicy(SizeBasedTriggeringPolicy) {
maxFileSize = 1000000
}
layout(PatternLayout) {
pattern = "%d{yyyy-MM-dd HH:mm:ss}, %p, %c, %t, %ex, %F, %L, %C{1}, %M %m%n"
}
}
appender("RootConsoleAppender", ConsoleAppender) {
filter(ThresholdFilter) {
level = INFO
}
layout(PatternLayout) {
pattern = "%d{yyyy-MM-dd HH:mm:ss}, %p, %c, %t %m%n"
}
}
appender("RootEmailAppender", SMTPAppender) {
filter(ThresholdFilter) {
level = ERROR
}
bufferSize = 10
SMTPHost = "smtp.hostaddress"
to = "logback.user@xyz.com"
from = " logback.user@xyz.com "
username = "user"
password = "password"
subject = "Logback Error"
layout(PatternLayout) {
pattern = "%d{yyyy-MM-dd HH:mm:ss}, %p, %c, %t, %ex, %F, %L, %C{1}, %M %m%n"
}
}
root(INFO, ["RootFileAppender", "RootConsoleAppender", "RootEmailAppender"])
(Some values have been masked for security reasons).
I put this file in the classpath.
After that I started my application, but I got this exception:
Failed to instantiate [ch.qos.logback.classic.LoggerContext]
Reported exception:
java.lang.VerifyError: (class: groovy/runtime/metaclass/java/lang/StringMetaClass, method: super$2$invokeMethod signature: (Ljava/lang/Class;Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/Object;ZZ)Ljava/lang/Object;) Illegal use of nonvirtual function call
at java.lang.Class.forName0(_Native Method_)
at java.lang.Class.forName(_Class.java:169_)
at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createWithCustomLookup(_MetaClassRegistry.java:127_)
at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.create(_MetaClassRegistry.java:122_)
at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(_ClassInfo.java:165_)
at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(_ClassInfo.java:195_)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(_MetaClassRegistryImpl.java:214_)
at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(_InvokerHelper.java:747_)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.createPojoSite(_CallSiteArray.java:107_)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallSite(_CallSiteArray.java:148_)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(_CallSiteArray.java:40_)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(_AbstractCallSite.java:116_)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(_AbstractCallSite.java:124_)
at ch.qos.logback.classic.gaffer.ConfigurationDelegate.appender(ConfigurationDelegate.groovy:117)
at sun.reflect.NativeMethodAccessorImpl.invoke0(_Native Method_)
at sun.reflect.NativeMethodAccessorImpl.invoke(_NativeMethodAccessorImpl.java:39_)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(_DelegatingMethodAccessorImpl.java:25_)
at java.lang.reflect.Method.invoke(_Method.java:597_)
at org.codehaus.groovy.reflection.CachedMethod.invoke(_CachedMethod.java:90_)
at org.codehaus.groovy.runtime.metaclass.MixinInstanceMetaMethod.invoke(_MixinInstanceMetaMethod.java:53_)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoMetaMethodSiteNoUnwrapNoCoerce.invoke(_PogoMetaMethodSite.java:307_)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(_PogoMetaMethodSite.java:51_)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(_CallSiteArray.java:44_)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(_AbstractCallSite.java:141_)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(_AbstractCallSite.java:157_)
at Script1.run(Script1.groovy:24)
at Script1$run.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(_CallSiteArray.java:40_)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(_AbstractCallSite.java:116_)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(_AbstractCallSite.java:120_)
at ch.qos.logback.classic.gaffer.GafferConfigurator.run(GafferConfigurator.groovy:59)
at ch.qos.logback.classic.gaffer.GafferConfigurator$run.callCurrent(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(_CallSiteArray.java:44_)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(_AbstractCallSite.java:141_)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(_AbstractCallSite.java:149_)
at ch.qos.logback.classic.gaffer.GafferConfigurator.run(GafferConfigurator.groovy:37)
at ch.qos.logback.classic.gaffer.GafferUtil.runGafferConfiguratorOn(_GafferUtil.java:44_)
at ch.qos.logback.classic.util.ContextInitializer.configureByResource(_ContextInitializer.java:67_)
at ch.qos.logback.classic.util.ContextInitializer.autoConfig(_ContextInitializer.java:150_)
at org.slf4j.impl.StaticLoggerBinder.init(_StaticLoggerBinder.java:85_)
at org.slf4j.impl.StaticLoggerBinder.<clinit>(_StaticLoggerBinder.java:55_)
at org.slf4j.LoggerFactory.bind(_LoggerFactory.java:121_)
at org.slf4j.LoggerFactory.performInitialization(_LoggerFactory.java:111_)
at org.slf4j.LoggerFactory.getILoggerFactory(_LoggerFactory.java:268_)
at org.slf4j.LoggerFactory.getLogger(_LoggerFactory.java:241_)
at src.temporalprocessing.StartProgram.<clinit>(_StartProgram.java:37_)
When I switch from logback.groovy to logback.xml, everything works perfectly (both the configurations are equal in functionality).
My google search did not yield useful information.
I am using the following jars:
1.groovy-all-1.7.8.jar
2.logback-access-0.9.28.jar
3.logback-classic-0.9.28.jar
4.logback-core-0.9.28.jar
5.slf4j-api-1.6.1.jar
Can somebody please help me to resolve the issue.
Regards
Rathnadhar.K.V
*Please do not print this email unless it is absolutely necessary. *
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
www.wipro.com
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user