Skip to content

Client overwriting my app's logback configuration #276

@taylorKonigsmark

Description

@taylorKonigsmark

Hello everyone!

When adding the client as a dependency to my spring boot 2 application, the library is overwriting the logback configurations that I specified at /src/main/resources/logback-spring.xml.

my dependency config with gradle looks like:

compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-actuator')
compile('org.springframework.cloud:spring-cloud-starter-consul-config')

compile('org.elasticsearch.client:elasticsearch-rest-high-level-client:6.2.4')
compile('org.elasticsearch.client:transport:6.2.4')
compile ('io.reactivex.rxjava2:rxjava:2.1.13')
compile ('io.kubernetes:client-java:1.0.0')
compileOnly('org.springframework.boot:spring-boot-configuration-processor')
compileOnly('org.projectlombok:lombok')
testCompile('org.springframework.boot:spring-boot-starter-test')

my logback-spring.xml looks like this:

<configuration>
    <springProperty name="APP_VERSION" source="spring.application.version"/>
    <springProperty name="APP_NAME" source="spring.application.name"/>
    <appender name="consoleAppenderJson" class="ch.qos.logback.core.ConsoleAppender">
        <encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
            <providers>
                <mdc/><!-- MDC variables on the Thread will be written as JSON fields -->
                <context/> <!-- Outputs entries from logback's context -->
                <logLevel/>
                <loggerName/>
                <pattern>
                    <pattern>
                        {
                        "appName": "${APP_NAME}",
                        "appVersion": "${APP_VERSION}"
                        }
                    </pattern>
                </pattern>
                <threadName/>
                <message/>
                <logstashMarkers/> <!-- Useful so we can add extra information for specific log lines as Markers -->
                <arguments/> <!-- or through StructuredArguments -->
                <stackTrace/>
            </providers>
        </encoder>
    </appender>
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%date{yyyy-MM-dd HH:mm:ss.SSS} %-4relative [%thread] %-5level %marker %logger{35} - %msg %n
            </pattern>
        </encoder>
    </appender>
    <springProfile name="default,dev,ci,perf,stg,uat,prod">
        <root>
            <appender-ref ref="consoleAppenderJson"/>
        </root>
    </springProfile>
    <springProfile name="local">
        <root>
            <level value="INFO"/>
            <appender-ref ref="STDOUT"/>
        </root>
    </springProfile>
</configuration>

I couldn't find any documentation on this, so I imagine that this shouldn't be happening.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions