please help me with this one. the file handler object I created gave me an
error;
FileHandler fh = new FileHandler("file.txt"); .can some one correct me?
public class MyLogToFileUsingFileHandler {
private static Logger logger = Logger.getLogger("loggerdemo");
private static Logger mylog = Logger.getLogger("myloggerdemo");
FileHandler fh = new FileHandler("file.txt");
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws Exception {
logger.addHandler(new FileHandler("MultipleHandlers.xml"));
mylog.addHandler(new FileHandler("myown.txt"));
mylog.info("starting operation");
mylog.setLevel(Level.ALL);
try{
System.out.println(3/0);
} catch(Exception e){
logger.log(Level.SEVERE,"dividing by 0");
}finally{
mylog.info("cant continue");
}
mylog.info("terminating");
}
}
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---