<html>
<head>
<base href="http://bugzilla.slf4j.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Priority</th>
<td>P5
</td>
</tr>
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Get wrong %class content in wrapper class"
href="http://bugzilla.slf4j.org/show_bug.cgi?id=326">326</a>
</td>
</tr>
<tr>
<th>Assignee</th>
<td>slf4j-dev@qos.ch
</td>
</tr>
<tr>
<th>Summary</th>
<td>Get wrong %class content in wrapper class
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Reporter</th>
<td>monkeyk1987@gmail.com
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Version</th>
<td>1.7.x
</td>
</tr>
<tr>
<th>Component</th>
<td>jul-to-slf4j
</td>
</tr>
<tr>
<th>Product</th>
<td>SLF4J
</td>
</tr></table>
<p>
<div>
<pre>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()) {
logger.info(currentUser() + LOG_DELIMITER + msg);
}
}
...
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{yyyy-MM-dd HH:mm:ss} %class:%line - %msg%n</pattern>
</encoder>
</appender>
We expect the %class is Activity class, not LogHelper class, but it is failed.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>