Script name in log

Hi All,

How can I know the script name or/and path from log message ?

Eg. In a message “at Script19.run(Script19.groovy:5)” how can I discovery the script name ? Are there any way checking database table ?

Tks!

Hi @carloborsoi

as far as I know a script does not have a “name” in Camunda. What you can do in your script is something like this:

var name = execution.getCurrentActivityName();

With this method call you can identify the name of the task in which the script is executed. You can then append this information to your log message. (There are also a lot more things you can get with the execution object to make your log message more meaningfull).

Another thing you can try is using Java classes. If you have a Log implementation in you classpath of your deployed project you can simply use the Java Logger in the script.

var logger = com.packagename.LogFactory.getLogger();

But this only works if you have the necessary Java files deployed together with your bpmn-file.

Hope this helps

Regards
Michael