Re: [Log4cplus-devel] Facing problem in LOG4CPLUS_TRACE
Logging Framework for C++
Brought to you by:
wilx
From: Václav H. <v.h...@sh...> - 2009-01-16 23:38:57
|
Rajeshkumar Swain (HCL Financial Services) wrote, On 16.1.2009 11:50: > Hi, > > I am new to log4cplus. I am using this with the VC8. I am able to link > and run with the samples provided but I am getting some problem. My code > is as follow. > > > > #define LOG4CPLUS_TRACE(logger, logEvent) // If I do not give this line > then it gives the error This means you are effectivelly disabling the macro because it will expand into empty space. Also "the error"? What error do you mean? Have you included <log4cplus/loggingmacros.h>? > > int main() > > { > > BasicConfigurator config; > > config.configure(); Just today somebody has reported a bug that BasicConfigurator uses wrong name for the ConsoleAppender (it should be "log4cplus::ConsoleAppender") and thus this will not set up output to console correctly with 1.0.3-RC5. It is fixed in Subversion repository and it will fixed in the next RC. I will probably roll RC6 this weekend. > > > > > > string str("test"); > > string str1("trace"); > > string str2("First Log"); > > > > > > SharedAppenderPtr myAppender = new > RollingFileAppender(towstring(str),1024*5,5); > > //SharedAppenderPtr myAppender(new RollingFileAppender((tstring > &)"Test")); > > > > std::auto_ptr<Layout>myLayout(new log4cplus::TTCCLayout()); > > myAppender->setLayout(myLayout); > > // > > Logger logger = Logger::getInstance(towstring(str1)); //create the > logger > > logger.addAppender(myAppender) ; //Interface Appnder with the logger > > logger.setLogLevel(TRACE_LOG_LEVEL); > > > > LOG4CPLUS_TRACE(logger,"Error"); > > > > std::auto_ptr<Layout>myLayout1(new log4cplus::TTCCLayout()); > > myAppender->setLayout(myLayout1); > > return 0; > > } > > > > The problem is it is creating the log file as test but it is not writing > anything into it with the statement LOG4CPLUS_TRACE(logger,"Error"); > > > > What is the problem I do not know > > Can anyone help -- wilx |