Legacy Knowledge Base
Published Sep. 10, 2025

Changing the Liferay Logs Directory

Written By

Liferay Support

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.
This article documents how to change the Liferay logs directory from the default [LIFERAY_HOME]/logs to another desired path. 

Resolution

Steps to Change the Liferay Logs Directory

  1. Unzip the files log4j.dtd and portal-log4j.xml from [Liferay WAR]/WEB-INF/lib/portal-impl.jar
  2. Move log4j.dtd and portal-log4j.xml to [Liferay WAR]/WEB-INF/classes/META-INF
  3. Rename portal-log4j.xml to portal-log4j-ext.xml
  4. Edit portal-log4j-ext.xml and delete all the category tags and keep only the needed tags, like the example below:
<?xml version="1.0"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

  <appender name="FILE" class="org.apache.log4j.rolling.RollingFileAppender">
    <rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
      <param name="FileNamePattern" value="@liferay.home@/logs/liferay@spi.id@.%d{yyyy-MM-dd}.log" />
    </rollingPolicy>

    <layout class="org.apache.log4j.EnhancedPatternLayout">
      <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%t][%c{1}:%L] %m%n" />
    </layout>
  </appender>

  <root>
    <priority value="INFO" />
    <appender-ref ref="FILE" />
  </root>
</log4j:configuration>

In the param tag that contains: 

value="$liferay.home/logs/liferay@spi.id@.%d{yyyy-MM-dd}.log"

You must change $liferay.home/logs/liferay to the path where you want the logs to be created. See the following example:

value="/var/logs/liferay@spi.id@.%d{yyyy-MM-dd}.log"

Additional Information

The [LIFERAY_HOME]/logs files will still be created but will be empty files and not contain any data. 

Did this article resolve your issue ?

Legacy Knowledge Base