logback-access-spring-boot-starter icon indicating copy to clipboard operation
logback-access-spring-boot-starter copied to clipboard

bug: `springProperty` no longer works in 4.2.2

Open DarkAtra opened this issue 6 months ago • 0 comments

Describe the bug

Including a config file which uses springProperty does no longer work in version 4.2.2. It could be the same issue as https://github.com/spring-projects/spring-boot/issues/40491.

logback-access-spring.xml:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <include resource="logback-access-base.xml"/>
</configuration>

logback-access-base.xml:

<?xml version="1.0" encoding="UTF-8"?>
<included>
    <!-- is set to true in application.yml -->
    <springProperty scope="context" name="consoleEnabled" source="accesslog.console.enabled"/>

    <!-- this should evaluate to true and thus add the ConsoleAppender -->
    <if condition='${consoleEnabled}'>
        <then>
            <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
                <encoder>
                    <pattern>common</pattern>
                </encoder>
            </appender>
            <appender-ref ref="console"/>
        </then>
    </if>
</included>

To Reproduce

  1. Checkout https://github.com/DarkAtra/logback-access-spring-boot-starter-issue
  2. Start the spring application
  3. Make a request to http://localhost:8080
  4. Observe that nothing is logged

Expected behavior

As accesslog.console.enabled is set to true in application.yml, there should be access logs in the console (see logback-access-base.xml for details).

Possible Fix

  • https://github.com/akkinoc/logback-access-spring-boot-starter/pull/466

DarkAtra avatar Aug 16 '24 16:08 DarkAtra