[Log4cplus-devel] Facing problem in LOG4CPLUS_TRACE
Logging Framework for C++
Brought to you by:
wilx
From: Rajeshkumar S. (H. F. Services) <Raj...@hc...> - 2009-01-16 10:53:52
|
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 int main() { BasicConfigurator config; config.configure(); 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 DISCLAIMER: ----------------------------------------------------------------------------------------------------------------------- The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only. It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately. Before opening any mail and attachments please check them for viruses and defect. ----------------------------------------------------------------------------------------------------------------------- |