Export logs using UTF-8 (#1028)

This commit is contained in:
Glavo 2021-09-12 15:25:54 +08:00 committed by GitHub
parent eebd373aef
commit beea7d0ae2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,6 +20,7 @@ package org.jackhuang.hmcl.util;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -27,7 +28,6 @@ import java.util.Date;
import java.util.logging.*; import java.util.logging.*;
/** /**
*
* @author huangyuhui * @author huangyuhui
*/ */
public final class Logging { public final class Logging {
@ -63,6 +63,11 @@ public final class Logging {
flush(); flush();
} }
}; };
try {
streamHandler.setEncoding("UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
streamHandler.setLevel(Level.ALL); streamHandler.setLevel(Level.ALL);
LOG.addHandler(streamHandler); LOG.addHandler(streamHandler);
} }