agido-malter / logback-elasticsearch-appender

Logback Elasticsearch Appender
Other
23 stars 11 forks source link

Application run failed Spring boot 3.X #20

Open george0131 opened 1 year ago

george0131 commented 1 year ago

Good morning.

I try to use the library in the latest version with spring V. 3.1.3.

image

This is my logback-spring.xml file:

http://AppUser:AppUser@localhost:9200/_bulk demoservice-%date{yyyy.MM} tester es-logger es-error-logger 30000 false false false 104857600 3 30000 250 false false 100 true data. index
        <properties>
            <!-- please note that <property> tags are also supported, esProperty was added for logback-1.3 compatibility -->
            <esProperty>
                <name>host</name>
                <value>${HOSTNAME}</value>
                <allowEmpty>false</allowEmpty>
            </esProperty>
            <esProperty>
                <name>severity</name>
                <value>%level</value>
            </esProperty>
            <esProperty>
                <name>thread</name>
                <value>%thread</value>
            </esProperty>
            <esProperty>
                <name>stacktrace</name>
                <value>%ex</value>
            </esProperty>
            <esProperty>
                <name>logger</name>
                <value>%logger</value>
            </esProperty>
        </properties>
        <headers>
            <header>
                <name>Content-Type</name>
                <value>application/json</value>
            </header>
        </headers>
    </appender>

    <root level="info">
        <appender-ref ref="FILELOGGER" />
        <appender-ref ref="ELASTIC" />
    </root>

    <logger name="es-error-logger" level="INFO" additivity="false">
        <appender-ref ref="FILELOGGER" />
    </logger>

    <logger name="es-logger" level="INFO" additivity="false">
        <appender name="ES_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
            <!-- ... -->
            <encoder>
                <pattern>%msg</pattern> 
            </encoder>
        </appender>
    </logger>
</springProfile>

And when I check the logs in elasticsearch (V. 7.16.2) I get this:

image

However, the application still works without problem (I know this because the application sends an automatic mail and it is doing it).

image

I would be very grateful for your support.