Log Context

  • Log context is very useful during rules engine code development. You can print regular debugging information into the platform admin UI's rules console for visual inspection

  • Context Variable: log

API Interface

void info(String msg);

void info(String format, Object... args);

void info(Throwable e);

void trace(Throwable e);

void trace(String format, Object... args);

void trace(String msg);

void debug(Throwable e);

void debug(String format, Object... args);

void debug(String msg);

void error(Throwable e);

void error(String msg);

void error(String format, Object... args);

void warn(String format, Object... args);

void warn(Throwable e);

void warn(String msg);
  • If you want to persist the log messages for later viewing, you can use the below functions
//Insert a failure message
void insert(String message);

//Insert a failure exception
void insert(Throwable cause);

//Insert a failure message with dynamic arguments
void insert(String format, Object... args);


if(msg.humidity > 45){
  log.warn("Humidity :> %d", msg.humidity);
  //Processing something
}catch(Exception ex){