我有自定义记录器类 mycust.log.LoggerLog4j.java
,每当我想记录我将使用的任何消息时,如Log.info("Some Message")
。假设我在方法com/TestLog.java
中10
行的printLogTest()
处写了这一行。
当前日志:
2013-10-30 16:32:50,528 INFO [main] [45:mycust.log.LoggerLog4j.java][log] - Some Message
预期日志:
2013-10-30 16:32:50,528 INFO [main] [10:com.TestLog.java][printLogTest] - Some Message
Log4j.properties条目:
log4j.appender.file.layout.ConversionPattern=%d{ISO8601} %-5p [%t] [%L:%C.%F][%M] - %m%n
Log4j版本:
`log4j-1.2.14.jar`
LoggerLog4j.java:
private static void log(Priority p, Object o, Throwable t) {
try {
Logger logger = org.apache.log4j.Logger.getLogger(this.className);
logger.log(p, o, t);
} catch (Exception e) {
// Logged to sys to avoid infinite cycle
e.printStackTrace();
}
}