log4j.dtd

<?xml version="1.0" encoding="UTF-8" ?>
<!--
 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.
-->

<!-- Authors: Chris Taylor, Ceki Gulcu. -->

<!-- Version: 1.2 -->

<!-- A configuration element consists of optional renderer
elements,appender elements, categories and an optional root
element. -->

<!ELEMENT log4j:configuration (renderer*, throwableRenderer?,
                               appender*,plugin*, (category|logger)*,root?,
                               (categoryFactory|loggerFactory)?)>

<!-- The "threshold" attribute takes a level value below which -->
<!-- all logging statements are disabled. -->

<!-- Setting the "debug" enable the printing of internal log4j logging   -->
<!-- statements.                                                         -->

<!-- By default, debug attribute is "null", meaning that we not do touch -->
<!-- internal log4j logging settings. The "null" value for the threshold -->
<!-- attribute can be misleading. The threshold field of a repository	 -->
<!-- cannot be set to null. The "null" value for the threshold attribute -->
<!-- simply means don‘t touch the threshold field, the threshold field   -->
<!-- keeps its old value.                                                -->

<!ATTLIST log4j:configuration
  xmlns:log4j              CDATA #FIXED "http://jakarta.apache.org/log4j/"
  threshold                (all|trace|debug|info|warn|error|fatal|off|null) "null"
  debug                    (true|false|null)  "null"
  reset                    (true|false) "false"
>

<!-- renderer elements allow the user to customize the conversion of  -->
<!-- message objects to String.                                       -->

<!ELEMENT renderer EMPTY>
<!ATTLIST renderer
  renderedClass  CDATA #REQUIRED
  renderingClass CDATA #REQUIRED
>

<!--  throwableRenderer allows the user to customize the conversion
         of exceptions to a string representation.  -->
<!ELEMENT throwableRenderer (param*)>
<!ATTLIST throwableRenderer
  class  CDATA #REQUIRED
>

<!-- Appenders must have a name and a class. -->
<!-- Appenders may contain an error handler, a layout, optional parameters -->
<!-- and filters. They may also reference (or include) other appenders. -->
<!ELEMENT appender (errorHandler?, param*,
      rollingPolicy?, triggeringPolicy?, connectionSource?,
      layout?, filter*, appender-ref*)>
<!ATTLIST appender
  name 		CDATA 	#REQUIRED
  class 	CDATA	#REQUIRED
>

<!ELEMENT layout (param*)>
<!ATTLIST layout
  class		CDATA	#REQUIRED
>

<!ELEMENT filter (param*)>
<!ATTLIST filter
  class		CDATA	#REQUIRED
>

<!-- ErrorHandlers can be of any class. They can admit any number of -->
<!-- parameters. -->

<!ELEMENT errorHandler (param*, root-ref?, logger-ref*,  appender-ref?)>
<!ATTLIST errorHandler
   class        CDATA   #REQUIRED
>

<!ELEMENT root-ref EMPTY>

<!ELEMENT logger-ref EMPTY>
<!ATTLIST logger-ref
  ref CDATA #REQUIRED
>

<!ELEMENT param EMPTY>
<!ATTLIST param
  name		CDATA   #REQUIRED
  value		CDATA	#REQUIRED
>

<!-- The priority class is org.apache.log4j.Level by default -->
<!ELEMENT priority (param*)>
<!ATTLIST priority
  class   CDATA	#IMPLIED
  value	  CDATA #REQUIRED
>

<!-- The level class is org.apache.log4j.Level by default -->
<!ELEMENT level (param*)>
<!ATTLIST level
  class   CDATA	#IMPLIED
  value	  CDATA #REQUIRED
>

<!-- If no level element is specified, then the configurator MUST not -->
<!-- touch the level of the named category. -->
<!ELEMENT category (param*,(priority|level)?,appender-ref*)>
<!ATTLIST category
  class         CDATA   #IMPLIED
  name		CDATA	#REQUIRED
  additivity	(true|false) "true"
>

<!-- If no level element is specified, then the configurator MUST not -->
<!-- touch the level of the named logger. -->
<!ELEMENT logger (param*,level?,appender-ref*)>
<!ATTLIST logger
  class         CDATA   #IMPLIED
  name		CDATA	#REQUIRED
  additivity	(true|false) "true"
>

<!ELEMENT categoryFactory (param*)>
<!ATTLIST categoryFactory
   class        CDATA #REQUIRED>

<!ELEMENT loggerFactory (param*)>
<!ATTLIST loggerFactory
   class        CDATA #REQUIRED>

<!ELEMENT appender-ref EMPTY>
<!ATTLIST appender-ref
  ref CDATA #REQUIRED
>

<!-- plugins must have a name and class and can have optional parameters -->
<!ELEMENT plugin (param*, connectionSource?)>
<!ATTLIST plugin
  name 		CDATA 	   #REQUIRED
  class 	CDATA  #REQUIRED
>

<!ELEMENT connectionSource (dataSource?, param*)>
<!ATTLIST connectionSource
  class        CDATA  #REQUIRED
>

<!ELEMENT dataSource (param*)>
<!ATTLIST dataSource
  class        CDATA  #REQUIRED
>

<!ELEMENT triggeringPolicy ((param|filter)*)>
<!ATTLIST triggeringPolicy
  name 		CDATA  #IMPLIED
  class 	CDATA  #REQUIRED
>

<!ELEMENT rollingPolicy (param*)>
<!ATTLIST rollingPolicy
  name 		CDATA  #IMPLIED
  class 	CDATA  #REQUIRED
>

<!-- If no priority element is specified, then the configurator MUST not -->
<!-- touch the priority of root. -->
<!-- The root category always exists and cannot be subclassed. -->
<!ELEMENT root (param*, (priority|level)?, appender-ref*)>

<!-- ==================================================================== -->
<!--                       A logging event                                -->
<!-- ==================================================================== -->
<!ELEMENT log4j:eventSet (log4j:event*)>
<!ATTLIST log4j:eventSet
  xmlns:log4j             CDATA #FIXED "http://jakarta.apache.org/log4j/"
  version                (1.1|1.2) "1.2"
  includesLocationInfo   (true|false) "true"
>

<!ELEMENT log4j:event (log4j:message, log4j:NDC?, log4j:throwable?,
                       log4j:locationInfo?, log4j:properties?) >

<!-- The timestamp format is application dependent. -->
<!ATTLIST log4j:event
    logger     CDATA #REQUIRED
    level      CDATA #REQUIRED
    thread     CDATA #REQUIRED
    timestamp  CDATA #REQUIRED
    time       CDATA #IMPLIED
>

<!ELEMENT log4j:message (#PCDATA)>
<!ELEMENT log4j:NDC (#PCDATA)>

<!ELEMENT log4j:throwable (#PCDATA)>

<!ELEMENT log4j:locationInfo EMPTY>
<!ATTLIST log4j:locationInfo
  class  CDATA	#REQUIRED
  method CDATA	#REQUIRED
  file   CDATA	#REQUIRED
  line   CDATA	#REQUIRED
>

<!ELEMENT log4j:properties (log4j:data*)>

<!ELEMENT log4j:data EMPTY>
<!ATTLIST log4j:data
  name   CDATA	#REQUIRED
  value  CDATA	#REQUIRED
>

  

时间: 2025-01-12 07:42:02

log4j.dtd的相关文章

log4j.xml与log4j.dtd的配置详细说明与使用

1.log4j.dtd .dtd文件是对相应.xml进行约束验证用的.这里不做介绍了,详细见上一篇关于dtd的介绍:xml基础.DTD验证.Schema验证 log4j.dtd的文件: <?xml version="1.0" encoding="UTF-8" ?> <!-- Authors: Chris Taylor, Ceki Gulcu. --> <!-- Version: 1.2 --> <!-- A configur

log4j.xml的实用例子

大多数讲log4j配置的教程用的都是log4j.properties文件,我觉得xml或许更好一点,在这里我提供一个我已经用于生产环境的log4j.xml的例子,先上代码,然后再解释: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE log4j:configuration PUBLIC "-//log4j/log4j Configuration//EN" "log4j.

java中log4j的使用体验

log4j相信大部分java开发者都已经很熟悉了,在此记录下自己的使用过程. 一.文件准备: 1.log4j.jar(我这里使用的版本是log4j-1.2.17.jar,在附件中提供下载) 2.log4j配置,可以使用xml或properties文件进行配置,推荐使用xml形式的配置,方便灵活还直观,一个完整的log4j.xml参考配置文件如下所示: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE

Spring学习8-SSH+Log4j黄金整合

最下面有log4j的详解及配置步骤 步骤一.导入相应的jar包(具体参看下一篇博文) 步骤二.修改WEB.XML文件,内容如下: <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quo

log4j+logback+slf4j+commons-logging的关系与调试(转)

背景     由于现在开源框架日益丰富,好多开源框架使用的日志组件不尽相同.存在着在一个项目中,不同的版本,不同的框架共存.导致日志输出异常混乱.虽然也不至于对系统造成致命伤害,但是明显可以看出,架构不够精良,追求极致略有不足.     其中有一些标准通用接口,标准实现,各种桥接器的存在,下面就让笔者树立一下这些框架之间的关系. 从上图中,我们可以看到4部分. 接口:将所有日志实现适配到了一起,用统一的接口调用. 实现:目前主流的日志实现 旧日志到slf4j的适配器:如果使用了slf4j,但是只

log4j 配置文件 (XML/.properties)

xml: <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'> <appender name="STDOUT" class=

Spring集成Log4j日志框架

1.日志系统介绍 slf4j,即简单日志门面(Simple Logging Facade for Java),不是具体的日志解决方案,它只服务于各种各样的日志系统.简答的讲就是slf4j是一系列的日志接口,而log4j是具体实现了的日志框架. slf4j与常用日志框架绑定关系,图片来源 2.Maven导入slf4j和log4j,编辑pom.xml <!-- 导入slf4j-log4j12,依赖slf4j-api和log4j,自动导入 --> <dependency> <gro

log4j配置打印mybatis的sql到控制台(复制)

log4j.rootLogger=DEBUG, stdout log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=[service] %d - %c -%-4r [%t] %-5p %c %x - %m%n #log4j.app

org.apache.log4j.Logger详解

1. 概述 1.1. 背景 在应用程序中添加日志记录总的来说基于三个目的 :监视代码中变量的变化情况,周期性的记录到文件中供其他应用进行统计分析工作:跟踪代码运行时轨迹,作为日后审计的依据:担当集成开发环境中的调试器的作用,向文件或控制台打印代码的调试信息. 最普通的做法就是在代码中嵌入许多的打印语句,这些打印语句可以输出到控制台或文件中,比较好的做法就是构造一个日志操作类 来封装此类操作,而不是让一系列的打印语句充斥了代码的主体. http://logging.apache.org/log4j