views:

13

answers:

0

What is better in my application (called MyApp) that has the following 2 classes. MyApp is a multithreaded application requiring ClassA and ClassB. Also ClassA and ClassB spawn P-threads. The underlying system is Linux and the logging library used is Apache's Log4CXX.

//ClassA: LoggerPtr ClassA::logger(Logger::getLogger("ClassA"));

//ClassB: LoggerPtr ClassB::logger(Logger::getLogger("ClassB"));

or

//ClassA: LoggerPtr ClassA::logger(Logger::getLogger("MyApp"));

//ClassB: LoggerPtr ClassB::logger(Logger::getLogger("MyApp"));

So in other words is it better to get one instance of the logger (MyApp) and use it througout the application, or get different instances specific to each class requiring logging?