张世豪
6 小时以前 a6077217e25f5804027194a5c2848e773eda1abd
src/dialog/Charulog.java
ÎļþÃû´Ó src/xitongshezhi/Charulog.java ÐÞ¸Ä
@@ -1,4 +1,4 @@
package xitongshezhi;
package dialog;
import java.io.*;
import java.text.SimpleDateFormat;
@@ -51,8 +51,9 @@
        File file = new File(LOG_FILE);
        
        if (file.exists()) {
            try (FileInputStream fis = new FileInputStream(file)) {
                props.load(fis);
            try (FileInputStream fis = new FileInputStream(file);
                 InputStreamReader isr = new InputStreamReader(fis, "UTF-8")) {
                props.load(isr);
            } catch (IOException e) {
                System.err.println("读取日志文件失败: " + e.getMessage());
            }
@@ -95,14 +96,14 @@
     * å†™å…¥æ—¥å¿—文件
     */
    private static void writeLogFile(Properties props) {
        try (FileOutputStream fos = new FileOutputStream(LOG_FILE)) {
        try (FileOutputStream fos = new FileOutputStream(LOG_FILE);
             OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8")) {
            // æ·»åŠ æ–‡ä»¶å¤´æ³¨é‡Š
            props.store(fos, "操作日志记录 - æœ€åŽæ›´æ–°: " + new Date());
            props.store(osw, "操作日志记录 - æœ€åŽæ›´æ–°: " + new Date());
        } catch (IOException e) {
            System.err.println("写入日志文件失败: " + e.getMessage());
        }
    }
    /**
     * èŽ·å–å½“å‰æ—¥å¿—è®°å½•æ•°é‡ï¼ˆç”¨äºŽæµ‹è¯•ï¼‰
     */