Reputation: 33
Context: I am using java or-tools for a CP problem (from the constraint solver package) Issue: I want to make these prints/logs disappear. They look like this:
[11:29:43] ./ortools/constraint_solver/search.cc:240: Start search (memory used = 5,28 GB)
[11:29:43] ./ortools/constraint_solver/search.cc:240: Start search (memory used = 5,28 GB)
[11:29:43] ./ortools/constraint_solver/search.cc:240: End search (time = 2 ms, branches = 0, failures = 1, memory used = 5,28 GB, speed = 0 branches/s)
[11:29:43] ./ortools/constraint_solver/search.cc:240: End search (time = 3 ms, branches = 0, failures = 1, memory used = 5,28 GB, speed = 0 branches/s)
[11:29:43] ./ortools/constraint_solver/search.cc:240: Start search (memory used = 5,28 GB)
Although this is my log4j2.xml file:
<configuration status="OFF">
<appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="[%d{yyyy.MM.dd HH:mm:ss.SSS}][%t] [%-5level] [%logger{36}] - %msg%n%xException"/>
</Console>
<RollingFile name="RollingFile" fileName="./../../logs/raptor-engine-tests.log" filePattern="./../../logs/raptor-engine-tests-%d{MM-dd-yyyy}.log.gz" ignoreExceptions="false">
<PatternLayout pattern="[%d{yyyy.MM.dd HH:mm:ss.SSS}][%t] [%-5level] [%logger{36}] - %msg%n%xException"/>
<TimeBasedTriggeringPolicy/>
</RollingFile>
</appenders>
<loggers>
<logger name="akka" level="info"/>
<Logger name="org.hibernate" level="info"/>
<Logger name="com.google.ortools" level="info"/>
<!-- levels: trace, debug, info, warn, error, fatal -->
<root level="info">
<appender-ref ref="Console"/>
<appender-ref ref="RollingFile"/>
</root>
</loggers>
</configuration>
Did anybody encounter this problem? And how did you solve it? It's like the "com.google.ortools" Logger is completely ignored.
Upvotes: 3
Views: 809
Reputation: 11034
Are you using the routing library ? or directly the CP solver ?
In the first case, there should be a parameter to control logging: https://github.com/google/or-tools/blob/f3fd201e68cf75b7720ff5c3cadc599a1d02b54b/ortools/constraint_solver/routing_parameters.proto#L376
In the second case, this only happens if you create a search log object, and use it when searching.
Now, these logs are generated by the C++ code, thus the logger will do nothing.
Upvotes: 3