Home
Analytics
BIRT logging using log4j
DButtery
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
Find more posts tagged with
Comments
JasonW
Dennis.<br />
<br />
Can you try:<br />
<a class='bbc_url' href='
http://wiki.eclipse.org/BIRT/FAQ/Deployment#Logging'>BIRT/FAQ/Deployment
- Eclipsepedia</a><br />
and report back?<br />
<br />
Jason
AndyL7948
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
JasonW
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%conflogging.properties"
Run the attached report to see if the logging.properties file is set.
Jason
AndyL7948
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..........................
JasonW
Try creating a clean properties file first. You can then reenable all the tomcat logging.
AndyL7948
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
JasonW
Andy,
Did you change the code to use log4j?
private static org.apache.log4j.Logger log = Logger
.getLogger(LogCorg.eclipse.birt");
Jason