Package org.kie.internal.logger

# Class KnowledgeRuntimeLoggerFactory

java.lang.Object
org.kie.internal.logger.KnowledgeRuntimeLoggerFactory

public class KnowledgeRuntimeLoggerFactory extends Object

The KnowledgeRuntimeLogger uses the comprehensive event system to create an audit log that can be used to log the execution of the session for later inspection, in tools such as the Eclipse audit viewer.

     KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "logdir/mylogfile");
     ....
     logger.close();

Don't forget to close the logger when it is no longer needed, so resources can be released.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `KnowledgeRuntimeLoggerFactory()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static KieRuntimeLogger`
  `newConsoleLogger(KieRuntimeEventManager session)`
  Logs events to command line console.
  `static KieRuntimeLogger`
  `newFileLogger(KieRuntimeEventManager session, String fileName)`
  Creates a file logger in the current thread.
  `static KieRuntimeLogger`
  `newThreadedFileLogger(KieRuntimeEventManager session, String fileName, int interval)`
  Creates a file logger that executes in a different thread, where information is written on given intervals (in milliseconds).

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### KnowledgeRuntimeLoggerFactory

    public KnowledgeRuntimeLoggerFactory()

- ## Method Details

  - ### newFileLogger

    public static KieRuntimeLogger newFileLogger(KieRuntimeEventManager session, String fileName)
    Creates a file logger in the current thread. The file is in XML format, suitable for interpretation by Eclipse's Drools Audit View or other tools. Note that while events are written as they happen, the file will not be flushed until it is closed or the underlying file buffer is filled. If you need real time logging then use a Console Logger or a Threaded File Logger.
    Parameters:
      `session` -
      `fileName` - - .log is appended to this.
    Returns:

  - ### newThreadedFileLogger

    public static KieRuntimeLogger newThreadedFileLogger(KieRuntimeEventManager session, String fileName, int interval)
    Creates a file logger that executes in a different thread, where information is written on given intervals (in milliseconds). The file is in XML format, suitable for interpretation by Eclipse's Drools Audit View or other tools.
    Parameters:
      `session` -
      `fileName` - - .log is appended to this.
      `interval` - - in milliseconds.
    Returns:

  - ### newConsoleLogger

    public static KieRuntimeLogger newConsoleLogger(KieRuntimeEventManager session)
    Logs events to command line console. This is not in XML format, so it cannot be parsed by other tools, but is in real time and is more human readable.
    Parameters:
      `session` -
    Returns: