Issue
- In {Liferay_Home}/log folder, we can see two different files as below:
liferay.2019-08-25.log
liferay.2019-08-25.xml
We only want "liferay.2019-08-25.log" file and need to disable "xml" file.
Environment
- Liferay DXP 7.0
- Liferay DXP 7.1
- Liferay DXP 7.2
- Liferay DXP 7.3
- Liferay DXP 7.4
Resolution
Liferay DXP 7.0 to 7.3:
- Extract portal-log4j.xml from /ROOT/WEB-INF/lib/portal-impl.jar/META-INF
- Copy the file to /ROOT/WEB-INF/classes/META-INF/
- Comment out or remove the line at the bottom of the file:
<appender-ref ref="XML_FILE" />
- Restart server
Liferay DXP 7.4:
- Extract portal-log4j.xml from /ROOT/WEB-INF/shielded-container-lib/portal-impl.jar/META-INF
- Copy the file to /ROOT/WEB-INF/classes/META-INF/
- Rename de file to portal-log4j-ext.xml
- In this case it is not enough to remove the appender because if there is no property, the one that exists in the portal-loj4j.xml file will be used. So in addition to removing that appender, you have to override it with a null value so it doesn't get created. Add this line to de appenders section at the top of the file:
<Null name="XML_FILE" />
- Comment out or remove the following section
<Appender filePattern="@liferay.home@/logs/liferay.%d{yyyy-MM-dd}.xml" ignoreExceptions="false" name="XML_FILE" type="RollingFile">
<Log4j1XmlLayout locationInfo="true" />
<TimeBasedTriggeringPolicy />
<DirectWriteRolloverStrategy />
</Appender> - Comment out or remove the line at the bottom of the file:
<appender-ref ref="XML_FILE" />
- Restart the server.