我使用GWT 2.7和Java 7在IntelliJ 14中创建了示例GWT应用程序。我启动了超级开发模式,但onModuleLoad开头的日志属性未打印到Javascript控制台。我使用GWT 2.5.1创建了一个类似的示例项目,并且我能够使用与下面描述的相同的日志记录配置来打印日志。
CodeServer启动消息
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");
...
}
}
答案 0 :(得分:2)
您是否尝试添加:
<set-property name="gwt.logging.enabled" value="TRUE"/>
到您的模块描述符?这对我有用。
希望有所帮助。