xml - Log4j2 xml 配置是否区分大小写?

标签 xml logging log4j log4j2

让我们假设我有类似的 Log4j2 xml 配置

<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
    <Properties>            
        <Property name="company.log.folder">.</Property>
    </Properties>
    <Appenders>
        <RollingFile name="mainFile" fileName="${sys:company.log.folder}/main.log"
                 filePattern="archive-logs/$${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log.zip">
            <PatternLayout>
                <Pattern>%d [%t] %-5p %c - %m%n</Pattern>
            </PatternLayout>
            <Policies>
                <SizeBasedTriggeringPolicy size="10MB"/>
            </Policies>
        </RollingFile>
    </Appenders>
    <Loggers>
        <Root level="info">
            <AppenderRef ref="mainFile"/>
        </Root>
    </Loggers>
</Configuration>

大多数情况下,我对这里的两个参数感兴趣 - 级别和大小。那么,如果我写 INFO 而不是 info 或 10mb 而不是 10MB 有什么区别吗?其他参数呢?

最佳答案

这是 log4j2 documentation 的相对部分:

Log4j can be configured using two XML flavors; concise and strict. The concise format makes configuration very easy as the element names match the components they represent however it cannot be validated with an XML schema. For example, the ConsoleAppender is configured by declaring an XML element named Console under its parent appenders element. However, element and attribute names are are not case sensitive. In addition, attributes can either be specified as an XML attribute or as an XML element that has no attributes and has a text value.

关于xml - Log4j2 xml 配置是否区分大小写?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30727503/

相关文章:

xml - XSLT:从多个 XML 文件复制节点,替换或添加节点到另一个 XML 文件,并将整个内容转换为 HTML

c++ - 如何通过boost::log打印到不同属性的不同日志?

java - log4j。唯一的日志文件名

java - map api v2 android : Binary XML file line #2 error

Android - 将填充设置为 RadioButton pin

php - 如何使用 simplexml 处理无效的 unicode

python - 将记录器消息存储在字符串中

.net - 应用程序日志记录

java - 异步日志

java - 如何在 log4j 2 中添加/减去日期?