optapy / optapy

OptaPy is an AI constraint solver for Python to optimize planning and scheduling problems.

Home Page:https://www.optapy.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Alex-K37 opened this issue · comments

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.