Show Table of Contents
18.13. Creating Audit Logs
Procedure 18.5. Task
- To create an audit log, execute the rules engine. You will be given the option of creating a new audit log.
- Enter the following code:
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(); // Create a new Knowledge Runtime Logger, that logs to file. // An event.log file is created in the subdirectory log dir (which must exist) of the working directory KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newFileLogger( ksession, "log/event"); ksession.insert(...); ksession.fireAllRules(); // stop logging logger.close();
- Open the log by clicking the Open Log action, the first icon in the Audit View, and select the file. The Audit View now shows all events that where logged during the executing of the rules.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.