2 Replies Latest reply: Apr 19, 2007 6:07 AM by 807606 RSS

    how to create and manage the log file

    807606
      Hi,

      I want to trace and debug the program process.
      I write the code for creating log file and debugging the process.
      But i am not able get the result.

      please help me how to create and manage the log file.

      Here i post sample program
      --------------------------------------------
      package Src;
      
      import java.io.*;
      import org.apache.log4j.*;
      import java.util.logging.FileHandler;
      
      public class Mylog
       {
           private static final Logger log = Logger.getLogger("Mylog.class");
           public static void main(String[] args) throws Exception {
           try {
             // Create an appending file handler
              boolean append = true;
              FileHandler handler = new FileHandler("debug.log", append);
              
              // Add to the desired logger
              Logger logger = Logger.getLogger("com.mycompany");
              System.out.println("after creating log file");     
                  }
                catch (IOException e)
                {
                     System.out.println("Sys Err");
                }     
              }
      Please give the your valuable suggesstion... !

      Thanks
      MerlinRoshina