log4cplus-devel Mailing List for log4cplus (Page 21)
Logging Framework for C++
Brought to you by:
wilx
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
(2) |
Apr
(2) |
May
(1) |
Jun
|
Jul
|
Aug
(2) |
Sep
(3) |
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2005 |
Jan
|
Feb
(1) |
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
2006 |
Jan
|
Feb
(1) |
Mar
|
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
(3) |
Nov
(7) |
Dec
(15) |
2007 |
Jan
(19) |
Feb
(23) |
Mar
(40) |
Apr
(36) |
May
(18) |
Jun
(8) |
Jul
(10) |
Aug
(18) |
Sep
(18) |
Oct
(4) |
Nov
(1) |
Dec
(4) |
2008 |
Jan
(2) |
Feb
(1) |
Mar
(4) |
Apr
(16) |
May
(17) |
Jun
(15) |
Jul
(23) |
Aug
(7) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
2009 |
Jan
(2) |
Feb
(1) |
Mar
(1) |
Apr
(7) |
May
|
Jun
(5) |
Jul
(2) |
Aug
(9) |
Sep
|
Oct
(4) |
Nov
(6) |
Dec
(4) |
2010 |
Jan
(2) |
Feb
(2) |
Mar
(6) |
Apr
(5) |
May
(2) |
Jun
(13) |
Jul
(5) |
Aug
|
Sep
(2) |
Oct
(2) |
Nov
|
Dec
|
2011 |
Jan
(1) |
Feb
|
Mar
|
Apr
(2) |
May
(2) |
Jun
(11) |
Jul
(1) |
Aug
(4) |
Sep
(5) |
Oct
|
Nov
(4) |
Dec
|
2012 |
Jan
|
Feb
(13) |
Mar
(3) |
Apr
(5) |
May
(18) |
Jun
(22) |
Jul
(11) |
Aug
(25) |
Sep
(56) |
Oct
(1) |
Nov
(28) |
Dec
(3) |
2013 |
Jan
(66) |
Feb
(40) |
Mar
(61) |
Apr
(1) |
May
(45) |
Jun
(30) |
Jul
(30) |
Aug
(46) |
Sep
(23) |
Oct
(43) |
Nov
(95) |
Dec
(27) |
2014 |
Jan
(16) |
Feb
(19) |
Mar
(23) |
Apr
(18) |
May
(22) |
Jun
(12) |
Jul
(15) |
Aug
(16) |
Sep
(30) |
Oct
(10) |
Nov
(10) |
Dec
(5) |
2015 |
Jan
(2) |
Feb
(7) |
Mar
|
Apr
(1) |
May
(10) |
Jun
(3) |
Jul
(1) |
Aug
(5) |
Sep
|
Oct
(6) |
Nov
(2) |
Dec
(15) |
2016 |
Jan
(21) |
Feb
(6) |
Mar
(30) |
Apr
(12) |
May
(11) |
Jun
(4) |
Jul
(2) |
Aug
(7) |
Sep
(13) |
Oct
|
Nov
(6) |
Dec
(8) |
2017 |
Jan
(21) |
Feb
(5) |
Mar
(7) |
Apr
(3) |
May
|
Jun
(4) |
Jul
(18) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2018 |
Jan
(1) |
Feb
|
Mar
(2) |
Apr
(1) |
May
(4) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
2019 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
|
Jun
|
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
2020 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2021 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2023 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2024 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
From: heapifyman <hea...@gm...> - 2009-11-03 16:50:54
|
Hello all, I managed to successfully build log4cplus in Visual Studio 2005 and now am trying to use it in my C++ project. In my project settings, I added the log4cplus include dir to Additional Includedirectories and also the msvc8\log4cplus_dll.Debug directory to Additional Librarydirectories. Further, I added log4cplusD.lib to my Linker-->Input-->Additional Dependencies (sorry if the setting's names are not correct, I only have the German version here. However, when building the project I get the following error in the Linking step: error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: void __thiscall log4cplus::Logger::forcedLog(int,class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &,char const *,int)" (__imp_?forcedLog@Logger@log4cplus@@QAEXHABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@PBDH@Z)" in Funktion ""public: __thiscall Plateau::MyPlugin_impl::MyPlugin_impl(void)" (??0MyPlugin_impl@Plateau@@QAE@XZ)". Am I missing anything in my includes or library dependencies? Is there some documentation available on how to setup a VS 2005 project with log4cplus support? I'd appreciate any help. Greetings, Philip |
From: myselfquestion <mys...@12...> - 2009-10-13 07:41:39
|
I used this code in WindowXP, but I can't use NTEventLogAppender. I dont't find the help documnet about NTEventLogAppender. Please give an example! Thank you! |
From: Václav H. <wi...@us...> - 2009-10-13 05:52:14
|
raJkumar subbarayan wrote, On 13.10.2009 6:45: > 1)Is it possible to use this in vc6 I do not know if 1.0.3 and later releases even compile with VC6. I do not support that compiler. > 2)When can I expect detailed documentation for your library The only documentation there is the Doxygen genrated docs <http://log4cplus.sourceforge.net/docs/html/index.html> and of course the source itself. -- VH |
From: Václav H. <v.h...@sh...> - 2009-10-12 21:00:09
|
raJkumar subbarayan wrote, On 12.10.2009 22:02: > Hi, Hi. > > Looking forward to use your library in my application but I am missing > documentation for the same.Can you help me getting started by providing > a example to log into file.My expectation is to log in files of 64KB > size as described in the following > question. http://stackoverflow.com/questions/1553885/how-to-write-logs-to-files-of-size-64kb-in-c-vc . Take a look at how test/fileappnder_test does things. It uses RollingFileAppender class. The key properties for this class are MaxFileSize and MaxBackupIndex. -- VH |
From: raJkumar s. <ye...@gm...> - 2009-10-12 20:03:28
|
Hi, Looking forward to use your library in my application but I am missing documentation for the same.Can you help me getting started by providing a example to log into file.My expectation is to log in files of 64KB size as described in the following question. http://stackoverflow.com/questions/1553885/how-to-write-logs-to-files-of-size-64kb-in-c-vc . Regards, Raj S. |
From: Václav H. <wi...@us...> - 2009-08-25 16:24:35
|
Václav Haisman wrote, On 25.8.2009 18:21: > ss ak wrote, On 25.8.2009 18:19: >> where do i find the list of properties to set???? >> in the documentation or in the code..i could not find what properties to >> set... > Well, the documentation is not that good as it should be. If in doubt, look > into the code :) > >> >> how to set layout as Patternlayout??? > What part of my example is not clear? Oh, I can see what you mean. Sorry. Try to take a look at the tests in tests directory. There is even a patternlayout_test. > >> >> log4cplus::BasicConfigurator config;config.configure(); >> >> logger = Logger::getInstance("main"); >> >> log4cplus::helpers::Properties props; >> >> props.setProperty (LOG4CPLUS_TEXT ("Append"), LOG4CPLUS_TEXT ("true")); >> >> props.setProperty (LOG4CPLUS_TEXT ("File"), LOG4CPLUS_TEXT ("logfile.log")); >> >> props.setProperty (LOG4CPLUS_TEXT ("PatternLayout"), >> >> LOG4CPLUS_TEXT ("%c")); >> >> log4cplus::Layout pattlayout = new log4cplus::PatternLayout(props); >> >> log4cplus::SharedAppenderPtr fileapp (new log4cplus::FileAppender (props)); >> >> logger.addAppender(fileapp); >> >> logger.setLogLevel(log4cplus::DEBUG_LOG_LEVEL); -- VH |
From: Václav H. <wi...@us...> - 2009-08-25 16:22:01
|
ss ak wrote, On 25.8.2009 18:19: > where do i find the list of properties to set???? > in the documentation or in the code..i could not find what properties to > set... Well, the documentation is not that good as it should be. If in doubt, look into the code :) > > how to set layout as Patternlayout??? What part of my example is not clear? > > log4cplus::BasicConfigurator config;config.configure(); > > logger = Logger::getInstance("main"); > > log4cplus::helpers::Properties props; > > props.setProperty (LOG4CPLUS_TEXT ("Append"), LOG4CPLUS_TEXT ("true")); > > props.setProperty (LOG4CPLUS_TEXT ("File"), LOG4CPLUS_TEXT ("logfile.log")); > > props.setProperty (LOG4CPLUS_TEXT ("PatternLayout"), > > LOG4CPLUS_TEXT ("%c")); > > log4cplus::Layout pattlayout = new log4cplus::PatternLayout(props); > > log4cplus::SharedAppenderPtr fileapp (new log4cplus::FileAppender (props)); > > logger.addAppender(fileapp); > > logger.setLogLevel(log4cplus::DEBUG_LOG_LEVEL); |
From: ss ak <ss...@gm...> - 2009-08-25 16:19:51
|
where do i find the list of properties to set???? in the documentation or in the code..i could not find what properties to set... how to set layout as Patternlayout??? log4cplus::BasicConfigurator config;config.configure(); logger = Logger::getInstance("main"); log4cplus::helpers::Properties props; props.setProperty (LOG4CPLUS_TEXT ("Append"), LOG4CPLUS_TEXT ("true")); props.setProperty (LOG4CPLUS_TEXT ("File"), LOG4CPLUS_TEXT ("logfile.log")); props.setProperty (LOG4CPLUS_TEXT ("PatternLayout"),LOG4CPLUS_TEXT ("%c")); log4cplus::Layout pattlayout = new log4cplus::PatternLayout(props); log4cplus::SharedAppenderPtr fileapp (new log4cplus::FileAppender (props)); logger.addAppender(fileapp); logger.setLogLevel(log4cplus::DEBUG_LOG_LEVEL); 2009/8/24 Václav Haisman <v.h...@sh...> > ss ak wrote, On 25.8.2009 1:15: > > How do i set > > Append=true. > > > > I didnt find any properties to set on the fileappender.... > > this is the only code i am using... > > > >> here is the code > >> log4cplus::BasicConfigurator config; > >> > >> config.configure(); > >> > >> log4cplus::Logger logger = Logger::getInstance("main"); > >> > >> log4cplus::SharedAppenderPtr > > fileapp(new log4cplus::FileAppender("logfile.log")); > >> > >> logger.addAppender(fileapp); > >> > >> logger.setLogLevel(log4cplus::DEBUG_LOG_LEVEL); > > It outputs on the console too... > I did not realise it before, yes, it does output to console. That is > because > BasicConfigurator automatically adds ConsoleAppender to rootLogger. If you > want to avoid that, use PropertyConfigurator instead. > > To make the FileAppender append to existing file, configure it with the > Append=true property. Something like this: > > log4cplus::helpers::Properties props; > props.setProperty (LOG4CPLUS_TEXT ("Append"), LOG4CPLUS_TEXT ("true")); > props.setProperty (LOG4CPLUS_TEXT ("File"), LOG4CPLUS_TEXT > ("logfile.log")); > log4cplus::SharedAppenderPtr fileapp (new log4cplus::FileAppender (props)); > > -- > VH > > |
From: Václav H. <v.h...@sh...> - 2009-08-25 05:45:04
|
ss ak wrote, On 25.8.2009 1:15: > How do i set > Append=true. > > I didnt find any properties to set on the fileappender.... > this is the only code i am using... > >> here is the code >> log4cplus::BasicConfigurator config; >> >> config.configure(); >> >> log4cplus::Logger logger = Logger::getInstance("main"); >> >> log4cplus::SharedAppenderPtr > fileapp(new log4cplus::FileAppender("logfile.log")); >> >> logger.addAppender(fileapp); >> >> logger.setLogLevel(log4cplus::DEBUG_LOG_LEVEL); > It outputs on the console too... I did not realise it before, yes, it does output to console. That is because BasicConfigurator automatically adds ConsoleAppender to rootLogger. If you want to avoid that, use PropertyConfigurator instead. To make the FileAppender append to existing file, configure it with the Append=true property. Something like this: log4cplus::helpers::Properties props; props.setProperty (LOG4CPLUS_TEXT ("Append"), LOG4CPLUS_TEXT ("true")); props.setProperty (LOG4CPLUS_TEXT ("File"), LOG4CPLUS_TEXT ("logfile.log")); log4cplus::SharedAppenderPtr fileapp (new log4cplus::FileAppender (props)); -- VH |
From: Václav H. <v.h...@sh...> - 2009-08-24 21:17:22
|
ss ak wrote, On 24.8.2009 23:12: > I am writing into a file but does not append!! I have answered this in the previous email. > then one more big issue : While writing into file,it also puts on the > console... > > how to set it to write into a file with out putting ont eh console... > > please..i need this to set it up asap... Show the code and/or the properties file you are using. -- VH |
From: ss ak <ss...@gm...> - 2009-08-24 21:12:37
|
I am writing into a file but does not append!! then one more big issue : While writing into file,it also puts on the console... how to set it to write into a file with out putting ont eh console... please..i need this to set it up asap... thanks |
From: ss ak <ss...@gm...> - 2009-08-24 21:01:00
|
Hi, I want to write to log file which appends.... 1.It writes into a file but does not append??it writes to a new file everytime....what is wrong in this... 2.I set to debug level, LOG4CPLUS_DEBUG(logger,logstring.c_str()); LOG4CPLUS_ERROR(logger,logstring.c_str()); Both get printed.I mean same message is written into the file,2 times..Should it write only once. here is the code log4cplus::BasicConfigurator config; config.configure(); log4cplus::Logger logger = Logger::getInstance("main"); log4cplus::SharedAppenderPtr fileapp(new log4cplus::FileAppender("logfile.log")); logger.addAppender(fileapp); logger.setLogLevel(log4cplus::DEBUG_LOG_LEVEL); Please someone help me... thanks, SS |
From: Václav H. <v.h...@sh...> - 2009-08-14 05:26:13
|
ss ak wrote, On 14.8.2009 2:04: > > After trying a lot and different logging api....i am here and need help... > > I could successfully built log4cplus.lib and dll and included in my > application... > and also working with xerces api which is already included.... > > but not included any msxml.h file....Please tell me how to get rid of it... This has nothing to do with log4cplus. > > > > >>c:\program files\microsoft sdks\windows\v6.0a\include\msxml.h(7963) : > error C2371: 'DOMDocument' : redefinition; different basic types > > 1> c:\program files\microsoft sdks\windows\v6.0a\include\msxml.h(171) : > see declaration of 'DOMDocument' > > 1>c:\friday7\domp\dmpsetup.h(85) : error C2872: 'DOMDocument' : > ambiguous symbol > > 1> could be 'c:\program files\microsoft > sdks\windows\v6.0a\include\msxml.h(7963) : DOMDocument' > > 1> or > 'c:\downloads\xerces-c-3.0.1-x86-windows-vc-9.0\xerces-c-3.0.1-x86-windows-vc-9.0\include\xercesc\dom\domdocument.hpp(64) > : xercesc_3_0::DOMDocument' > > 1>c:\friday7\domp\dmpsetup.cpp(221) : error C2872: 'DOMDocument' : > ambiguous symbol > > 1> could be 'c:\program files\microsoft > sdks\windows\v6.0a\include\msxml.h(7963) : DOMDocument' > > 1> or > 'c:\downloads\xerces-c-3.0.1-x86-windows-vc-9.0\xerces-c-3.0.1-x86-windows-vc-9.0\include\xercesc\dom\domdocument.hpp(64) > : xercesc_3_0::DOMDocument' > > 1>c:\friday7\domp\dmpsetup.cpp(221) : error C2440: 'initializing' : > cannot convert from 'xercesc_3_0::DOMDocument *' to 'DOMDocument *' > > 1> Types pointed to are unrelated; conversion requires reinterpret_cast, > C-style cast or function-style cast > > 1>c:\friday7\domp\dmpsetup.cpp(229) : error C2027: use of undefined type > 'DOMDocument' > > 1> c:\program files\microsoft sdks\windows\v6.0a\include\msxml.h(7963) : > see declaration of 'DOMDocument' > > 1>c:\friday7\domp\dmpsetup.cpp(229) : error C2227: left of > '->getDocumentElement' must point to class/struct/union/generic type > > 1>c:\friday7\domp\dmpsetup.cpp(235) : error C2027: use of undefined type > 'DOMDocument' > > 1> c:\program files\microsoft sdks\windows\v6.0a\include\msxml.h(7963) : > see declaration of 'DOMDocument' It looks like you are including both MSXML and Xerces which both define DOMDocument class and that breaks the compilation. I am sorry but I cannot help you with that. -- VH |
From: ss ak <ss...@gm...> - 2009-08-14 00:04:33
|
After trying a lot and different logging api....i am here and need help... I could successfully built log4cplus.lib and dll and included in my application... and also working with xerces api which is already included.... but not included any msxml.h file....Please tell me how to get rid of it... >c:\program files\microsoft sdks\windows\v6.0a\include\msxml.h(7963) : error C2371: 'DOMDocument' : redefinition; different basic types 1> c:\program files\microsoft sdks\windows\v6.0a\include\msxml.h(171) : see declaration of 'DOMDocument' 1>c:\friday7\domp\dmpsetup.h(85) : error C2872: 'DOMDocument' : ambiguous symbol 1> could be 'c:\program files\microsoft sdks\windows\v6.0a\include\msxml.h(7963) : DOMDocument' 1> or 'c:\downloads\xerces-c-3.0.1-x86-windows-vc-9.0\xerces-c-3.0.1-x86-windows-vc-9.0\include\xercesc\dom\domdocument.hpp(64) : xercesc_3_0::DOMDocument' 1>c:\friday7\domp\dmpsetup.cpp(221) : error C2872: 'DOMDocument' : ambiguous symbol 1> could be 'c:\program files\microsoft sdks\windows\v6.0a\include\msxml.h(7963) : DOMDocument' 1> or 'c:\downloads\xerces-c-3.0.1-x86-windows-vc-9.0\xerces-c-3.0.1-x86-windows-vc-9.0\include\xercesc\dom\domdocument.hpp(64) : xercesc_3_0::DOMDocument' 1>c:\friday7\domp\dmpsetup.cpp(221) : error C2440: 'initializing' : cannot convert from 'xercesc_3_0::DOMDocument *' to 'DOMDocument *' 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 1>c:\friday7\domp\dmpsetup.cpp(229) : error C2027: use of undefined type 'DOMDocument' 1> c:\program files\microsoft sdks\windows\v6.0a\include\msxml.h(7963) : see declaration of 'DOMDocument' 1>c:\friday7\domp\dmpsetup.cpp(229) : error C2227: left of '->getDocumentElement' must point to class/struct/union/generic type 1>c:\friday7\domp\dmpsetup.cpp(235) : error C2027: use of undefined type 'DOMDocument' 1> c:\program files\microsoft sdks\windows\v6.0a\include\msxml.h(7963) : see declaration of 'DOMDocument' |
From: Václav H. <v.h...@sh...> - 2009-07-30 19:56:09
|
Philipp Kursawe wrote, On 30.7.2009 16:30: > [...] Oh, and please try just released 1.0.4-RC1, if it fixes any of your problems. -- VH |
From: Václav H. <v.h...@sh...> - 2009-07-30 19:56:02
|
Philipp Kursawe wrote, On 30.7.2009 16:30: > Message body follows: > > Hello, > > I try to use your log library statically inside my win32 dll > project. Somehow the _static_log4cplus_initializer class is > not instantiated. The code is generated but not called. If you have built log4cplus as DLL then it does not use _static_log4cplus_initializer, in case of DLL it uses DllMain() function to initalize things. > > Also, since my dll project does not have a console, all > calls to tcerr (which is null) vial LogLog fail and the > exceptions are not catched. I have enabled C++ Exception > Handling in my compiler settings though. Internal error reporting/logging is rather inconsistent and incomplete. In case you do not have access to std::cerr there is not much you can do right now. I will try to improve it for 1.0.4. > > I am using Visual Studio 2005 Professional. > > Also the NTEventAppender does not work as expected. The dll > that is registerered in the Registry does not exists and I > think the EventLog fails to display the text of the event > message because of that. I will look into this. I thought that it just puts some longish text in front of the logged message if it cannot find the registered DLL. > > Thanks for your help, > Phil -- VH |
From: Václav H. <v.h...@sh...> - 2009-06-06 12:51:27
|
Koller, Georg wrote, On 2.6.2009 16:32: > Hello, > > when I use ConfigureAndWatchThread in my application and change the > configuration file, while my application is running, my application hangs. > Any ideas? > The code is printed below. > > Regards, > Georg > > > #include <log4cplus/logger.h> > #include <log4cplus/configurator.h> > > #include <unistd.h> > > using namespace log4cplus; > > int > main > (int argc, char* argv []) > { > ConfigureAndWatchThread > configureThread(LOG4CPLUS_TEXT("logger.properties"), 5 * 1000); > > Logger log1 = Logger::getInstance("test.log_1"); > LOG4CPLUS_FATAL(log1,"fatal message"); > } I have pushed some fixes on the PRODUCTION_1_0_x branch, this code should now work out of the box. Please check out the source from <https://log4cplus.svn.sourceforge.net/svnroot/log4cplus/branches/PRODUCTION_1_0_x/log4cplus> and test it. -- VH |
From: Václav H. <v.h...@sh...> - 2009-06-02 20:17:44
|
Koller, Georg wrote, On 2.6.2009 17:19: > Sorry, I forgot to add a few lines. > Here is the corrected code. > > What I did to see the error: > 1. Start application. > 2. Modify logger.properties. > 3. I would expect the application to quit after 20 seconds, but it never quits. I have identified some problems with the threading code and the ConfigureAndWatchThread itself. I think I have fixed at least one related to the life time of the watch dog thread object. To get it check out the code from <https://log4cplus.svn.sourceforge.net/svnroot/log4cplus/branches/PRODUCTION_1_0_x/log4cplus>. > > > #include <log4cplus/logger.h> > #include <log4cplus/configurator.h> > > #include <unistd.h> > > using namespace log4cplus; > > int > main > (int argc, char* argv []) > { > ConfigureAndWatchThread configureThread(LOG4CPLUS_TEXT("logger.properties"), 5 * 1000); To work around the problems in the log4cplus code, try the following instead: ConfigureAndWatchThread * configureThread = new ConfigureAndWatchThread(LOG4CPLUS_TEXT("logger.properties"), 5 * 1000); > > Logger log1 = Logger::getInstance("test.log_1"); > > LOG4CPLUS_FATAL(log1,"fatal message"); > > for (int i=0; i<20; i++) > { > sleep(1); > } delete configureThread; sleep (5 * 1000 + 1000); The problem here is that right now there is no way how to reliably wait for the watch dog thread to exit before exiting main(). > } -- VH |
From: Václav H. <v.h...@sh...> - 2009-06-02 15:01:15
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Koller, Georg wrote: > Hello, > > when I use ConfigureAndWatchThread in my application and change the > configuration file, while my application is running, my application hangs. > Any ideas? > The code is printed below. > > Regards, > Georg > > > #include <log4cplus/logger.h> > #include <log4cplus/configurator.h> > > #include <unistd.h> > > using namespace log4cplus; > > int > main > (int argc, char* argv []) > { > ConfigureAndWatchThread > configureThread(LOG4CPLUS_TEXT("logger.properties"), 5 * 1000); > > Logger log1 = Logger::getInstance("test.log_1"); > LOG4CPLUS_FATAL(log1,"fatal message"); > } > Is this just an example or does the real code also return from the main() function while the ConfigureAndWatchThread is still running? If the real code looks like this example then the problem is in the code: The application might seem to be hung because even though the main thread has returned from main(), the ConfigureAndWatchThread is still running. Also, after you return from main() all static variables get destroyed. log4cplus uses them for various singletons. Accessing them in the ConfigureAndWatchThread after that is undefined behaviour. - -- VH -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iFYEAREIAAYFAkolPq0ACgkQhQBMvHf/WHndYgDdFageJ65NGnECam2j5yPC7kox B8LTZ/3+mKA0VQDfYaqYXiuwX46jhl3Oyb3sdjp9JXebOrQGZYtFpQ== =DwMh -----END PGP SIGNATURE----- |
From: Koller, G. <Geo...@an...> - 2009-06-02 14:32:33
|
Hello, when I use ConfigureAndWatchThread in my application and change the configuration file, while my application is running, my application hangs. Any ideas? The code is printed below. Regards, Georg #include <log4cplus/logger.h> #include <log4cplus/configurator.h> #include <unistd.h> using namespace log4cplus; int main (int argc, char* argv []) { ConfigureAndWatchThread configureThread(LOG4CPLUS_TEXT("logger.properties"), 5 * 1000); Logger log1 = Logger::getInstance("test.log_1"); LOG4CPLUS_FATAL(log1,"fatal message"); } ________________________________________________ Andrew Wireless Systems GmbH Industriering 10 D-86675 Buchdorf Germany Georg Koller Product Development - SW Tel. +49 9099 69-189 Fax +49 9099 69-140 geo...@an... ________________________________________________ Andrew Wireless Systems GmbH, Industriering 10, D-86675 Buchdorf Managing Directors: Michael Ferber, Neil Shankland, Michael D. Coppin Phone: +49 (0) 90 99/69-0, Fax: +49 (0) 90 99 69-9 30, Internet: www.andrew.com <http://www.andrew.com/> Amtsgericht Augsburg, HRB No: 949, German Tax-No: 152/121/50468, VAT: DE127491606 ------------------------------------------------------------------------------------------------ This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any unauthorized use of this email is prohibited. ------------------------------------------------------------------------------------------------ [mf2] |
From: Václav H. <v.h...@sh...> - 2009-04-27 19:27:50
|
Semyon Kleinerman wrote, On 27.4.2009 17:49: > Hi Vaclav, > > I have another question about log4cplus implementation… I am using class > RollingFileAppender. This class creates a set of log files like > "filename.log", "filename.log.1", "filename.log.2" etc… I need to create > files with a different format of file names: "filename1.log", > "filename2.log" etc… > > Is there some way to implement this? > > p.s. I can derive RollingFileAppender class and implement append function, > but it forces me to write a lot of cloned code, such as rollover function > (it's not virtual) and static function rolloverFiles.. This solution > doesn't seems to be efficient…. No, this is not currently possible. Foo.N is the traditional format of rotating log files. -- VH |
From: Václav H. <v.h...@sh...> - 2009-04-26 13:22:03
|
Semyon Kleinerman wrote, On 26.4.2009 11:49: > Hi Vaclav, > > I have a separate thread using log4cplus. There is a stack of log messages > and my thread executing them one by one. Now the parameters I have to > pass: > > 1) Original thread ID > 2) Original Time of log event > > TCCLayout is not friendly for me because it will print a wrong thread id > and a later time. > > By creating a custom layout I don't reach the target as the > InternalLoggingEvent doesn't let me to put any user data. The only way is > to format the whole message before sending it to log. > > Maybe the solution is to extend the InternalLoggingEvent members with some > pointer "m_pUserData" and to add one more parameter to the function > LOG4CPLUS_ERROR? All this sounds like are trying to do logging asynchronously in separate thread (speed concerns?). If you want to do such thing, then custom layout is not the way. Either implement a custom appender, that will push the logging work to separate thread (This is something that AsyncAppender on the 1.1 branch does.) or implement a custom logging layer using InternalLoggingEvent directly, filling in the thread ID before you give it to another thread. -- VH |
From: Václav H. <v.h...@sh...> - 2009-04-23 16:57:53
|
Semyon Kleinerman wrote, On 23.4.2009 16:10: > Hi, > I have a some difficulties in creating of custom layout. > > I have derived base log4cplus::Layout class: > > class LogLayout : public Layout > { > public: > LogLayout(void); > ~LogLayout(void); > > virtual void formatAndAppend(log4cplus::tostream& output, const > log4cplus::spi::InternalLoggingEvent& event); > }; > > The problem is that in formatAndAppend function parameters there is an > InternalLoggingEvent object only and I have no way to put *my > parameters* there. What kind of parameters do you have in mind? > > The only way I found is to format the message before I send it to logger: > > void LogLayout::formatAndAppend(log4cplus::tostream& output, > const log4cplus::spi::InternalLoggingEvent& event) > { > output << event.getMessage(); > } I think the idea is that formatting depends only on what you can get from the InternalLoggingEvent instance and the state of the layout. For that the signature of the function is adequate. > > Could you please explain me what is the right way to create a custom > layout? > Plese, don't send HTML emails. -- VH |
From: Semyon K. <skl...@in...> - 2009-04-23 14:12:16
|
Hi, I have a some difficulties in creating of custom layout. I have derived base log4cplus::Layout class: class LogLayout : public Layout { public: LogLayout(void); ~LogLayout(void); virtual void formatAndAppend(log4cplus::tostream& output, const log4cplus::spi::InternalLoggingEvent& event); }; The problem is that in formatAndAppend function parameters there is an InternalLoggingEvent object only and I have no way to put my parameters there. The only way I found is to format the message before I send it to logger: void LogLayout::formatAndAppend(log4cplus::tostream& output, const log4cplus::spi::InternalLoggingEvent& event) { output << event.getMessage(); } Could you please explain me what is the right way to create a custom layout? Thank you, Semyon |
From: Václav H. <v.h...@sh...> - 2009-04-19 16:13:56
|
Semyon Kleinerman wrote, On 19.4.2009 13:57: > I've downloaded log4cplus, compiled it and it runs fine. But when I'm > trying to link it with the static library (log4cplus_static) instead of > dll, application fail to start due to log4cplus.dll absence… > > I am running on VS2008. > > Any advice? Are you sure that you are linking your application against one of log4cplus[U]S[D].lib libraries? -- VH |