Logging & Monitoring
Transformation of raw logs into actionable insights. Learn how to secure sensitive data, group outputs, and create professional build summaries.
Interactive Log Dashboard
Grouping
Collapse verbose steps into clean folders to keep long workflow logs readable.
Masking
Force GitHub to redact secrets like passwords or keys with '***' automatically.
Annotations
Create red/yellow/blue UI banners for errors, warnings, and info notices.
Mastering Log Commands
How to use workflow commands and job controls effectively.
Markdown Summaries
Writing to $GITHUB_STEP_SUMMARY creates a dedicated tab on the GitHub Actions page. Perfect for test reports, build tables, and final tallies.
Artifact Persistence
Artifacts are uploaded files (like server logs or build binaries) that persist long after the runner is destroyed. Use 'if: always()' to ensure they upload on failure.
Failure Notification Chains
By using 'if: failure()', you can trigger a secondary job that sends a Slack/Discord notification or opens an issue ONLY when the main job fails.
Full Workflow Reference
Copy this template to implement professional logging today.
# Learn - Logging and Monitoring
name: Learn - Logging and Monitoring
on:
workflow_dispatch:
push:
branches: [master]
jobs:
logging-examples:
name: "Logging Techniques"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# 1. Grouping logs
- name: "Technique 1 â Grouped logs"
run: |
echo "::group::đĻ Installing packages"
echo "Installing express..."
echo "All packages installed!"
echo "::endgroup::"
# 2. Notices, Warnings and Errors
- name: "Technique 2 â Coloured annotations"
run: |
echo "::notice::âšī¸ This is an info notice"
echo "::warning::â ī¸ This is a warning"
echo "::error::â This is an error annotation"
# 3. Masking secrets
- name: "Technique 3 â Masking secrets"
run: |
MY_SECRET="super-secret-password-123"
echo "::add-mask::$MY_SECRET"
echo "Secret is: $MY_SECRET"
# 4. Creating a Summary
- name: "Technique 4 â Step summary"
run: |
echo "## â
Build Report" >> $GITHUB_STEP_SUMMARY
echo "| Check | Result |" >> $GITHUB_STEP_SUMMARY
echo "|-------|--------|" >> $GITHUB_STEP_SUMMARY
echo "| Build | â
Pass |" >> $GITHUB_STEP_SUMMARY
# 5. Saving Artifacts
- name: "Technique 5 â Upload logs"
uses: actions/upload-artifact@v4
if: always()
with:
name: app-logs
path: logs/
alert-on-failure:
name: "Alert â Notification on Failure"
runs-on: ubuntu-latest
needs: logging-examples
if: failure()
steps:
- name: "Print failure details"
run: echo "đ¨ The workflow FAILED!"