Skip to content

fix: Restore original log level in dotty LogTest to prevent CI test failures#3997

Merged
xerial merged 2 commits intomainfrom
copilot/fix-3996
Jul 21, 2025
Merged

fix: Restore original log level in dotty LogTest to prevent CI test failures#3997
xerial merged 2 commits intomainfrom
copilot/fix-3996

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jul 21, 2025

Problem

CI was failing with the error "INFO didn't match with TRACE" in the LogTest.scala file. The issue was that the LogTest.run() method in airframe-dotty-test was calling Logger.setDefaultLogLevel(LogLevel.INFO) but never restoring the original log level, causing side effects that could impact other tests running in the same JVM.

Solution

Added a try-finally block to save and restore the original default log level, following the same pattern used in the regular LogTest in the airframe-log module:

def run: Unit = {
  // Save the original log level to restore it later
  val originalLogLevel = Logger.getDefaultLogLevel
  try {
    // ... existing test logic ...
    Logger.setDefaultLogLevel(LogLevel.INFO)
  } finally {
    // Restore the original log level to avoid affecting other tests
    Logger.setDefaultLogLevel(originalLogLevel)
  }
}

This ensures that the global log level state is properly restored after the test completes, preventing interference with other tests that might have assertions about the expected log level.

Testing

  • dottyTest/run executes successfully
  • logJVM/test passes all tests including "Test setting root log level"
  • ✅ Code formatting passes scalafmtAll check
  • ✅ Combined test scenarios pass without the previous CI failure

Fixes #3996.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] CI failure: LogTest.scala - "INFO didn't match with TRACE" error fix: Restore original log level in dotty LogTest to prevent CI test failures Jul 21, 2025
Copilot AI requested a review from xerial July 21, 2025 21:07
@xerial xerial marked this pull request as ready for review July 21, 2025 21:34
@xerial xerial merged commit 570bd20 into main Jul 21, 2025
20 checks passed
@xerial xerial deleted the copilot/fix-3996 branch July 21, 2025 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI failure: LogTest.scala - "INFO didn't match with TRACE" error

2 participants