ikevin8me
ikevin8me

Reputation: 4313

How to turn off logs for Apache 4.0 (BETA 1)?

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!

Upvotes: 0

Views: 269

Answers (1)

Nikita
Nikita

Reputation: 266

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();

Upvotes: 1

Related Questions