没有合适的资源?快使用搜索试试~ 我知道了~
对用户操作进行纪录,并写入日志
5星 · 超过95%的资源 需积分: 50 44 下载量 95 浏览量
2007-12-14
09:57:42
上传
评论 2
收藏 3KB TXT 举报
温馨提示
试读
4页
纯源代码,通过它可以实现用户对系统操作的纪录
资源推荐
资源详情
资源评论
package cn.tools;
import java.io.*;
import java.util.*;
public class LogWriter {
private static final String DefalutLogFilePathName="c:/logtext.log";//默认的日志文件的路径和文件名称
private static LogWriter logwriter; //该类的唯一的实例
private static InputStream fin; //属性配置文件的输入流
private static Properties pro; //class Properties´s supper is Hashtable class
private static PrintWriter out; //output stream
private static String logFileName; //output file name
private LogWriter() {
outInit();//init out put stream,实例化PrintWriter out 对象.
}
/**保存你想保存在日志文件中的信息,实现同步
* out put the message infomation
* @param message infomation
*/
public static synchronized void log(String message) {
if (logwriter == null || (out == null)){
logwriter = new LogWriter();
}
if (out != null) {
out.println(new java.util.Date() + ":" + message);
}
}
/**把异常信息保存在日志文件中,实现同步
* out put the Excetion infomation
* @param message infomation
*/
import java.io.*;
import java.util.*;
public class LogWriter {
private static final String DefalutLogFilePathName="c:/logtext.log";//默认的日志文件的路径和文件名称
private static LogWriter logwriter; //该类的唯一的实例
private static InputStream fin; //属性配置文件的输入流
private static Properties pro; //class Properties´s supper is Hashtable class
private static PrintWriter out; //output stream
private static String logFileName; //output file name
private LogWriter() {
outInit();//init out put stream,实例化PrintWriter out 对象.
}
/**保存你想保存在日志文件中的信息,实现同步
* out put the message infomation
* @param message infomation
*/
public static synchronized void log(String message) {
if (logwriter == null || (out == null)){
logwriter = new LogWriter();
}
if (out != null) {
out.println(new java.util.Date() + ":" + message);
}
}
/**把异常信息保存在日志文件中,实现同步
* out put the Excetion infomation
* @param message infomation
*/
资源评论
- mlxymlxy22013-12-05正是我需要的,不错,多谢分享
wang23713343
- 粉丝: 3
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于Python的PCA人脸识别算法的原理及实现代码详解+源码+详细代码解析+开发文档+数据(毕业设计&课程设计&项目开发)
- Decision tree20240105(1).ipynb
- zuoyezuoyezuoye
- zuoyezuoyezuoye
- 机械设计电机转子装配设备sw22非常好的设计图纸100%好用.zip
- 作业作业作业作业作业作业
- xdotool.c
- RLMD鲁棒性局部均值分解信号分量可视化(Matlab完整源码和数据)
- Screenshot_2024-04-26-17-17-26-36_9d26c6446fd7bb8e41d99b6262b17def.jpg
- 6.0版本超广角文件+教程使用MT管理器打-7.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功