问题
I created the sample GWT app in IntelliJ 14 using GWT 2.7 and Java 7. I started Super Dev Mode, but the log statment at the start of onModuleLoad is not printing to the Javascript console. I create a similar example project using GWT 2.5.1 and I was able to get the logging to print using the same logging configuration as described below.
CodeServer Startup Message
Runing CodeServer with parameters: [-noprecompile, -port, 9876, -sourceLevel, 1.7, -bindAddress, 127.0.0.1, -launcherDir, /Users/xxx/Library/Caches/IntelliJIdea14/gwt/gwt5.10e7b474/gwt5.bbec8ec6/run/www, -logLevel, INFO, com.mySampleApplication.MySampleApplication]
MySampleApplicaton.gwt.xml
<module rename-to="MySampleApplication">
<inherits name="com.google.gwt.logging.Logging"/>
<source path='client' />
<source path='shared' />
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
<!-- Specify the app entry point class. -->
<entry-point class='com.mySampleApplication.client.MySampleApplication'/>
<!-- Specify the app servlets. -->
<servlet path='/MySampleApplicationService' class='com.mySampleApplication.server.MySampleApplicationServiceImpl'/>
</module>
MySampleApplication.java (EntryPoint)
public class MySampleApplication implements EntryPoint {
private static final Logger logger = Logger.getLogger(MySampleApplication.class.getName());
public void onModuleLoad() {
logger.log(Level.INFO, "Starting module gwt5");
...
}
}
回答1:
Have you tried to add:
<set-property name="gwt.logging.enabled" value="TRUE"/>
to your module descriptor? This works for me.
Hope that helps.
来源:https://stackoverflow.com/questions/28402833/gwt-2-7-logging-is-not-working