I have a project in Eclipse which uses OptaPlanner (v8.12.0). I want to be able to write temporary debug statements within the OptaPlanner code itself, so I:
8.12.x
,mvn
,optaplanner-core
(again, Eclipse), andoptaplanner-core
dependency from my Gradle dependenciesEverything compiles and runs just fine, but OptaPlanner no longer responds to my log config changes.
We're using Log4j2 and, when pulling OptaPlanner using the standard build process (Gradle), I can set the log level just fine using the Log4j2 config. But, with the src as a project dependency, it's not working.
I have tried:
logback.xml
-Dlogging.level.org.optaplanner=trace
-Dlog4j.configurationFile=C:\path\to\log4j2.xml
LOGGING_CONFIG=C:\path\to\logback.xml
Configurator
OptaPlanner only has Logback as a scoped-to-test dependency.
To get a local copy of OptaPlanner to pick up your log config, you need to (locally) add your logging dependency to the OptaPlanner buildpath.
For me, this meant adding a Log4j2 dependency to the OptaPlanner pom.xml
:
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>pick.your.favorite</version>
</dependency>
I also deleted the scoped test dependency just to be sure it wouldn't screw with anything.
I suspect, for those not using a dependency management tool, that you could manually add a JAR to the buildpath.