testlog.java:如何在類/方法名稱的groovy中配置java.util.logging?
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
如何配置常規類/米ethod名稱而不是「java_util_logging_Logger $ info call」?
感謝我展示我所需要的格式! –