Skip to content

Conversation

@jwren
Copy link
Member

@jwren jwren commented Dec 9, 2025

The stack trace is effectively just the log message being excessively loud because of how IntelliJ handles exceptions passed to the logger.

This is a follow up on #8631

@jwren jwren requested a review from helin24 December 9, 2025 05:13
// This can happen if the logger is wrapped by a 3rd party plugin that doesn't correctly implement setLevel.
// See https://github.com/flutter/flutter-intellij/issues/8631
Logger.getInstance(PluginLogger.class).warn("Failed to set log level", e);
// Use an empty catch block to suppress the exception.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we warn with just the message and no exception?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't tried that yet. The goal here is to simply catch and log it without reporting it in the (!) on startup.

@jwren jwren force-pushed the 2025_3_JmixLogger_bug_2 branch from 7685a5d to fd4984b Compare December 9, 2025 06:37
try {
rootLoggerInstance.setLevel(FlutterSettings.getInstance().isVerboseLogging() ? LogLevel.ALL : LogLevel.INFO);
if (isSetLevelOverridden(rootLoggerInstance)) {
rootLoggerInstance.setLevel(FlutterSettings.getInstance().isVerboseLogging() ? LogLevel.ALL : LogLevel.INFO);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you try this and get rid of the reflection?

try {
  rootLoggerInstance.setLevel(FlutterSettings.getInstance().isVerboseLogging() ? LogLevel.ALL : LogLevel.INFO);
} catch (Throwable _) {
  // Ignore
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reflection is removed.

…lutter#8631)

Suppressed IDE stack trace for setLevel failure using reflection check, and optimized with caching to avoid performance overhead.
@jwren jwren force-pushed the 2025_3_JmixLogger_bug_2 branch from fd4984b to f4560fe Compare December 10, 2025 23:00
@jwren jwren merged commit d5ef4c9 into flutter:main Dec 10, 2025
6 of 7 checks passed
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.

3 participants