Uploaded image for project: 'SR for Confluence - Development'
  1. SR for Confluence - Development
  2. SRCONF-508

Unable to get consistent log output in the Logs tab of the Script Console screen

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Done
    • High
    • Resolution: Done
    • 5.4.26
    • 5.6.7
    • None
    • SR Squad 118, SR Squad 120, SR Squad 121, SR4C Squad 122, SR4C Squad 123
    • 1
    • 7.3

    Description

      Versions tested

      Confluence 6.10.2
      ScriptRunner 5.4.17, 5.4.26

      Issue

      There is no log output on the Logs tab of the Script Console window.

      Steps to Reproduce

      Run the following script in the Script Console:

      import org.apache.log4j.Logger
      import org.apache.log4j.Level
      
      def log = Logger.getLogger("Test")
      log.setLevel(Level.ALL)
      
      log.info("test Log")

      Expected Result

      Log output appears in the Logs tab.

      Actual Result

      Unexpected output, or no output appears in the Logs tab.

      Investigation

      During troubleshooting, the first time the above script is run, the following appeared:

      On subsequent runs of the same script, there is no output in the Logs tab:

      Changing line 5 to 'log.setLevel(Level.DEBUG)' then running the script produces the following output on the first run:

      On subsequent runs, there is once again no output.

      Note that there is expected output in the log files themselves:

      Only the Logs tab of the Script Console window is lacking the output.

      Workaround

      A workaround is to specify the log level directly in the log4j.properties file, located in <CONFLUENCE-INSTALL>/confluence/WEB-INF/classes. This results in the correct, actual log output appearing in the Logs tab of the Script Console window as expected.

      Relevant Documentation

      ScriptRunner docs - Advanced Logging
      Atlassian docs - Configuring Logging

      Acceptance criteria

      Our functional tests for the Script Console should also check the log output.

      Attachments

        Activity

          People

            jdavis Jenna Davis
            tgough Tony Gough
            Votes:
            2 Vote for this issue
            Watchers:
            13 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: