Simple Logging Framework

rmurphy
edited February 11, 2022 in Analytics #1
How to use this simple logging framework:
    <br />
  1. Copy the logging.js file to the resource folder. In the designer, the resource folder is the root of the project you are working with by default. In the iServer, this is typically the /Resources folder. Don't forget to set permissions in the iserver<br />
  2. Add the logging.js as a Javascript resource file for the report. Select the report design, and in the Property Editor view, select the Resources menu item in the Properties tab. Scroll down to the Javascript Files section and add the loggin.js file. If logging.js was added properly in step one, it will show up in the dialog upon clicking Add File...<br />
  3. Add the following code to the report's onPrepare script event: enableLogging = true; logFile = "C:\path\to\file\myLog.log"; //to overwrite the log for each report run, pass false instead of true openLog(logFile, true);<br />
  4. Add the following code to the afterFactory script event: closeLog();<br />
<br />
<br />
<br />
You can now call the log() method from within BIRT Expressions and anyonPrepare or onCreate script events. If you want to perform any logging during the render phase of report generation, you will need toadd the code from above in number 3 to the beforeRender script eventand code from number 4 to the afterRender event.