Issue
- Log levels that have been adjusted through the Server Administration are reset after a server restart. I'd like the log levels adjustments to persist after restarts.
Environment
- DXP 7.0+
Resolution
-
Adjust log levels using a
portal-log4j-ext.xmlfile. Please note that this method works only for classes from the core portal implementationportal-impl. To override the default log level of a class in a specific OSGi module, please see https://help.liferay.com/hc/en-us/articles/360018168751-Adjusting-Module-Logging.- Find and open up
portal-impl.jar:- Path for 7.3 and before:
webapps/ROOT/WEB-INF/lib/ - Path for 7.4 and later:
webapps/ROOT/WEB-INF/shielded-container-lib/
- Path for 7.3 and before:
- Inside
portal-impl.jar, navigate to theMETA-INFfolder. - Copy the
portal-log4j.xmlfile towebapps/ROOT/WEB-INF/classes/META-INF. - Navigate to
webapps/ROOT/WEB-INF/classes/META-INF, and rename the copiedportal-log4j.xmlfile toportal-log4j-ext.xml. - Open up the file and modify the priority levels of the categories as desired. Note that Log4j2 is used from 7.4. For example, if you'd like to add
DEBUGlogs forcom.liferay.portal.events.LoginPreAction, change the category's priority level like the following:- 7.3 and before
<category name="com.liferay.portal.events.LoginPreAction"> <priority value="DEBUG" /> </category> - 7.4 and later
<Logger level="DEBUG" name="com.liferay.portal.events.LoginPreAction" />
- 7.3 and before
- Save changes made to the
portal-log4j-ext.xmlfile and start up Liferay.
- Find and open up