Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-155004

Add context thread information on upgrade logs for LXC to identify those lines

Details

    Description

      Motivation

      For LXC, it is needed to identify the log lines related to the database upgrades when the portal is started with the auto upgrade on startup property set to true. By identifying those lines they will be able to detect issues on new upgrade processes and send them to us in an early way.

      For identify those lines in the console, log4j provides the ThreadContext feature, which allows to add properties to the log lines. For adding those properties the next approach will be implemented:

      • Create a new log4j wrapper class to be used in Upgrade Processes. This wrapper will populate the ThreadContext with a constant value that will allow to identify the Upgrade Processes log messages.
      • In the Log4jLogFactoryImpl class, we will add a condition to check the class for which we are trying to obtain the log. If this class extends from BaseDBProcess (UpgradeProcess and VerifyProcess classes), or it is the DBUpgrader class, instead of creating a Log4jLogContextLogWrapper, it will create a new wrapper specific for the upgrade classes.

      Acceptance Criteria

      Environment

      Autoupgrade: Yes

      Testing Scenarios

      • NOTE: In order to test these scenarios you will need the xml file attached and add it in /bundles/tomcat-9.0.56/webapps/ROOT/WEB-INF/classes/META-INF.
      Acceptance Criteria
       
      Testing Scenarios
       
      Test Strategy
       
      Covered by backend test? (Yes/No)
       
        Given a database from a previous version (such as 7.3)
      And the xml is added to the portal
      And the property upgrade.log.context.enabled=true is added to the portal-ext.properties file
      When a portal is started using the database
      And the property upgrade.database.auto.run=true is added to the portal-ext.properties file
      Then log lines will be marked with upgradeLog=upgradeLog
      High Yes 
        Given a database from a previous version (such as 7.3)
      And the xml is added to the portal
      And the property upgrade.log.context.enabled=true is added to the portal-ext.properties file
      And the property upgrade.log.context.name=ExampleText is added to the portal-ext.properties file
      When a portal is started using the database
      And the property upgrade.database.auto.run=true is added to the portal-ext.properties file
      Then log lines will be marked with ExampleText=ExampleText
      Medium  No
        Given a database from a previous version (such as 7.3)
      And the xml is added to the portal
      And the property upgrade.log.context.enabled=true is not added to the portal-ext.properties file
      When a portal is started using the database
      And the property upgrade.database.auto.run=true is added to the portal-ext.properties file
      Then none of the log lines is marked with upgradeLog=upgradeLog
      High Yes 
        Given a database from a previous version (such as 7.3)
      And the xml is not added to the portal
      And the property upgrade.log.context.enabled=true is added to the portal-ext.properties file
      When a portal is started using the database
      And the property upgrade.database.auto.run=true is added to the portal-ext.properties file
      Then none of the log lines is marked with upgradeLog=upgradeLog
      High No 
        Given a database from a previous version (such as 7.3)
      And the xml is not added to the portal
      And the property upgrade.log.context.enabled=true is not added to the portal-ext.properties file
      When a portal is started using the database
      And the property upgrade.database.auto.run=true is added to the portal-ext.properties file
      Then none of the log lines is marked with upgradeLog=upgradeLog
      Medium No 

      Attachments

        Issue Links

          Activity

            People

              support-qa Support QA
              maria.muriel Maria Muriel
              Luis Ortiz Luis Ortiz
              Maria Muriel Maria Muriel
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Packages

                  Version Package
                  Master