2 Replies Latest reply on Dec 14, 2015 12:35 AM by Hongchao Nie

    How to use loggers (log4j or other) in rules depoyed in the Kie server ?

    nicolas duminil Master

      Hello,

       

      I found several samples showing how to use a logger in rules, by passing an instance of it in the kie session, etc. But I don't know how to do it in rules executed in the Kie server and called like this:

       

        KieServicesClient client = KieServicesFactory.newKieServicesRestClient("http://localhost:8080/kie-server/services/rest/server", "user", "password");

      ServiceResponse<String> response = client.executeCommands("container-0", payload);

       

       

      Given that this code doesn't handle the Kie session such that to pass, in it, an instance of the logger to the rules, I don't know how to use a logger defined like this:

       

       

      import org.apache.log4j.Logger;

       

      global Logger LOGGER;

       

      ...........................

        LOGGER.debug ("HelloWorld *****");      // NullPointerException

       

      Many thanks i advance for any help.

       

      Nicolas