You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the logback.groovy configuration file, setting the debug property results in a compilation error. 'debug' is not a good property name for the LogzioLogbackAppender and should probably be changed to 'isDebug' or something similar.
appender("LOGZIO", LogzioLogbackAppender) {
token ='my-token'
logzioUrl ='https://listener-wa.logz.io:8071'
logzioType = app
additionalFields ="env=$environment;appStack=$stack;appOwner=$appOwner;appId=$appId"
addHostname =true
format ='text'
line =true
debug =true//results in error
}
Error:
Reported exception:
groovy.lang.ReadOnlyPropertyException: Cannot set readonly property: DEBUG for class: ch.qos.logback.classic.Level
at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:2715)
at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:3809)
at org.codehaus.groovy.runtime.InvokerHelper.setProperty(InvokerHelper.java:215)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.setProperty(ScriptBytecodeAdapter.java:496)
at Script1$_run_closure1.doCall(Script1.groovy:22)
at Script1$_run_closure1.doCall(Script1.groovy)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:101)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:263)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1041)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:37)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:119)
at ch.qos.logback.classic.gaffer.ConfigurationDelegate.appender(ConfigurationDelegate.groovy:143)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:101)
at org.codehaus.groovy.runtime.metaclass.MixinInstanceMetaMethod.invoke(MixinInstanceMetaMethod.java:56)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoMetaMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:223)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:58)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:156)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:184)
at Script1.run(Script1.groovy:14)
at Script1$run.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:119)
at ch.qos.logback.classic.gaffer.GafferConfigurator.run(GafferConfigurator.groovy:77)
at ch.qos.logback.classic.gaffer.GafferConfigurator$run.callCurrent(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:156)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:168)
at ch.qos.logback.classic.gaffer.GafferConfigurator.run(GafferConfigurator.groovy:44)
at ch.qos.logback.classic.gaffer.GafferUtil.runGafferConfiguratorOn(GafferUtil.java:43)
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:84)
at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:107)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:295)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:269)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:281)
at io.micronaut.runtime.Micronaut.<clinit>(Micronaut.java:46)
at edu.ucr.cnc.app.Application.main(Application.groovy:12)
I have also tried setting the debug property after the appender is registered:
The problem with this is that the underlying LogzioSender object was already built and the debug property was set to false at the time of instantiation so it makes no difference.
@Doron-Bargo It is part of the configuration. Logback supports both XML configuration and Groovy configuration. When trying to set the debug property when using a groovy logback configuration file, it results in a compilation error.
After investigation, this ReadOnlyPropertyException occurs when using debug = true in logback.groovy because of a name collision within the Groovy DSL between the intended setDebug(boolean) method and Logback's static Level.DEBUG constant.
Workaround: Users configuring via logback.groovy should use the explicit setter method syntax:
appender("LOGZIO", io.logz.logback.LogzioLogbackAppender) {
// ... other settings ...
setDebug(true) // Use this instead of debug = true
}
Context: Please also note that official Groovy configuration support was removed in Logback 1.2.9+. To use logback.groovy with Logback 1.3+ (like the versions compatible with recent logzio-logback-appender releases), a third-party library such as virtualdogbert/logback-groovy-config is required (see also Stack Overflow discussion).
Resolution: No code changes are needed in logzio-logback-appender.
When using the logback.groovy configuration file, setting the debug property results in a compilation error. 'debug' is not a good property name for the LogzioLogbackAppender and should probably be changed to 'isDebug' or something similar.
Error:
I have also tried setting the debug property after the appender is registered:
The problem with this is that the underlying LogzioSender object was already built and the debug property was set to false at the time of instantiation so it makes no difference.
JDK: 11.0.7
Micronaut: 1.1.3
Logback: 1.2.3
logzio-logback-appender: 1.0.24
The text was updated successfully, but these errors were encountered: