Java 如何在logback.xml中添加小于(<;)和大于(>;)

Java 如何在logback.xml中添加小于(<;)和大于(>;),java,logback,Java,Logback,有人能告诉我如何添加小于()的登录logback.xml 我想要一个编码器。模式如下 <encoder> <pattern>%p [%d{yyyy-MM-dd HH:mm:ss,SSS}] %c{3}:[%C{1}:%M:%L] - [%t][%file:%line] - %replace(%.-20480m){'[^A-Za-z0-9=<>:@\\-\\[\\]\n\\s!]','_'}%n </pattern> <encoder>

有人能告诉我如何添加小于()的登录
logback.xml

我想要一个
编码器。模式
如下

<encoder>
 <pattern>%p [%d{yyyy-MM-dd HH:mm:ss,SSS}] %c{3}:[%C{1}:%M:%L] - [%t][%file:%line] - %replace(%.-20480m){'[^A-Za-z0-9=<>:@\\-\\[\\]\n\\s!]','_'}%n
 </pattern>
<encoder>
<?xml version="1.0" encoding="UTF-8"?>

<!-- Scanning for changes in configuration file and automatic re-configuration -->
<configuration scan="true" debug="true">
    <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
        <Target>System.out</Target>
        <encoder>
            <pattern>%p [%d{yyyy-MM-dd HH:mm:ss,SSS}] %c{3}:[%C{1}:%M:%L] - [%t][%file:%line] - %replace(%.-20480m){'[^A-Za-z0-9=&lt;&gt;:@\\-\\[\\]\n\\s!]','_'}%n</pattern>
        </encoder>
    </appender>

    <root level="INFO">
        <appender-ref ref="CONSOLE"/>
    </root>
</configuration>

%p[%d{yyyyy-MM-dd HH:MM:ss,SSS}]%c{3}:[%c{1}:%M:%L]-[%t][%t][%file:%line]-%replace(%.-20480m){'[^A-Za-z0-9=:@\\\\\[\\]\n\\s!]','\\\\}%n
但这是失败的,因为存在

编辑

我的logback.xml如下所示

<encoder>
 <pattern>%p [%d{yyyy-MM-dd HH:mm:ss,SSS}] %c{3}:[%C{1}:%M:%L] - [%t][%file:%line] - %replace(%.-20480m){'[^A-Za-z0-9=<>:@\\-\\[\\]\n\\s!]','_'}%n
 </pattern>
<encoder>
<?xml version="1.0" encoding="UTF-8"?>

<!-- Scanning for changes in configuration file and automatic re-configuration -->
<configuration scan="true" debug="true">
    <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
        <Target>System.out</Target>
        <encoder>
            <pattern>%p [%d{yyyy-MM-dd HH:mm:ss,SSS}] %c{3}:[%C{1}:%M:%L] - [%t][%file:%line] - %replace(%.-20480m){'[^A-Za-z0-9=&lt;&gt;:@\\-\\[\\]\n\\s!]','_'}%n</pattern>
        </encoder>
    </appender>

    <root level="INFO">
        <appender-ref ref="CONSOLE"/>
    </root>
</configuration>

系统输出
%p[%d{yyyyy-MM-dd HH:MM:ss,SSS}]%c{3}:[%c{1}:%M:%L]-[%t][%t][%file:%line]-%replace(%.-20480m){'[^A-Za-z0-9=:@\\\\\[\\]\n\\s!]','\\\\}%n

XML标准转义序列可能会有所帮助。



XML标准转义序列可能会有所帮助。

尝试使用
转义,尝试使用
转义,并且
我已转义,但现在行号没有显示
信息[2018-01-19 16:39:31]c.v.c.u.GCNotificationListener:[?:?:?]-[Service Thread]-GC\u DETAILS\uID=9\ugc\u TYPE=end of minor GC\ugc\u NAME=PS cleave\uduration\u milliss\uuu=43\ugc\u CAUSE=Allocation Failure\ugc\u START\u TIME\u millsAfterJVMStart\u7241
I已转义,但现在行号未显示
INFO[2018-01-19 16:39:31]c.v.c.c.u.notification:[http:]-GC\u详细信息\uID=9\uGC\u类型=次要GC的结束\uGC\u名称=PS清除\uuUduration\u毫秒\uU=43\uGC\u原因=分配失败\uGC\u开始\u时间\uMillsAfterJVStart\uU7198\uGC\u结束\uMillsAfterJVStart\u7241