Skip to content

logback-spring.xml reloading not working for springProfile in 1.4.2.RELEASE #7955

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ximanta opened this issue Jan 11, 2017 · 5 comments
Closed
Labels
status: duplicate A duplicate of another issue

Comments

@ximanta
Copy link

ximanta commented Jan 11, 2017

I was expecting scan="true" with scanPeriod="5 seconds" to work with logback configuration in SpringBoot 1.4.2.RELEASE

The error I get on updating a logger level inside is

-ERROR in ch.qos.logback.core.joran.spi.Interpreter@4:39 - no applicable action for [springProfile],   
 current ElementPath  is [[configuration][springProfile]]

Same goes for springProperty

 -ERROR in ch.qos.logback.core.joran.spi.Interpreter@12:125 - no applicable action for [springProperty],    
 current ElementPath  is [[configuration][springProperty]]

Without springProfile and springProperty scan happens as expected, but only when changes done in target/classes/logback-spring.xml and not in src/main/resources/logback-spring.xml

Without setting scan, springProfile working as expected.

Maven is being used for this SpringBoot Web app.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 11, 2017
@wilkinsona
Copy link
Member

wilkinsona commented Jan 11, 2017

Sadly, I think we may need to document this as a limitation. To support springProfile and springProperty we use a JoranConfigurator subclass. Unfortunately, Logback's ReconfigureOnChangeTask doesn't give us an opportunity to plug it in:

private void performXMLConfiguration(LoggerContext lc, URL mainConfigurationURL) {
    JoranConfigurator jc = new JoranConfigurator();
    jc.setContext(context);
    StatusUtil statusUtil = new StatusUtil(context);
    List<SaxEvent> eventList = jc.recallSafeConfiguration();

    URL mainURL = ConfigurationWatchListUtil.getMainWatchURL(context);
    lc.reset();
    long threshold = System.currentTimeMillis();
    try {
        jc.doConfigure(mainConfigurationURL);
        if (statusUtil.hasXMLParsingErrors(threshold)) {
            fallbackConfiguration(lc, eventList, mainURL);
        }
    } catch (JoranException e) {
        fallbackConfiguration(lc, eventList, mainURL);
    }
}

@wilkinsona wilkinsona added priority: normal type: documentation A documentation update and removed status: waiting-for-triage An issue we've not yet triaged labels Jan 11, 2017
@wilkinsona wilkinsona added this to the 1.4.4 milestone Jan 11, 2017
@ximanta ximanta closed this as completed Jan 12, 2017
@ximanta ximanta reopened this Jan 12, 2017
@wilkinsona
Copy link
Member

I've just noticed that this is a duplicate of #5611

@wilkinsona wilkinsona added status: duplicate A duplicate of another issue and removed priority: normal type: documentation A documentation update labels Jan 17, 2017
@wilkinsona wilkinsona removed this from the 1.4.4 milestone Jan 17, 2017
@extraneu
Copy link

My apologies for commenting on a closed ticket, but shouldn't this limitation/RFE be reported to logback? (I can't find it on their JIRA)

@snicoll
Copy link
Member

snicoll commented Nov 29, 2017

@extraneu I am not aware this has been reported but feel free to do so.

@guai
Copy link

guai commented Dec 26, 2023

Hi
Any workaroud to make logback+spring reloadable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

6 participants