Comparison between log4j and jdbmonitor

Source: Internet
Author: User
Tags string back
Comparison between log4j and jdbmonitor

Log4j (http://logging.apache.org/log4j/docs) is an open source project, which enables developers to flexibly control the output of program debugging information, this is implemented through an additional configuration file.

Jdbmonitor is an open source project. With it, developers can easily add the database execution log function to the system. It is very convenient to use. The only thing you need to do is add "listenerconfig =/config. XML: url = ". No code is required. With jdbmonitor, you can record the execution status of the database in various ways, such as printing it to the console, outputting it to a file, or sending it to a remote client through a socket.

Commonalities:

1. Both log4j and jdbmonitor have strong scalability. For example, log4j can write its own appender and jdbmonitor can write its own dblistener.

2. log4j and jdbmonitor are easy to configure. Of course, the log4j configuration file is relatively complex.

Differences:

1. log4j can output logs for various events, such as key operations, running variable values, and database statement logs. Jdbmonitor can only record database SQL statement Operation Records. Therefore, log4j is widely used. If you need to record non-database statement logs, you must use log4j. jdbmonitor is powerless.

2. log4j configuration is flexible. For example, you can configure what levels of logs are recorded, what the record format is, and how many log files are dumped; jdbmonitor is relatively inflexible, and the output format is relatively simple, and you cannot specify which logs can be ignored.

3. log4j is intrusive, and all log operations are written in the Business Code. The disadvantage is obvious, which leads to a lot of log output code in the Business Code, this reduces the readability of the Code. Once you want to remove the log function, you must delete the code one by one, increasing the workload and risks. Jdbmonitor is non-intrusive. It uses proxy mode to intercept database calls and then record logs. Therefore, no log code is required in the business system. You only need to modify the JDBC connection string. To remove the log function, you only need to modify the JDBC connection string back.

4. The implementation of logging in log4j may affect the running speed of the program. When there are many logs, the whole program may be slowed down to an intolerable level. Jdbmonitor starts another thread to record SQL statements, so it has almost no impact on the program running speed.

5. The appender of log4j is not suitable for debugging and development. debugging and development can only be used by the appender in the console. However, when there is a large amount of data, the entire screen will be overwhelmed and cannot be seen clearly, in addition, many operating system consoles (such as Windows) have buffer size restrictions, so it is easy to see the SQL log is rushed out of sight. Log4j not only supports console appender similar to log4j, but also has a client socketswingclient that can be used. This client is similar to sqlserver's event listener and contains a large amount of logs, in addition, you can freely control the upstream and downstream scrolling of logs.

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.