views:

645

answers:

5

Hi,

can anybody hint me a good, free Delphi logging framework? It should be easy to use and it should support different "log writers" including plain text, database and network.

+3  A: 

I know it's not free - but well worth it's money: CodeSite by Raize Software. Quality has its price! :-)

I always enjoyed working with CodeSite, especially the ability to add just about any type of objects to the log without huge conversions to a string format was often very helpful.

Again: not free, but worth its price in gold, if you really are serious about production-quality logging and viewing of those logs.

Marc

marc_s
I have to disagree with this, although my opinion is of course very biased, as I'm one of the developers behind the SmartInspect logging tool. One of the many reasons CodeSite is almost never the best solution is because you have to distribute an external Dispatcher service with your application in order to log data (yes, there are *Direct protocols for CodeSite now, but they are very limited and slow). There are other reasons against CodeSite, but it's one of the main reasons users switch to other tools in my experience.
Dennis G.
I see your point on the Dispatcher service - that could be a drawback depending on your scenario. What other reasons would you have, though?
marc_s
marc_s: Sorry about the downvote, I agree it wasn't the best way to communicate my disagreement with your statement (I've removed the downvote), and it wasn't meant personal.
Dennis G.
You asked about other reasons/issues: based on reports from customers who switched to SmartInspect, one big issue with CodeSite seems to be the slow logging performance. Another issue: the default logging protocol is based on window messages, which is very problematic for quite a few applications, especially since Windows Vista changed the service/desktop interaction mechanisms. Others: lack of asynchronous logging, log levels, file encryption etc. Of course, some of these issues might not be a problem in all scenarios. I'm just saying that there are better tools, not even necessarily our own.
Dennis G.
OK, thanks - bringing up your reservations about CodeSite in this manner is much more productive and hopefully also more helpful to the original poster than a downvote - thanks!
marc_s
+1  A: 

I'm a big fan of CodeSite, too, but if you're looking for free, how about OutputDebugString with either the Delphi IDE or DebugView from SysInternals.

Bruce McGee
+4  A: 

http://stackoverflow.com/questions/72983/which-logging-library-is-better mentions the following of which only the last two are free.

Lars Truijens
A: 

Another alternative to Codesite is Overseer which is open sourced and part of the nexus project, but stands alone so does not require you to use their framework.

skamradt
A: 

There is a port of the Java Log4J logging framework at sourceforge.

It is Currently based on log4j 1.2.12 and quite active, and very easy to use. It includes TLogODSAppender, TLogStreamAppender, TLogFileAppender, TLogRollingFileAppender.

Log4D project page at sourceforge

Writing appenders is straightforward, here is an example of a simple console appender:

unit LogConsoleAppender;

interface

uses
  Log4D;

type
  { Send log messages to console output. }
  TLogConsoleAppender = class(TLogCustomAppender)
  protected
    procedure DoAppend(const Message: string); override;
  end;

implementation

{ TLogConsoleAppender }

procedure TLogConsoleAppender.DoAppend(const Message: string);
begin
  if IsConsole then
    Write(Message);
end;

initialization
  RegisterAppender(TLogConsoleAppender);

end.
mjustin