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

[PYTHON] there is logging problem and some commands exit prematurely #12135

Closed
matecsaj opened this issue May 1, 2023 · 10 comments
Closed

[PYTHON] there is logging problem and some commands exit prematurely #12135

matecsaj opened this issue May 1, 2023 · 10 comments

Comments

@matecsaj
Copy link

matecsaj commented May 1, 2023

Description

The program aborts before completing some commands when a logging library is absent.

Swagger-codegen version

3.0.42

Swagger declaration file content or URL

I cached them from https://developer.ebay.com/; there is nothing special about them; any contract will exhibit the problem.

Command line used for generation
/usr/local/bin/swagger-codegen version
/usr/local/bin/swagger-codegen generate -l python -o /Users/matecsaj/PycharmProjects/ebay_rest/scripts/api_cache/sell_inventory -DpackageName=sell_inventory -i /Users/matecsaj/PycharmProjects/ebay_rest/scripts/api_cache/sell_inventory_v1_oas3.json
Steps to reproduce

I'm currently using macOS Ventura Intel and openjdk@11.

I've used the program for a few years and have upgraded regularly. Today the upgrade proceeded normally, but afterwards, the program malfunctioned.

brew update && brew upgrade && brew cleanup

All commands that I tried displayed the following. See the prior section for examples.

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.

The more severe consequence is that some commands, e.g. generate, abort prematurely, so essential work can be accomplished.

Related issues/PRs

Searching on 'slf4j' yields many results. The gist is the problem has arisen and then been fixed several times.

Suggest a fix/enhancement

I don't know Java, so I can't help myself or others.

This might be a good starting point.
https://www.slf4j.org/codes.html#StaticLoggerBinder

Since this problem recurs, add a unit test.

@matecsaj matecsaj changed the title [PYTHON] there logging library problem and some commands exit prematurely [PYTHON] there is logging problem and some commands exit prematurely May 1, 2023
@matecsaj
Copy link
Author

Version 3.0.43 is better; it continues and generates code despite the load class failure.

@alexkart
Copy link

alexkart commented May 30, 2023

I have the same issue with version 3.0.43 on Ubuntu 22.04

image

But I think that besides SLF4J issue there is one more issue related to NullPointerException

@jeremydyoung
Copy link

This is caused by a mismatch between logback 1.4.x and slf4j 1.7.x

Logback 1.3.x and 1.4.x require slf4j 2.x, due to a change in the binding behavior.

The fix is EITHER upgrade slf4j to 2.0.7
OR
Downgrade logback to 1.2.12 which is the latest logback compatible with slf4j 1.7.x.

I am going to provide a quick PR with the upgrade for slf4j.

@jeremydyoung
Copy link

PR: #12194

@jeremydyoung
Copy link

Apologies, my fix will not address any of the underlying generation errors, but it will allow the logging output to be seen when using the tool.

On a larger scale, it seems 3.0.42, by upgrading from Java 8 to Java 11 might not be so minor of a release after all, so it may be useful to make it easier for people to jump back to 3.0.41 if they are experiencing problems.

HugoMario added a commit that referenced this issue Jul 8, 2023
@pluberd
Copy link

pluberd commented Jul 26, 2023

swagger-codegen-cli-3.0.46.jar / Windows 10

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.

@deniskniazev-municorn
Copy link

macos homebrew swagger-codegen/3.0.46. Same error

@hlovdal
Copy link

hlovdal commented Sep 22, 2023

@pluberd @deniskniazev-municorn See this comment for how to compensate.

@matecsaj
Copy link
Author

matecsaj commented Nov 6, 2023

Problem solved. Version 3.0.50 works fine. Thank you, kind stranger.

@matecsaj matecsaj closed this as completed Nov 6, 2023
@hlovdal
Copy link

hlovdal commented Dec 14, 2023

It was solved in 3.0.47.

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

6 participants