From: http://monkeycn.iteye.com/blog/1021703
#1 log4cxx has a complete configuration document method, XML and Java configuration files; glog can only be configured by input parameters when the program is started;
#2 glog file writing efficiency is about 15% higher than that of log4cxx, but the efficiency of glog writing to stderr is lower than that of log4cxx;
#3 glog writes stderr and files at the same time, which is less efficient than log4cxx;
#4 the CPU usage and memory usage are basically the same;
#5 both support the printf and C ++ stream output formats of C;
#6 both have a way to achieve continuous log output of the current thread under multiple threads;
#7 Currently, log4cxx can be output to the console, file, remote server, and some special devices. glog can only be used as the first two;
#8 The log4cxx structure is clearly designed. It is easier to use logger (hierarchical logger), appender (output source), and layout (format) in combination with the configuration file for both understanding and use; glog is currently a lightweight library than log4cxx. It is designed only for the console and files, but is born to support some special conditions to output log functions;
#9 log4cxx supports hierarchical logger. You can use this concept to easily design the logger of each class (including its namespace) based on each class. The output level is obvious.
Sample features.
Additional points:
* Log4cxx can change the log output during running. For example, if you change the log level or output file, the log configuration file will be read again after it is changed.
* Log4cxx can be asynchronously output, so the log Io output will not slow down the main program.