diff --git a/debugger/src/main/java/org/apache/pdfbox/debugger/ui/DebugLogAppender.java b/debugger/src/main/java/org/apache/pdfbox/debugger/ui/DebugLogAppender.java index 6c137cf5003..32574fa32e7 100644 --- a/debugger/src/main/java/org/apache/pdfbox/debugger/ui/DebugLogAppender.java +++ b/debugger/src/main/java/org/apache/pdfbox/debugger/ui/DebugLogAppender.java @@ -23,9 +23,14 @@ import org.apache.logging.log4j.core.config.Configurator; import org.apache.logging.log4j.core.config.builder.api.*; import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration; +import org.apache.logging.log4j.core.config.plugins.Plugin; +import org.apache.logging.log4j.core.config.plugins.PluginAttribute; +import org.apache.logging.log4j.core.config.plugins.PluginElement; +import org.apache.logging.log4j.core.config.plugins.PluginFactory; import java.io.Serializable; +@Plugin(name = "DebugLogAppender", category = "Core", elementType = "appender", printObject = true) public class DebugLogAppender extends AbstractAppender { protected DebugLogAppender(String name, Filter filter, Layout layout, @@ -34,6 +39,14 @@ protected DebugLogAppender(String name, Filter filter, Layout layout, + @PluginAttribute("ignoreExceptions") boolean ignoreExceptions) { + return new DebugLogAppender(name, filter, layout, ignoreExceptions); + } + @Override public void append(LogEvent event) { @@ -53,7 +66,7 @@ public static void setupCustomLogger() "%d [%t] %-5level: %msg%n%throwable")); builder.add(appenderBuilder); - appenderBuilder = builder.newAppender("Custom", "org.package.CustomAppender"); + appenderBuilder = builder.newAppender("Custom", "DebugLogAppender"); appenderBuilder.add(builder.newLayout("PatternLayout").addAttribute("pattern", "%d [%t] %-5level: %msg%n%throwable")); builder.add(appenderBuilder); diff --git a/debugger/src/main/java/org/apache/pdfbox/debugger/ui/LogDialog.java b/debugger/src/main/java/org/apache/pdfbox/debugger/ui/LogDialog.java index 70a87751ce6..f261cbd8d65 100644 --- a/debugger/src/main/java/org/apache/pdfbox/debugger/ui/LogDialog.java +++ b/debugger/src/main/java/org/apache/pdfbox/debugger/ui/LogDialog.java @@ -79,37 +79,37 @@ public void log(String name, String level, Object o, Throwable throwable) SimpleAttributeSet levelStyle = new SimpleAttributeSet(); switch (level) { - case "fatal": + case "FATAL": levelText = "Fatal"; StyleConstants.setForeground(levelStyle, Color.WHITE); StyleConstants.setBackground(levelStyle, Color.BLACK); fatalCount++; break; - case "error": + case "ERROR": levelText = "Error"; StyleConstants.setForeground(levelStyle, new Color(0xFF291F)); StyleConstants.setBackground(levelStyle, new Color(0xFFF0F0)); errorCount++; break; - case "warn": + case "WARN": levelText = "Warning"; StyleConstants.setForeground(levelStyle, new Color(0x614201)); StyleConstants.setBackground(levelStyle, new Color(0xFFFCE5)); warnCount++; break; - case "info": + case "INFO": levelText = "Info"; StyleConstants.setForeground(levelStyle, new Color(0x203261)); StyleConstants.setBackground(levelStyle, new Color(0xE2E8FF)); otherCount++; break; - case "debug": + case "DEBUG": levelText = "Debug"; StyleConstants.setForeground(levelStyle, new Color(0x32612E)); StyleConstants.setBackground(levelStyle, new Color(0xF4FFEC)); otherCount++; break; - case "trace": + case "TRACE": levelText = "Trace"; StyleConstants.setForeground(levelStyle, new Color(0x64438D)); StyleConstants.setBackground(levelStyle, new Color(0xFEF3FF));