Logging of cached entities

Hello,
is there a way to enable logging for eclipselink.cache? I would like to see if a entity is loaded from cache or the db.
I’ve enabled caching following the examples on this site: Entity and Query Cache :: Jmix Documentation

Regards
Pascal

Hello,

Unfortunately, there is not so many logs in eclipselink cache mechanism which will show how entity obtained from cache, but you can try a few things:

First of all, you can enable query logging in your application.properties:
logging.level.eclipselink.logging.sql=debug
thus, each executed SQL will be logged, so you will see, whether actual call to database has been performed.

Secondary, for Query Cache you can enable debug log level for QueryCacheManager class to know whether query results are not found in cache, or even override this bean to add any logs you want.

For Entity Cache you can enable debug logging for JmixEntityManager and compare "find {} by id={}" log records with sql query log records to determine whether an entity has been obtained from cache or db.

Regards,
Dmitry