Bonitasoft Logging

1
0
-1

Hi guys, a noob question here, so I was reading the documentation about logging and saw this example:

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Logger logger = LoggerFactory.getLogger("org.bonitasoft.groovy.script.my_int_init_script");
logger.debug("Set initial value of process variable using Groovy script");
return Integer.valueOf(3 + 5);

Tried it in a simple process but I have no idea where exactly does it print the log, because that´s what is suppose to do right? I already imported the slf4j jar and checked the engine and studio log but I can´t find it.

1 answer

1
+3
-1
This one is the BEST answer!

I use this wrapper code around my code, much easier...

import org.bonitasoft.engine.api.ProcessRuntimeAPI;
import java.util.logging.Logger;

//init vars
string routineName = "my Groovy Script Name";
int dI = 0;
boolean debug = true;  // make false when not debugging

//get the process name
ProcessRuntimeAPI processRuntimeAPI = apiAccessor.getProcessAPI();
String processName = processRuntimeAPI.getProcessInstance(processInstanceId).getName();

//set the name of the routine
String thisTrace = " "+processName+" " + routineName+": ";

Logger logger= Logger.getLogger("org.bonitasoft");
if(debug){dI++; logger.severe(dI+thisTrace+"Trace Start");}

//TODO - Code goes in here - START
 
//TODO - Code goes in here - END

//print out the returned data last before the return
if(debug){dI++; logger.severe(dI+thisTrace+"return Data: "+returnData.toString());}
if(debug){dI++; logger.severe(dI+thisTrace+"Trace End");}
return returnData;

This will go into the Bonita BPM Engine Log and you can search by process name or my Groovy Script Name.

regards
Seán

PS: If this solves your problem, please mark as Resolved

Comments

Submitted by mzhu on Tue, 12/15/2015 - 20:05

Much appreciated Sean :)

Notifications