From e2dd3ac8bc04bd539e2e8daf9f4ba45de93dc8b9 Mon Sep 17 00:00:00 2001 From: Andy Seaborne Date: Sat, 14 Dec 2024 16:32:16 +0000 Subject: [PATCH] Tidy up Fuseki logging --- .../apache-jena-fuseki/log4j2.properties | 6 ++--- .../java/org/apache/jena/fuseki/Fuseki.java | 25 +++++++++++-------- .../jena/fuseki/system/FusekiLogging.java | 5 ++-- .../apache/jena/fuseki/main/FusekiServer.java | 2 +- .../src/main/webapp/log4j2.properties | 7 ++++-- 5 files changed, 26 insertions(+), 19 deletions(-) diff --git a/jena-fuseki2/apache-jena-fuseki/log4j2.properties b/jena-fuseki2/apache-jena-fuseki/log4j2.properties index 81dac1df7b4..c261a1b8778 100644 --- a/jena-fuseki2/apache-jena-fuseki/log4j2.properties +++ b/jena-fuseki2/apache-jena-fuseki/log4j2.properties @@ -1,6 +1,6 @@ ## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0 status = error -name = PropertiesConfig +name = FusekiLogging filters = threshold filter.threshold.type = ThresholdFilter @@ -11,7 +11,7 @@ appender.console.name = OUT appender.console.target = SYSTEM_ERR appender.console.layout.type = PatternLayout appender.console.layout.pattern = %d{HH:mm:ss} %-5p %-15c{1} :: %m%n -#appender.console.layout.pattern = [%d{yyyy-MM-dd HH:mm:ss}] %-5p %-15c{1} :: %m%n +## appender.console.layout.pattern = [%d{yyyy-MM-dd HH:mm:ss}] %-5p %-15c{1} :: %m%n rootLogger.level = INFO rootLogger.appenderRef.stdout.ref = OUT @@ -49,7 +49,7 @@ logger.jetty.level = WARN logger.shiro.name = org.apache.shiro logger.shiro.level = WARN -# Hide bug with Shiro 1.5.0+, 2.0.0 +# Hide issue with Shiro 1.5.0+, 2.0.0 logger.shiro-realm.name = org.apache.shiro.realm.text.IniRealm logger.shiro-realm.level = ERROR diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/Fuseki.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/Fuseki.java index b58e75a135c..e51b47bdc86 100644 --- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/Fuseki.java +++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/Fuseki.java @@ -132,14 +132,16 @@ public static void initConsts() {} /** Instance of log for operations. */ public static final Logger adminLog = LoggerFactory.getLogger(adminLogName); - /** Admin log file for operations. */ - public static final String builderLogName = PATH + ".Builder"; - - /** Instance of log for operations. */ - public static final Logger builderLog = LoggerFactory.getLogger(builderLogName); - - /** Validation log file for operations. */ - public static final String validationLogName = PATH + ".Validate"; + // Unused +// /** Admin log file for operations. */ +// public static final String builderLogName = PATH + ".Builder"; +// +// /** Instance of log for operations. */ +// public static final Logger builderLog = LoggerFactory.getLogger(builderLogName); +// +// // Now validation uses action logger. +// /** Validation log file for operations. */ +// public static final String validationLogName = PATH + ".Validate"; /** Instance of log for validation. */ public static final Logger validationLog = LoggerFactory.getLogger(adminLogName); @@ -150,10 +152,13 @@ public static void initConsts() {} /** Instance of log for general server messages. */ public static final Logger serverLog = LoggerFactory.getLogger(serverLogName); - /** Logger used for the servletContent.log operations (if settable -- depends on environment) */ + /** + * Logger used for the servletContent.log operations (if settable -- depends on environment). + * This is both the display name of the servlet context and the logger name. + */ public static final String servletRequestLogName = PATH + ".Servlet"; - /** Actual log file for config server messages. */ + /** log for config server messages. */ public static final String configLogName = PATH + ".Config"; /** Instance of log for config server messages. */ diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/system/FusekiLogging.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/system/FusekiLogging.java index b1e8cc90982..a6356b057e5 100644 --- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/system/FusekiLogging.java +++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/system/FusekiLogging.java @@ -279,15 +279,14 @@ private static String log4j2setupFallback() { logger.jetty.name = org.eclipse.jetty logger.jetty.level = WARN - logger.apache-http.name = org.apache.http - logger.apache-http.level = WARN logger.shiro.name = org.apache.shiro logger.shiro.level = WARN - # Hide bug in Shiro 1.5.0 + # Hide issue with Shiro 1.5.0+, 2.0.0 logger.shiro-realm.name = org.apache.shiro.realm.text.IniRealm logger.shiro-realm.level = ERROR + ## (NCSA) Common Log Format request log # This goes out in NCSA format appender.plain.type = Console appender.plain.name = PLAIN diff --git a/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/FusekiServer.java b/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/FusekiServer.java index 261a10cda7e..313540ee0ea 100644 --- a/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/FusekiServer.java +++ b/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/FusekiServer.java @@ -1705,7 +1705,7 @@ else if ( !contextPath.startsWith("/") ) contextPath = "/" + contextPath; ServletContextHandler context = new ServletContextHandler(); context.setDisplayName(Fuseki.servletRequestLogName); - // Also set on the server which handles request that don't dispatch. + // Also set on the server which handles requests that don't Fuseki-dispatch. context.setErrorHandler(errorHandler); context.setContextPath(contextPath); // SPARQL Update by HTML - not the best way but. diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/webapp/log4j2.properties b/jena-fuseki2/jena-fuseki-webapp/src/main/webapp/log4j2.properties index 0524e408b04..029030168d2 100644 --- a/jena-fuseki2/jena-fuseki-webapp/src/main/webapp/log4j2.properties +++ b/jena-fuseki2/jena-fuseki-webapp/src/main/webapp/log4j2.properties @@ -1,14 +1,17 @@ ## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0 -## Plain output to stdout status = error name = FusekiLoggingWebapp +filters = threshold +filter.threshold.type = ThresholdFilter +filter.threshold.level = ALL appender.console.type = Console appender.console.name = OUT appender.console.target = SYSTEM_OUT appender.console.layout.type = PatternLayout -appender.console.layout.pattern = [%d{yyyy-MM-dd HH:mm:ss}] %-10c{1} %-5p %m%n +## appender.console.layout.pattern = %d{HH:mm:ss} %-5p %-15c{1} :: %m%n +appender.console.layout.pattern = [%d{yyyy-MM-dd HH:mm:ss}] %-5p %-15c{1} :: %m%n rootLogger.level = INFO rootLogger.appenderRef.stdout.ref = OUT