• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

GWT Logging

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
How can i write log message in a file (/WEB-INF/logs) in GWT? it seems log4j is not supported but then i wrote a servlet (to be loaded when application starts to load my custom "logging.properties"(from /WEB-INF/classes/logging.properties) file and load it into java.util.LogManager but i get below error

java.lang.NoClassDefFoundError: java.util.logging.LogManager is a restricted class. Please see the Google App Engine developer's guide for more details.

my point here is to write log messages into a file under /WEB-INF/logs.

Thanks,
Vikas.
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.

GWT is client side technology and WEB-INF/logs would indicate the server. Also Please see the Google App Engine developer's guide for more details indicates you are using GAE.
So what are you using exactly? GWT hosted on Tomcat or GWT with GAE?
 
Vikas Pandit
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Maneesh,
Thanks for your reply. actually i just started learning GWT and my whole point is to log all messages into file whether its on Entry point or on service/DAO layer the way we do in struts (control, service & DAO layer) on tomcat.

Thanks,
Vikas
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Like I mentioned GWT is client side and you cannot log to the server from your client. Thats the reason I asked you

So what are you using exactly? GWT hosted on Tomcat or GWT with GAE?



If you are using GWT+Tomcat or something similar you can use log4j in the usual way.
If you are using GAE as your back end check out https://developers.google.com/appengine/articles/logging
You might also want to check out https://developers.google.com/web-toolkit/doc/latest/DevGuideLogging

 
Vikas Pandit
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Maneesh,
So of an application is running in prod on tomcat and i want to see all my log messages then as per your last mail i should go for log4j?
What is the GWT standard for logging in prod to log client and server messages to file?
Also when i try to integrate log4j i get below error.

No source code is available for type org.apache.log4j.Logger; did you forget to inherit a required module?

Thanks,
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you check the links I posted, especially the second one?
 
Vikas Pandit
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes i did...i can understand all the logging what GWT supports but my question is how can i write all my logging messages to a File on client & server both side. Please share any example where i can write all log messages to a file.

IS IT POSSIBLE OR NOT, IN GWT???

Thanks,
Vikas
 
Vikas Pandit
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i wrote a simple program using java logging framework which i want to use in GWT to write log messages int file.

# The following creates two handlers
handlers=java.util.logging.ConsoleHandler, java.util.logging.FileHandler

# Set the default logging level for the root logger
.level=SEVERE
# log level for the "com.rst.example" package
com.maxima.level=INFO

# Set the default logging level
java.util.logging.ConsoleHandler.level=ALL
java.util.logging.FileHandler.level=INFO

# Set the default formatter
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter

# Specify the location and name of the log file
java.util.logging.FileHandler.pattern=C:/sample/log/log-test.log

java.util.logging.FileHandler.limit=50000
java.util.logging.FileHandler.append=true
java.util.logging.FileHandler.count=1

==========================
package com.maxima;
import java.util.logging.*;
import java.io.*;
public class TestLogeer{
static{
try{
File f = new File("C:\\sample\\log\\logging.properties");
System.out.println("File Exists\t"+f.exists());
LogManager.getLogManager().readConfiguration(new FileInputStream(f));
}catch(Exception e){
System.out.println("Exception\t"+e);
}
}
private static final Logger LOG = Logger.getLogger(TestLogeer.class.getName());
public TestLogeer(){
}
public void writeLog(){
LOG.info("First Message");
}
public static void main(String ar[]){
TestLogeer tl = new TestLogeer();
tl.writeLog();
}
}
 
Aaaaaand ... we're on the march. Stylin. Get with it tiny ad.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic