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:
- Tar-zxvf cxxtools-2.0.tar.gz
- CD cxxtools-2.0
- ./Configure -- prefix =/usr/local
- Make
- Make install
Install log4shell and unzip it first:
- 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.
- ./Configure -- prefix =/usr
- Make
- 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:
- Log4shell 0.1
- Usage: log4shell options category message
- Options:-f | -- fatal
- -E | -- Error
- -W | -- warn
- -I | -- info
- -D | -- debug
- -P | -- properties filename