renamed loggerhierarchy from mrw.gccfunctiontrace to mrw.fn

master
Marc Wäckerlin 20 years ago
parent beac3d87b8
commit 39b7520ffd
  1. 62
      mrw/autofunctiontracelog4cxx.cpp
  2. 57
      mrw/mrwautofunctiontracelog4cxx_test.cpp

@ -9,6 +9,9 @@
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.2 2005/04/07 20:42:38 marc
renamed loggerhierarchy from mrw.gccfunctiontrace to mrw.fn
Revision 1.1 2005/03/11 21:07:54 marc
initial version
@ -92,7 +95,7 @@ extern "C" int main(int, char**);
- optional: boost for thread support http://boost.org
The logger hiararchy name is: @c
"mrw.gccfunctiontrace.<full-method-name>" where @c
"mrw.fn.<full-method-name>" where @c
<full-method-name> is the full name of the method, including
namespace and class name, seperated not by double colon @c :: but
by single dots @c . as it is common use in log4cxx. This way, you
@ -111,15 +114,15 @@ extern "C" int main(int, char**);
@verbatim
log4j.rootLogger = OFF, A1
log4j.logger.mrw.gccfunctiontrace = DEBUG
log4j.logger.mrw.gccfunctiontrace.log4cxx = OFF
log4j.logger.mrw.gccfunctiontrace.boost = OFF
log4j.logger.mrw.gccfunctiontrace.Thread = OFF
log4j.logger.mrw.gccfunctiontrace.mrw = OFF
log4j.logger.mrw.gccfunctiontrace.std = OFF
log4j.logger.mrw.gccfunctiontrace.new = OFF
log4j.logger.mrw.gccfunctiontrace.CppUnit = OFF
log4j.logger.mrw.gccfunctiontrace.__gnu_cxx = OFF
log4j.logger.mrw.fn = DEBUG, A1
log4j.logger.mrw.fn.log4cxx = OFF, A1
log4j.logger.mrw.fn.boost = OFF, A1
log4j.logger.mrw.fn.Thread = OFF, A1
log4j.logger.mrw.fn.mrw = OFF, A1
log4j.logger.mrw.fn.std = OFF, A1
log4j.logger.mrw.fn.new = OFF, A1
log4j.logger.mrw.fn.CppUnit = OFF, A1
log4j.logger.mrw.fn.__gnu_cxx = OFF, A1
log4j.appender.A1 = org.apache.log4j.FileAppender
log4j.appender.A1.layout = org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern = %t-%-41c%m%n
@ -131,28 +134,29 @@ log4j.appender.A1.filename = filename.log
information):
@verbatim
mrw.gccfunctiontrace.anotherFunction \ anotherFunction()
mrw.gccfunctiontrace.HalloWelt.fn1 \ HalloWelt::fn1()
mrw.gccfunctiontrace.HalloWelt.fn \ HalloWelt::fn()
mrw.gccfunctiontrace.HalloWelt.A.method \ HalloWelt::A::method()
mrw.gccfunctiontrace.HalloWelt.A.method / HalloWelt::A::method()
mrw.gccfunctiontrace.HalloWelt.A.method \ HalloWelt::A::method()
mrw.gccfunctiontrace.HalloWelt.A.method / HalloWelt::A::method()
mrw.gccfunctiontrace.HalloWelt.fn / HalloWelt::fn()
mrw.gccfunctiontrace.HalloWelt.fn \ HalloWelt::fn()
mrw.gccfunctiontrace.HalloWelt.A.method \ HalloWelt::A::method()
mrw.gccfunctiontrace.HalloWelt.A.method / HalloWelt::A::method()
mrw.gccfunctiontrace.HalloWelt.A.method \ HalloWelt::A::method()
mrw.gccfunctiontrace.HalloWelt.A.method / HalloWelt::A::method()
mrw.gccfunctiontrace.HalloWelt.fn / HalloWelt::fn()
mrw.gccfunctiontrace.HalloWelt.fn1 / HalloWelt::fn1()
mrw.gccfunctiontrace.anotherFunction / anotherFunction()
mrw.fn.anotherFunction \ anotherFunction()
mrw.fn.HalloWelt.fn1 \ HalloWelt::fn1()
mrw.fn.HalloWelt.fn \ HalloWelt::fn()
mrw.fn.HalloWelt.A.method \ HalloWelt::A::method()
mrw.fn.HalloWelt.A.method / HalloWelt::A::method()
mrw.fn.HalloWelt.A.method \ HalloWelt::A::method()
mrw.fn.HalloWelt.A.method / HalloWelt::A::method()
mrw.fn.HalloWelt.fn / HalloWelt::fn()
mrw.fn.HalloWelt.fn \ HalloWelt::fn()
mrw.fn.HalloWelt.A.method \ HalloWelt::A::method()
mrw.fn.HalloWelt.A.method / HalloWelt::A::method()
mrw.fn.HalloWelt.A.method \ HalloWelt::A::method()
mrw.fn.HalloWelt.A.method / HalloWelt::A::method()
mrw.fn.HalloWelt.fn / HalloWelt::fn()
mrw.fn.HalloWelt.fn1 / HalloWelt::fn1()
mrw.fn.anotherFunction / anotherFunction()
@endverbatim
@note The configurator is not installed automatically. If you
want to trace e.g. on the console, you have to call @c
log4cxx::BasicConfigurator::configure(); as first statement
in your @c main().
in your @c main(). @see @ref AutoInitLog4cxx if you also want to
automatically configure @c log4cxx.
@section AutoFunctionTraceThread Multithreading
@ -189,7 +193,7 @@ extern "C" void __cyg_profile_func_enter(void *this_fn, void*) {
std::string::size_type p(hierarchy.rfind(' ', hierarchy.find('<')));
if (p!=std::string::npos) hierarchy.erase(0, p+1);
log4cxx::Logger* logger
(log4cxx::Logger::getLogger(_T("mrw.gccfunctiontrace.")+hierarchy));
(log4cxx::Logger::getLogger(_T("mrw.fn.")+hierarchy));
if (logger->isDebugEnabled()) {
std::stringstream ss;
ss<<std::setw(2+mrw::info.level++)<<std::setfill(' ')
@ -222,7 +226,7 @@ extern "C" void __cyg_profile_func_exit(void *this_fn, void*) {
std::string::size_type p(hierarchy.rfind(' ', hierarchy.find('<')));
if (p!=std::string::npos) hierarchy.erase(0, p+1);
log4cxx::Logger* logger
(log4cxx::Logger::getLogger(_T("mrw.gccfunctiontrace.")+hierarchy));
(log4cxx::Logger::getLogger(_T("mrw.fn.")+hierarchy));
if (logger->isDebugEnabled()) {
std::stringstream ss;
ss<<std::setw(2+--mrw::info.level)<<std::setfill(' ')

@ -9,6 +9,9 @@
@license LGPL, see file <a href="license.html">COPYING</a>
$Log$
Revision 1.2 2005/04/07 20:42:38 marc
renamed loggerhierarchy from mrw.gccfunctiontrace to mrw.fn
Revision 1.1 2005/03/11 21:07:55 marc
initial version
@ -78,23 +81,23 @@ namespace mrw {
log4cxx::helpers::Properties properties;
properties.setProperty("log4j.rootLogger",
"OFF, A1");
properties.setProperty("log4j.logger.mrw.gccfunctiontrace",
properties.setProperty("log4j.logger.mrw.fn",
"DEBUG");
properties.setProperty("log4j.logger.mrw.gccfunctiontrace.log4cxx",
properties.setProperty("log4j.logger.mrw.fn.log4cxx",
"OFF");
properties.setProperty("log4j.logger.mrw.gccfunctiontrace.boost",
properties.setProperty("log4j.logger.mrw.fn.boost",
"OFF");
properties.setProperty("log4j.logger.mrw.gccfunctiontrace.Thread",
properties.setProperty("log4j.logger.mrw.fn.Thread",
"OFF");
properties.setProperty("log4j.logger.mrw.gccfunctiontrace.mrw",
properties.setProperty("log4j.logger.mrw.fn.mrw",
"OFF");
properties.setProperty("log4j.logger.mrw.gccfunctiontrace.std",
properties.setProperty("log4j.logger.mrw.fn.std",
"OFF");
properties.setProperty("log4j.logger.mrw.gccfunctiontrace.new",
properties.setProperty("log4j.logger.mrw.fn.new",
"OFF");
properties.setProperty("log4j.logger.mrw.gccfunctiontrace.CppUnit",
properties.setProperty("log4j.logger.mrw.fn.CppUnit",
"OFF");
properties.setProperty("log4j.logger.mrw.gccfunctiontrace.__gnu_cxx",
properties.setProperty("log4j.logger.mrw.fn.__gnu_cxx",
"OFF");
properties.setProperty("log4j.appender.A1",
"org.apache.log4j.FileAppender");
@ -102,12 +105,12 @@ namespace mrw {
"org.apache.log4j.PatternLayout");
#ifdef _REENTRANT
properties.setProperty("log4j.appender.A1.layout.ConversionPattern",
"%t-%-41c%m%n");
"%t-%-27c%m%n");
properties.setProperty("log4j.appender.A1.filename",
"mrwautofunctiontracelog4cxx_test-mt.log");
#else
properties.setProperty("log4j.appender.A1.layout.ConversionPattern",
"%-41c%m%n");
"%-27c%m%n");
properties.setProperty("log4j.appender.A1.filename",
"mrwautofunctiontracelog4cxx_test.log");
#endif
@ -128,22 +131,22 @@ namespace mrw {
}
void checkfile() {
mrw::RegExp match
("^mrw\\.gccfunctiontrace\\.anotherFunction ( ? ? ?)\\\\ anotherFunction\\(\\)\n"
"mrw\\.gccfunctiontrace\\.HalloWelt\\.fn1 \\1 \\\\ HalloWelt::fn1\\(\\)\n"
"mrw\\.gccfunctiontrace\\.HalloWelt\\.fn \\1 \\\\ HalloWelt::fn\\(\\)\n"
"mrw\\.gccfunctiontrace\\.HalloWelt\\.A\\.method \\1 \\\\ HalloWelt::A::method\\(\\)\n"
"mrw\\.gccfunctiontrace\\.HalloWelt\\.A\\.method \\1 / HalloWelt::A::method\\(\\)\n"
"mrw\\.gccfunctiontrace\\.HalloWelt\\.A\\.method \\1 \\\\ HalloWelt::A::method\\(\\)\n"
"mrw\\.gccfunctiontrace\\.HalloWelt\\.A\\.method \\1 / HalloWelt::A::method\\(\\)\n"
"mrw\\.gccfunctiontrace\\.HalloWelt\\.fn \\1 / HalloWelt::fn\\(\\)\n"
"mrw\\.gccfunctiontrace\\.HalloWelt\\.fn \\1 \\\\ HalloWelt::fn\\(\\)\n"
"mrw\\.gccfunctiontrace\\.HalloWelt\\.A\\.method \\1 \\\\ HalloWelt::A::method\\(\\)\n"
"mrw\\.gccfunctiontrace\\.HalloWelt\\.A\\.method \\1 / HalloWelt::A::method\\(\\)\n"
"mrw\\.gccfunctiontrace\\.HalloWelt\\.A\\.method \\1 \\\\ HalloWelt::A::method\\(\\)\n"
"mrw\\.gccfunctiontrace\\.HalloWelt\\.A\\.method \\1 / HalloWelt::A::method\\(\\)\n"
"mrw\\.gccfunctiontrace\\.HalloWelt\\.fn \\1 / HalloWelt::fn\\(\\)\n"
"mrw\\.gccfunctiontrace\\.HalloWelt\\.fn1 \\1 / HalloWelt::fn1\\(\\)\n"
"mrw\\.gccfunctiontrace\\.anotherFunction \\1/ anotherFunction\\(\\)\n$");
("^mrw\\.fn\\.anotherFunction ( ? ? ?)\\\\ anotherFunction\\(\\)\n"
"mrw\\.fn\\.HalloWelt\\.fn1 \\1 \\\\ HalloWelt::fn1\\(\\)\n"
"mrw\\.fn\\.HalloWelt\\.fn \\1 \\\\ HalloWelt::fn\\(\\)\n"
"mrw\\.fn\\.HalloWelt\\.A\\.method \\1 \\\\ HalloWelt::A::method\\(\\)\n"
"mrw\\.fn\\.HalloWelt\\.A\\.method \\1 / HalloWelt::A::method\\(\\)\n"
"mrw\\.fn\\.HalloWelt\\.A\\.method \\1 \\\\ HalloWelt::A::method\\(\\)\n"
"mrw\\.fn\\.HalloWelt\\.A\\.method \\1 / HalloWelt::A::method\\(\\)\n"
"mrw\\.fn\\.HalloWelt\\.fn \\1 / HalloWelt::fn\\(\\)\n"
"mrw\\.fn\\.HalloWelt\\.fn \\1 \\\\ HalloWelt::fn\\(\\)\n"
"mrw\\.fn\\.HalloWelt\\.A\\.method \\1 \\\\ HalloWelt::A::method\\(\\)\n"
"mrw\\.fn\\.HalloWelt\\.A\\.method \\1 / HalloWelt::A::method\\(\\)\n"
"mrw\\.fn\\.HalloWelt\\.A\\.method \\1 \\\\ HalloWelt::A::method\\(\\)\n"
"mrw\\.fn\\.HalloWelt\\.A\\.method \\1 / HalloWelt::A::method\\(\\)\n"
"mrw\\.fn\\.HalloWelt\\.fn \\1 / HalloWelt::fn\\(\\)\n"
"mrw\\.fn\\.HalloWelt\\.fn1 \\1 / HalloWelt::fn1\\(\\)\n"
"mrw\\.fn\\.anotherFunction \\1/ anotherFunction\\(\\)\n$");
#ifdef _REENTRANT
std::string log(mrw::File::read("mrwautofunctiontracelog4cxx_test-mt.log"));
std::map<unsigned long, std::string> logs;

Loading…
Cancel
Save