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

Launch app with log4j2 support not generating a proper project template #11425

Open
erdincyilmazel opened this issue Dec 10, 2024 · 0 comments
Open

Comments

@erdincyilmazel
Copy link

erdincyilmazel commented Dec 10, 2024

Expected Behavior

I just created a new project using the micronaut launch app, added log4j2 as an option. When I start the generated empty project as is, I am getting an error from SL4J that says No SLF4J providers were found. Obviously, logging doesn't work. I can't tell exactly where the problem is, as the log4j dependencies are clearly in the gradle build file:

    annotationProcessor("io.micronaut:micronaut-http-validation")
    annotationProcessor("io.micronaut.serde:micronaut-serde-processor")
    implementation("io.micronaut.serde:micronaut-serde-jackson")
    implementation("org.apache.logging.log4j:log4j-api")
    implementation(platform("org.apache.logging.log4j:log4j-bom:2.24.1"))
    compileOnly("io.micronaut:micronaut-http-client")
    runtimeOnly("org.apache.logging.log4j:log4j-core")
    runtimeOnly("org.apache.logging.log4j:log4j-slf4j-impl")
    testImplementation("io.micronaut:micronaut-http-client")

Actual Behaviour

I expect slf4j to pickup log4j2 as the logger. I am getting a NoOp logger at runtime instead.

Steps To Reproduce

Go to https://micronaut.io/launch, on features add log4j2 and then generate a project.

Console output when I first run the blank app:

SLF4J(W): No SLF4J providers were found.
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
 __  __ _                                  _   
|  \/  (_) ___ _ __ ___  _ __   __ _ _   _| |_ 
| |\/| | |/ __| '__/ _ \| '_ \ / _` | | | | __|
| |  | | | (__| | | (_) | | | | (_| | |_| | |_ 
|_|  |_|_|\___|_|  \___/|_| |_|\__,_|\__,_|\__|

Environment Information

No response

Example Application

No response

Version

4.7.1

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

No branches or pull requests

1 participant