Hi.
I am currently replacing an old logging API with log4cxx.
This old API had a method called Log::getLastError().
When doing code like this:
try
{
a.method1(); // May throw exception that logs using Log API
b.method2(); // May throw exception that logs using Log API
}
catch( SpecifiedException )
{
}
catch(...) // All other exceptions
{
// No way to retrieve messages from exceptions
someinstance.throwUserException(Log::getLastError()); // Display
the last logged error to the user
}
it will be easy to display the last logged message to the user (by
throwing userexceptoin) without having to keep the errormessage stored
somewhere.
The problem when using log4cxx as I see it is that I use one logger
instance per class. So before I write a logger extension class to
log4cxx
in my project I just wanted to know if there is a method for retrieving
the last logged message by log4cxx within an application?
Regards
Tomas Andersen
moreCom AS