When I write messages to log (i.e. com.allen_sauer.gwt.log.client.Log#debug
) I can see them in Chrome->F12->Console or (during debug) in IDEA->Debug->Dev Mode. But if the System.out.println()
was used in IDEA the messages appear in the same place as the logged ones, but what about when I am not debugging? where do they go?
Where do System.out.println() messages go, when it is called in client-side GWT-module?
System.out.println()
are just removed by the compiler in production mode.
If you want to check just create this simple module:
public class Foo implements EntryPoint {
public void onModuleLoad() {
System.out.println("Hello World!");
}
}
And look at the generated javascript.
What about in Super Dev Mode? What happens to them then? –
Dorladorlisa
The preferred way to do logging (at development time) is com.google.gwt.core.client.GWT.log()
. Messages logged this way will also wind up in your browser's console like you mention. Likely System.out.println
is mapped to the same functionality for convenience. From the GWT.log
Javadoc:
Logs a message to the development shell logger in Development Mode, or to the console in Super Dev Mode. Calls are optimized out in Production Mode.
Also consider the juli logging: gwtproject.org/doc/latest/DevGuideLogging.html –
Bottle
© 2022 - 2024 — McMap. All rights reserved.