Skip to content

Commit

Permalink
added LogbackConfigHandler back into EmissaryServer
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-mlb committed Sep 1, 2023
1 parent b3aae2f commit ae221fb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@
<dep.junit-jupiter.version>5.8.2</dep.junit-jupiter.version>
<!-- junit-vintage, hamcrest and jersey disagree, but this works for everyone -->
<dep.junit.version>4.13.2</dep.junit.version>
<dep.logback.version>1.2.11</dep.logback.version>
<dep.logback.version>1.4.11</dep.logback.version>
<!-- seems to have an impact with java 11 integration, update with caution -->
<dep.maven-surefire-plugin.version>3.1.0</dep.maven-surefire-plugin.version>
<dep.mockito.version>5.4.0</dep.mockito.version>
<dep.picocli.version>4.7.4</dep.picocli.version>
<dep.slf4j.version>1.7.36</dep.slf4j.version>
<dep.slf4j.version>2.0.7</dep.slf4j.version>
<dep.spullara.mustache.compiler.version>0.9.10</dep.spullara.mustache.compiler.version>
<dep.spymemcached.version>2.12.3</dep.spymemcached.version>
<dep.versions.maven.plugin.version>2.14.2</dep.versions.maven.plugin.version>
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/emissary/server/EmissaryServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit ae221fb

Please sign in to comment.