GWT.log logs not showing in the GWT Dev Mode console - java

I have a GWT application which is run with maven:
mvn gwt:run
However, all the GWT.log logs are not being showed what could be the problem?

In order for the logging to work you need to have the following:
Logging module inherited in your module xml file:
<inherits name="com.google.gwt.logging.Logging" />
Logging level set and handlers configured:
<set-property name="gwt.logging.logLevel" value="FINE" />
<set-property name="gwt.logging.systemHandler" value="ENABLED" />
<set-property name="gwt.logging.consoleHandler" value="ENABLED" />
<set-property name="gwt.logging.developmentModeHandler" value="ENABLED" />
<set-property name="gwt.logging.popupHandler" value="DISABLED" />
<set-property name="gwt.logging.firebugHandler" value="DISABLED" />
<set-property name="gwt.logging.simpleRemoteHandler" value="DISABLED" />
You may need a different handler configuration than this one based on what you are tring to achieve, for more info check the offical doc on that matter.
Notice that the level I set up is FINE which would ensure that most of what you log is not ignored by any handler since FINE is one of the lowest levels. By default loggers are configured to handle only SEVERE level logs, which usually ignores the rest, SEVERE being the highest level.
Next you need to ensure that the level you use to log is included withing the LEVEL you setup on the XML module file. For instance if you use...
static final Logger logger= Logger.getLogger(MyClass.class.getName());
logger.fine("--MESSAGE--");
// or
logger.log(Level.FINE, "--MESSAGE--");
...the level must be set to FINE or any other level below for this messages you appear in your log, if you choose any level above FINE, all those messages will be ignored.
Hope this helps...

Related

vaadin superdevmode can't find custom widget classes

I'm trying to debug a Vaadin custom widgetset using superdevmode. In "normal" mode the custom widget shows up correctly in the browser. When using superdevmode though, it shows the following text instead of the custom widget:
Widgetset xxx does not contain implementation for yyy
Tried all the usual things such as recompile from command line, restart superdevmode server, to no avail.
The weird thing is that the class in the error message (yyy above) is a server side class, used in the client side code only in #Connect(yyy.class), in the client side Connector. Obviously compiled widgetsets do not contain server side classes. So why would it complain about this class?
Also the fact that it works in normal mode makes me wonder what can be wrong. Many similar questions throughout the forums are unanswered. Any help would be appreciated.
Using Vaadin 7.6.6
Contents of widgetset.gwt.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN"
"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd">
<module>
<set-configuration-property name="devModeRedirectEnabled" value="true" />
<add-linker name="xsiframe" />
<inherits name="com.vaadin.DefaultWidgetSet" />
<inherits name="..." />
<source path='client' />
<source path='shared' />
<stylesheet src="resetbuttonfortextfield/styles.css" />
</module>
Solved it eventually by adding -src ${project_loc}/src/main/java to my superdevmode run configuration. Beats me why it wasn't able to figure that for itself.

vaadin 7: Widgetset does not contain implementation of my custom widget

I'm using vaadin 7.5.6 to create a custom GWT widget and use it in my application, but when I run it, my custom component is not shown and I get the message "Widgetset does not contain an implementation for ...".
I know there are several questions related to the same issue but I've already tried all the "solutions" like:
Re-compile the widgetset
Clear all caches from Ivy
Clean the project
Check the annotation #VaadinServletConfiguration, which already contains widgetset = "com.example.myapp.widgetset.MyAppWidgetset")
But nothing works... Any suggestions of what might be the problem?
To create the widget I followed the instructions given in Vaadin's Wiki.
My widgetset looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Uncomment the following to compile the widgetset for one browser only.
Multiple browsers can be specified as a comma separated list. The
supported user agents at the moment of writing were:
ie8,ie9,gecko1_8,safari,opera
The value gecko1_8 is used for Firefox and safari is used for webkit
based browsers including Google Chrome.
-->
<!-- <set-property name="user.agent" value="safari"/> -->
<!--
To enable SuperDevMode, uncomment this line.
See https://vaadin.com/wiki/-/wiki/Main/Using%20SuperDevMode for more
information and instructions.
-->
<!-- <set-configuration-property name="devModeRedirectEnabled" value="true" /> -->
<inherits name="com.lexaden.business.chart.widgetset.OrganisationWidgetset" />
<inherits name="com.vaadin.addon.touchkit.gwt.TouchKitWidgetSet" />
<inherits name="org.vaadin.alump.beforeunload.gwt.BeforeUnloadWidgetSet" />
<inherits name="com.example.fieldcustomcomponents.FieldcustomcomponentsWidgetset" />
Thanks in advance,
Matías

Not able to run Gxt 3.1.1 application after upgrading from 3.0.0

I have tried upgrading my projects GWT and Gxt from 2.5.1,3.0.0 to 2.7,3.1.1 . I was able to build the project successfully with some workarounds but am not able to run it. Error I am getting is :
Loading inherited module 'com.ApplicationShellModule'
Loading inherited module 'com.sencha.gxt.ui.GXT'
Loading inherited module 'com.sencha.gxt.data.Data'
Loading inherited module 'com.sencha.gxt.core.Core'
[ERROR] Line 96: Value 'ie6' in not a valid value for property 'user.agent'
I am trying to find the cause in applicationShellModule.gxt.xml which is my gxt configuration which is as follows near line 96:
<property-provider name="gxt.user.agent">
<![CDATA[
{window.alert("inside user agent gxt");
var ua = navigator.userAgent.toLowerCase();
if (ua.indexOf('trident') != -1) {
if (11 == document.documentMode) return 'gecko1_9';
return 'ie8';
}
if (ua.indexOf('msie') != -1) {
return 'ie8';
}
return 'chrome';
} ]]>
</property-provider>
<property-provider name="user.agent">
<![CDATA[
{ window.alert("inside user agent");
return 'ie8';
var ua = navigator.userAgent.toLowerCase();
if (ua.indexOf('trident') != -1) {
if (11 == document.documentMode) return 'gecko1_8';
return 'ie8';
}
if (ua.indexOf('msie') != -1) {
return 'ie8';
}
return 'safari';
} ]]>
</property-provider>
<property-provider name="user.agent.os">
<![CDATA[
{window.alert("inside user agent os");
return 'windows';
} ]]>
</property-provider>
<!-- Supported Browsers -->
<!-- uncomment this for dev after upgrade
<set-property name="gxt.user.agent" value="chrome, ie8, gecko1_9" />
<set-property name="user.agent.os" value="windows" />
<extend-property name="locale" values="en,es,ko,pt,ru,fr,hu,pl,zh_CN,zh_TW,tr,uk"/>
<set-property-fallback name="locale" value="en" />
<collapse-property name="locale" values="en, default" />
-->
<!-- changes for upgrade gwt -->
<set-property name="user.agent" value="ie8,ie9,opera,gecko1_8,safari" />
<set-property name="gxt.user.agent" value="ie8" />
<set-property name="user.agent.os" value="windows" />
<extend-property name="locale" values="en" />
<set-property-fallback name="locale" value="en" />
<collapse-property name="locale" values="en" />
<collapse-all-properties />
<set-configuration-property name="CssResource.obfuscationPrefix"
value="empty" />
<add-linker name="xsiframe"/>
<set-configuration-property name="devModeRedirectEnabled" value="true"/>
<set-property name="compiler.useSourceMaps" value="true"/>
<!-- upgrade changes over check last line setting to false below revert it to original-->
I have set the user agent manually here as can be seen to a list of browsers but not ie6 which is coming under the error. I have searched for the string 'ie6' but nowhere I am getting the actual reason for this error. Please help me get out of the issue.
Loading inherited module 'com.sencha.gxt.core.Core'
[ERROR] Line 96: Value 'ie6' in not a valid value for property 'user.agent'
If you are seeing this, you have at least one copy of GXT 3.0 still on your classpath - the Core.gwt.xml in 3.1.1 has a blank line on 96.
As El Hoss mentions in the comments, GWT 2.7 dropped support for IE6, and to be compatible, GXT 3.1 did the same. If you are seeing references to IE6, you either have customizations in your own project that use IE6, or are not actually using the correct versions of GWT or GXT.
There are some properties which are being set in the GWT and GXT jars like
Ex :- user.agent - for GWT lesser than 2.6.0 - they support ie6
:- user.agent - for GWT greater than 2.6.0 - they do not support ie6
So you will get compilation error if you have different versions of GWT and GXT.
Even if you find a work around - it may fail later when you use the different widgets of GWT and GXT. So it is better to change the version earlier.
If youe Base GWT version is lesser than 2.6.0 - then you need GXT jar version lesser than 3.0.1
If you base GWT version greater than or equal to 2.6.0 then you need to add GXT jar version 3.1.X

Gwt 2.7 logging dosn't work. Tested with java.util.logging

I've started a new GWT 2.7 project, and I am trying to set up logging, but I can't make it work.
I've followed these instructions:
GWT 2.7 Logging Is Not Working
https://groups.google.com/forum/#!topic/google-web-toolkit-contributors/Tqu5Zw5H-II
http://www.gwtproject.org/doc/latest/DevGuideLogging.html
But nothing helped.
Here is my module conf:
<?xml version="1.0" encoding="UTF-8"?>
<!-- When updating your version of GWT, you should also update this DTD reference,
so that your app can take advantage of the latest GWT module capabilities. -->
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.7.0//EN" "http://gwtproject.org/doctype/2.7.0/gwt-module.dtd">
<module rename-to='derp'>
<inherits name="com.google.gwt.logging.Logging"/>
<set-property name="gwt.logging.enabled" value="TRUE"/>
<set-property name="gwt.logging.consoleHandler" value="ENABLED"/>
<set-property name="gwt.logging.logLevel" value="INFO"/>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<inherits name='com.google.web.bindery.requestfactory.RequestFactory' />
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<!-- <inherits name='com.google.gwt.user.theme.clean.Clean' /> -->
<!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<inherits name='com.google.gwt.user.theme.dark.Dark' />
<stylesheet src="/public/css/theme/darkly.min.css" />
<stylesheet src="/public/css/bootstrapOverride.css" />
<stylesheet src="/public/css/gwtOverride.css" />
<stylesheet src="/public/css/Derp.css" />
<!-- Other module inherits -->
<!-- <inherits name="org.gwtbootstrap3.GwtBootstrap3" /> -->
<inherits name="org.gwtbootstrap3.GwtBootstrap3NoTheme" />
<stylesheet src="css/font-awesome-4.3.0.min.cache.css" />
<!-- <inherits name="org.gwtbootstrap3.extras.fullcalendar.FullCalendar" /> -->
<inherits name="org.gwtbootstrap3.extras.notify.Notify"/>
<!-- Specify the app entry point class. -->
<entry-point class='pl.dany.derp.client.Derp' />
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
<!-- allow Super Dev Mode -->
<add-linker name="xsiframe" />
</module>
and entry point class:
package pl.dany.derp.client;
import java.util.logging.Level;
import java.util.logging.Logger;
public class Derp implements EntryPoint {
private static final Logger logger = Logger.getLogger(Derp.class.getName());
#Override
public void onModuleLoad() {
logger.log(Level.ALL, "----------------------------------------_>this message should get logged");
logger.log(Level.CONFIG, "----------------------------------------_>this message should get logged");
logger.log(Level.FINE, "----------------------------------------_>this message should get logged");
logger.log(Level.FINER, "----------------------------------------_>this message should get logged");
logger.log(Level.FINEST, "----------------------------------------_>this message should get logged");
logger.log(Level.INFO, "----------------------------------------_>this message should get logged");
logger.log(Level.OFF, "----------------------------------------_>this message should get logged");
logger.log(Level.SEVERE, "----------------------------------------_>this message should get logged");
logger.log(Level.WARNING, "----------------------------------------_>this message should get logged");
System.out.println("----------------------------------------_>this message should get logged");
logger.warning("----------------------------------------_>this message should get logged");
Window.alert("LLLLLLLLLLL 2222");
}
I am not getting output in eclipse console:
GET /recompile/derp
Job pl.korbeldaniel.derp.Derp_1_72
starting job: pl.dany.derp.Derp_1_72
binding: user.agent=safari
skipped compile because no input files have changed
0,022s total -- Compile completed
GET /sourcemaps/derp/ED2FD982D7D3CF133708FC4EC52FB0FB_sourcemap.json
sent source map for module 'derp' in 31 ms
I am getting no output in web browser console.
Please help.
You need add only <set-property name="gwt.logging.enabled" value="TRUE"
After adding this property, if server up and running you need to restart it. I found answer here

How does Deobfuscation with GWT-Log works in Production with Style Obfuscated?

I am using GWT 2.6 and GWT-log 3.3.0.
I tried to get remote log messages with gwt-log. I tried this:
Log.fatal("This is what an exception might look like", new RuntimeException("2 + 2 = 5"));
Here is my gwt.xml:
<module rename-to='testgwt'>
<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.popupHandler" value="DISABLED" />
<set-property name="gwt.logging.developmentModeHandler" value="ENABLED" />
<inherits name="com.allen_sauer.gwt.log.gwt-log-DEBUG" />
<inherits name="com.allen_sauer.gwt.log.gwt-log-RemoteLogger" />
<set-property name="log_ConsoleLogger" value="ENABLED" />
<set-property name="log_DivLogger" value="ENABLED" />
<set-property name="log_FirebugLogger" value="ENABLED" />
<set-property name="log_GWTLogger" value="ENABLED" />
<set-property name="log_SystemLogger" value="ENABLED" />
<set-property name="compiler.emulatedStack" value="true" />
<set-configuration-property name="compiler.emulatedStack.recordLineNumbers" value="true"/>
<set-configuration-property name="compiler.emulatedStack.recordFileNames" value="true"/>
My entry point class:
public void onModuleLoad() {
Log.setUncaughtExceptionHandler();
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
#Override
public void execute() {
onModuleLoad2();
}
});
}
public void onModuleLoad2() {
Log.fatal("This is what an exception might look like", new RuntimeException("2 + 2 = 5"));
}
I can see that in WEB-INF/deploy/web/symbolMaps/ there are many files of size 4.3MB each. So I guess the symbolMaps are generated successful.
My remote servlet config is:
<servlet>
<servlet-name>gwt-log-remote-logger-servlet</servlet-name>
<servlet-class>com.allen_sauer.gwt.log.server.RemoteLoggerServiceImpl</servlet-class>
<init-param>
<param-name>symbolMaps</param-name>
<param-value>WEB-INF/deploy/testgwt/symbolMaps/</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>gwt-log-remote-logger-servlet</servlet-name>
<url-pattern>/testgwt/gwt-log</url-pattern>
</servlet-mapping>
I compile with style obfuscated. In my WEB-INF/lib folder I have the gwt-log.3.3.jar file.
On the client side I get
(-:-) 2014-02-20 23:09:54,529 [FATAL] This is what an exception might look like
java.lang.RuntimeException: 2 + 2 = 5
at Unknown.ui(StackTraceCreator.java:180)
at Unknown.Zf(StackTraceCreator.java:518)
at Unknown.Yf(Throwable.java:56)
at Unknown.kh(Exception.java:29)
at Unknown.mh(RuntimeException.java:29)
at Unknown.PW(Testgwt.java:66)
at Unknown.TW(Testgwt.java:52)
at Unknown.ki(SchedulerImpl.java:180)
at Unknown.bi(SchedulerImpl.java:345)
at Unknown.oi(SchedulerImpl.java:78)
at Unknown.ii(SchedulerImpl.java:138)
at Unknown.Kh(Impl.java:290)
at Unknown.Oh(Impl.java:347)
at Unknown.anonymous(Impl.java:93)
at Unknown.anonymous(UnloadSupport.java:42)
On the server side I get:
SEVERE: This is what an exception might look like
java.lang.RuntimeException: 2 + 2 = 5
at Unknown.ui(StackTraceCreator.java:180)
at Unknown.Zf(StackTraceCreator.java:518)
at Unknown.Yf(Throwable.java:56)
at Unknown.kh(Exception.java:29)
at Unknown.mh(RuntimeException.java:29)
at Unknown.PW(Testgwt.java:66)
at Unknown.TW(Testgwt.java:52)
at Unknown.ki(SchedulerImpl.java:180)
at Unknown.bi(SchedulerImpl.java:345)
at Unknown.oi(SchedulerImpl.java:78)
at Unknown.ii(SchedulerImpl.java:138)
at Unknown.Kh(Impl.java:290)
at Unknown.Oh(Impl.java:347)
at Unknown.anonymous(Impl.java:93)
at Unknown.anonymous(UnloadSupport.java:42)
What do I have to do to get the deobfuscation on server side working in production with style obfuscated?
Edit:
Even if I don't use:
symbolMaps
WEB-INF/deploy/testgwt/symbolMaps/
It does not change anything. The path to the symbolMaps folder seems to be correct. There are also files in it which have been generated after gwt comile in my eclipse web application project. See this demo eclipse gwt project I made: https://github.com/confile/gwtlogtest
Edit: I run my app on a Tomcat 7.0.52 server. In my catalina.log ther is the following warning:
Feb 21, 2014 12:08:11 AM com.allen_sauer.gwt.log.server.ServerLogImplJDK14 log
WARNING: Servlet configuration parameter 'symbolMaps' specifies directory
'WEB-INF/deploy/testgwt/symbolMaps/' which does not exist or is not relative
to your server's current working directory '/'
Feb 21, 2014 12:08:11 AM com.allen_sauer.gwt.log.server.ServerLogImplJDK14 log
WARNING: In order to enable stack trace deobfuscation, please specify
the 'symbolMaps' <init-param> for the com.allen_sauer.gwt.log.server.RemoteLoggerServlet servlet in your web.xml
It seems that the symbolMaps cannot be found. I checked it is exactly at this path.
Do you have these properties in your module?
<set-property name="compiler.stackMode" value="emulated" />
<set-configuration-property name="compiler.emulatedStack.recordLineNumbers" value="true" />
<set-configuration-property name="compiler.emulatedStack.recordFileNames" value="true" />
Note that those properties should be removed if you want your production code being fully optimized.
This is my Configuration and it works fine:
Client side Configuration (Task.gwt.xml):
<!-- Enabling server side logging: -->
<inherits name="com.google.gwt.logging.Logging"/>
<set-property name="gwt.logging.logLevel" value="SEVERE"/>
<set-property name="gwt.logging.simpleRemoteHandler" value="ENABLED" />
<!-- To show line number of occurred exception in server side logging (This will increase compiled js size): -->
<set-property name="compiler.stackMode" value="emulated"/>
<set-configuration-property name="compiler.emulatedStack.recordLineNumbers" value="true"/>
<set-configuration-property name="compiler.emulatedStack.recordFileNames" value="true"/>
<set-property name="gwt.logging.enabled" value="TRUE" />
<set-property name="gwt.logging.developmentModeHandler" value="ENABLED" />
<set-property name="gwt.logging.systemHandler" value="ENABLED" />
<set-property name="gwt.logging.popupHandler" value="DISABLED" />
<set-property name="gwt.logging.consoleHandler" value="ENABLED" />
<set-property name="gwt.logging.firebugHandler" value="ENABLED" />
Server side Configuration (web.xml):
<!-- gwt remote logging -->
<servlet>
<servlet-name>remoteLogging</servlet-name>
<servlet-class>com.google.gwt.logging.server.RemoteLoggingServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>remoteLogging</servlet-name>
<url-pattern>/gwt/ir.asta.zrm.cm.gwt.Task/remote_logging</url-pattern>
</servlet-mapping>

Categories

Resources