diff --git a/guacamole/src/main/java/org/apache/guacamole/GuacamoleServletContainerInitializer.java b/guacamole/src/main/java/org/apache/guacamole/GuacamoleServletContainerInitializer.java new file mode 100644 index 000000000..afdbb6785 --- /dev/null +++ b/guacamole/src/main/java/org/apache/guacamole/GuacamoleServletContainerInitializer.java @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole; + +import java.util.Set; +import javax.servlet.ServletContainerInitializer; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import org.apache.guacamole.log.GuacamoleLogbackServiceProvider; +import org.slf4j.LoggerFactory; +import org.slf4j.helpers.Reporter; + +/** + * ServletContainerInitializer which forces the SLF4J service provider to be + * Guacamole's built-in logging system. This is necessary as Logback also + * includes an SLF4J service provider, and there is no guarantee which provider + * will be chosen by SLF4J in the case that multiple are present. + *
+ * SLF4J uses a "slf4j.provider" system property to allow a specific provider
+ * to be chosen, which this initializer sets automatically.
+ */
+public class GuacamoleServletContainerInitializer implements ServletContainerInitializer {
+
+ @Override
+ public void onStartup(Set