diff options
author | Leif Åstrand <leif@vaadin.com> | 2013-08-01 12:18:05 +0300 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2013-08-01 12:18:05 +0300 |
commit | ea148c80ea6e12860a646bfaf60a0b712ebc8958 (patch) | |
tree | 62b7815742ee93f0fa29911a8b8111189bb6d9a7 /client | |
parent | 17bb700e551aabcacde52528e9abd5c4b7481ffb (diff) | |
download | vaadin-framework-ea148c80ea6e12860a646bfaf60a0b712ebc8958.tar.gz vaadin-framework-ea148c80ea6e12860a646bfaf60a0b712ebc8958.zip |
Disable all logging if production mode is enabled (#12299)
Change-Id: Ia6b05c0ebaf1f0bb4fb675392cc8f634cab8e494
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ApplicationConfiguration.java | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/client/src/com/vaadin/client/ApplicationConfiguration.java b/client/src/com/vaadin/client/ApplicationConfiguration.java index ecd957194d..da8f521799 100644 --- a/client/src/com/vaadin/client/ApplicationConfiguration.java +++ b/client/src/com/vaadin/client/ApplicationConfiguration.java @@ -610,6 +610,11 @@ public class ApplicationConfiguration implements EntryPoint { getLogger().log(Level.SEVERE, e.getMessage(), e); } }); + + if (isProductionMode()) { + // Disable all logging if in production mode + Logger.getLogger("").setLevel(Level.OFF); + } } Profiler.leave("ApplicationConfiguration.onModuleLoad"); @@ -649,7 +654,11 @@ public class ApplicationConfiguration implements EntryPoint { /** * Checks if client side is in debug mode. Practically this is invoked by - * adding ?debug parameter to URI. + * adding ?debug parameter to URI. Please note that debug mode is always + * disabled if production mode is enabled, but disabling production mode + * does not automatically enable debug mode. + * + * @see #isProductionMode() * * @return true if client side is currently been debugged */ @@ -658,6 +667,19 @@ public class ApplicationConfiguration implements EntryPoint { && Window.Location.getParameter("debug") != null; } + /** + * Checks if production mode is enabled. When production mode is enabled, + * client-side logging is disabled. There may also be other performance + * optimizations. + * + * @since 7.1.2 + * @return <code>true</code> if production mode is enabled; otherwise + * <code>false</code>. + */ + public static boolean isProductionMode() { + return !isDebugAvailable(); + } + private native static boolean isDebugAvailable() /*-{ if($wnd.vaadin.debug) { |