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

logging.getLogger('optapy').setLevel(logging.DEBUG) (as documented) has no effect on optapy 9.370b0 logger #181

Open
Alex-K37 opened this issue Dec 27, 2023 · 4 comments

Comments

@Alex-K37
Copy link

Environment is Python 3.11 JDK 11.

I started with logging.getLogger('optapy').setLevel(logging.DEBUG) as described in the optapy documentation, which did not work.

The following initial code prints MY debug test message, but NOTHING below INFO from optapy:

logging.basicConfig(level=logging.DEBUG)
logging.getLogger('optapy').setLevel(logging.DEBUG)
if not logging.getLogger('optapy').hasHandlers():
    handler = logging.StreamHandler()
    handler.setLevel(logging.DEBUG)
    logging.getLogger().addHandler(handler)
    
logging.getLogger('optapy').debug("Initial DEBUG Testlog.")

I have only had success after looking at the issues here and was able to make it work with only this:

import org
org.optaplanner.optapy.logging.PythonLoggingToLogbackAdapter.setLevel("org.optaplanner",logging.DEBUG)

May I suggest to either fix the code or the documentation? I wasted hours trying to debug my constraints.

@ge0ffrey
Copy link
Contributor

@Christopher-Chianelli does this affect timefold-solver-python too?

@Christopher-Chianelli
Copy link
Contributor

@ge0ffrey Nope; it was fixed in timefold-solver-python.

@Alex-K37
Copy link
Author

Thank you for the info. I have found out about timefold only a couple of weeks ago and will likely migrate.

The issue may be closed from my point of view.

@Alex-K37
Copy link
Author

I have had a first go at timefold with the python API which has only recently been released with 1.11 and it also has issues with logging. cf. TimefoldAI/timefold-solver-python#103

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

3 participants