Global Logging for BPMN Scripts


Hi first,

what I want:
i want to use a logger in every script without having to initialize the logger every time

how it works
in a normal script task
the script format is groovy:

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Logger log = LoggerFactory.getLogger(“irgendwas”);“any text”);

as I want it to work
I only want to use the logger without any imports and initializations
like this:“any text”);

Is it possible?


Create a class with the logger as a static field. Then import the class and access the logger through the static field ?


Thank you for the fast answer,

On the way you described i would still have to make an import in every bpmn script.
I am looking for a solution like the interface DelegateExecution that is available everywhere without imports


afaik, you will have to implement edits to how the Bindings are added into the Script Engine services. this will mean modifications to the engine’s internal apis.


so what do you mean is it even possible?
if “yes”
does anyone have an idea how to implement that
thank you in advance


Would be looking at something like extensions around this class or the classes in the same package.


Thank you that could work!
I will try it in the next few days


Ok, i think that will not work like that.

I have another idea
i want to intercept the output of print

like this:
script.out = IoBuilder.forLogger(“MyScript”).setLevel(Level.INFO).buildPrintWriter()

Do you know where the Groovy scripts are executed?