Reputation: 1404
I tried to search for an answer for at least an hour, tried all the ways I could find but I can't make the damn thing to log anything from server code.
If I use System.out.println() in client classes, the console logs it just fine, but when I try the same in anything server-side, it just doesn't work!
Anyway, the test class is here: http://pastebin.com/e6XgeUuX
For example, I want to log the uploadsFolder value.
I've tried the following, and none of them worked (no output in Eclipse console, not in .gwt-log, nowhere):
System.out.println(uploadsFolder.getPath());
GWT.log(uploadsFolder.getPath());
log.info(uploadsFolder.getPath()); // by creating an ordinary java.util.Logger in the body of the class
What do I have to do to make it just log anything I want to log? Why doesn't even System.out.println() work??
I'm totally new to this nightmare so I'll need a thorough explanation, not just "read this".
P.S. I'm trying to make an image gallery with this; I've made the front-end, but now I'm trying to make it save the images on the disk, not in memory and for that I need to know if and where it creates the upload folder (I can't find any ways to find out the path of the war folder...)
Upvotes: 2
Views: 1767
Reputation: 192
None of these can be used when the code is compiled into JavaScript (GWT.log() is used for HostedMode logging). There is this library gwt-log that I've had a lot of success with before, it allows you to log to a file via RPC and many other options.
Upvotes: 0
Reputation: 7976
Have you tried this?
Logger logger = Logger.getLogger("NameOfYourLogger");
logger.log(Level.SEVERE, "this message should get logged");
This always works for me serverside, System.out.println("") also for that matter.
And perhaps there is something wrong with your uploadsFolder object, try appending something before it like:
logger.log("My Path for uploads:"+ uploadsFolder.getPath());
Upvotes: 2