org.springframework.boot logback将日志文件($ {LOG_FILE})放在哪里?

时间:2019-01-12 08:19:46

标签: spring-boot logback

我正在尝试确定$ {LOG_FILE}的定义位置。

请参见下面的file-appender.xml:

<?xml version="1.0" encoding="UTF-8"?>

<!--
File appender logback configuration provided for import, equivalent to the programmatic
initialization performed by Boot
-->

<included>
    <appender name="FILE"
        class="ch.qos.logback.core.rolling.RollingFileAppender">
        <encoder>
            <pattern>${FILE_LOG_PATTERN}</pattern>
        </encoder>
        <file>${LOG_FILE}</file> <!-- THIS ONE ---------------------------------->

<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
                <fileNamePattern>${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz</fileNamePattern>
                <maxFileSize>${LOG_FILE_MAX_SIZE:-10MB}</maxFileSize>
                <maxHistory>${LOG_FILE_MAX_HISTORY:-0}</maxHistory>
            </rollingPolicy>
        </appender>
    </included>

我没有在springframework日志目录的任何xml中看到它的定义。而且肯定没有在我的半样板logback-spring.xml中定义

1 个答案:

答案 0 :(得分:-1)

通常由文件包括 /org/springframework/boot/logging/logback/base.xml(spring-boot-2.2.0)

$ {LOG_FILE}这样定义,base.xml通过include file-appender.xml

class QuestionChoiceInline(admin.StackedInline):
    model = QuestionChoice


class CustomQuestionAdmin(admin.ModelAdmin):
    list_display = ['PROFILE', ------]
    inlines = [QuestionChoiceInline, ]
    class Meta:
        model = Question


admin.site.register(Question, CustomQuestionAdmin)