diff options
-rw-r--r-- | apps/apps.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/apps.cpp b/apps/apps.cpp index 80fae13..b9ee81c 100644 --- a/apps/apps.cpp +++ b/apps/apps.cpp @@ -1,5 +1,7 @@ #include "apps.h" #include <log4cplus/logger.h> +#include <log4cplus/consoleappender.h> +#include <log4cplus/layout.h> #include <log4cplus/configurator.h> #include <netdb.h> @@ -17,8 +19,12 @@ const po::options_description logging_options() { } void setup_logging(po::variables_map vm) { - BasicConfigurator config; - config.configure(); + Appender *console = new ConsoleAppender(true, true); + PatternLayout* layout = new PatternLayout(LOG4CPLUS_TEXT("%-5p %r %-20c %m%n")); + console->setLayout(auto_ptr<Layout>(layout)); + + Hierarchy &h = Logger::getDefaultHierarchy(); + h.getRoot().addAppender(SharedAppenderPtr(console)); } int launch_app(int argc, char *argv[], app &app) { |