Browse Source

Disable all logging if production mode is enabled (#12299)

Change-Id: Ia6b05c0ebaf1f0bb4fb675392cc8f634cab8e494
tags/7.1.2
Leif Åstrand 11 years ago
parent
commit
ea148c80ea
1 changed files with 23 additions and 1 deletions
  1. 23
    1
      client/src/com/vaadin/client/ApplicationConfiguration.java

+ 23
- 1
client/src/com/vaadin/client/ApplicationConfiguration.java View File

getLogger().log(Level.SEVERE, e.getMessage(), e); 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"); Profiler.leave("ApplicationConfiguration.onModuleLoad");




/** /**
* Checks if client side is in debug mode. Practically this is invoked by * 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 * @return true if client side is currently been debugged
*/ */
&& Window.Location.getParameter("debug") != null; && 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() private native static boolean isDebugAvailable()
/*-{ /*-{
if($wnd.vaadin.debug) { if($wnd.vaadin.debug) {

Loading…
Cancel
Save