Saturday, 16 August 2014

Logging in Eclipse Birt

Birt is one of the best open source projects that provides data visualization and reports for rich internet applications. But logging is one of the common problems while developing reports in BIRT report engine. Here is the small hack that I have used in birt global script to log my data.
  • Select initialize Script in birt(Select report, open report in Birt Report Design perspective select report and go to script tag, on the top of the screen, you can select initialize script). 
  • Since Birt uses java logging, you can use following script in initialize script to log the message
  • 
    
    
    
    importPackage(Packages.java.lang); function log(msg){ System.out.println("Info : " + msg); } reportContext.setGlobalVariable("log", log)
    
    
  • Use log function in other scripts to log message. 
Note : If you cant find the console in eclipse, open eclipse in console mode. (To open eclipse in console mode, open eclipsec.exe instead of eclipse.exe). 

You can also use Log4j properties in birt reporting. Here is the detailed explanation.   

No comments:

Post a Comment