V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
wk1563396689
V2EX  ›  问与答

log4j 一会换行一会不换行的

  •  
  •   wk1563396689 · 2020-11-11 15:56:47 +08:00 · 596 次点击
    这是一个创建于 1510 天前的主题,其中的信息可能已经有所发展或是发生改变。
    11-11 15:48:02 ==> Received ready msg from worker
    11-11 15:52:01 ==> Start service daemon by auroravm on Linux.
    11-11 15:52:01 ==> init monitor status:true
    11-11 15:52:01 ==> Starting service
    11-11 15:52:01 ==> Connecting to Message Agent tcp://localhost:6666
    11-11 15:52:01 ==> Registering services
    11-11 15:52:01 ==> Received ready msg from worker11-11 07:52:40 INFO Admin.Daemon ServiceDaemon.java:454 - ==> Received new task from Message Agent, dispatch msg to worker.
    11-11 15:52:40 ==> Start user=aurora@aurora-system.com, project=Byte1,folder=523930175671504896, task=Rocky Simulation.


    可以看到倒数第二行就不换行了

    采用的 springboot 框架,截取了一段配置如下

    <Properties>
    <Property name="logDir">log</Property>
    <Property name="logFile">${sys:log_name}</Property>
    <Property name="adminLogFile">${sys:log_name}_admin</Property>
    <Property name="LOG_PATTERN">%d{MM-dd HH:mm:ss}{UTC} %-5level %logger{36} %file:%line - %msg%xEx%n</Property>
    </Properties>
    <Appenders>
    <!-- Async Loggers will auto-flush in batches, so switch off immediateFlush. -->
    <Console name="Console" target="SYSTEM_OUT">
    <PatternLayout pattern="${LOG_PATTERN}"/>
    </Console>

    <RollingFile name="adminFile" fileName="${logDir}/${adminLogFile}.log" append="true"
    filePattern="${logDir}/%d{MM-dd-yyyy}{UTC}-%i.${adminLogFile}.log.gz">
    <PatternLayout pattern="${LOG_PATTERN}"/>
    <RegexFilter regex=".*/api/v3/backend/log.*" onMatch="DENY" onMismatch="ACCEPT"/>
    <Policies>
    <OnStartupTriggeringPolicy />
    <TimeBasedTriggeringPolicy interval="12"/>
    <SizeBasedTriggeringPolicy size="50MB"/>
    </Policies>
    <DefaultRolloverStrategy>
    <Delete basePath="${logDir}/" maxDepth="2">
    <IfFileName glob="*.${adminLogFile}.log.gz" />
    <IfLastModified age="7d" />
    </Delete>
    </DefaultRolloverStrategy>
    </RollingFile>
    </Appenders>
    1 条回复    2020-11-12 10:51:48 +08:00
    wk1563396689
        1
    wk1563396689  
    OP
       2020-11-12 10:51:48 +08:00
    这个没人回复么。。。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   964 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 21:18 · PVG 05:18 · LAX 13:18 · JFK 16:18
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.