什么要求呀!
log4j包是实现日至的,你可以看看!

解决方案 »

  1.   

    package common;import java.io.*;
    import java.sql.*;public class Log {   public Log(){
       }   private static String filePath = "c:"+System.getProperty("file.separator")+"log.txt";   public void setFilePath( String str ){
           filePath = str;
       }   public static void write( String str ){
              File fl = new File( filePath );
              FileOutputStream fo = null;
              try{            if( !fl.exists() ) fl.createNewFile();            if( str == null ) str = "";            fo = new FileOutputStream( filePath, true );
                fo.write( Util.getNow(3).getBytes() );
                fo.write( 32 );
                fo.write( 32 );
                fo.write( str.getBytes() );
                fo.write( 13 );
                fo.write( 10 );          }catch( Exception e ){
                       e.printStackTrace();
              }finally{
                       if( fo != null )
                       try {
                             fo.close();
                     } catch (IOException e1) {
                             e1.printStackTrace();
                     }
              }
     }
    }
      

  2.   

    log4j
    commons-logging
    多的是啊
      

  3.   

    详细请看tomcat 4.1.30代码看:org.apache.catalina.logger 包里面吧,告诉你怎么写日志。