Is there a simple way to use logging in a Groovy Script?
My naiv attempt looks like this (as Camunda uses SLF4J and following this: Inject Logger into Script engine groovy - #4 by StephenOTT):
import org.slf4j.*
Logger logger = LoggerFactory.getLogger("MyScriptLogger");
logger.info("Hello World");
But this gives me this:
17-Aug-2020 11:22:44.612 SEVERE [http-nio-8080-exec-17] org.camunda.commons.logging.BaseLogger.logError ENGINE-16004 Exception while closing command context: Unable to evaluate script: java.lang.IllegalArgumentException: UTILS-02001 Parameter 'parameter' is null
org.camunda.bpm.engine.ScriptEvaluationException: Unable to evaluate script: java.lang.IllegalArgumentException: UTILS-02001 Parameter 'parameter' is null
at org.camunda.bpm.engine.impl.scripting.CompiledExecutableScript.evaluate(CompiledExecutableScript.java:61)
at org.camunda.bpm.engine.impl.scripting.SourceExecutableScript.evaluate(SourceExecutableScript.java:61)
at org.camunda.bpm.engine.impl.scripting.ResourceExecutableScript.evaluate(ResourceExecutableScript.java:46)
at org.camunda.bpm.engine.impl.scripting.ExecutableScript.execute(ExecutableScript.java:63)
at org.camunda.bpm.engine.impl.scripting.env.ScriptingEnvironment.execute(ScriptingEnvironment.java:101)
at org.camunda.bpm.engine.impl.scripting.env.ScriptingEnvironment.execute(ScriptingEnvironment.java:87)
at org.camunda.bpm.engine.impl.delegate.ScriptInvocation.invoke(ScriptInvocation.java:47)
at org.camunda.bpm.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:58)
at org.camunda.bpm.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocationInContext(DefaultDelegateInterceptor.java:92)