当我在测试服务器上部署项目时,日志文件中不会生成日志。我正在获取空白日志文件

时间:2019-04-18 09:57:42

标签: java spring spring-boot logging

我在Spring Boot项目中使用Maven。 这是pom.xml

setTimeout(() => setShowForm(false));

这是logback.xml

<groupId>nic.vahan.services</groupId>
<artifactId>vahanLoggerApp1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>vahanLoggerApp1</name>
<description>vahan logging</description>

<properties>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter</artifactId>
    </dependency>
<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
</dependencies>

<build>
  <finalName>vahanLoggerApp1</finalName>
      <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

这是我的主要课程

<configuration>

 <property name="DEV_HOME"
    value="/vahanLoggerAppVer/log_vahavahanLogger" />

<appender name="STDOUT"
    class="ch.qos.logback.core.ConsoleAppender">
    <layout class="ch.qos.logback.classic.PatternLayout">
        <Pattern>
            <!-- %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - 
   %msg%n -->
            %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %class{36}.%M %L
            %logger{36} - %msg%n
        </Pattern>
    </layout>
</appender>

<appender name="FILE-AUDIT"
    class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>${DEV_HOME}/vahanLoggerVer-${hostName}.log</file>
    <encoder
        class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
        <Pattern>
            <!-- %d{yyyy-MMM-dd HH:mm:ss.SSS} %-5level [%thread] 
    %logger{15} - %msg%n -->
            %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %class{36}.%M %L - 
     %msg%n
        </Pattern>
    </encoder>

    <rollingPolicy
        class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
        <!-- rollover daily -->


<fileNamePattern>${DEV_HOME}/archived/vahanLoggerVer-${hostName}.%d{yyyy- 
MM-dd}.%i.log
        </fileNamePattern>
        <timeBasedFileNamingAndTriggeringPolicy
            class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
            <maxFileSize>500MB</maxFileSize>
        </timeBasedFileNamingAndTriggeringPolicy>
    </rollingPolicy>

</appender>

<appender name="FILE-ERROR"
    class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>${DEV_HOME}/vahanLoggerVer-error-${hostName}.log</file>
    <encoder
        class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
        <Pattern>
            <!-- %d{yyyy-MMM-dd HH:mm:ss.SSS} %-5level [%thread] 
   %logger{15} - %msg%n -->
            %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %class{36}.%M %L - 
  %msg%n
        </Pattern>
    </encoder>

    <rollingPolicy
        class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
        <!-- rollover daily -->
        <fileNamePattern>${DEV_HOME}/archived/vahanLoggerVer- 
    error-${hostName}.%d{yyyy-MM-dd}.%i.log
        </fileNamePattern>
        <timeBasedFileNamingAndTriggeringPolicy
            class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
            <maxFileSize>500MB</maxFileSize>
        </timeBasedFileNamingAndTriggeringPolicy>
    </rollingPolicy>

</appender>

<!-- Send logs to both console and file audit -->

<logger name="nic.vahan.service.controller" level="error"
    additivity="true">
    <appender-ref ref="FILE-AUDIT" />
    <appender-ref ref="STDOUT" />
</logger>
<logger name="nic.vahan.service.controller" level="info"
    additivity="true">
    <appender-ref ref="FILE-AUDIT" />
    <appender-ref ref="STDOUT" />
</logger>

<logger name="nic.vahan.service" level="error" additivity="true">
    <appender-ref ref="FILE-AUDIT" />
    <appender-ref ref="STDOUT" />
</logger>
<logger name="nic.vahan.service" level="info" additivity="true">
    <appender-ref ref="FILE-AUDIT" />
    <appender-ref ref="STDOUT" />
</logger>


<logger name="org.springframework" level="error"
    additivity="true">
    <appender-ref ref="FILE-ERROR" />
</logger>
<logger name="org.springframework" level="error"
    additivity="false">
    <appender-ref ref="STDOUT" />
</logger>
<logger name="org.springframework" level="info"
    additivity="false">
    <appender-ref ref="FILE-ERROR" />
    <appender-ref ref="STDOUT" />
</logger>

<!-- Hibernate error logs -->

<logger name="org.hibernate" level="info" additivity="true">
    <appender-ref ref="FILE-AUDIT" />
</logger>

<logger name="org.hibernate" level="info" additivity="false">
    <appender-ref ref="STDOUT" />
</logger>

<logger name="org.hibernate" level="error" additivity="true">
    <appender-ref ref="FILE-AUDIT" />
</logger>

<logger name="org.hibernate" level="error" additivity="false">
    <appender-ref ref="STDOUT" />
</logger>

</configuration>

问题是,当我在本地计算机上运行项目时,我收到类似“ vahan日志正在生成”的日志,但是我想知道何时在测试服务器上使用我的项目时,我得到了空白的日志文件,并且日志中没有打印任何日志文件。 请帮助我。

0 个答案:

没有答案