java-technotes

Tuesday, September 18, 2012

Using log4j logging in BIRT Viewer

Here i am discussing about how to add/initialize log4j logger when BIRT Viewer is invoked.

Here is the clue...
As we know BIRT provides the frameset servlet via which we can run BIRT reports.

By now you might have already guessed it...did you ? if not here is the deal...

Define your own servelet say MyBIRTServlet and instead of extending it from HttpServerlet extend it from frameset servlet , and the define two obvious methods goGet() and doPost() along with init() method.

Now initialize your logger object with some name inside init() method and after that you would need to call super.init() to allow framset-init() to execute..

Also redirect the call of doGet(…) and doPost(…) to frameset doGet(…) and doPost(..)
MyBIRTServlet doGet(..) -> Call super.doGet(…) similarly for doPost(…)

Last thing that we need to do is update the web.xml (which is present under birt-viewer/WEB-INF directory) for newly created servlet mapping with frameset.


No comments:

Post a Comment