Using GWT, I have deployed my server into Tomcat. This works fine, but when GWT throws an exception, a Popup shows the client the
It's a bit difficult to find all the information in the GWT docs, which you need to setup de-obfuscated logging, so here's the short version:
In your module file (.gwt.xml), add:
On the client side, use something like
import java.util.logging.Logger;
private static Logger rootLogger = Logger.getLogger("");
...
rootLogger.log(Level.SEVERE, "My message", e);
You don't have to create a RemoteLoggingServiceAsync instance on the client side - it's used automatically by the logger, because we specified .
On the server side, configure the RemoteLoggingServiceImpl. You will have to tell it, where it finds the symbolMaps, which will be generated when compiling with the GWT compiler argument -extra /path/to/myExtraDir. I personally use the approach to override RemoteLoggingServiceImpl, to allow specifying the directory from web.xml's s [*]
package mypackage.server;
public class ConfigurableRemoteLoggingServiceImpl extends RemoteLoggingServiceImpl {
@Override
public void init(final ServletConfig config) throws ServletException {
super.init(config);
final String symbolMapsDirectory =
config.getInitParameter("symbolMapsDirectory");
setSymbolMapsDirectory(symbolMapsDirectory);
}
}
In web.xml, register it like
remoteLogging
mypackage.server.ConfigurableRemoteLoggingServiceImpl
symbolMapsDirectory
/path/to/myExtraDir/mymodulename/symbolMaps
remoteLogging
/mymodulename/remote_logging
Replace /path/to/myExtraDir, mymodulename and mypackage with your own values, and don't forget to call the GWT compiler with the -extra argument (Note that you you don't have to use -style PRETTY or DETAILED, it also works with OBF). Keep all generated symbolMaps: Without them, deobfuscation will not work. As every new version gets a unique name automatically, you can collect them all in a safe central place when building.
[*] And I really, really wonder, why RemoteLoggingServiceImpl doesn't implement that itself!