Install and use log4shell in Linux

Source: Internet
Author: User
Http://blog.chinaunix.net/uid-78707-id-2603396.htmllog4shellis open Source code Project Implementation of the sub-project log4j of Apache logging service in shell, used for ShellProgramThe log function is provided for developers to debug and audit the target program. Although shell can be easily operatedCompositionBut the mature log framework makes it easier for us to record and process logs. To install log4shell, you must first install log4cxx, because log4shell is implemented based on log4cxx. For details about how to install log4cxx, refer to my other article.Article: Http://blog.chinaunix.net/space.php? Uid = 78707 & Do = Blog & id = 368589. Log4shell requires the support of cxxtools. Therefore, you must install cxxtools before installing log4shell. Download source code: cxxtools http://www.tntnet.org/download.html I download file is cxxtools-2.0.tar.gz The log4shell http://freshmeat.net/projects/log4shell/ I downloaded is log4shell-0.1.tar.gz We all download the tar.gz package. Run tar-zxvf to decompress the command. Install cxxtools:

    1. Tar-zxvf cxxtools-2.0.tar.gz
    2. CD cxxtools-2.0
    3. ./Configure -- prefix =/usr/local
    4. Make
    5. Make install

Install log4shell and unzip it first:

    1. Tar-zxvf log4shell-0.1.tar.gz

Then run the log4shell-0.1 directory, edit the log4shell. cpp file, change the cxxtools: Arg <bool> starting from row 56th to cxxtools: Arg <bool>, and then compile and install.

    1. ./Configure -- prefix =/usr
    2. Make
    3. Make install

This completes the installation of log4shell.

Because we have installed log4shell in/usr/bin, we can directly use commands like log4shell. In our shell file, we can call this command to output logs. But there should be a log4j. properties file in the current directory of shell. It doesn't matter. Just put the configuration file of log4j in the current directory.

Remember that the log4shell usage is: Usage: log4shell options category message

The first is the command, the second is the parameter, the third is the category, and the fourth is the message.

The parameters are as follows:

    1. Log4shell 0.1
    2. Usage: log4shell options category message
    3. Options:-f | -- fatal
    4. -E | -- Error
    5. -W | -- warn
    6. -I | -- info
    7. -D | -- debug
    8. -P | -- properties filename

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.