Search code examples
debugginglogginggithub-actions

Github actions, rerun maven with log4j on debug?


I have a GitHub-Actions job which generates a huge amount of logging when running test and log-level=debug.

I want to run this test with log-level=WARN, and if it failes, I'd like to re-run the job (or the failed tests) with log-level=DEBUG, preferably by checking the debug-logging checkbox

enter image description here

How do I set this up?


Solution

  • You can use manual workflow triggering with inputs. Try this workflow:

    name: Rerun with Debug
    
    on:
      workflow_dispatch:
        inputs:
          logLevel:
            type: choice
            description: Chose log level
            options:
              - info
              - debug
    
    jobs:
      tests:
        runs-on: ubuntu-latest
        steps:
          - run: echo ${{ inputs.logLevel }}
    

    Click on the workflow name in the Workflow panel on the left. Then click "Run workflow" button on the right. Choose the logging level and run