On 14 March 2014 06:48, UK S wrote:
> Dear All,
> I am using log4cplus version log4cplus-1.1.2-rc2 .
> I am facing a problem if I am using the LOG4CPLUS_TRACE then I am not
> getting any traces out of it. I understand it should log function entry
> and exit .
>
> Is there any issue or something I am missing ?
>
> Attached the simple program for the same.
>
>
> #include "log4cplus/logger.h"
> #include "log4cplus/consoleappender.h"
> #include "log4cplus/loglevel.h"
> #include <log4cplus/loggingmacros.h>
> #include <iomanip>
>
> using namespace std;
> using namespace log4cplus;
>
> int
> main()
> {
> log4cplus::initialize ();
> SharedAppenderPtr append_1(new ConsoleAppender());
> append_1->setName(LOG4CPLUS_TEXT("First"));
> Logger::getRoot().addAppender(append_1);
>
> Logger root = Logger::getRoot();
> Logger test = Logger::getInstance(LOG4CPLUS_TEXT("test"));
>
> test.setLogLevel(NOT_SET_LOG_LEVEL);
> LOG4CPLUS_TRACE(root, "ENTER");
> LOG4CPLUS_TRACE(test, "ENTER");
> LOG4CPLUS_INFO(test, "Hello UKS ");
>
>
> return 0;
> }
>
> *Output :-*
> $./ostream_test
> INFO - Hello UKS
>
The default threshold for root logger is DEBUG_LOG_LEVEL. You will have to
set the threshold for the root logger to TRACE_LOG_LEVEL to get it to show.
--
VZ
|