2

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:

  • appengine-web.xml has <property name="java.util.logging.config.file" value="WEB-INF/logging.properties" />
  • I also moved logging.properties to the subfolder "classes" and adjusted the settings (saw this as an idea in another question)
  • logging.properties contains only ".level = ALL"
  • on the server changed the minimum log level but still no logs ("Error" is the default level, set it to "Debug")
  • deployed many times
  • let it sit one day
  • checked the deployed version online
  • checked the multiple "Console" windows
  • googled for hours

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

Mark
  • 520
  • 1
  • 7
  • 21
  • there is a typo System.out.println("out"); System.out.println("err"); They are both System.out :-). Not that this solves anything... – Boris Daich Jul 13 '11 at 05:15

4 Answers4

3

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

Community
  • 1
  • 1
Mark
  • 520
  • 1
  • 7
  • 21
0

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

PrintWriter out;

lanzalibre
  • 321
  • 2
  • 7
0
  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.
zacheusz
  • 8,750
  • 3
  • 36
  • 60
  • 1
    1. yes, it's java.util.logging.Logger. 2. I found it out now, it was s.t. with GWT, I will write up an answer. Thanks for trying to help! – Mark Jul 13 '11 at 22:11
0

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 :-)

Boris Daich
  • 2,431
  • 3
  • 23
  • 27
  • - eclipse launch: I start the eclipse.exe directly - GWT: yes, using it. what could I do there? - fresh install: I did that with 3.6, didn't help – Mark Jul 13 '11 at 08:05
  • Thanks for the hint to GWT, it had to do with that, I will write up an answer. Or should I mark your answer as correct so you get some points (first stackoverflow question for me). But where do I write the complete detailed answer then? – Mark Jul 13 '11 at 22:12
  • you welcome. That is OK. stackoverflow is about the right answer to any weird question points are side effect :-) – Boris Daich Jul 18 '11 at 09:15