Liferay DXP 2026.Q4    |    Release Webinar: 18 November 2026    |    Replay coming soon! 

Blogs

How to log ehcache cache events in Liferay 7.1

Tim Telcik
Tim Telcik
Lecture une minute

Overview

This article outlines how to configure EHCache cache event logging in Liferay 7.1.

Scenario

We want to log and monitor EHCache cache events in a clustered environment.

This is helpful when monitoring cache replication of data across nodes in a cluster to ensure caches on slave nodes are updated with cache data from the master node.

We can monitor ehcache portal cache events by using the Liferay 7.1 PortalCacheCacheEventListener  with logging configuration for one or many caches.

The PortalCacheCacheEventListener implements an EHCache Cache Event Listener and logs cache events with logging level DEBUG, hence we must enable DEBUG level logging.

Configuration

Configure ehcache cache event logging for all caches

To log all cache events for all caches, add or update the parent portal logger namespace for PortalCacheCacheEventListener.

e.g.

com.liferay.portal.cache.ehcache.internal.event.PortalCacheCacheEventListener = ALL
 

Configure ehcache event logging for a specific cache

To log all cache events for an individual cache, use the following logger name format:

com.liferay.portal.cache.ehcache.internal.event.PortalCacheCacheEventListener.EHCACHE_NAME

where EHCACHE_NAME is the fully-qualified name of your cache.

For example, I want to log all cache events for a cache named "net.mitnet.demo.service.impl.MyServiceImpl".

The ehcache definition for the cache could be similar to the following snippet:

e.g.

<cache
    eternal="false"
    maxElementsInMemory="100"
    name="net.mitnet.demo.service.impl.MyServiceImpl"
    overflowToDisk="false"
    timeToIdleSeconds="600"
/>

The cache logger name will be as follows:

com.liferay.portal.cache.ehcache.internal.event.PortalCacheCacheEventListener.net.mitnet.demo.service.impl.MyServiceImpl

Hence, the portal logger definition will be as follows:

com.liferay.portal.cache.ehcache.internal.event.PortalCacheCacheEventListener.net.mitnet.demo.service.impl.MyServiceImpl = DEBUG

Commentaires sur la page

Related Assets...

More Blog Entries...

Himanshu Chauhan
novembre 20, 2026
Tony Lim
novembre 19, 2026