提供现成的java日志类,100分。。。。。。。。。。。。。 什么要求呀!log4j包是实现日至的,你可以看看! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 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(); } } }} log4jcommons-logging多的是啊 详细请看tomcat 4.1.30代码看:org.apache.catalina.logger 包里面吧,告诉你怎么写日志。 哪位大神可不可以给我讲一下继承abstract怎么用的啊? 关于鼠标的问题 请问怎样将数据库access中的数据读入到vector中,并且打印出来? 单元测试中的错误 帮帮忙啊!!超级简单的问题,在线等. 急需!字符过虑 关于jTree的时时更新问题!在线等~! 如何让JAR发布的程序在系统启动时自动运行? 请大家推荐一条适合本人的JAVA学习路线,和参考书籍! Java socket作为客户端连接mina server(银联多渠道离线仿真模拟器) 初学者小问:关于重抛异常的问题 简单问题:散分100.请教各位大侠有关包的程序的调试,希望各位不吝赐教!!~谢谢,在线等待
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();
}
}
}
}
commons-logging
多的是啊