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.
-
1Can't make a coment here... Telling from names, Log4delphi and Log4D are both inspired and modelled after Log4J Then how they are different and how to choose between ? – Arioch 'The Oct 03 '11 at 09:25
8 Answers
Which logging library is better? mentions the following of which only the last two are free.

- 1
- 1

- 42,837
- 6
- 126
- 143
-
1@Kenny being open source, Log4D development can be continued any time by others. Also, the Log4Delphi listed here is a different project. – mjn Dec 11 '15 at 10:30
-
QuickLogger is uptodate and logs to Redis, Elastic, Influxdb, files, email, etc... https://github.com/exilon/QuickLogger – Kike Pérez Apr 05 '19 at 22:22
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

- 732,580
- 175
- 1,330
- 1,459
-
7I 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. Jul 27 '09 at 21:02
-
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 Jul 27 '09 at 21:15
-
1marc_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. Jul 27 '09 at 21:27
-
3You 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. Jul 27 '09 at 21:48
-
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 Jul 28 '09 at 06:02
-
1@Dennis: a central dispatcher (or other TCP/IP logging server) like the one in CodeSite is very useful - or should I say required - if many applications from different workstations or a Terminal Server farm must write to the same log file. Which other logging tool do you know which can handle this? (just curious) – mjn Dec 16 '10 at 10:48
-
3@mjn SmartInspect has an optional router service that does exactly this. However, this is a very special use case (even if it's an important one) and although I believe a good logging tool should support this, it shouldn't be the default/only way of processing log entries (because in most cases, especially when you need logging in environments that you cannot control, installing a separate application just for logging is just not practical). – Dennis G. Dec 16 '10 at 20:14
I have been granted access to update the dormant Log4Delphi project and I have rolled up 4 years of bugfixes and patches into the latest 0.8 release available on Source-forge. I use this library in production and have found it to very stable and reliable and easy to use.

- 10,435
- 2
- 32
- 62
-
1Kenny, As with many Delphi frameworks out there support and maintenance is starting to wain as people stop using Delphi. There was a guy who made a clone of Log4Delphi and was keeping it up to date but I can't seem to fine his page anymore. – Melloware Dec 12 '15 at 13:27
A logger library shouldn't dump the contents synchronously. That will slow down the application. Instead, it needs to buffer the contents and dump them when it is flushed.
It should also be thread-safe and able to dump the contents from different threads. (And preferably be able to log the thread ID as well)
It should also be flexible and able to log multiple output formats.
Here's a library which does all this: loggerpro

- 11,090
- 5
- 65
- 85
-
It's great, it's by the same author of the Delphi MVC framework, I especially like the "memory appender", and I adopted to TSynLog in the mORMot framework. – Edwin Yip Apr 25 '18 at 04:26
-
1@EdwinYip I recently added a syslog appender to loggerpro, they make it very easy to contribute. – nurettin May 29 '18 at 14:32
-
thanks for letting me know about it. How do you receive and view syslog on Windows? Using a tool like this? https://github.com/MaxBelkov/visualsyslog Thanks – Edwin Yip May 30 '18 at 10:22
-
1@EdwinYip I have seen visualsyslog being used, but I prefer sending to linux (syslog-ng -> elasticsearch -> kibana) and viewing the logs from kibana which lets you do full text search on elasticsearch data from a web UI. – nurettin May 31 '18 at 13:45
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.

- 15,076
- 6
- 55
- 70
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.

- 15,366
- 2
- 36
- 53
There is another new logging framework for Delphi, which comes in a single file (nxlogging.pas). nxlogging is a nice lightweight and powerful set of classes like log4d (appenders, formaters), but much easier tu use. It includes file appenders (rolling files, all in a single one, etc...) and a tcp appender too, so you can forward your logs to a central logserver.

- 21
- 1
-
1Link: http://www.navimatix.de/loesungen/log-server/logging-fuer-delphi-nxlogging/ – mjn Sep 13 '13 at 15:25
-
2@mjn Unfortunately, it's in German. Site can be translated with Google, but not applications themselves. – vladon Sep 18 '13 at 10:19
There is Log4D, another port of the Java Log4J logging framework for Delphi at Sourceforge.
Log4D project page at sourceforge
A description of its architecture can be found on CodeCentral and here.
Help files are available online at http://cc.embarcadero.com/item/16446.
It is currently based on log4j 1.2.12 and quite active, and very easy to use. It includes TLogODSAppender, TLogStreamAppender, TLogFileAppender, TLogRollingFileAppender.
The following example project creates a ODS appender. If you run it in the IDE, the log messages will appear in the ‘Event log’ window.
program Log4Dexample;
{$APPTYPE CONSOLE}
uses
Log4D,
SysUtils;
var
Logger: TLogLogger;
begin
try
// basic configuration - creates a TLogODSAppender (ODS = OutputDebugString)
TLogBasicConfigurator.Configure;
// set the log level
TLogLogger.GetRootLogger.Level := Trace;
// create a named logger
Logger := TLogLogger.GetLogger('exampleLogger');
// write log messages
Logger.Fatal('fatal output');
Logger.Error('error output');
Logger.Warn('warn output');
Logger.Info('info output');
Logger.Debug('debug output');
Logger.Trace('trace output');
ReadLn;
except
on E:Exception do
begin
Writeln(E.Classname, ': ', E.Message);
ReadLn;
end;
end;
end.
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.

- 36,362
- 28
- 176
- 378