Why does SuperDevMode only provides LogLevel SEVERE? - java

I use GWT 2.7 and want to provide logging with Level INFO and WARNUNG in my app. In my gwt.xml file I have:
<inherits name="com.google.gwt.logging.Logging"/>
<set-property name="gwt.logging.logLevel" value="INFO"/>
It works perfect in Dev mode but in SuperDevMode I only get Log level SEVERE to be logged.
Why does SuperDevMode only provides LogLevel SEVERE?

I just checked one of my applications (which uses GXT) and there I see the log message:
I use this lines inside my module descriptor:
<!-- values are: severe, warning, info, config, fine, finer, finest -->
<set-property name="gwt.logging.logLevel" value="INFO"/>
<set-property name="gwt.logging.enabled" value="TRUE" />
<!-- Write messages to browser consoles and to the jvm and dev mode -->
<!-- Note that these are the defaults, so we don’t actually need to list them -->
<set-property name="gwt.logging.consoleHandler" value="ENABLED"/>
<set-property name="gwt.logging.developmentModeHandler" value="ENABLED"/>
<set-property name="gwt.logging.systemHandler" value="ENABLED"/>
<!-- Leave RPC logging disabled, as we aren’t setting that up in this example -->
<set-property name="gwt.logging.simpleRemoteHandler" value="DISABLED"/>
<!-- Ask GXT to log all internal details -->
<set-property name="gxt.logging.enabled" value="true"/>
and add this code to my presenter:
private static final Logger logger = logger.getLogger(ShellPresenter.class.getName());
logger.log(Level.INFO, "Starting module Hermes");
I don't spent time to find out which one of the configurations enables logging nor if it is related to GXT.
And some more informations:
groups.google.com/forum/#!topic/google-web-toolkit/BRZNt1_qEjg

To change log level in SDM, add this option to command line when running it:
-logLevel (ERROR|WARN|INFO|TRACE|DEBUG|SPAM|ALL)

Related

How to use Vaadin add-on with Spring Boot?

I'm using Vaadin 7.6.3 with Spring Boot. I'm trying to use the PopupButton add-on (but I don't think the issue is specific to the add-on).
I added the add-on as a dependency to gradle. This is the code for creating a PopupButton:
PopupButton btn = new PopupButton("Test Button");
btn.setContent(new Label("Test"));
layout.addComponent(btn);
Via the Vaadin plugin for Gradle I ran the task vaadinCompile which created the file src/main/resources/addon/client/ListaideWidgetset.gwt.xml and serveral files in src/main/webapp/VAADIN/gwt-unitCache and
src/main/webapp/VAADIN/widgetsets/addon.client.ListaideWidgetset. I also added #Widgetset("addon.client.ListaideWidgetset") to my UI. I confirmed that the widgetset is used via the client's ?debug mode.
Content of ListaideWidgetset.gwt.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Vaadin//DTD Vaadin 7//EN" "https://raw.github.com/vaadin/gwt/master/distro-source/core/src/gwt-module.dtd">
<!-- WS Compiler: manually edited -->
<module>
<inherits name="com.vaadin.DefaultWidgetSet" />
<set-configuration-property name="devModeRedirectEnabled" value="true" />
<set-property name="user.agent" value="ie8,ie9,gecko1_8,safari,ie10" />
<source path="client" />
<source path="shared" />
<collapse-all-properties />
<set-property name="compiler.useSymbolMaps" value="true" />
</module>
The problem is that on the client the button shows up as a standard button (no chevron) and doesn't open a popup when clicked.
Your widgetset does not contain the addon. See the the example:
<inherits name="org.vaadin.hene.popupbutton.widgetset.PopupbuttonWidgetset" />
Once added, recompile the widgetset, restart your application.
Usually the gradle plugin can handle this for you, but that feature can be disabled and or some other configuration error could prevent it. Hard to tell without the build.gradle...
edit
The gradle vaadin plugin seems not to be able to handle this addon properly. As a workaround disable the automatic management for widgetset, which prevents regeneration of the gwt.xml. See manageWidgetset in https://github.com/johndevs/gradle-vaadin-plugin/wiki/Tasks-and-configuration-DSL). E.g. add vaadinCompile.manageWidgetset = false in your vaadin{}-block.

How to specify root url tomcat?

for example app.war. I want to change root url for ruuning program on it.
I am absolutely confused. I tried out to specify root url in context.xml(in my app folder, and I've tried to add ROOT.xml. But it doesn't work(in general, I don't know where I make mistake of changing parametrs, I've looked over all tips. If i change in /web-inf context.xml, then tomcat removes all changing. Tomcat doesn't see ROOT.xml in specific folder. Please, may be someone can write more explicitly these steps and explain some things, which happened with me preventing my Tomcat from working correctly.
this is C:\Users\user\Desktop\psc\ProductCatalog\psc-ui\target\tomcat\conf\context.xml below
<Context>
<!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<!-- Uncomment this to disable session persistence across Tomcat restarts -->
<!--
<Manager pathname="" />
-->
<!-- Uncomment this to enable Comet connection tacking (provides events
on session expiration as well as webapp lifecycle) -->
<!--
<Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
-->
<Environment name="SQL.log" value="DEBUG" type="java.lang.String"/>
this is C:\Users\Alexander.Luchko\Desktop\psc\ProductCatalog\psc-ui\target\ProductCatalog\META-INF\context.xml below
<Context>
<Parameter name="javax.faces.PROJECT_STAGE" value="Production" override="false"/>
........
<Resource ....
sorry for my bad english! in advance

GWT Logging only shows Level SERVE

I use GWT Logging with a simple web application project. I have the following on my module gwt.xml:
<inherits name="com.google.gwt.logging.Logging" />
<set-property name="gwt.logging.logLevel" value="INFO" />
<set-property name="gwt.logging.enabled" value="TRUE" />
<set-property name="gwt.logging.consoleHandler" value="ENABLED" />
<set-property name="gwt.logging.simpleRemoteHandler"
value="ENABLED" />
<set-property name="gwt.logging.developmentModeHandler" value="ENABLED" />
In my onModuleLoad function I set:
Logger rootLogger = Logger.getLogger("");
rootLogger.log(Level.SEVERE, "root SEVERE");
rootLogger.log(Level.INFO, "root INFO");
When I run the app in SuperDevMode I get the following output in my browser console:
root SEVERE
Even with log level INFO I do not get the info log message.
How do I get all GWT log level to be displayed?
Check your GWT run configuration. On the Arguments tab, you should see something like this:
-remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -logLevel INFO -codeServerPort 9997 -port 8888 -server com.google.appengine.tools.development.gwt.AppEngineLauncher -war C:\Users\username\workspace\ProjectName\war com.domain.name.ProjectName
If you see "-logLevel SEVERE" instead of "-logLevel INFO", that's your problem.
Since GWT 2.7.0 you need to explicitly include few properties in your .gwt.xml file. This should fix your problem:
<set-property name="gwt.logging.enabled" value="TRUE"/>
<set-property name="gwt.logging.logLevel" value="INFO" />
<set-property name="gwt.logging.consoleHandler" value="ENABLED"/>
Source

Super dev mode + JSP page in Tomcat

I have a .jsp page (the main page of my gwt module) and I'm trying to enable super dev mode as I'm migrating to gwt 2.6.
Following the explanations I found out on internet, once I launch the codeserver and add the bookmarklets, next I gotta open the page in my browser, so I call the jsp page from my tomcat server.
The problem is that nothing happens, and looking at the chrome console it seems it is unable to find my module/module.nocache.js
Any idea?
EDIT : added .gwt.xml
<inherits name="XXX.frontend.gwt.Framework"/>
<inherits name="XXX.frontend.gwt.sample.frontend.module.blanc.Module"/>
<!-- Specify the paths for translatable code -->
<source path='client'/>
<source path='shared'/>
<!-- Specify the application entry point class -->
<entry-point class='XXX.frontend.gwt.client.FrameworkEntryPoint'/>
<!-- Compile for specific browser -->
<!-- <set-property name="user.agent" value="ie8,ie9,ie10,gecko1_8,safari" /-->
<!-- Compile for specific language -->
<extend-property name="locale" values="fr" />
<set-property-fallback name="locale" value="fr" />
<set-configuration-property name='xsiframe.failIfScriptTag' value='FALSE' />
<set-configuration-property name="devModeUrlWhitelistRegexp" value="http://(localhost|127\.0\.0\.1)(:\d+)?/.*" />
<add-linker name="xsiframe" />
<set-property name="compiler.useSourceMaps" value="true" />
You have to load your .nocache.js file from your codeserver instance.
In your .jsp you must have something like this:
<script src="http://localhost:9876/myapp/myapp.nocache.js"></script>
In your gwt.xml you need these lines as well:
<add-linker name="xsiframe"/>
<set-configuration-property name="devModeRedirectEnabled" value="true"/>
<set-property name="compiler.useSourceMaps" value="true" />

How to create a development/debug and production setup

I recently deployed inadvertently a debug version of our game typrX
(typing races at www.typrx.com - try it it's fun).
It was quickly corrected but I know it may happen again. After digging
on Google I found some info how to create 2 different profiles, one
for development mode that has the debug functions and one used for
deployment. Here is what I found from a Google IO presentation. Does
anyone have this setup? Can someone explains how to run this?
MyAppCommon.gwt.xml
<module>
...
<define-property values="debug, release" name="app.config" />
<replace-with class="myapp.debug.DebugConsole">
<when-type-is class="myapp.Console" />
<when-property-is name="app.config" value="debug" />
</replace-with>
...
</module>
MyAppDebug.gwt.xml
<module>
...
<set-property name="app.config" value="debug" />
</module>
The idea of using a specific module for debugging has been floating around for some times, and was also mentioned in this Google I/O presentation (see slide 33 from PDF or at 0h31m in the video).
The basic idea is that you have a standard GWT module, and a second debug module that inherits this standard module, configures some properties, and uses GWT's deferred binding to replace some classes with specific instances when debugging.
Then, you only have to configure your Maven / ant build to compile the appropriate module depending on wether you are in development mode or in release mode.
In my project, I did not create an "app.config" deferred binding property, but I might do that later on. What I did was the following:
Created a standard module
com/example/MainModule.gwt.xml:
<module rename-to="mainModule">
<inherits name="com.smartgwt.SmartGwt" />
<!-- (other configurations) -->
<!-- gwt-log configuration -->
<define-property name="log_level" values="OFF,DEBUG" />
<inherits name="com.allen_sauer.gwt.log.gwt-log-common" />
<!-- Locales we want to compile for -->
<extend-property name="locale" values="en" />
<extend-property name="locale" values="fr_FR" />
</module>
Created a "debug" module, that inherits the standard module and configures some additional properties for development
com/example/MainModuleDebug.gwt.xml:
<module rename-to="mainModule">
<inherits name="com.example.MainModule" />
<set-property name="user.agent" value="gecko1_8" />
<set-property name="locale" value="fr_FR"/>
<set-property name="log_level" value="DEBUG" />
</module>
Note: the rename-to attribute is very important here, since you want both modules to be deployed under the exact same name. When you compile during development, you do not want to have to change all your html host pages to point to the debug module.
Configured Maven and the gwt-maven-plugin to compile the right module
<project>
(...)
<properties>
(...)
<!--
Suffix appended to the names of the GWT modules we compile in our child projects.
Empty by default, this suffix is overriden by some profiles to specify an alternative module to compile.
-->
<gwt.module.suffix></gwt.module.suffix>
<!-- We force GWT-recompilation by default (except when using the "gwtDebug" profile - see below for more info) -->
<gwt.compiler.force>true</gwt.compiler.force>
</properties>
(...)
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<configuration>
(...)
<module>com.example.MainModule${gwt.module.suffix}</module>
</configuration>
</plugin>
(...)
<profiles>
<!-- This profile should be used during *DEVELOPMENT* -->
<profile>
<id>gwtDebug</id>
<properties>
<gwt.module.suffix>Debug</gwt.module.suffix>
<!-- Tells gwt-maven-plugin to recompile GWT modules only when necessary -->
<gwt.compiler.force>false</gwt.compiler.force>
</properties>
<activation>
<property>
<name>gwtDebug</name>
</property>
</activation>
</profile>
</profiles>
</project>
Simply doing "maven clean install" will compile the production module. In development, you use "mvn clean install -DgwtDebug" to activate the gwtDebug profile, which in turn compiles the debug module.
Of course, you could configure your ~/.m2/settings.xml to always define the "gwtDebug" property...
The same idea would also apply to Ant. But I'm not well versed with it.
When you starts to toy with the idea of overriding your real module with a debug module, you start to envision some very cool possibilities:
You could add performance logs, which would be pruned from the code when in production.
You could configure all your toString() methods to return something useful when in debug mode, and the empty string when in production (and thus reduce the .js size).
You may reduce the number of permutations by specifying only one locale / one browser / one log level, to speed up the compilation (but do not forget to test for other locales / browsers from time to time).

Categories