PDA

View Full Version : Logger Library : advice and help needed.



Antoine
5th April 2007, 09:04
Hello,

I hope I'm posting in the right thread - forgive me if it's not the case.

I'm using Qt on WinXP with MinGW 3.4.5 / QT 4.2.3, and I am currently looking for a 'logger' library (ideally I would like to find one as "log4j" in the Java world, but I'm interested in others, too).

I saw many references to C++ libraries, but :
- I could not determine with one was the best to use
- ... and honestly I could not compile them properly on my configuration... :( (without knowing if I was doing something wrong, of if there was no compatibility with MinGW or my environment). :crying:

So my questions are : do any of you use a logger library under WinXP / MinGW ?
Could you provide me help with this ?

Thanks in advance for your help and patience.

guilugi
5th April 2007, 09:08
Hello Antoine,

I don't really know a logging library...
Well, it's not really difficult to write a Logger module on your own : Qt provides all the good components to achieve that...
For instance, QTextStream, QFile to dump your log lines.
This code would be portable.

The only thing that you really have to implement is the log rotation & log packing into archive (if you need them).

I think there was already another thread about that, I'm looking for it !

By the way, I did a small logging class in my application, so I can help ;-)

Guilugi.

wysota
5th April 2007, 09:57
I've been using log4cpp (http://log4cpp.sourceforge.net/) or log4cxx (http://directory.fsf.org/log4cpp.html) - I don't remember which of them right now.

Antoine
5th April 2007, 16:04
Thank you very much for your answers ! ;)

Guilugi : did you find the thread you were talking about ? I didn't ! :(
Qt allows me to define a message handler to manage calls to "qDebug" or "qWarning" : is that what you mentioned ?
I could use that, but I don't have time to implement a logger class now, and I wanted to manage the logs behaviour from the outside of the app, and with a notion of "levels"...

Wysota : were these two libraries compiled without any problem on WinXP / MinGW 3.4.5 / Qt 4.2.3 ?
Are they portable, too ?

Thanks for your help and answers ! :cool:

wysota
5th April 2007, 16:26
They are portable.

guilugi
5th April 2007, 16:29
Oops, sorry Antoine, here's the link to the thread.

http://www.qtcentre.org/forum/f-qt-programming-2/t-writing-log-records-to-a-log-file-6140.html/?highlight=QTextStream

It was meant for Qt3, but it may help :)

Guilugi.

Antoine
6th April 2007, 08:40
Thanks for your help and answers !
This will help me a lot ! :D