我尝试了以下方法:
File logFile = new File("performance.log");
FileAppender appender = new FileAppender(layout, logFile.getName() , false);
appender.setEncoding("UTF-8");
logger.addAppender(appender);
logger.setLevel((Level) Level.DEBUG);
logger.setAdditivity(false);
....
logger.info("Finished in " + (System.nanoTime() - start) / 1000 + " \u03BCs");
但它不能正确打印希腊语 mu char。如果我根据 log4j.properties 配置我的记录器,它会起作用