Setting a logger to a Java SE rule session
You can set a logger to Java™ SE rule sessions.
About this task
Procedure
Create a Java SE
rule session factory.
FileOutputStream outFile = ...;
PrintWriter loggerPrinter = ...;
IlrJ2SESessionFactory sessionFactory = new IlrJ2SESessionFactory(loggerPrinter );
Note: You can disable the logging trace by passing the null value
to the IlrJ2SESessionFactory constructor.
Results
- When you use the IlrContext.note method in a call to the classic rule engine, the output from this method is not directed to the rule session logger. The output of this method is automatically attached to System.out in a Java SE application.
- When you use the rule session API, the output stream is captured by the session. The output stream is available in the IlrSessionResponse.getRulesetExecutionOutput method.