首页>代码>java sqlserver数据库导入oracle实例工具>/sqlserverTooracle/src/getandset/AddLog.java
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package getandset;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Date;
import javax.swing.JOptionPane;


/**
 *
 * @author Administrator
 */
public class AddLog {

 public static void addlog(String error)//将错误信息写入日志
    {
        FileWriter fw=null;
        BufferedWriter bw=null;
        File logFile=null;
        String containt=(new Date()).toString()+"\t\t"+error;
        try {
            logFile = new File("datalog.zhoujian");
            if (!logFile.exists()) {
                logFile.createNewFile();//如果该日志文件不存在,则新建一个
            }
            fw=new FileWriter(logFile,true);//以追加的模式操作文件
            bw=new BufferedWriter(fw);
			bw.newLine();
                        bw.newLine();
			bw.write(containt);
			bw.close();
                fw.close();

        }
        catch (IOException ex) {
            JOptionPane.showMessageDialog(null,"写入日志文件出错!","严重警告",JOptionPane.ERROR_MESSAGE);
        }finally{

        }



    }
}
最近下载更多
Hachi6  LV13 2022年1月31日
占山为王7064  LV7 2021年12月31日
yangxuhao  LV1 2021年4月1日
lb1234  LV2 2021年3月18日
runs810  LV1 2021年1月29日
dongzhan  LV12 2020年12月9日
微量的记忆  LV10 2019年7月9日
安宇12345  LV15 2019年7月2日
gxd123  LV1 2019年6月25日
2585235446  LV2 2018年6月8日
最近浏览更多
siximu912  LV10 2023年7月14日
nurmamat001  LV2 2022年11月1日
lingqianjue  LV3 2022年4月27日
Hachi6  LV13 2022年1月31日
空心菜4  LV9 2022年1月12日
占山为王7064  LV7 2021年12月31日
knklan  LV8 2021年12月22日
BruceQ  LV14 2021年12月8日
yangsi1025yss  LV11 2021年11月29日
xiaokeimi01  LV15 2021年6月21日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友