Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Logging from EventHandler
Logging from EventHandler [message #541228] Fri, 18 June 2010 18:39 Go to next message
Bill Knotts is currently offline Bill KnottsFriend
Messages: 6
Registered: November 2009
Junior Member
I am writing a simple extension of a DataSourceEventAdapter and would like to be able to emit log messages from this class to the standard ReportEngine_*.log file. This has proven to be quite elusive...

Code excerpt:
public class JndiNameResolver extends DataSourceEventAdapter {

private Logger logger = Logger.getLogger(this.getClass().getName());

@Override
public void beforeOpen(IDataSourceInstance dataSource,
IReportContext reportContext) throws ScriptException {

if (logger.isLoggable(Level.FINER)) {
logger.entering(this.getClass().getName(), "beforeOpen");
}
.
.
.


I expected that I would need to alter the BIRT_VIEWER_LOG_LEVEL context parameter in web.xml or declare a new logger in viewer.properties to reflect the desired level of 'FINER' but neither of these approaches results in any output.

I've tried this both in the designer and in the viewer webapp deployed to a Tomcat server.

Debugging the event handler in the designer clearly shows that there are no logging handlers associated with the logger.

Any suggestions or hints would be appreciated...

Regards,
Bill
Re: Logging from EventHandler [message #541243 is a reply to message #541228] Fri, 18 June 2010 21:11 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Bill

Try:

public void beforeOpen(IDataSetInstance dataSet,
IReportContext reportContext) {
try{
Logger logger =
reportContext.getReportRunnable().getReportEngine().getLogge r();
logger.log(Level.INFO,"test");
}catch(Exception e){
e.printStackTrace();
}

}

Jason

On 6/18/2010 2:39 PM, Bill Knotts wrote:
> I am writing a simple extension of a DataSourceEventAdapter and would
> like to be able to emit log messages from this class to the standard
> ReportEngine_*.log file. This has proven to be quite elusive...
>
> Code excerpt:
> public class JndiNameResolver extends DataSourceEventAdapter {
>
> private Logger logger = Logger.getLogger(this.getClass().getName());
>
> @Override
> public void beforeOpen(IDataSourceInstance dataSource,
> IReportContext reportContext) throws ScriptException {
>
> if (logger.isLoggable(Level.FINER)) {
> logger.entering(this.getClass().getName(), "beforeOpen");
> }
Re: Logging from EventHandler [message #541612 is a reply to message #541243] Mon, 21 June 2010 19:10 Go to previous messageGo to next message
Bill Knotts is currently offline Bill KnottsFriend
Messages: 6
Registered: November 2009
Junior Member
Thanks Jason,

This accomplished exatcly what I need when viewed via the BIRT Web Viewer but still seems to result in no output when tested in the BIRT Designer (2.5.1).

I just re-tested this technique in both JavaScript and Java Event Handlers by:
- deleting all files under my workspace '.metadata\.plugins\org.eclipse.birt.report.viewer\logs' directory

- ensuring that web.xml value of BIRT_VIEWER_LOG_LEVEL under [eclipse_home]eclipse\plugins\org.eclipse.birt.report.viewer _2.5.1.v20090821\birt\WEB-INF has a value of 'INFO'

- ensuring that no additional entries exist in viewer.properties at the same location

In this case, when running the report in the designer, several log files are created under the logs directory but all are completely empty.

Interestingly, debugging the Java Event Handler shows the logger being retrieved successfully but without any associated handlers.

I can live with this in the short term but it seems like I am missing a valuable tool when working with a report design.

Regards,
Bill

Re: Logging from EventHandler [message #541631 is a reply to message #541612] Mon, 21 June 2010 20:35 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Bill,

Can you open a bug for this?

Jason

On 6/21/2010 3:10 PM, Bill Knotts wrote:
> Thanks Jason,
>
> This accomplished exatcly what I need when viewed via the BIRT Web
> Viewer but still seems to result in no output when tested in the BIRT
> Designer (2.5.1).
>
> I just re-tested this technique in both JavaScript and Java Event
> Handlers by:
> - deleting all files under my workspace
> '.metadata\.plugins\org.eclipse.birt.report.viewer\logs' directory
>
> - ensuring that web.xml value of BIRT_VIEWER_LOG_LEVEL under
> [eclipse_home]eclipse\plugins\org.eclipse.birt.report.viewer
> _2.5.1.v20090821\birt\WEB-INF has a value of 'INFO'
>
> - ensuring that no additional entries exist in viewer.properties at the
> same location
>
> In this case, when running the report in the designer, several log files
> are created under the logs directory but all are completely empty.
>
> Interestingly, debugging the Java Event Handler shows the logger being
> retrieved successfully but without any associated handlers.
>
> I can live with this in the short term but it seems like I am missing a
> valuable tool when working with a report design.
>
> Regards,
> Bill
>
>
Previous Topic:How can I get all TableHandle object form ReportDesignHandle?
Next Topic:PDF output with garbled fonts
Goto Forum:
  


Current Time: Thu Apr 18 13:49:23 GMT 2024

Powered by FUDForum. Page generated in 0.02040 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top