Logging information for the greex rule

You can log information for the Greex rule or an advanced XML condition at different levels. The different levels of logging information is described in GreexLogConstants. You can log information ranging from Apache's log4j1 framework to a simple System.out.println().

About this task

To log information for the Greex rule:

Procedure

  1. Create the GreexLogger class and implement the following methods within the class:
    log(GreexLogData data) method and log information as needed. 
    For example: 
    public class MyLogger implements GreexLogger 
    {
        public void log(GreexLogData data)
        {
          System.out.println("Message:: "+data.getMessage());
             System.out.println("Severity:: "+data.getSeverity());
        }
     }
  2. Register the GreexLogger class with the GreexContext using the registerLogger() method. For example,
    public class MyApp 
    {
     GreexContext  ctx = new GreexContext();
     Ctx.registerLogger(new MyLogger(),GreexLogConstants.GREEX_DEBUG); 
    }