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();
}
}