Setting a logger to a Java SE rule session

You can set a logger to Java™ SE rule sessions.

About this task

You can attach a logger to an instance of a stateless Java SE rule session to log the session runtime activity. The logger that you pass when you create a rule session factory is used by the execution unit (XU) for logging its activity.

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 rule session API, the output stream is captured by the session. The output stream is available in the IlrSessionResponse.getRulesetExecutionOutput method.