Mark
Mark

Reputation: 568

Logging with AppEngine doesn't work (neither in-IDE nor deployed)

Using Eclipse 3.6SR2 and the appropriate Google Plugin I create a new Web Application Project. Everything seems already preconfigured to use java.util.logging.Logger but I see no output, neither in the IDE nor after deploying.

private void sendNameToServer() {
    Logger log = Logger.getLogger(TestAppEngine1.class.getName());
    log.setLevel(Level.INFO);
    log.info("info");
    log.severe("severe");
    System.out.println("out");
    System.err.println("err");
    log.log(Level.SEVERE, "severe");

I can only see "out" and "err" in the "Console" window in Eclipe, but not the logs from Logger. After deploying and checking the only logs I see the normal logs e.g. created by long initial load time, but not the Logger logs NOR the "out" or "err".

Things already checked:

I'm really lost. Would be grateful if you could give me a hint.

Upvotes: 2

Views: 1432

Answers (4)

lanzalibre
lanzalibre

Reputation: 370

The same happened to me because I inserted this right after the Logger declaration

PrintWriter out;

Upvotes: 0

Mark
Mark

Reputation: 568

Problem solved:

When using Google App Engine SDK:

java.util.logging.Logger log = java.util.logging.Logger.getLogger("Test");
log.severe("severe");

works fine in the Console and on the Google server.

When using Google Web Toolkit:

java.util.logging.Logger log = java.util.logging.Logger.getLogger("Test");
log.severe("severe");

works in the server part and outputs to the console.
For the client part include

<inherits name="com.google.gwt.logging.Logging"/>

in (modulename).gwt.xml and (using the same logging command) it will output to the console and a small window in the browser.

But no technique works in onModuleLoad(). This seems to be a blind area.

When using GAE+GWT: the same as GWT alone.

Problem why I didn't see anything: trying in onModuleLoad and/or not restarting the hosting server correctly I think.
Thanks to Boris for hinting in the right direction.
Also see GWT logging setup and http://code.google.com/webtoolkit/doc/latest/DevGuideLogging.html

Upvotes: 3

zacheusz
zacheusz

Reputation: 8842

  1. Check imports. Are you using import java.util.logging.Logger; or is there sth else?
  2. Run this code from JavaSE main or JUnit and look at the console.

Upvotes: 0

Boris Daich
Boris Daich

Reputation: 2461

Check your eclipse launch configuration it may include something like

   -logLevel INFO 

Do you use GWT with this? if yes there are some issues with logging since they introduced revamped GWT logging...

last idea. clean instance of eclipse... take 3.7 install only google plugin see what happens. it works for the rest of us :-)

Upvotes: 0

Related Questions