Skip to content

Do not display color log information in idea console #309

@zhuo9426

Description

@zhuo9426
<contextName>logback</contextName>
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="log.path" value="E:\\log\\logback.log" />



<!--输出到控制台-->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
    <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
        <level>INFO</level>
    </filter>
    <withJansi>true</withJansi>
    <encoder>
        <!--<pattern>%d %p (%file:%line\)- %m%n</pattern>-->
        <!--格式化输出:%d:表示日期    %thread:表示线程名     %-5level:级别从左显示5个字符宽度  %msg:日志消息    %n:是换行符-->
        <pattern>%black(控制台-) %red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger) - %cyan(%msg%n)</pattern>
        <charset>UTF-8</charset>
    </encoder>
</appender>

<!--输出到文件-->
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>${log.path}</file>
    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
        <fileNamePattern>logback.%d{yyyy-MM-dd-HH-mm}.log</fileNamePattern>
        <maxHistory>30</maxHistory>
        <totalSizeCap>1GB</totalSizeCap>
    </rollingPolicy>
    <encoder>
        <!--格式化输出:%d:表示日期    %thread:表示线程名     %-5level:级别从左显示5个字符宽度  %msg:日志消息    %n:是换行符-->
        <pattern>文件记录-%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n</pattern>
        <charset>GBK</charset>
    </encoder>
</appender>

<root level="info">
    <appender-ref ref="console" />
    <appender-ref ref="file" />
</root>

<logger name="com.sxd.controller"/>
<logger name="com.sxd.util.LogTestController" level="WARN" additivity="false">
    <appender-ref ref="console" />
</logger>

This is my logback configuration file content,When I set true, the info information in the idea console is not a color log. When I delete this line with the value true, the information of the color log will appear in the idea console
What is the reason? Did I misunderstand the true configuration?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions