# 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