0

After upgrading to Cayenne 4 BETA 1, I'm getting lots of logs. How do I turn them off?

For example:

org.apache.cayenne.log.Slf4jJdbcEventLogger logBeginTransaction org.apache.cayenne.log.Slf4jJdbcEventLogger logCommitTransaction ... etc.

(I believe the methods are different from the previous versions.)

Thanks!

ikevin8me
  • 4,253
  • 5
  • 44
  • 84

1 Answers1

1

Methods generally are same as in previous version but underlying API used by Cayenne has changed from commons-logging to SLF4J. And JDBC events logger was renamed accordingly.

You can either:

  • tune log levels by yourself using logging API. How to do this depends on logging back-end of your choice (e.g. logback, log4j or commons-logging) and is out of Cayenne's scope. If you have some configuration for commons-logging you can learn how to keep it here.
  • or you can completely disable Cayenne JDBC logging, when you are creating ServerRuntime, for example:
ServerRuntime runtime = ServerRuntime.builder()
            .addConfig("your_project.xml")
            .addModule(binder -> binder.bind(JdbcEventLogger.class).to(NoopJdbcEventLogger.class))
            .build();
Nikita
  • 266
  • 2
  • 7
  • Thanks! It worked. However, I'm still seeing "org.apache.cayenne.map.EntityResolver applyDBLayerDefaults" and "org.apache.cayenne.datasource.DriverDataSource logConnect". What is the best way to turn off ALL logs, or at least those appearing? – ikevin8me Jun 22 '17 at 08:49
  • As I mentioned above to deal with all logging output you should use logging specific methods, e.g. you can add logback library to your project and make it filter out all cayenne related logs, see [logback documentation](https://logback.qos.ch/manual/configuration.html) for details – Nikita Jun 22 '17 at 10:35