📜 ⬆️ ⬇️

Comparison of logging libraries



There are a lot of Q & A sites in the network where questions from the category are asked:


People share their experience and knowledge, but the format of such sites allows only to show the personal preferences of the respondent. For example, one of the most productive loggers is most often called Pantheios, which even the manufacturer’s tests spend more than 100 seconds to write 1M log lines, on modern hardware this is about 30 seconds, is it fast?
')
In this article, I will compare the most famous and well-deserved loggers of recent years and several relatively young loggers by more than 25 criteria.

Motivation


In almost every project I know, logging appeared sooner or later, and the engineers asked themselves “how to solve this problem?”, Someone rummaged in Q & A sites and got answers “I got a logger X, like normal flight” (1), someone then he wrote his logger (2), and someone had reserved patience and studied a whole bunch of loggers about their interests and a week later another made his choice (3).

This article is for all 3 groups:

  1. For the first group, this article will give a more extensive comparison of loggers than the recommendation “logger X is the best for me”
  2. For the second group, the article will give an idea of ​​the current level of technology and may tip the scales in the direction of “easier to use ready-made” or “oh, a lot of work, but I can do better” and who knows, maybe another year we will see a breakthrough in this area.
  3. For the third and most pedantic group, I hope this article will save at least one of the 3 weeks of research, across the industry it can be an impressive number of man-hours

NB The article is quite voluminous, so if you decide to read, please be patient!

Loggers and their basic parameters


The choice of loggers for comparison is a troublesome and not simple matter, in any case the questions will arise: “Why hasn’t logger X been considered?” What can I say, the logic was simple - take 4 well-known loggers and 4 relatively young and “hungry.”

But even comparing these 8 candidates took more than 3 weeks of smoking docks, issues, reading forums, writing tests and collecting results.

One way or another, if a very important logger was missed, you can update the article. The review got:

  1. Pantheios
  2. Glog
  3. log4cpp
  4. P7
  5. G3log
  6. Spdlog
  7. Easylogging
  8. Boost.Log (part of the huge Boost library)

General characteristics of selected loggers
PersonsLanguagesUpdatePlatf.Comp.
PantheiosBSDC ++2010Windows, * nix, OS-XVC ++, GCC, Intel, Borland, Comeau, Digital Mars, Metrowerks
Glog3-clause BSDC ++2018Windows, * nix, QNXVC ++, GCC, clang, intel
log4cppLGPLC ++2017Windows * nix SolarisVC ++, GCC, Sun CC, OpenVMS
P7LGPLC ++, C, C #, Python2018Windows * nixVC ++, GCC, clang, MinGW
G3logPublic DomainC ++ 112018Windows * nixVC ++, GCC, clang
SpdlogMITC ++ 112018Windows, Linux, Solaris, OS-X, AndroidVC ++, GCC, Clang
EasyloggingMITC ++ 112018Windows, Linux, Solaris, OS-X, AndroidVC ++, GCC, Clang, Intel
Boost.LogBoost ( 1 )C ++2016Windows Linux ( 2 )VC ++, GCC, Clang ( 3 )

  1. Own license www.boost.org/LICENSE_1_0.txt
  2. www.boost.org/doc/libs/1_62_0/libs/log/doc/html/log/installation.html
  3. There are a number of other platforms and compilers on which Boost can be compiled, but they are not officially supported and will probably require additional effort.

Documentation and dependencies


It is difficult to dispute the importance of documentation for complex projects, modern loggers with simple projects can be called a big stretch and the availability of good documentation sometimes significantly speeds up the introduction and correction of errors:
DocumentationDependencies
PantheiosFull (API + usage)STLSoft
GlogRudimentary, almost absentGoogle gflags, weak dependency ( 1 )
log4cppGenerated (Doxygen) (API only)Boost, weak dependency ( 1 )
P7Full (API + usage)Not
G3logBasic (common usage methods)Not
SpdlogBasic (common usage methods)No, header file only ( 2 )
EasyloggingBasic (common usage methods)No, header file only ( 2 )
Boost.LogBasic (common methods of use) plus a basic description of some classes and their methodsBoost

  1. Low dependency - part of the code depends on third-party solutions, but does not prevent compilation, and only partially restricts the functionality.

  2. Header file only - the library is distributed as one or more header files that must be included in each source file of your program; in the case of Easylogging, the compilation speed is significantly reduced. But there is a way out of this situation - to compile these projects in the form of a library and connect it already, though this will require additional time to create a project.

Logger type, memory control and thread safety


At the moment, there are widespread 2 approaches in logging:


However, there are nuances of understanding asynchrony by different manufacturers of logging libraries.

  1. Type number 1: Some believe that the call to the Log (..) function must be atomic, and thus the order of the log messages in the file will be consistent in time 00:00 -> 00:01 -> 00:02 and so on.

  2. Type # 2: Others believe that in order to achieve maximum performance, you can sacrifice the atomicity of the call to the Log (..) function and accept the fact that the log messages in the file will be intermittent, for example 00:00 -> 00:05 -> 00 : 01.

Personally, I adhere to the point of view of the first group on asynchronous logging, since the analysis of mixed logs cannot be pleasantly called, especially if it is a large log file and not single logs are mixed but groups of logs of several hundreds or thousands of elements.

Another important aspect of asynchronous logging is control over memory allocation, since in order for your logger to be asynchronous, you must save data in a buffer and write from another thread. And here the important trifle is hidden - what size of buffers will be optimal and can the user influence this parameter? The question is not at all idle, as some of the tested loggers allocated hundreds of megabytes for their needs.
Type ofMemory controlFlow safety
PantheiosSynchronousnotYes
GlogSynchronousnotYes
log4cppSynchronousnotYes
P7Asynchronous, (type 1) ( 2 )exact (in 1Kb increments)Yes
G3logAsynchronous, (type 2) ( 3 )no ( 5 )Yes
SpdlogAsynchronous, (type 2) ( 3 )partial ( 6 )Yes
EasyloggingSynchronous ( 1 )notno ( 4 )
Boost.LogSynchronous, Asynchronous, (type 2) ( 7 )no default ( 8 )Yes

  1. Asynchronous mode is in experimental state.
  2. Timestamps and messages are not mixed.
  3. Timestamps and messages may be shuffled.
  4. The default is not available, you must activate the macro ELPP_THREAD_SAFE
  5. Uncontrolled memory allocation, with high loads can allocate hundreds of megabytes, author's comment: kjellkod.wordpress.com/2014/08/16/presenting-g3log-the-next-version-of-the-next-generation-of-loggers
    This is a std :: queue is used internally that is a std :: deque. It is unbounded but much more memory tolerant than a std :: vector. Internally the queue is wrapped inside the shared_queue.hpp.

  6. You can set the queue length in the elements, the size of the element in the initial form - 88 bytes + text message (30-160 bytes). The author recommends setting the queue size to 1 million messages for optimal performance, which translates into memory consumption from 120 megabytes to 250 megabytes only for the logging library.
  7. The order of messages is not guaranteed by the library by default, time stamps can be mixed in the final file when logging from different streams: “Why does the log record have a multithreaded application?” The author of the library suggests using “unbounded_ordering_queue” to overcome this problem using special . attribute "RecordID" which will be sorted
  8. By default, the library uses “unbounded_fifo_queue” which results in an uncontrollable increase in memory consumption during intensive logging. It is possible to use with the additional setting “bounded_fifo_queue”. In this case, you can set the queue length in the elements. Each element (record in library terminology) occupies about 1KB

Process Failure Handling


Proper handling of process failures (crash handling) is primarily important for asynchronous loggers, since part of the data is stored in buffers and if they are not stored in time, perhaps the most valuable data will be lost right before the failure.

Three approaches are common in intercepting falls:


PantheiosNot
Glogautomatic, only under Linux ( 1 )
log4cppNot
P7manual and automatic ( 2 )
G3logautomatic, Linux only ( 3 )
SpdlogNo ( 4 )
Easyloggingautomatic, only under Linux ( 5 )
Boost.LogNo ( 6 )

  1. The following signals are intercepted: SIGSEGV, SIGILL, SIGFPE, SIGABRT, SIGBUS, SIGTERM.
  2. Intercepted following signals: SIGSEGV, SIGILL, SIGFPE, SIGINT, SIGABRT, SIGBUS, SIGTERM, SIGBUS, PureVirtualCall, VectoredException, Newhandler, InvalidParameterHandler, status_access_, exception_array_bounds_exceeded, exception_datatype_misalignment, exception_flt_divide_by_zero, exception_flt_stack_check, exception_illegal_instruction, exception_int_divide_by_zero, exception_noncontinuable_exception, exception_priv_instruction, exception_stack_overflow
  3. The following signals are intercepted: SIGSEGV, SIGILL, SIGFPE, SIGABRT, SIGBUS, SIGTERM, Div by zero, illegal printf, out of bounds, access violation, std :: future_error
  4. github.com/gabime/spdlog/issues/55 - The defect was “closed” in 2015, i.e. No work is foreseen in this area.
  5. The following signals are intercepted: SIGABRT, SIGFPE, SIGILL, SIGSEGV, SIGINT
  6. Even for synchronous mode, there is a risk of data loss in the event of a process failure; in the case of asynchronous mode, the risk of data loss is extremely high.

Logging style and output (sink)


The bulk of the libraries supports 2 well-established logging styles:


StyleConclusion (Sink)
PantheiosTemplate + overloaded functions
F (A), F (A, A), F (A, A, A), ... F (A, <-64->, A)
Printf
File, syslog, console, speech, ACE, COMerror, WinEventLog
GlogLog () << MessageFile, syslog, console
log4cppPrintf, Log () << MessageFile, syslog, console, NT log, IDS / A, OsStream, StringQueue, Win32Debug
P7 ( 6 )PrintfBinary file, console, syslog, text file (Linux: UTF8, Windows: UTF-16) network (own protocol and server ( 2 )), null
G3logPrintf, Log () << MessageFile ( 3 )
SpdlogPrintf ( 4 )File, syslog, console
EasyloggingPrintf ( 1 ), Log () << MessageFile, syslog, console
Boost.LogLog () << Message ( 5 )File, syslog, console, Win32Debug, WinEventLog, IPC

  1. In the case of the use of "Printf" generated an exception, this is probably a temporary problem.
  2. Own server is used for maximum performance. The server is free, but unfortunately only supports Windows, apparently based on Qt, a request for Linux support was sent to the author. The speed of sending logs over the network in the test configuration was about 3.5 million per second when the CPU was loaded - 13%. Performance tests are discussed in detail in the following chapters.
  3. The official delivery does not include Sink with support for file rotation and the console, but these extensions can be downloaded github.com/KjellKod/g3sinks
  4. Format string for Printf library functions is not compatible with the canonical format, which significantly complicates the painless replacement of one logger with another
  5. Passing a nullptr string as an argument to the logger causes a segmentation fault / access violation
  6. Most productive Sink: Binary file, Baical

Initialization of logger


Initialization or transfer of parameters is quite an important point because adds flexibility to the logger and eliminates the need to recompile if you decide to change the logging level for example.
PantheiosManual (code only)
GlogCommand line, manual, environment variables
log4cppManual configuration file ( 1 )
P7Command line ( 2 ), manual
G3logManual (code only)
SpdlogManual (code only)
EasyloggingConfiguration file, command line, manual
Boost.LogManual configuration file ( 3 )

  1. Detailed and well-organized setting of the parameters of the logger, perhaps the most extensive of all.
  2. In all other loggers, in order for the command line parameters to be processed, you must transfer them to the logger by hand from the int main (int argc, char * argv []) functions. In this logger, these parameters can be intercepted automatically from any part of the program / module (dll, so).
  3. The library provides only the most basic primitives for configuration via the configuration file . A more complete discussion of this issue can be found at the link. And as a conclusion
    This is a list of It is impossible to give an explicit configuration format description.

Filtering setup


The most common filtering technique is by logging levels, say if the filter is set to ERROR level - then anything that is less than ERROR (TRACE, DEBUG, INFO, WARNING ...) will not be included in the log. This method is very useful for screening out a large amount of unnecessary information at the moment and saving the CPU and disk space.
PantheiosNo ( 1 )
GlogCommand line, manual, environment variables
log4cppConfiguration file ( 4 ), manual
P7Command line, remotely over the network in real time ( 2 ) ( 3 ), manual
G3logNo ( 5 )
SpdlogManual
EasyloggingManual ( 6 )
Boost.LogManual configuration file

  1. To organize the filter you need to develop your FrontEnd
  2. Supported only if the data is sent over the network, in the case of recording to a local file, the server does not have access to the Verbosity level
  3. In addition to the global level, you can set the levels for each module.
  4. Hierarchical logging and setting of levels individually for each logger
  5. By default it is disabled, it is activated by the macro G3_DYNAMIC_LOGGING, then you can manually set the level for all loggers. Significantly reduces performance.
  6. The support is declared by the manufacturer, but it was not possible to get it to work, during use, the impression was that the function was under development or abandoned.

Unicode support


This part of the testing was one of the saddest, in 2016 the support of unicode in such well-known libraries is still at the level “ not officially ”.

The library is needed in order to save important application data (the user's last name, file path, domain name), and most of the existing ones simply will not allow you to do this if the data does not fit into the trivial char.
PantheiosUtf-16 ( 1 ) ( 4 ), Utf-8
GlogNot
log4cppNot
P7Windows - UTF-16, * nix - UTF-8, UTF-32
G3logNot
SpdlogNot
EasyloggingWindows Utf-16 ( 2 ), Utf-8 ( 3 )
Boost.LogUTF-8 partially ( 5 )

  1. Almost perfect, except that the final log file does not have a Unicode marker and the encoding in the viewer will need to be selected by yourself.
  2. Support is stated, but not implemented, unicode characters do not fall into the log file.
  3. The macro START_EASYLOGGINGPP does not support unicode
  4. In a single message, you cannot combine an ANSI string, say with UTF-16
  5. Unicode support is carried out using the Boost.Locale library, impressively wide support is provided for various UTF-8/16/32 formats and other national locales, unfortunately, Boost.Log was only able to get to work with the UTF-8 file format and only using the initialization function synchronous logger "logging :: add_file_log", all other attempts failed and unicode characters did not reach the file, perhaps with enough time, this functionality can be made to work

Access to the logger


In modern libraries, the question “who owns the logger” remains behind the scenes, most often you can write LOG (ERROR) << “My message” and the library takes care of everything itself. This simplicity is achieved using global variables. I will leave ethical use of global variables behind the scenes, after all this is a special case, but the simplicity of using a global variable in the case of a simple application turns against the developer of a complex application consisting of many dynamic or static modules.

Another option to gain access to the logger is to create the object yourself and control its life cycle.

And the last option is a hybrid one, the logger objects are created in manual mode, and then global variables (registry) or shared memory are used, which is common to the whole process including dynamic modules.
PantheiosGlobal variables, automatic initialization
GlogGlobal variables, automatic initialization
log4cppGlobal variables, automatic and manual initialization
P7Shared memory, manual initialization
G3logGlobal variables, automatic and manual initialization
SpdlogGlobal variables, manual initialization
EasyloggingGlobal variables, automatic initialization
Boost.LogGlobal variables, automatic and manual initialization

File rotation


PantheiosNot
GlogThe size
log4cppSize ( 2 )
P7Time, size ( 1 ) ( 2 )
G3logSize, not available by default ( 1 )
SpdlogSize, time (day) ( 1 )
EasyloggingThe size
Boost.LogTime, size ( 1 ) ( 2 )

  1. Each file in the title contains the date and time.
  2. Supported option is “max. number of files "allowing you to store only the last N files

Time accuracy


Many of the loggers considered in this article were developed with an eye to high performance, with a potential of millions of messages per second. But in addition to high speeds, accurate high resolution time stamps are needed, since If you have a couple of tens or even hundreds of messages in the log file with the same time stamp, this means that some of the information about the execution time has already been lost.
PantheiosWindows: 10ms ( 1 ), custom back-end can help increase accuracy
Linux: theor. minimum value of 1ns, depending on the hardware
GlogWindows: 10ms ( 1 )
Linux: theor. minimum value of 1ns, depending on the hardware
log4cppWindows: 10ms ( 1 )
Linux: theor. minimum value of 1ns, depending on the hardware
P7Windows: 100ns
Linux: theor. minimum value of 1ns, depending on the hardware
G3logWindows: 1ms
Linux: 1us
SpdlogWindows: 1ms
Linux: theor. minimum value of 1ns, depending on the hardware
EasyloggingWindows: 1ms
Linux: 1us
Boost.LogWindows: 10ms ( 1 )
Linux: theor. minimum value of 1ns, depending on the hardware

  1. Sometimes you can get a granularity of 1 millisecond, but much more often a quantum is 10 milliseconds.

Performance


Many loggers from the list in this article state that performance is one of their top priorities.

I took this statement more than seriously and conducted a series of tests:


For each test, the time and CPU spent by the logger on saving 1 million messages to a file are measured. 3 measurements are taken and average values ​​are calculated.

We also conducted tests in debug (optimization disabled) and release (optimization O2) assembly. The following configuration was used for the tests:


In order to bring the tests closer to actual use, the following information was saved for each log message:


The code that was executed for each logger (requires C ++ 11 support for compilation):

Source text
#include <stdio.h> #include <atomic> #include <thread> #include <vector> //Include specific logger headers #include "Logger headers ..." using namespace std; using namespace std::chrono; //Use this macro to switch on multi-threading mode //#define MULTI_THREAD int main(int argc, char* argv[]) { //Logger initialization //.. unsigned int thread_count = 4; unsigned int howmany = 1'000'000; vector<thread> threads; auto start = system_clock::now(); #if !defined(MULTI_THREAD) for(unsigned int i=0; i < howmany; i++) { //Has to be customized for every logger LOG(INFO) << " Message + all required information, #" << i; } #else howmany /= thread_count; for (int t = 0; t < thread_count; ++t) { threads.push_back(std::thread([&] { for(unsigned int i=0; i < howmany; i++) { //Has to be customized for every logger LOG(INFO) << " Message + all required information, #" << i; } })); } for(auto &t:threads) { t.join(); }; howmany *= thread_count; #endif auto delta = system_clock::now() - start; auto delta_d = duration_cast<duration<double>> (delta).count(); LOG(INFO) << "Time = " << (double)howmany / delta_d << " per second, total time = " << delta_d; //Logger uninitialization if necessary return 0; } 


One thread


One thread should save 1 million messages to a file, filtering is disabled, file rotation is disabled. Runtime and average CPU utilization are measured.
Debug
Time (ms)
Debug
CPU (%)
Release
Time (ms)
Release
CPU (%)
Pantheios140 30013%28,40013%
Glog52 50013%8,27013%
log4cpp130 57013%13,80613%
P7 ( 1 ) ( 2 ) ( 6 )52014%10014%
G3log ( 1 ) ( 3 )102 99038%3,66037%
Spdlog ( 1 ) ( 4 )64,25013%86913%
Spdlog ( 1 ) ( 5 )65,66013%88513%
Easylogging271,06013%9,10013%
Boost.Log ( 1 ) ( 7 )2 310 20017%44 3009%
Boost.Log ( 1 ) ( 8 )649 48025%12,68025%

  1. Asynchronous logging
  2. Compiled with the option “/P7.Pool=1024” - the total amount of available memory is 1 megabyte.
  3. Measurements can be considered synthetic, since most of the time the logger adds the data to the buffers, and recording occurs upon exiting the application and this work takes time exceeding the logging time by an order of magnitude, 1 second logging and 10 seconds of saving data.
  4. Logging under the conditions recommended by the manufacturer “spdlog :: set_async_mode (1048576)” while the logger consumes about 250 megabytes of memory
  5. Logging in conditions of equal memory consumption “spdlog :: set_async_mode (4096)” - in this case, the logger has a buffer of 4k elements, each element takes about 250 bytes, which ultimately results in a memory consumption of about 1 megabyte.
  6. Recording was carried out in a binary file, text in UTF-16 format
  7. Logging in conditions of equal memory consumption (asynchronous_sink + text_file_backend + bounded_ordering_queue + block_on_overflow), the queue length is 1024 elements, each element takes about 1100 bytes, which ultimately results in a memory consumption of just over 1 megabyte
  8. Synthetic test. Logging in the most comfortable conditions, default logger configuration (asynchronous_sink + text_file_backend + unbounded_fifo_queue). There are no restrictions in memory consumption, there is no sorting of messages in the order of receipt, the memory consumption was fixed at 1.8GB

4 threads


4 threads should save 1 million messages to a file in total, filtering is disabled, file rotation is disabled.

Runtime and average CPU utilization are measured.
Debug
Time (ms)
Debug
CPU (%)
Release
Time (ms)
Release
CPU (%)
Pantheios10,60048%9 50048%
Glog30,20093%5,90093%
log4cpp149 60018%16 900nineteen%
P7 ( 1 ) ( 2 ) ( 6 )790nineteen%230nineteen%
G3log ( 1 ) ( 3 )39,70075%2,30075%
Spdlog ( 1 ) ( 4 )11,51013%27025%
Spdlog ( 1 ) ( 5 )73,24025%4,65325%
Easylogging328 230nineteen%8 57525%
Boost.Log ( 1 ) ( 7 )2 645 12014%48,29014%
Boost.Log ( 1 ) ( 8 )655 47065%13,56065%

  1. Asynchronous logging
  2. Compiled with the option “/P7.Pool=1024” - the total amount of available memory is 1 megabyte.
  3. Measurements can be considered synthetic, since most of the time the logger adds the data to the buffers, and recording occurs upon exiting the application and this work takes time exceeding the logging time by an order of magnitude, 1 second logging and 10 seconds of saving data.
  4. Logging under the conditions recommended by the manufacturer “spdlog :: set_async_mode (1048576)” while the logger consumes about 250 megabytes of memory
  5. Logging in conditions of equal memory consumption “spdlog :: set_async_mode (4096)” - in this case, the logger has a buffer of 4k elements, each element takes about 250 bytes, which ultimately results in a memory consumption of about 1 megabyte.
  6. Recording was carried out in a binary file, text in UTF-16 format
  7. Logging in conditions of equal memory consumption (asynchronous_sink + text_file_backend + bounded_ordering_queue + block_on_overflow), the queue length is 1024 elements, each element takes about 1100 bytes, which ultimately results in a memory consumption of just over 1 megabyte
  8. Synthetic test. Logging in the most comfortable conditions, default logger configuration (asynchronous_sink + text_file_backend + unbounded_fifo_queue). There are no restrictions in memory consumption, there is no sorting of messages in the order of receipt, the memory consumption was fixed at 1.8GB

Filtration


The logger should process 1 million messages and filter them, i.e. In the final file will not get any 1 message.

Measurement time is measured.
Debug
1 thread, time (ms)
Debug
4 threads, time (ms)
Release
1 thread, time (ms)
Release
4 threads, time (ms)
Pantheios ( 1 )----
Glog55 52028,2406,8404,790
log4cpp200708045
P7841022342
G3log5 5301950249
Spdlog269134632
Easylogging ( 2 )----
Boost.Log26,4078,554699389

  1. Filtering is not available by default.
  2. Couldn't make filtering work

Performance review


The performance of many loggers was very good.
Unfortunately, almost all loggers except P7 have a huge performance gap between the debug and release builds, sometimes the coefficient reaches 74 (Spdlog: 65660/885). This can complicate debugging projects due to increased logging delays.

The tests performed in a certain sense can be called synthetic, since not one developer who implements a logging library into her application does not want it to allocate 250 megabytes of memory for its needs or consume 75% of CPU or more.

Typically, an integrator developer wants the library to be invisible and do its job with minimal hardware requirements, especially when it comes to small embedded systems.

Therefore, I recalculated the best performance of each logger ( tests with equal memory consumption ) in order to determine how many message logs can be written using only 1% CPU and a reasonable but still large amount of memory equal to 1mb

The formula for calculating:
((1,000 ms / test time in ms) * 1,000,000 messages) / use CPU in the test

Number of messages per second with 1% CPU
P7714,285 messages (1,000,000 * (1,000 / 100 ms) / 14%)
Spdlog86,918 messages (1,000,000 * (1,000 / 885 ms) / 13%)
Glog9 301 messages (1000000 * (1000/8270 ms) / 13%)
Easylogging8,453 messages (1,000,000 * (1,000 / 9,100 ms) / 13%)
G3log7,384 messages (1,000,000 * (1,000 / 3,660 ms) / 37%)
log4cpp5,571 messages (1,000,000 * (1,000 / 13,806 ms) / 13%)
Pantheios2,708 messages (1,000,000 * (1,000 / 28,400 ms) / 13%)
Boost.Log2 508 messages (1000000 * (1000/44300 ms) / 9%)


findings


Pantheios


This library made quite mixed impressions, on the one hand, the author approached the project thoroughly and thoughtfully, good functional reviews, documentation, on the other hand poor performance (although the author notes the opposite (1)), the lack of file rotation and other trifles spoil the overall impression.

So, the advantages of the library:

Minuses:

  1. C ++ Diagnostic Logging Critical Diagnostic Logging Cards (up to two orders of magnitude) www.pantheios.org/essentials.html

NB: The library is one of the largest and most complex of all compared, so it is likely that many of its features have not been considered.

Glog


Despite the fact that the library is rather poor in functionality and does not shine with performance, but this library has inspired a number of other projects that have outgrown its “father” count to the head. Only this is already a fat plus in the karma of the authors.

Advantages of the library:

Minuses:


log4cpp


Another well-deserved logger made a pretty good impression, no big disappointments, no high-profile promotions, no unfulfilled promises.

Advantages of the library:

Minuses:


P7


One of the most unusual loggers among those considered in this article, the package includes not only a logger, but also a server for receiving messages over the network, viewing log files, filtering, exporting, verbosity remotely and many other functions. As in the case of SpdLog, the sight was on performance and the ability to use on embedded devices, as the project is sharpened on the network and precise memory management.
It should also be noted that in the case of using Sink = FileBin or Sink = Baical, the project provides free software for network reception, viewing, filtering, etc.:
soft
image


Advantages of the library:

Minuses:


G3log


The heir to G2Log which in turn was the result of a rethinking of Glog. The author pursued first of all the performance and conducts a rather active educational work on this subject ( 1 ) ( 2 ). Unfortunately, the performance tests turned out to be synthetic, and the result was far from expectations.

Advantages of the library:

Minuses:


  1. kjellkod.wordpress.com/2014/08/16/presenting-g3log-the-next-version-of-the-next-generation-of-loggers
  2. kjellkod.wordpress.com/2015/06/30/the-worlds-fastest-logger-vs-g3log


Spdlog


Another logger written with an eye to performance, unfortunately good performance can only be obtained when using hundreds of megabytes of RAM. The functionality is standard for many other loggers, the main focus is speed.

Advantages of the library:

Minuses:


Easylogging


Logger with a light-weight target, single header file (about 6700 lines of code). The functionality is standard for many other loggers.

Advantages of the library:

Minuses:


Boost.Log


Logger with an eye on functionality, simplicity, as well as performance, such priorities and goals are pursued by the author: motivation.
We must pay tribute, the project has been developing for almost 9 years and is present in such a large project as Boost.

Advantages of the library:

Minuses:


Total


Attention!
Subjective opinion of the author.
  • Pantheios — , , ,
  • Glog — , , . — , .
  • Log4cpp — , - ( , ) , /.
  • P7 — , embedded . , , , ( home ). – , . , ( Sink ) (5-7)
  • G3Log, SpdLog — , , –
  • Easylogging — , ,
  • Boost.Log — , , - , , nullptr . , - .


Thank you very much for your attention and your time, I hope this article has helped you in drawing up a general idea of ​​the realities of modern loggers.

Source: https://habr.com/ru/post/313686/


All Articles