Comparison between glog and log4cxx

Source: Internet
Author: User

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.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.