Details
-
Improvement
-
Resolution: Unresolved
-
None
-
1.7.x
-
None
-
Operating System: Windows NT
Platform: PC
-
enhancement
-
P5
-
326
Description
I define a Java Object: LogHelper, use it wrapper the logger operations, the main codes as follow:
private final Logger logger;
protected LogHelper(Class clazz)
{ this.logger = LoggerFactory.getLogger(clazz); } public void info(String msg) {
if (logger.isInfoEnabled())
}
...
Then when i want to record log use LogHelper replace Logger, code as follow:
private static final LogHelper LOG = LogHelper.create(Activity.class);
In the log file can not get the current Class name(Activity class),
always get LogHelper class name, the log content look like:
2014-11-28 14:39:15 xxx.infrastructure.log.LogHelper:89 - lisz|Start to generate [2014-10] Attendance-Report...
the log appender configuration is:
<appender name="SchedulerAppender" class="ch.qos.logback.core.FileAppender">
<file>../logs/xxx_scheduler.log</file>
<append>true</append>
<encoder>
<pattern>%d
%class:%line - %msg%n</pattern>
</encoder>
</appender>
We expect the %class is Activity class, not LogHelper class, but it is failed.