[slf4j-dev] [Bug 141] New: Need programmatic access to nested profiler or stopwatch
bugzilla-daemon at pixie.qos.ch
bugzilla-daemon at pixie.qos.ch
Mon Jul 20 09:50:14 CEST 2009
http://bugzilla.slf4j.org/show_bug.cgi?id=141
Summary: Need programmatic access to nested profiler or stopwatch
Product: SLF4J
Version: 1.5.x
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P1
Component: slf4j-ext
AssignedTo: dev at slf4j.org
ReportedBy: lindelof at ieee.org
I'd like to use Profiler to log the execution times of different parts of my
(web)application, but I need to write out the times on a single line upon the
completion of the client request.
E.g., I need to see something similar to the following in my logfile:
2009-07-14T15:06:07.364 3258/2342/234
where ##/##/## stands for the time in ms for different parts of my application.
To do that I would need to access programmatically the nested profilers created
by Profiler.
Ideally, I would have a getTimeInstrumentByName(String name) method on Profiler
that would return a reference to the first sub-TimeInstrument of that name. It
would be up to the developer to ensure that all sub-TimeInstruments are
uniquely named. A possible implementation would be:
public TimeInstrument getTimeInstrumentByName(String name) {
for (TimeInstrument ti : childTimeInstrumentList) {
if (ti instanceof StopWatch && name.equals(ti.getName()) {
return ti;
}
else {
TimeInstrument result = ((Profiler)ti).getTimeInstrumentByName(name);
if (null != result) return result;
}
}
return null;
}
--
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the slf4j-dev
mailing list