Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Liferay 7.3, how to change the log directory
We are deploying liferay image as docker image where currently the
default directory is "podname:/usr/local/liferay-ce-portal-7.3.5-ga6/logs"
And we have a mountpoint attached in our cluster so we
want to change the logs directory to "podname:/usr/local/mnt/logs/".
can anyone please suggest?
Steps to Change the Liferay Logs Directory
- Unzip the
files
log4j.dtd
andportal-log4j.xml
from[Liferay WAR]/WEB-INF/lib/portal-impl.jar
- Move
log4j.dtd
andportal-log4j.xml
to[Liferay WAR]/WEB-INF/classes/META-INF
- Rename
portal-log4j.xml
toportal-log4j-ext.xml
- 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.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™