Skip to content
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

Feature/implement logback logger context listener code generation #302

Conversation

alexey-lapin
Copy link
Contributor

Current implementation of logback optimizer io.micronaut.aot.std.sourcegen.LogbackConfigurationSourceGenerator incorrectly translates contextListener tags.

This PR adds generator handler for contextListener element in logback.xml:

<configuration>

    <contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator"> <!-- line of interest -->
        <resetJUL>true</resetJUL> <!-- line of interest -->
    </contextListener> <!-- line of interest -->

    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <withJansi>true</withJansi>
        <encoder>
            <pattern>%cyan(%d{HH:mm:ss.SSS}) %gray([%thread]) %highlight(%-5level) %magenta(%logger{36}) - %msg%n</pattern>
        </encoder>
    </appender>
</configuration>

becomes:

LevelChangePropagator contextlistener = new LevelChangePropagator();
contextlistener.setResetJUL(true);
contextlistener.setContext(context);
contextlistener.start();
loggerContext.addListener(contextlistener);

@CLAassistant
Copy link

CLAassistant commented Jun 2, 2024

CLA assistant check
All committers have signed the CLA.

@alexey-lapin
Copy link
Contributor Author

alexey-lapin commented Jun 3, 2024

Hi @melix, @sdelamo, @graemerocher could you please take a look

@graemerocher graemerocher requested a review from melix June 6, 2024 10:20
@melix
Copy link
Collaborator

melix commented Jun 6, 2024

Thanks for the PR!

@melix melix merged commit 3bcaa4c into micronaut-projects:2.5.x Jun 6, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants