Springboot log cannot be output normally, there are log files

incomplete log output

incomplete under window and linux

related codes

Log output:

2019-01-29 01:16:42.214 [restartedMain] WARN  com.netflix.config.sources.URLConfigurationSource - No URLs will be polled as dynamic configuration sources.
2019-01-29 01:16:42.214 [restartedMain] INFO  com.netflix.config.sources.URLConfigurationSource - To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-01-29 01:16:42.220 [restartedMain] WARN  com.netflix.config.sources.URLConfigurationSource - No URLs will be polled as dynamic configuration sources.
2019-01-29 01:16:42.220 [restartedMain] INFO  com.netflix.config.sources.URLConfigurationSource - To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-01-29 15:27:39.122 [restartedMain] WARN  com.netflix.config.sources.URLConfigurationSource - No URLs will be polled as dynamic configuration sources.
2019-01-29 15:27:39.122 [restartedMain] INFO  com.netflix.config.sources.URLConfigurationSource - To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-01-29 15:27:39.128 [restartedMain] WARN  com.netflix.config.sources.URLConfigurationSource - No URLs will be polled as dynamic configuration sources.
2019-01-29 15:27:39.128 [restartedMain] INFO  com.netflix.config.sources.URLConfigurationSource - To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-01-29 15:55:41.006 [restartedMain] WARN  com.netflix.config.sources.URLConfigurationSource - No URLs will be polled as dynamic configuration sources.
2019-01-29 15:55:41.007 [restartedMain] INFO  com.netflix.config.sources.URLConfigurationSource - To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-01-29 15:55:41.012 [restartedMain] WARN  com.netflix.config.sources.URLConfigurationSource - No URLs will be polled as dynamic configuration sources.
2019-01-29 15:55:41.012 [restartedMain] INFO  com.netflix.config.sources.URLConfigurationSource - To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-01-29 15:59:54.552 [restartedMain] WARN  com.netflix.config.sources.URLConfigurationSource - No URLs will be polled as dynamic configuration sources.
2019-01-29 15:59:54.552 [restartedMain] INFO  com.netflix.config.sources.URLConfigurationSource - To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-01-29 16:48:15.052 [restartedMain] WARN  com.netflix.config.sources.URLConfigurationSource - No URLs will be polled as dynamic configuration sources.
2019-01-29 16:48:15.052 [restartedMain] INFO  com.netflix.config.sources.URLConfigurationSource - To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-01-29 16:55:32.159 [restartedMain] WARN  com.netflix.config.sources.URLConfigurationSource - No URLs will be polled as dynamic configuration sources.
2019-01-29 16:55:32.159 [restartedMain] INFO  com.netflix.config.sources.URLConfigurationSource - To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-01-29 16:57:28.997 [restartedMain] WARN  com.netflix.config.sources.URLConfigurationSource - No URLs will be polled as dynamic configuration sources.
2019-01-29 16:57:28.998 [restartedMain] INFO  com.netflix.config.sources.URLConfigurationSource - To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-01-29 17:08:05.546 [restartedMain] WARN  com.netflix.config.sources.URLConfigurationSource - No URLs will be polled as dynamic configuration sources.
2019-01-29 17:08:05.547 [restartedMain] INFO  com.netflix.config.sources.URLConfigurationSource - To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-01-29 17:08:55.152 [restartedMain] WARN  com.netflix.config.sources.URLConfigurationSource - No URLs will be polled as dynamic configuration sources.
2019-01-29 17:08:55.153 [restartedMain] INFO  com.netflix.config.sources.URLConfigurationSource - To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-01-29 17:09:52.737 [restartedMain] WARN  com.netflix.config.sources.URLConfigurationSource - No URLs will be polled as dynamic configuration sources.
2019-01-29 17:09:52.738 [restartedMain] INFO  com.netflix.config.sources.URLConfigurationSource - To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-01-29 17:46:14.749 [restartedMain] WARN  com.netflix.config.sources.URLConfigurationSource - No URLs will be polled as dynamic configuration sources.
2019-01-29 17:46:14.749 [restartedMain] INFO  com.netflix.config.sources.URLConfigurationSource - To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-01-29 17:59:38.357 [restartedMain] WARN  com.netflix.config.sources.URLConfigurationSource - No URLs will be polled as dynamic configuration sources.
2019-01-29 17:59:38.357 [restartedMain] INFO  com.netflix.config.sources.URLConfigurationSource - To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.

build.gradle

buildscript {
    ext {
        springBootVersion = "2.0.5.RELEASE"
    }
    repositories {
        mavenCentral()
        maven { url "https://maven.aliyun.com/repository/public" }
        maven { url "https://repo.spring.io/milestone" }
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

apply plugin: "java"
apply plugin: "eclipse"
apply plugin: "org.springframework.boot"
apply plugin: "io.spring.dependency-management"

group = "com.jmking.health"
version = "0.0.1"
sourceCompatibility = 1.8

repositories {
    mavenCentral()
    maven { url "https://maven.aliyun.com/repository/public" }
    maven { url "https://repo.spring.io/milestone" }
}

ext {
    springCloudVersion = "Finchley.SR1"
}

dependencies {
    compile project(":base_module")
    compile fileTree(dir:"libs",include:["*.jar"])
    compile("com.alibaba:fastjson:1.2.47")
    compile("org.apache.httpcomponents:httpclient:4.5.3")
    compile("org.dom4j:dom4j:2.1.1")
    compile("commons-codec:commons-codec:1.11")
    compile("org.springframework.cloud:spring-cloud-starter-openfeign")
    compile("org.springframework.boot:spring-boot-starter-web")
    compile("org.springframework.boot:spring-boot-starter-data-redis")
    compile("commons-beanutils:commons-beanutils:1.9.3")
    runtime("org.springframework.boot:spring-boot-devtools")
}

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
    }
}
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
    <!--  LogBack  -->
    <!--  -->
    <springProfile name="dev">
        <property name="LOG_HOME" value="F://logs/health/lead" />
    </springProfile>
    <springProfile name="test">
        <property name="LOG_HOME" value="/home/health/logs/lead" />
    </springProfile>
    <springProfile name="prod">
        <property name="LOG_HOME" value="/home/health/logs/lead" />
    </springProfile>
    <!--  -->
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
            <!--:%d%thread%-5level:5%msg:%n -->
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
        </encoder>
    </appender>
    <!--  -->
    <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
            <!-- -->
            <FileNamePattern>${LOG_HOME}/lead.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
             <!---->
            <MaxHistory>30</MaxHistory>
            <!---->
            <totalSizeCap>1GB</totalSizeCap>
            <MaxFileSize>10MB</MaxFileSize>
        </rollingPolicy>
        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
            <!--:%d%thread%-5level:5%msg:%n -->
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
        </encoder>
    </appender>

    <!--  -->
    <logger name="com" level="INFO">
        <appender-ref ref="FILE" />
    </logger>
    <root level="INFO">
        <appender-ref ref="STDOUT" />
    </root>
</configuration>

how to output normally

May.31,2022

what does incomplete mean? Incomplete in file or incomplete in console?

in addition: there is no file appender in
< root >, is it? It should not be exported to file. Can I add to
< logger >? I haven't tried this. Since < root > doesn't add file, let's delete the file here.

Menu