JSON logging
mmmvvvppp opened this issue · comments
Is there any way to make OptaPy log with a JSON format? It seems the handler in the optaplanner_python_logger is disabled, otherwise I'd be trying to provide a custom handler, e.g. https://pypi.org/project/python-json-logger/
This is complicated, since we don't actually use a Python logger, but a Java logger which our Python logger acts as a wrapper for:
optapy/optapy-core/src/main/python/optaplanner_python_logger.py
Lines 6 to 37 in 3c35ef7
Having the Java logger call the Python logger on the solve thread will probably massively decrease performance, due to FFI calls being so costly and Python having an interpreter lock. Since solving mostly happen in Java (since constraints are translated to Java with jpyinterpreter
), having the Java logger call the Python logger in a separate thread should not be as costly, but I would need to write a custom appender for logback/slf4j.