|[birt-dev]CheckIn: Fix Bugzilla Bug --- 165188 logging per report
- Bugzilla Bug (s) Resolved:
165188 logging per report
BIRT depends on multiple components such as DTP/DTE/MODEL/CHART/EMF etc. As
multiple components are developed separate with BIRT, we can't assume that the
logger setting in the appContext can be used by all others.
JAVA has provided a logging utilities, it is reasonable to assume that all
other components are using the java logging framework. In the java logging
framework, there are three layer to control the logging: LogManager, Logger or
The LogManager is initialized only once for each JVM, as BIRT is only a
component which can be embedded into a J2EE container, so BIRT shouldn't try to
change the LogManager as it may be overridden by the container.
In java's logging tutorial, the suggest usage of logger is:
each class get the logger from Logger.getLogger("CLASS NAME") store it in a
static member field, all the instances of the same class shares the static
It means once the class has been loaded, the user will have no chance to change
the logger. The user defined logger is set after the class loading, at that
time, the logger has been initialized, it is too late to finish it in Logger
The last choice is Handler. Logger output the logging message to handles. If we
can create a task aware handler, we can output the logging messages to
different stream in different task using the same logger.
So, the solution is:
a. BIRT create a task aware handle (through ThreadLocal) and register it to the
root logger "org.eclipse.birt".
b. The user can set the handle for engine level, the handle is shared by all
tasks in the engine.
c. The user can set the handle for task level, the handle is shared by all
components running in the task level.
d. Before running the task, BIRT associate the user defined handle with the
current thread and set it back when the task finish.
e. the task-aware handle will choose the handle associated with the current
thread to output the logging messages.
The weakness is the user can't change the log level in the user defined handle
as it is defined in the logger level which is control by the java logging
As the API is freeze in RC0, so we still support the handle setting through:
setLogger() instead of setLogHandle(), but only the handle in the logger is
- Tests Description :
- Notes to Build Team:
check into 2.2
- Notes to Developers:
- Notes to QA:
- Notes to Documentation:
- Files Edited:
cvs ci -m "165188 use user defined logger for all components" -l "/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/api/EngintTaskLoggerTest.java"
cvs ci -m "165188 use user defined logger for all components" -l "/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/impl/EngineLoggerHandler.java" "/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/impl/EngineLogger.java" "/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/impl/ReportEngine.java" "/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/impl/EngineTask.java"
- Files Added:
- Files Deleted
Back to the top