# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# For the general syntax of property based configuration files see the
# documenation of org.apache.log4j.PropertyConfigurator.
# The root category uses the appender called A1. Since no priority is
# specified, the root category assumes the default priority for root
# which is DEBUG in log4j. The root category is the only category that
# has a default priority. All other categories need not be assigned a
# priority in which case they inherit their priority from the
# hierarchy.
log4j.rootCategory=, A1
# A1 is set to be a LogMonitorAppender which outputs to a swing
# logging console.
#Set the level
# 1.配置根Logger,其语法为:
# log4j.rootLogger = [ level ] , appenderName, appenderName, …
log4j.rootLogger=debug,appender1
#log4j.rootLogger=info,appender1
#log4j.rootLogger=error,appender1
#out print console
# 2.配置日志信息输出目的地Appender,其语法为:
# log4j.appender.appenderName = fully.qualified.name.of.appender.class
# log4j.appender.appenderName.option1 = value1…
# log4j.appender.appenderName.option = valueN
# 其中,Log4j提供的appender有以下几种:
# org.apache.log4j.ConsoleAppender(控制台),
# org.apache.log4j.FileAppender(文件),
# org.apache.log4j.DailyRollingFileAppender(每天产生一个日志文件),
# org.apache.log4j.RollingFileAppender(文件大小到达指定尺寸的时候产生一个新的文件),
# org.apache.log4j.WriterAppender(将日志信息以流格式发送到任意指定的地方)
log4j.appender.appender1=org.apache.log4j.ConsoleAppender
#log4j.appender.appender1=org.apache.log4j.FileAppender
#out print style TTCCLayout
# 3.配置日志信息的格式(布局),其语法为:
# log4j.appender.appenderName.layout = fully.qualified.name.of.layout.class
# log4j.appender.appenderName.layout.option1 = value1
# log4j.appender.appenderName.layout.option = valueN
# 其中,Log4j提供的layout有以e几种:
# org.apache.log4j.HTMLLayout(以HTML表格形式布局),
# org.apache.log4j.PatternLayout(可以灵活地指定布局模式),
# org.apache.log4j.SimpleLayout(包含日志信息的级别和信息字符串),
# org.apache.log4j.TTCCLayout(包含日志产生的时间、线程、类别等等信息)
# Log4J采用类似C语言中的printf函数的打印格式格式化日志信息,打印参数如下:
# %m 输出代码中指定的消息
# %p 输出优先级,即DEBUG,INFO,WARN,ERROR,FATAL
# %r 输出自应用启动到输出该log信息耗费的毫秒数
# %c 输出所属的类目,通常就是所在类的全名
# %t 输出产生该日志事件的线程名
# %n 输出一个回车换行符,Windows平台为“rn”,Unix平台为“n”
# %d 输出日志时间点的日期或时间,默认格式为ISO8601,也可以在其后指定格式,比如:%d{yyy MMM dd HH:mm:ss,SSS},输出类似:2002年10月18日 22:10:28,921
# %l 输出日志事件的发生位置,包括类目名、发生的线程,以及在代码中的行数。举例:Testlog4.main(TestLog4.java:10)
log4j.appender.appender1.layout=org.apache.log4j.TTCCLayout