Log4j.properties is not fully configured as follows:Log4j.rootlogger=debug, stdoutLog4j.appender.stdout=org.apache.log4j.consoleappenderLog4j.appender.stdout.layout=org.apache.log4j.patternlayoutLog4j.appender.stdout.layout.conversionpattern=%c{1}-%m%nLog4j.logger.java.sql.preparedstatement=debugLog4j.rootlogger=debug, stdoutLog4j.appender.stdout=org.apache.log4j.consoleappenderLog4j.appender.stdout.layout=org.apache.log4j.patternlayoutLog4j.appender.stdout.layout.conversionpattern=%c{1}-%m%nLog
First of all, the company has a model for the HP LaserJet m1120 MFP printer, because not the network printer is very inconvenient to use, the company boss asked to connect this printer on the company's intranet Linux server (CentOS), and then configure the Samba share printer. The following three major steps to start, such as meet your needs, please continue to read.The first step is to ensure that your printer will print properly on a Linux server.1,
category name length is greater than 30, will be the left more than the character of the cut off, but less than 30 will not fill the space. Attached: log4j more comprehensive configuration log4j configuration file for output to the console, files, rollback files, send log messages, output to the database log table, custom tags and other full set of features. Log4j.rootlogger=Debug,console,dailyfile,imlog4j.additivity.org.apache=true# Console (consoles) Log4j.appender.console=Org.apache.log4j.Co
# #
The previous sentence sets the Patternlayout flexible specify the format, you specify the print parameters [%-5p][%d{hh:mm:ss}][%c-%m]%m%n [%-5p][%d{hh:mm:ss}][%l]%m%n Log4j.appender.stdout.layout.conversionpattern=[%-5p][%d{yyyy-mm-dd HH:mm:ss sss}][%t][%c-%m][%l] (%F:%L)-%m%n # QUERY: Destination--Output to file (qualify per file size) # # All info, warn,
In our project, there are some important logs to separate output to the specified file, rather than the total output to the system log file, then we log4j for us to provide such a function, below we have to step by step to see how to do. This is written in the configuration of the property, XML is similar, you want to know, you can see the official document.
The project package structure tested here is as follows:
Log4j mainly consists of three parts: loggers, appenders and layouts, (Appender c
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.