logback 配置文件的 xsd 本地文件

作用描述

可以帮助我们在 编写 logback.xml 配置文件时 有自动提示的功能。
在 logback.xml 文件的同级目录下,添加一个logback.xsd 文件即可。

logback.xml

<?xml version="1.0" encoding="UTF-8"?>
<configuration
        xmlns="http://ch.qos.logback/xml/ns/logback"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://ch.qos.logback/xml/ns/logback
        https://raw.githubusercontent.com/enricopulatzo/logback-XSD/master/src/main/xsd/logback.xsd">


......        
正经的配置内容

</configuration>

logback.xsd

<?xml version="1.0" encoding="UTF-8"?>
<!--
   logback.xml schema,
      https://github.com/enricopulatzo/logback-XSD
      https://github.com/nkatsar/logback-XSD
-->
<xsd:schema targetNamespace="http://ch.qos.logback/xml/ns/logback"
            xmlns="http://ch.qos.logback/xml/ns/logback"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            elementFormDefault="qualified"
            attributeFormDefault="unqualified"
            version="1.1">
    ​
    <xsd:element name="configuration" type="Configuration"/>
    <xsd:element name="included" type="Configuration"/>
    ​
    <xsd:complexType name="Configuration">
        <xsd:choice maxOccurs="unbounded">
            <xsd:element name="shutdownHook" minOccurs="0" maxOccurs="1" type="ShutdownHook"/>
            <xsd:element name="statusListener" minOccurs="0" maxOccurs="unbounded" type="StatusListener"/>
            <xsd:element name="contextListener" minOccurs="0" maxOccurs="unbounded" type="ContextListener"/>
            <xsd:element name="jmxConfigurator" minOccurs="0" maxOccurs="1" type="JmxConfigurator"/>
            <xsd:element name="conversionRule" minOccurs="0" maxOccurs="unbounded" type="ConversionRule"/>
            <xsd:element name="include" minOccurs="0" maxOccurs="unbounded" type="Include"/>
            <xsd:element name="contextName" minOccurs="0" maxOccurs="1" type="xsd:string"/>
            <xsd:element name="define" minOccurs="0" maxOccurs="unbounded" type="Define"/>
            <xsd:element name="timestamp" minOccurs="0" maxOccurs="1" type="Timestamp"/>
            <xsd:element name="if" minOccurs="0" maxOccurs="unbounded" type="If"/>
            <xsd:element name="property" minOccurs="0" maxOccurs="unbounded" type="Property"/>
            <xsd:element name="appender" minOccurs="0" maxOccurs="unbounded" type="Appender"/>
            <xsd:element name="logger" minOccurs="0" maxOccurs="unbounded" type="Logger"/>
            <xsd:element name="root" minOccurs="0" maxOccurs="1" type="Root"/>
            <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:choice>
        <xsd:attribute name="debug" type="xsd:boolean" use="optional"/>
        <xsd:attribute name="scan" type="xsd:boolean" use="optional" default="false"/>
        <xsd:attribute name="scanPeriod" type="xsd:string" use="optional" default="1 minute"/>
        <xsd:attribute name="packagingData" type="xsd:boolean" use="optional" default="false"/>
        <xsd:anyAttribute/>
    </xsd:complexType>
    ​
    <xsd:complexType name="ShutdownHook">
        <xsd:attribute name="class" type="xsd:string" use="optional"
                       default="ch.qos.logback.core.hook.DelayingShutdownHook"/>
        <xsd:anyAttribute/>
    </xsd:complexType>
    ​
    <xsd:complexType name="ConversionRule">
        <xsd:attribute name="conversionWord" type="xsd:string"/>
        <xsd:attribute name="converterClass" type="xsd:string"/>
    </xsd:complexType>
    ​
    <xsd:complexType name="StatusListener">
        <xsd:attribute name="class" type="xsd:string" use="optional"/>
        <xsd:anyAttribute/>
    </xsd:complexType>
    ​
    <xsd:complexType name="ContextListener">
        <xsd:choice maxOccurs="unbounded">
            <xsd:element name="resetJUL" type="xsd:boolean"/>
            <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:choice>
        <xsd:attribute name="class" type="xsd:string"/>
        <xsd:anyAttribute/>
    </xsd:complexType>
    ​
    <xsd:complexType name="Include">
        <xsd:attribute name="file" use="optional" type="xsd:string"/>
        <xsd:attribute name="resource" use="optional" type="xsd:string"/>
        <xsd:attribute name="url" use="optional" type="xsd:string"/>
        <xsd:attribute name="optional" use="optional" type="xsd:boolean"/>
    </xsd:complexType>
    ​
    <xsd:complexType name="Define">
        <xsd:sequence>
            <xsd:any minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
        <xsd:anyAttribute/>
    </xsd:complexType>
    ​
    <xsd:complexType name="Timestamp">
        <xsd:sequence>
            <xsd:any minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
        <xsd:attribute name="key" type="xsd:string" use="optional"/>
        <xsd:attribute name="datePattern" type="xsd:string" use="optional"/>
        <xsd:attribute name="timeReference" type="xsd:string" use="optional"/>
        <xsd:anyAttribute/>
    </xsd:complexType>
    ​
    <xsd:complexType name="RollingPolicy">
        <xsd:choice maxOccurs="unbounded">
            <xsd:element name="fileNamePattern" minOccurs="1" maxOccurs="1" type="xsd:string"/>
            <xsd:element name="maxHistory" minOccurs="0" maxOccurs="1" type="xsd:int"/>
            <xsd:element name="minIndex" minOccurs="0" maxOccurs="1" type="xsd:int"/>
            <xsd:element name="maxIndex" minOccurs="0" maxOccurs="1" type="xsd:int"/>
            <xsd:element name="timeBasedFileNamingAndTriggeringPolicy" minOccurs="0" maxOccurs="1" type="TriggeringPolicy"/>
            <xsd:element name="cleanHistoryOnStart" minOccurs="0" maxOccurs="1" type="xsd:boolean"/>
            <xsd:element name="maxFileSize" minOccurs="0" maxOccurs="1" type="FileSize"/>
            <xsd:element name="totalSizeCap" minOccurs="0" maxOccurs="1" type="FileSize"/>
        </xsd:choice>
        <xsd:attribute name="class" type="xsd:string" use="required"/>
    </xsd:complexType>
    ​
    <xsd:simpleType name="FileSize">
        <xsd:restriction base="xsd:string">
            <xsd:pattern value="[1-9][0-9]*(KB|MB|GB)?"/>
        </xsd:restriction>
    </xsd:simpleType>
    ​
    <xsd:complexType name="TriggeringPolicy">
        <xsd:sequence>
            <xsd:element name="maxFileSize" minOccurs="0" maxOccurs="1" type="FileSize"/>
        </xsd:sequence>
        <xsd:attribute name="class" type="xsd:string" use="required"/>
    </xsd:complexType>
    ​
    <xsd:complexType name="If">
        <xsd:choice maxOccurs="unbounded">
            <xsd:element type="Configuration" name="then"/>
            <xsd:element type="Configuration" name="else"/>
            <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:choice>
        <xsd:attribute name="condition" type="xsd:string"/>
        <xsd:anyAttribute/>
    </xsd:complexType>
    ​
    <xsd:complexType name="Property">
        <xsd:sequence>
            <xsd:any minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
        <xsd:attribute name="scope" type="xsd:string" use="optional"/>
        <xsd:attribute name="name" type="xsd:string" use="optional"/>
        <xsd:attribute name="value" type="xsd:string" use="optional"/>
        <xsd:attribute name="file" type="xsd:string" use="optional"/>
        <xsd:attribute name="resource" type="xsd:string" use="optional"/>
        <xsd:anyAttribute/>
    </xsd:complexType>
    ​
    <xsd:complexType name="Appender">
        <xsd:choice maxOccurs="unbounded">
            <xsd:element name="target" minOccurs="0" maxOccurs="1" type="Target"/>
            <xsd:element name="file" minOccurs="0" maxOccurs="1" type="xsd:string"/>
            <xsd:element name="withJansi" minOccurs="0" maxOccurs="1" type="xsd:boolean"/>
            <xsd:element name="encoder" minOccurs="0" maxOccurs="1" type="Encoder"/>
            <xsd:element name="filter" minOccurs="0" maxOccurs="1" type="Filter"/>
            <xsd:element name="append" minOccurs="0" maxOccurs="1" type="xsd:boolean"/>
            <xsd:element name="prudent" minOccurs="0" maxOccurs="1" type="xsd:boolean"/>
            <xsd:element name="layout" minOccurs="0" maxOccurs="1" type="Layout"/>
            <xsd:element name="rollingPolicy" minOccurs="0" maxOccurs="1" type="RollingPolicy"/>
            <xsd:element name="connectionSource" minOccurs="0" maxOccurs="1" type="ConnectionSource"/>
            <xsd:element name="triggeringPolicy" minOccurs="0" maxOccurs="1" type="TriggeringPolicy"/>
            <xsd:element name="appender-ref" minOccurs="0" maxOccurs="1" type="AppenderRef"/>
            <xsd:any namespace="##other" processContents="skip" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:choice>
        <xsd:attribute name="name" type="xsd:string" use="required"/>
        <xsd:attribute name="class" type="xsd:string" use="required"/>
        <xsd:anyAttribute/>
    </xsd:complexType>
    ​
    <xsd:simpleType name="Target">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="System.out"/>
            <xsd:enumeration value="System.err"/>
        </xsd:restriction>
    </xsd:simpleType>
    ​
    <xsd:complexType name="Filter">
        <xsd:choice maxOccurs="unbounded">
            <xsd:element name="level" minOccurs="0" maxOccurs="unbounded" type="LoggerLevel"/>
            <xsd:element name="onMatch" minOccurs="0" maxOccurs="unbounded" type="MatchValue"/>
            <xsd:element name="onMismatch" minOccurs="0" maxOccurs="unbounded" type="MatchValue"/>
            <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:choice>
        <xsd:attribute name="class" type="xsd:string" use="optional"/>
        <xsd:anyAttribute/>
    </xsd:complexType>
    ​
    <xsd:simpleType name="MatchValue">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="ACCEPT"/>
            <xsd:enumeration value="DENY"/>
            <xsd:enumeration value="NEUTRAL"/>
        </xsd:restriction>
    </xsd:simpleType>
    ​
    <xsd:complexType name="Layout">
        <xsd:choice maxOccurs="unbounded">
            <xsd:element name="pattern" minOccurs="0" maxOccurs="1" type="xsd:string"/>
            <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:choice>
        <xsd:attribute name="class" type="xsd:string" use="optional"/>
        <xsd:anyAttribute/>
    </xsd:complexType>
    ​
    <xsd:complexType name="Logger">
        <xsd:choice maxOccurs="unbounded">
            <xsd:element name="appender-ref" minOccurs="0" maxOccurs="unbounded" type="AppenderRef"/>
            <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:choice>
        <xsd:attribute name="name" type="xsd:string" use="required"/>
        <xsd:attribute name="level" type="LoggerLevel" use="optional"/>
        <xsd:attribute name="additivity" type="xsd:boolean" use="optional" default="true"/>
        <xsd:anyAttribute/>
    </xsd:complexType>
    ​
    <xsd:complexType name="Encoder">
        <xsd:choice maxOccurs="unbounded">
            <xsd:element name="charset" type="xsd:string" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="immediateFlush" type="xsd:boolean" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="layout" minOccurs="0" maxOccurs="1" type="Layout"/>
            <xsd:element name="outputPatternAsHeader" type="xsd:boolean" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="pattern" type="xsd:string" minOccurs="0" maxOccurs="1"/>
        </xsd:choice>
        <xsd:attribute name="class" type="xsd:string" use="optional"
                       default="ch.qos.logback.classic.encoder.PatternLayoutEncoder"
        />
    </xsd:complexType>
    ​
    <xsd:complexType name="Root">
        <xsd:sequence>
            <xsd:element name="appender-ref" minOccurs="0" maxOccurs="unbounded" type="AppenderRef"/>
        </xsd:sequence>
        <xsd:attribute name="level" use="required" type="LoggerLevel"/>
        <xsd:anyAttribute/>
    </xsd:complexType>
    ​
    <xsd:complexType name="AppenderRef">
        <xsd:attribute name="ref" type="xsd:string"/>
    </xsd:complexType>
    ​
    <xsd:simpleType name="LoggerLevel">
        <xsd:union>
            <xsd:simpleType>
                <xsd:restriction base="xsd:string">
                    <xsd:enumeration value="OFF"/>
                    <xsd:enumeration value="off"/>
                    <xsd:enumeration value="ALL"/>
                    <xsd:enumeration value="all"/>
                    <xsd:enumeration value="INHERITED"/>
                    <xsd:enumeration value="inherited"/>
                    <xsd:enumeration value="NULL"/>
                    <xsd:enumeration value="null"/>
                    <xsd:enumeration value="ERROR"/>
                    <xsd:enumeration value="error"/>
                    <xsd:enumeration value="WARN"/>
                    <xsd:enumeration value="warn"/>
                    <xsd:enumeration value="INFO"/>
                    <xsd:enumeration value="info"/>
                    <xsd:enumeration value="DEBUG"/>
                    <xsd:enumeration value="debug"/>
                    <xsd:enumeration value="TRACE"/>
                    <xsd:enumeration value="trace"/>
                </xsd:restriction>
            </xsd:simpleType>
            <xsd:simpleType>
                <xsd:restriction base="xsd:string">
                    <xsd:pattern value="($\{.+:-)?[Oo][Ff]{2}\}?"/>
                    <xsd:pattern value="($\{.+:-)?[Aa][Ll]{2}\}?"/>
                    <xsd:pattern value="($\{.+:-)?[Ii][Nn][Hh][Ee][Rr][Ii][Tt][Ee][Dd]\}?"/>
                    <xsd:pattern value="($\{.+:-)?[Nn][Uu][Ll]{2}\}?"/>
                    <xsd:pattern value="($\{.+:-)?[Ee][Rr]{2}[Oo][Rr]\}?"/>
                    <xsd:pattern value="($\{.+:-)?[Ww][Aa][Rr][Nn]\}?"/>
                    <xsd:pattern value="($\{.+:-)?[Ii][Nn][Ff][Oo]\}?"/>
                    <xsd:pattern value="($\{.+:-)?[Dd][Ee][Bb][Uu][Gg]\}?"/>
                    <xsd:pattern value="($\{.+:-)?[Tt][Rr][Aa][Cc][Ee]\}?"/>
                    <xsd:pattern value="\$\{.+\}"/>
                </xsd:restriction>
            </xsd:simpleType>
        </xsd:union>
    </xsd:simpleType>
    ​
    <xsd:complexType name="JmxConfigurator"/>
    ​
    <xsd:complexType name="ConnectionSource">
        <xsd:sequence>
            <xsd:element name="driverClass" type="xsd:string"/>
            <xsd:element name="url" type="xsd:string"/>
            <xsd:element name="user" type="xsd:string"/>
            <xsd:element name="password" type="xsd:string"/>
        </xsd:sequence>
        <xsd:attribute name="class" type="xsd:string" use="required"/>
    </xsd:complexType>
    ​
</xsd:schema>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值