Where can I find the log file from GWT's remoteLoggingServlet? - gwt

It runs without any log information. I can't find the log file on server anywhere, also didn't find any console info on server(because I don't know which console these log info will be displayed on). Should I do some further config or coding? Thanks.
I have configured GWT-Logging in .gwt.xml as below:
<inherits name="com.google.gwt.logging.Logging"/>
<set-property name="gwt.logging.enabled" value="TRUE"/>
<set-property name="gwt.logging.logLevel" value="FINE"/>
<set-property name="gwt.logging.popupHandler" value="DISABLED" />
<set-property name="gwt.logging.firebugHandler" value="DISABLED" />
<set-property name="gwt.logging.developmentModeHandler" value="DISABLED" />
<set-property name="gwt.logging.consoleHandler" value="DISABLED" />
<set-property name="gwt.logging.systemHandler" value="DISABLED" />
<set-property name="gwt.logging.simpleRemoteHandler" value="ENABLED"/>
remoteLoggingServlet has already been configured in web.xml:
<servlet>
<servlet-name>remoteLoggingServlet</servlet-name>
<servlet-class>com.google.gwt.logging.server.RemoteLoggingServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>remoteLoggingServlet</servlet-name>
<url-pattern>/my.app.class.name/remote_logging</url-pattern>
</servlet-mapping>
in GWT Client codeļ¼š
Logger logger = Logger.getLogger("NameOfYourLogger");
logger.log(Level.SEVERE, "this message should get logged ok!");
web client runs, but where is log file on server? Thanks.

for log-files:
After I put a logging.properties file under war\WEB-INF\classes, it works on tomcat if I deploy the GWT project. The location is tomcat\bin if you doesn't specify any path.
It still doesn't work in GWT devMode, maybe the Jetty server in devMode under eclipse works in a different way. But you can enable other handlers to find the log info on eclipse consoles. So far, that's enough for me.

Don't you need:
/your-gwt-module-name/remote_logging
and not
/my.app.class.name/remote_logging
in
<!-- 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>/your-gwt-module-name/remote_logging</url-pattern>
</servlet-mapping>

Related

How to debug GWT client code in JBoss?

I am working on a Java/J2EE web project in which all GUI is developed in GWT(V2.5.1). We have deployed WAR files in JBoss 7.1. Now I want to debug the UI/client side code in eclipse Luna(4.4). I have tried a lots of ways to debug but not successful. Is there any way/third party tool/eclipse plugin to debug the GWT code. Please help me to debug the code. Thanks in advance. (Also let me know the way of logging in GWT).
You can't debug GWT client code once it is deployed as a war.
You can only debug using SuperDevMode using the debugging tools of the browser (I prefer Chrome for this).
Logging is done using java.util.Logger after putting some stuff in your gwt.xml
<inherits name="com.google.gwt.logging.Logging"/>
<inherits name="be.gps.gwt.shared.Shared"/>
<set-property name="gwt.logging.enabled" value="TRUE" />
<set-property name="gwt.logging.developmentModeHandler" value="ENABLED" />
<set-property name="gwt.logging.systemHandler" value="DISABLED" />
<set-property name="gwt.logging.consoleHandler" value="ENABLED"/>
<set-property name="gwt.logging.simpleRemoteHandler" value="DISABLED" />
<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"/>
<replace-with class="be.gps.gwt.jsonrpclogger.client.JsonRpcRemoteLogHandler">
<when-type-is class="com.google.gwt.logging.client.SimpleRemoteLogHandler" />
<any>
<when-property-is name="gwt.logging.enabled" value="TRUE" />
<when-property-is name="gwt.logging.simpleRemoteHandler" value="ENABLED" />
</any>
</replace-with>

gwt.xml error: Content of element type module must match

I have a small GWT java program that has been running on google apps engine for about a year now. I recently made some changes to it, and then before I could deploy it had to update the JRE to 7.1. Once I did that, I am getting the following error on my gwt.xml file:
The content of element type "module" must match "(inherits|source|public|super-source|entry-point|stylesheet|script|servlet|replace-with|
generate-with|define-property|extend-property|set-property|set-property-fallback|clear-configuration-property|define-configuration-
property|extend-configuration-property|set-configuration-property|property-provider|define-linker|add-linker|collapse-all-properties|collapse-property)*".
I found this question which explained to me what the error meant, and I saw that my source elements were after my entry point element. I moved them around to match the order in the error message, but the error persists. Any thoughts?
Here is my gwt.xml file:
<?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.5.0//EN"
"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd">
<module rename-to='helpdesktest'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
<inherits name='com.google.gwt.xml.XML'/>
<inherits name='com.google.gwt.logging.Logging'/>
<inherits name='com.google.gwt.http.HTTP'/>
<!-- 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'/> -->
<!-- Other module inherits -->
<!-- Specify the paths for translatable code -->
<source path='client'/>
<source path='shared'/>
<!-- Specify the app entry point class. -->
<entry-point class='com.google.gwt.HelpDeskTest.client.HelpDeskTest'/>
<!-- Set logging parameters -->
<set-property name="gwt.logging.logLevel" value="SEVERE"/> #change default log level
<set-property name="gwt.logging.enabled" value="FALSE"/> #set to FALSE to disable logging
<set-property name="gwt.logging.consoleHandler" value="DISABLED"/> #to disable set to DISABLED
<set-property name="gwt.logging.popupHandler" value="DISABLED"/>
<set-property name="gwt.logging.developmentModeHandler" value="DISABLED"/>
</module>
<module> doesn't accept text content, yet you have those #change default log level bits in your file.
Convert them to XML comments (<!-- change default log leve -->) or remove them.
BTW, the order of the elements doesn't matter wrt XML validation (it matters in what they mean though; some things sometimes have to be processed for others because one overrides the other)

Build folder stays empty

Hi Im trying to follow the tutorial here regarding Struts. I have followed the tutorial exactly but am getting an HTTP 404 error. I know this error basically means that the resource can't be found be the the IDE.
I noticed that the 'Build' folder is actually completely empty - so I'm guessing that it should have automatically created a runnable project based on my project specifics and this is actually where the server looks in order to run an application.
So how do I go about manually generating this file? Should I drag all the resources in? Java classes, JSP files and so? If not how do I configure it to automatically build?
Cheers
EDIT
Have added what I think will be necessary to help solve this:
Web.xml Located in the WEB-INF folder, next to lib
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Struts2 Application</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>Login.jsp</welcome-file>
</welcome-file-list>
Struts.xml Located in a src folder called resources in the Java Resources folder
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="false" />
<constant name="struts.custom.i18n.resources" value="ApplicationResources" />
<package name="default" extends="struts-default" namespace="/">
<!--
If we changed from the default execute() method, which struts looks for
to say authenticate(), then we would have to specify this in the action
method below like this:
<action
name="login"
method="authenticate"
class="net.viralpatel.struts2.LoginAction">
</action>
-->
<action name="login" class="net.viralpatel.struts2.LoginAction">
<result name="success">Welcome.jsp</result>
<result name="error">Login.jsp</result>
</action>
</package>

Java GWT remoteLoggingServlet - can I configure java.util.Logging to send this to a log file?

Is it possible to get messages received on the server, from client side logging via the remoteLoggingServlet in GWT to write to a file?
http://code.google.com/intl/es-ES/webtoolkit/doc/latest/DevGuideLogging.html#Remote_Logging
I have GWT Logging set up successfully in my .gwt.xml
<set-property name="gwt.logging.enabled" value="TRUE"/>
<set-property name="gwt.logging.logLevel" value="FINE"/>
<set-property name="gwt.logging.popupHandler" value="DISABLED" />
<set-property name="gwt.logging.firebugHandler" value="DISABLED" />
<set-property name="gwt.logging.developmentModeHandler" value="DISABLED" />
<set-property name="gwt.logging.consoleHandler" value="DISABLED" />
<set-property name="gwt.logging.systemHandler" value="DISABLED" />
<set-property name="gwt.logging.simpleRemoteHandler" value="ENABLED"/>
And the remote logging servlet set up:
<servlet>
<servlet-name>remoteLoggingServlet</servlet-name>
<servlet-class>com.google.gwt.logging.server.RemoteLoggingServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>remoteLoggingServlet</servlet-name>
<url-pattern>/my.app.class.name/remote_logging</url-pattern>
</servlet-mapping>
I see my error messages on the development console.
I had hoped since the remote logging service
http://www.google.com/codesearch#A1edwVHBClQ/user/src/com/google/gwt/logging/server/RemoteLoggingServiceUtil.java&is_navigation=1
appears to use java.util.Logging under the covers, that I would be able to configure this to log to a log file, so that I could see what errors users were getting on the client side, to diagnose some performance problems.
Has anyone had any luck configuring messages to go somewhere other than client side displays?
For what it's worth - I have decided to work around this by reimplementing my own
RemoteLoggingServiceImpl and RemoteLoggingServiceUtil
And switching these from using java.util.Logging to using Log4j once the messages are on the server side.

GWT hosted mode not working with Spring + Eclipse + GWT Eclipse plugin

I've been trying to get GWT working with Spring for a while now. Is there anyone who is using official Eclipse GWT plugin with Spring, and who has managed to get hosted mode working with that combination?
I'm using GWTController to initialize GWT through dispatcher-servlet.xml. Since my WEB-INF is not in war, but in WebContent folder, I use "-war WebContent" switch when compiling Java code to .js.
As for hosted mode... if I try to run it through IDE (Run as Web Application) I get "Launch failed - Could not find any host pages in project MyProject." I tried running it with Ant task which goes something like this:
<condition property="XstartOnFirstThread" value="-XstartOnFirstThread">
<os family="mac"/>
</condition>
<condition property="XstartOnFirstThread" value="">
<not><os family="mac"/></not>
</condition>
<target name="hosted" depends="" description="Run hosted mode">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.HostedMode">
<classpath>
<pathelement location="src" />
<path refid="my-client-classpath" />
</classpath>
<jvmarg value="-Xmx256M" />
<jvmarg line="${XstartOnFirstThread}" />
<arg value="-startupUrl" />
<arg value="MyPage.html" />
<arg value="my.gwt.client.Whatever" />
</java>
</target>
This results in hosted mode starting, but I get 404 instead of my web page...
EDIT: When I go to hosted mode, I see folder with compiled Javascript code but nothing else. So my question is basically has someone got a good tutorial or a setup he can share? There is a lot of half-baked info on the Net, but I wasn't able to make any of it work.
EDIT 2: Here's my .gwt.xml file, it's pretty basic:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.7.1//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.7.1/distro-source/core/src/gwt-module.dtd">
<module rename-to='whatever'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<!-- 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.standard.Standard' />
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<!-- Other module inherits -->
<!-- Specify the app entry point class. -->
<entry-point class='my.gwt.client.Whatever' />
<!-- Lokalizacije -->
<extend-property name="locale" values="hr" />
</module>
We used this tutorial to get it working for us, hope it helps