-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable warnings from Narayana and print our own warning
This to make sure we have a consistent experience between JVM and native modes. (cherry picked from commit 4f372d0)
- Loading branch information
Showing
3 changed files
with
80 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...ta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/graal/DisableLoggingFeature.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package io.quarkus.narayana.jta.runtime.graal; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.logging.Level; | ||
import java.util.logging.Logger; | ||
|
||
import org.graalvm.nativeimage.hosted.Feature; | ||
|
||
/** | ||
* Disables logging during the analysis phase | ||
*/ | ||
public class DisableLoggingFeature implements Feature { | ||
|
||
private static final String[] CATEGORIES = { | ||
"com.arjuna.ats.arjuna" | ||
}; | ||
|
||
private final Map<String, Level> categoryMap = new HashMap<>(CATEGORIES.length); | ||
|
||
@Override | ||
public void beforeAnalysis(BeforeAnalysisAccess access) { | ||
for (String category : CATEGORIES) { | ||
Logger logger = Logger.getLogger(category); | ||
categoryMap.put(category, logger.getLevel()); | ||
logger.setLevel(Level.SEVERE); | ||
} | ||
} | ||
|
||
@Override | ||
public void afterAnalysis(AfterAnalysisAccess access) { | ||
for (String category : CATEGORIES) { | ||
Level level = categoryMap.remove(category); | ||
if (level != null) { | ||
Logger logger = Logger.getLogger(category); | ||
logger.setLevel(level); | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return "Disables INFO and WARN logging during the analysis phase"; | ||
} | ||
} |