Log4j.propertise configuration file

Source: Internet
Author: User

# level: Is the priority of logging, which is divided into off, FATAL, ERROR, WARN, INFO, DEBUG, all or levels you define. LOG4J recommends using only four levels, with the priority from high to low being error, WARN, INFO, DEBUG.
LOG4J.ROOTLOGGER=DEBUG,CONSOLE,DATABASE,A1//Control the output of log4j to where. The name is Log4j.appender.console.threshold=info. CONSOLE under Configuration
Log4j.addivity.org.apache=true

# The following is a detailed configuration

# Apply to Console
Log4j.appender.console=org.apache.log4j.consoleappender
# This section is set to "INFO" above the console output (using the settings in Rootlogger by default)
Log4j.appender.console.threshold=info
Log4j.appender.console.target=system.out
Log4j.appender.console.encoding=utf-8
Log4j.appender.console.layout=org.apache.log4j.patternlayout
Log4j.appender.console.layout.conversionpattern=[framework]%d-%c-%-4r [%t]%-5p%c%x-%m%n

# for database
Log4j.appender.database=org.apache.log4j.jdbc.jdbcappender
Log4j.appender.database.url=jdbc:o RACLE:THIN:@90.0.12.20:1521:ORCL
Log4j.appender.database.driver=oracle.jdbc.driver.oracledriver
Log4j.appender.database.user=nation
Log4j.appender.database.password=1
# is set to "WARN" above the level in the database store ( Use the settings in Rootlogger by default)
Log4j.appender.database.threshold=warn
Log4j.appender.database.sql=insert into T_ log4j (stamp,thread,infolevel,class,messages) VALUES ('%d{yyyy-mm-dd HH:mm:ss} ', '%t ', '%p ', '%l ', '%m ')
# Write to table in database log4j message field, content%d (date)%c: Log information location (class name)%p: Log information level%m: generated log details%n: output log message wrap
Log4j.appender.database.layout=org.apache.log4j.patternlayout
Log4j.appender.database.layout.conversionpattern=[framework]%d-%c-%-4r [%t]%-5p%c%x-%m%n

# Create a new log every day
Log4j.appender.a1=org.apache.log4j.dailyrollingfileappender
Log4j.appender.a1.file=c:/log4j/website.log
Log4j.appender.a1.encoding=gbk
Log4j.appender.a1.threshold=debug
Log4j.appender.a1.datepattern= '. ' Yyyy-mm-dd
Log4j.appender.a1.layout=org.apache.log4j.patternlayout
Log4j.appender.a1.layout.conversionpattern=%d{absolute}%5p%c{1}:%l:%m%n

Log4j.propertise configuration file

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.