Uploaded image for project: 'PUBLIC - Liferay Documentation'
  1. PUBLIC - Liferay Documentation
  2. LRDOCS-3628

As a developer I'd like to know how to customize the log4j settings for the portal

    Details

      Description

      Currently if you search google for "liferay log4j" you get an ancient result pointing here: https://web.liferay.com/community/wiki/-/wiki/Main/How+to+configure+the+logs+in+Liferay. That content is out-of-date and although technically you can still use it, either by manually placing a portal-log4j-ext.xml file in the right location or by using ext, there's a better way.

      DXP introduced the ability to add a src/main/resources/META-INF/module-log4j.xml file to any module using the extender pattern. For example, adding this module-log4j.xml will crank up logging on the export/import-related classes. This can be hugely useful when monitoring or diagnosing problems with publishing or LAR export/imports.

      <?xml version="1.0"?>
      <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
      
      <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
          <category name="com.liferay.exportimport">
              <priority value="DEBUG" />
          </category>
      </log4j:configuration>
      

      A different way would be to add:

      ${liferay.home}/osgi/log4j/{symbolicNameOfBundle}-log4j-ext.xml
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Packages

                  Version Package
                  7.0.x