jvz commented on code in PR #1964:
URL: https://github.com/apache/logging-log4j2/pull/1964#discussion_r1402775588


##########
log4j-api/src/main/java/org/apache/logging/log4j/util/Constants.java:
##########
@@ -120,4 +115,44 @@ static int getMajorVersion(final String version) {
             return 0;
         }
     }
+
+    /**
+     * {@code true} if we think we are running in a web container, based on 
the boolean value of system property
+     * "log4j2.is.webapp", or (if this system property is not set) whether the 
 {@code javax.servlet.Servlet} class
+     * is present in the classpath.
+     */
+    public static boolean isWebApp() {
+        return WEB_APP.getAsBoolean();
+    }
+
+    @InternalApi
+    public static void setWebApp(final boolean webApp) {
+        WEB_APP.setAsBoolean(webApp);
+    }
+
+    @InternalApi
+    public static void resetWebApp() {
+        WEB_APP.reset();
+    }

Review Comment:
   We can use `@RestrictedApi` from error prone as that's something the 
compiler can enforce (at least when using error prone). But right, this whole 
concept of these two values shouldn't really be public as it's an internal 
detail used by some tests. Should think of another way to do this.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to