We recently added dynamic logging to our gwt web application.
In order to achieve this we added a little javascript function to our webapp.gwt.xml file, which looks for the "?logging" parameter in the URL an returns either true or false.
<define-property name="dynamicLogging" values="TRUE, FALSE"/>
<property-provider name="dynamicLogging">
<![CDATA[
var logging = false;
var strHref = window.location.href;
if (strHref.indexOf("?") > -1) {
var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
var aParam = strQueryString.split("&").toString();
logging = aParam.indexOf("logging") > -1;
}
if (logging) {
return 'TRUE'
} else {
return 'FALSE'
}
]]>
</property-provider>
This function is used to activate the gwt.logging and setting the logLevel to "FINEST".
<set-property name="gwt.logging.enabled" value="TRUE">
<when-property-is name="dynamicLogging" value="TRUE"/>
</set-property>
<set-property name="gwt.logging.logLevel" value="FINEST">
<when-property-is name="dynamicLogging" value="TRUE"/>
</set-property>
In our configuration for the gwt-maven-plugin we set the disableClassMetadata property to true for generating smaller permutation files. We talk about ~90kb per permutation.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<configuration>
<style>OBF</style>
<draftCompile>false</draftCompile>
<disableClassMetadata>true</disableClassMetadata>
<disableCastChecking>true</disableCastChecking>
<disableAggressiveOptimization>false</disableAggressiveOptimization>
<optimizationLevel>9</optimizationLevel>
<enableClosureCompiler>true</enableClosureCompiler>
<logLevel>INFO</logLevel>
</configuration>
</plugin>
But this disables our dynamic logging! The only thing we found out so far is, that the JavaScript function works just fine in both configurations. (disableClassMetadata= true and false)
The description on the Maven GWT Plugin website gives no reasonable explanation why this could effect any code in the webapp.gwt.xml file.
Thanks for your help!