micronaut-openapi icon indicating copy to clipboard operation
micronaut-openapi copied to clipboard

OpenAPI module is initializing SLF4J

Open graemerocher opened this issue 2 years ago • 3 comments

Expected Behavior

Should not initialize SLF4J

Actual Behaviour

Causes

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
warning: unknown enum constant When.MAYBE

Steps To Reproduce

Add openapi and compile

Environment Information

No response

Example Application

No response

Version

3.7.1

graemerocher avatar Oct 04 '22 11:10 graemerocher

@graemerocher Hmm... Sorry, I don't know how to get rid of slfj4j initialization correctly. The only way I know to remove this message is to add logback or slf4j-simple to dependencies

altro3 avatar Oct 05 '22 09:10 altro3

the code path that initializes SLF4J has to be removed from the compiler.

graemerocher avatar Oct 05 '22 10:10 graemerocher

@graemerocher I went through all the code and all the dependencies. There is no use of slf4j anywhere in the project code itself.

What solutions do I see:

  1. Remove the dependency on the swagger-core libraries (I have already done this anyway and will add the PR in the near future). You also need to remove the dependency on the micronaut-http library, because inside it uses slf4j - this is also not difficult to do.

  2. Add to dependencies 'org.slf4j:slf4j-nop'

  3. Add dependencies 'org.slf4j:slf4j-simple' or 'ch.qos.logback:logback-classic'

altro3 avatar Oct 07 '22 13:10 altro3