⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 elog.java

📁 一个Mp3在线搜索器
💻 JAVA
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package biz.tbuy.huliqing.jloading;import java.io.File;import java.io.FileWriter;import java.io.IOException;import java.text.SimpleDateFormat;import java.util.Date;/** * * @author huliqing */public class Elog {    public Elog() {    }      public static void log(String message) {        try {            File logPath = new File("logs");            if (!logPath.exists()) {                logPath.mkdirs();            }            Date theDate = new Date();            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");            String fileName = "log" + sdf.format(theDate) + ".txt";            sdf.applyPattern("HH:mm:ss");            String nowTime = sdf.format(theDate);            File logFile = new File(logPath, fileName);            FileWriter fw = null;                    fw = new FileWriter(logFile, true);            fw.write("Log:[" + nowTime + "]");            fw.write(message + "\r\n");            fw.flush();            fw.close();        } catch (IOException ioe) {            //System.out.println("Elog:log:I/O Error");        }     }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -