From ae221fb61c6b329505aaefe71b1f425dcd5f4eba Mon Sep 17 00:00:00 2001 From: dev-mlb <19797865+dev-mlb@users.noreply.github.com> Date: Fri, 1 Sep 2023 14:55:09 -0400 Subject: [PATCH] added LogbackConfigHandler back into EmissaryServer --- pom.xml | 4 ++-- src/main/java/emissary/server/EmissaryServer.java | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index a8d4f892b2..f5e569cee9 100644 --- a/pom.xml +++ b/pom.xml @@ -73,12 +73,12 @@ 5.8.2 4.13.2 - 1.2.11 + 1.4.11 3.1.0 5.4.0 4.7.4 - 1.7.36 + 2.0.7 0.9.10 2.12.3 2.14.2 diff --git a/src/main/java/emissary/server/EmissaryServer.java b/src/main/java/emissary/server/EmissaryServer.java index abf7123318..a04aedf1ee 100644 --- a/src/main/java/emissary/server/EmissaryServer.java +++ b/src/main/java/emissary/server/EmissaryServer.java @@ -22,6 +22,7 @@ import emissary.server.mvc.ThreadDumpAction.ThreadDumpInfo; import emissary.spi.SPILoader; +import ch.qos.logback.classic.ViewStatusMessagesServlet; import com.google.common.annotations.VisibleForTesting; import org.apache.hc.client5.http.classic.methods.HttpGet; import org.eclipse.jetty.http.HttpVersion; @@ -131,6 +132,8 @@ public Server startServer() { // TODO: rework this, no need for it be set with a context path but if this // is left out, it matches / and nothing works correctly emissaryHandler.setContextPath("/idontreallyservecontentnowdoi"); + ContextHandler lbConfigHandler = buildLogbackConfigHandler(); + lbConfigHandler.setContextPath("/lbConfig"); ContextHandler apiHandler = buildApiHandler(); apiHandler.setContextPath("/api"); ContextHandler mvcHandler = buildMVCHandler(); @@ -145,6 +148,7 @@ public Server startServer() { // secure some of the contexts final HandlerList securedHandlers = new HandlerList(); + securedHandlers.addHandler(lbConfigHandler); securedHandlers.addHandler(apiHandler); securedHandlers.addHandler(mvcHandler); securedHandlers.addHandler(staticHandler); @@ -640,6 +644,14 @@ private ContextHandler buildEmissaryHandler() throws EmissaryException { return emissaryHolderContext; } + private ContextHandler buildLogbackConfigHandler() { + ServletHolder lbHolder = new ServletHolder("logback-config-holder", ViewStatusMessagesServlet.class); + ServletContextHandler lbHolderContext = new ServletContextHandler(ServletContextHandler.SESSIONS); + lbHolderContext.addServlet(lbHolder, "/*"); + + return lbHolderContext; + } + @VisibleForTesting protected Server configureServer() throws IOException, GeneralSecurityException { int maxThreads = 250;