Go Back   Forum - BIRT Exchange > Deploying Reports Forums > Deploying and Integrating BIRT Report Engine in Applications

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-27-2009, 09:17 AM
Member
 
Join Date: Jan 2009
Posts: 30
Default BIRT logging using log4j

Hi all,

I am using the Report Engine within my application... My application uses log4j for all of its logging...

How do I get BIRT to simply use my established log4j Logger to handle its logging needs?

I had thought that using setLogger() on the EngineConfig would do the trick. Unfortuately, it appears that setLogger() cannot take a org.apache.log4j.Logger object as its argument ...

What is the magic incantation here?

Thanks!
-Dennis
Reply With Quote
  #2 (permalink)  
Old 03-02-2009, 02:22 PM
Senior Member
 
Join Date: Aug 2007
Posts: 750
Default

Dennis.

Can you try:
BIRT/FAQ/Deployment - Eclipsepedia
and report back?

Jason
Reply With Quote
  #3 (permalink)  
Old 03-19-2009, 06:16 AM
Junior Member
 
Join Date: Jun 2008
Posts: 3
Default Log4j-BIRT help

Jason,
I had question regarding your post suggesting the Eclipsepedia link. Where would I put the "test.java" or "test.class" file in my Web project (e.g. WAR file)? Somewhere under WEB-INF?

Also, in step 3 where is the java.home folder? I'm running Tomcat 5.5 and have a 'Dynamic BIRT Web project' deployed on the server. Would the properties file go under common/classes?

Thanks!
-Andy
Reply With Quote
  #4 (permalink)  
Old 03-19-2009, 07:46 AM
Senior Member
 
Join Date: Aug 2007
Posts: 750
Default

Andy,

Can you jar the test class and put it the common/lib for tomcat?
If you want to set the location of the logging.properties file, in the startup of tomcat set it as part of the JAVA_OPTS

set JAVA_OPTS=%JAVA_OPTS% -XX:MaxPermSize=256m -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file="%CATALINA_BASE%\conf\logging.properties"

Run the attached report to see if the logging.properties file is set.

Jason
Attached Files
File Type: rptdesign info.rptdesign (11.6 KB, 8 views)
Reply With Quote
  #5 (permalink)  
Old 03-19-2009, 09:28 AM
Junior Member
 
Join Date: Jun 2008
Posts: 3
Default

Okay, I already have a logging.properties file with contents such as below.... Should I comment everything in the file out? Or perhaps comment everything having to do with catalina?

handlers = 1catalina.org.apache.juli.FileHandler, 2localhost.org.apache.juli.FileHandler, 3manager.org.apache.juli.FileHandler, 4admin.org.apache.juli.FileHandler, 5host-manager.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler

.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler

############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################

1catalina.org.apache.juli.FileHandler.level = FINE
1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
1catalina.org.apache.juli.FileHandler.prefix = catalina.

2localhost.org.apache.juli.FileHandler.level = FINE
2localhost.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
2localhost.org.apache.juli.FileHandler.prefix = localhost.

3manager.org.apache.juli.FileHandler.level = FINE
3manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
3manager.org.apache.juli.FileHandler.prefix = manager.

4admin.org.apache.juli.FileHandler.level = FINE
4admin.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
4admin.org.apache.juli.FileHandler.prefix = admin.

5host-manager.org.apache.juli.FileHandler.level = FINE
5host-manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
5host-manager.org.apache.juli.FileHandler.prefix = host-manager.

java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter..........................
Reply With Quote
  #6 (permalink)  
Old 03-19-2009, 09:32 AM
Senior Member
 
Join Date: Aug 2007
Posts: 750
Default

Try creating a clean properties file first. You can then reenable all the tomcat logging.
Reply With Quote
  #7 (permalink)  
Old 03-19-2009, 11:58 AM
Junior Member
 
Join Date: Jun 2008
Posts: 3
Default

All things considered it has mostly worked. Someone who is no longer here had wrote some custom java files for utilizing Quartz in sending reports automatically. In the custom Report.java file, they are using the Birt logging which ends up in my "catalina.out" file !!! Would you know how to instantiate the existing logger I'm using with Log4j instead of the old Birt logger. Here is my current code below:

package reports;
import java.util.logging.Logger;
...........
...
public class Report implements StatefulJob {

private IReportEngine birtReportEngine = null;
protected static Logger logger = Logger.getLogger("org.eclipse.birt");
...........
......


Thank you very much for your prompt assistance!
-Andy
Reply With Quote
  #8 (permalink)  
Old 03-20-2009, 06:16 AM
Senior Member
 
Join Date: Aug 2007
Posts: 750
Default

Andy,

Did you change the code to use log4j?

private static org.apache.log4j.Logger log = Logger
.getLogger(LogCorg.eclipse.birt");

Jason
Reply With Quote
Reply


Thread Tools
Display Modes




All times are GMT -7. The time now is 12:16 AM.
Powered by vBulletin Copyright © 2000-2010 Jelsoft Enterprises Limited.


Content Relevant URLs by vBSEO 3.1.0