【发布时间】:2014-01-18 07:22:53
【问题描述】:
testlog.java:
import java.util.logging.Logger;
public class testlog {
private final static Logger log = Logger.getLogger(testlog.class.getName());
public static void main(String[] args) {
System.setProperty("java.util.logging.SimpleFormatter.format","[%1$tF %1$tT]:%4$s:(%2$s): %5$s%n");
log.info("logging test");
}
}
执行:
$ java testlog
[2014-01-18 11:08:51]:INFO:(testlog main): logging test
testlog.groovy:
import java.util.logging.Logger;
public class testlog {
private final static Logger log = Logger.getLogger("testlog");
public static void main(String[] args) {
System.setProperty("java.util.logging.SimpleFormatter.format",'[%1$tF %1$tT]:%4$s:(%2$s): %5$s%n');
log.info("logging test");
}
}
执行:
$ groovy testlog
[2014-01-18 11:11:23]:INFO:(java_util_logging_Logger$info call): logging test
如何为类/方法名配置 groovy 而不是“java_util_logging_Logger$info call”?
【问题讨论】:
-
感谢您向我展示我需要的格式!
标签: logging groovy java.util.logging