Changing the Liferay Logs Directory

This article documents how to change the Liferay logs directory from the default [LIFERAY_HOME]/logs to another desired path. 


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="">

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

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

    <priority value="INFO" />
    <appender-ref ref="FILE" />

In the param tag that contains: 


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


Additional Information

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

0 人中有 0 人觉得有帮助