From: Andy <hew...@gm...> - 2008-05-19 12:38:47
|
Hi, This my log4cpp.properties file: ========================================================= log4cpp.rootCategory=DEBUG, console log4cpp.appender.console=ConsoleAppender log4cpp.appender.console.layout=PatternLayout log4cpp.appender.console.layout.ConversionPattern=%d [%p][%t] : %m%n log4cpp.category.sample=DEBUG, sample log4cpp.appender.sample=FileAppender log4cpp.appender.sample.fileName=sample.log log4cpp.appender.sample.layout=PatternLayout log4cpp.appender.sample.layout.ConversionPattern=%d [%p][%t] : %m%n log4cpp.category.sample.son=DEBUG, son log4cpp.appender.son=FileAppender log4cpp.appender.son.fileName=son.log log4cpp.appender.son.layout=PatternLayout log4cpp.appender.son.layout.ConversionPattern=%d [%p][%t] : %m%n log4cpp.category.sample.daughter=DEBUG, daughter log4cpp.appender.daughter=FileAppender log4cpp.appender.daughter.fileName=daughter.log log4cpp.appender.daughter.layout=PatternLayout log4cpp.appender.daughter.layout.ConversionPattern=%d [%p][%t] : %m%n log4cpp.category.mylog=DEBUG, mylog log4cpp.appender.mylog=ConsoleAppender log4cpp.appender.mylog.layout=PatternLayout log4cpp.appender.mylog.layout.ConversionPattern=%d [%p][%t] : %m%n ========================================================== And my code is like this : ------------------------------------------------------------------------------ log4cpp::Category& MscaLog::loggg = log4cpp::Category::getInstance(std::string("mylog")); void init() { try { log4cpp::PropertyConfigurator::configure("log4cpp.properties"); } catch (log4cpp::ConfigureFailure & f) { std::cerr << "configure problem " << f.what() << std::endl; } } ------------------------------------------------------------------------- after I call init(), then I write this: loggg.debug(" Hello, log4cpp!"); But I got nothing from my console ouput, is there anything wrong with my log4cpp.properties or my way of use log4cpp ? Thanks for your time. Best Regards. |
From: Konstantin L. <Kon...@ma...> - 2008-05-21 05:35:32
|
Hello, Andy! You wrote to <log...@li...> on Mon, 19 May 2008 20:38:37 +0800: A> after I call init(), then I write this: A> loggg.debug(" Hello, log4cpp!"); On Windows this code works as expected #include <log4cpp/Category.hh> #include <log4cpp/PropertyConfigurator.hh> #include <iostream> log4cpp::Category& loggg = log4cpp::Category::getInstance(std::string("mylog")); void init() { try { log4cpp::PropertyConfigurator::configure("log4cpp.properties"); } catch (log4cpp::ConfigureFailure & f) { std::cerr << "configure problem " << f.what() << std::endl; } } int main() { init(); loggg.debug(" Hello, log4cpp!"); return 0; } Print out: 2008-05-21 08:30:38,718 [DEBUG][3476] : Hello, log4cpp! 2008-05-21 08:30:38,718 [DEBUG][3476] : Hello, log4cpp! What log4cpp version, compiler version, OS do you use? With best regards, Konstantin Litvinenko. |
From: Andy <hew...@gm...> - 2008-05-21 07:41:39
|
2008/5/21 Konstantin Litvinenko <Kon...@ma...>: > Hello, Andy! > You wrote to <log...@li...> on Mon, 19 May 2008 > 20:38:37 +0800: > > > A> after I call init(), then I write this: > > A> loggg.debug(" Hello, log4cpp!"); > > On Windows this code works as expected > > #include <log4cpp/Category.hh> > #include <log4cpp/PropertyConfigurator.hh> > #include <iostream> > > log4cpp::Category& loggg = > log4cpp::Category::getInstance(std::string("mylog")); > > void init() > { > > try > { > log4cpp::PropertyConfigurator::configure("log4cpp.properties"); > } > catch (log4cpp::ConfigureFailure & f) > { > std::cerr << "configure problem " << f.what() << std::endl; > } > > } > > int main() > { > init(); > loggg.debug(" Hello, log4cpp!"); > return 0; > } > > Print out: > > 2008-05-21 08:30:38,718 [DEBUG][3476] : Hello, log4cpp! > 2008-05-21 08:30:38,718 [DEBUG][3476] : Hello, log4cpp! > > What log4cpp version, compiler version, OS do you use? OS: [root@localhost MSCA]# uname -a Linux localhost.localdomain 2.6.9-5.EL #1 Wed Jan 5 19:22:18 EST 2005 i686 i686 i386 GNU/Linux log4cpp: log4cpp-1.0 And I ssh to the computer with SSH SECURE SHELL, is this a problem ? Thanks so much. > > With best regards, Konstantin Litvinenko. > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Log4cpp-devel mailing list > Log...@li... > https://lists.sourceforge.net/lists/listinfo/log4cpp-devel > |
From: Andy <hew...@gm...> - 2008-05-21 09:19:29
|
Sorry...everybody After I restart the system, it becomes OK....... My God..... 2008/5/21 Andy <hew...@gm...>: > 2008/5/21 Konstantin Litvinenko <Kon...@ma...>: >> Hello, Andy! >> You wrote to <log...@li...> on Mon, 19 May 2008 >> 20:38:37 +0800: >> >> >> A> after I call init(), then I write this: >> >> A> loggg.debug(" Hello, log4cpp!"); >> >> On Windows this code works as expected >> >> #include <log4cpp/Category.hh> >> #include <log4cpp/PropertyConfigurator.hh> >> #include <iostream> >> >> log4cpp::Category& loggg = >> log4cpp::Category::getInstance(std::string("mylog")); >> >> void init() >> { >> >> try >> { >> log4cpp::PropertyConfigurator::configure("log4cpp.properties"); >> } >> catch (log4cpp::ConfigureFailure & f) >> { >> std::cerr << "configure problem " << f.what() << std::endl; >> } >> >> } >> >> int main() >> { >> init(); >> loggg.debug(" Hello, log4cpp!"); >> return 0; >> } >> >> Print out: >> >> 2008-05-21 08:30:38,718 [DEBUG][3476] : Hello, log4cpp! >> 2008-05-21 08:30:38,718 [DEBUG][3476] : Hello, log4cpp! >> >> What log4cpp version, compiler version, OS do you use? > > OS: > [root@localhost MSCA]# uname -a > Linux localhost.localdomain 2.6.9-5.EL #1 Wed Jan 5 19:22:18 EST 2005 > i686 i686 i386 GNU/Linux > > log4cpp: log4cpp-1.0 > > And I ssh to the computer with SSH SECURE SHELL, is this a problem ? > > Thanks so much. > > >> >> With best regards, Konstantin Litvinenko. >> >> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by: Microsoft >> Defy all challenges. Microsoft(R) Visual Studio 2008. >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >> _______________________________________________ >> Log4cpp-devel mailing list >> Log...@li... >> https://lists.sourceforge.net/lists/listinfo/log4cpp-devel >> > |