You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Deepak Narayan (Jira)" <ji...@apache.org> on 2020/10/28 08:30:00 UTC
[jira] [Created] (LOG4J2-2953) Method name does not print correctly
Deepak Narayan created LOG4J2-2953:
--------------------------------------
Summary: Method name does not print correctly
Key: LOG4J2-2953
URL: https://issues.apache.org/jira/browse/LOG4J2-2953
Project: Log4j 2
Issue Type: Bug
Components: Appenders
Affects Versions: 2.13.3
Environment: Windows 10, Java 1.8.0_251
Reporter: Deepak Narayan
My log4j configuration has the following layout:
{code:java}
<Property name="appenderPatternLayout">YF:%d{yyyy-MM-dd HH:mm:ss.SSS}:%5p (%c{1}:%M) - %m%n</Property>
{code}
A log message was created by the method {color:#de350b}MIRunDashboardAction<T>.execute{color}. The FQCN of the class was {color:#de350b}com.hof.mi.web.action.MIRunDashboardAction{color}. The stack trace:
{noformat}
StackLocator.calcLocation(String) line: 186
StackLocatorUtil.calcLocation(String) line: 78
LoggerConfig.log(String, String, Marker, Level, Message, Throwable) line: 409
AwaitCompletionReliabilityStrategy.log(Supplier<LoggerConfig>, String, String, Marker, Level, Message, Throwable) line: 63
Logger.logMessage(String, Level, Marker, Message, Throwable) line: 153
Logger(Category).forcedLog(String, Priority, Object, Throwable) line: 388
Logger(Category).log(String, Priority, Object, Throwable) line: 499
YFAdvancedLogger.log(YFLogger$YFLogLevel, Object, Throwable, boolean) line: 39
YFAdvancedLogger(YFLogger).log(YFLogger$YFLogLevel, Object, Throwable) line: 145
YFAdvancedLogger(YFLogger).info(Object, Throwable) line: 113
YFAdvancedLogger(YFLogger).info(Object) line: 109
MIRunDashboardAction<T>.execute(YFActionMapper<T>, HttpServletRequest, HttpServletResponse) line: 73
MIFormBindingController(FormBindingSpringController<T>).handleDefault(T, BindingResult, RedirectAttributes, HttpServletRequest, HttpServletResponse) line: 109
MIFormBindingController.handle(MIForm, BindingResult, RedirectAttributes, HttpServletRequest, HttpServletResponse) line: 57 {noformat}
However, the method printed in the log was one level lower than the actual one.
{noformat}
YF:2020-10-28 19:26:54.231: INFO (MIRunDashboardAction:handleDefault) - [42] [4E353F83] [/RunDashboard.i4] MIRunDashboardAction entered{noformat}
I think the bug is in line 187 of StackLocator.calcLocation().
{code:java}
if (found && !fqcnOfLogger.equals(className)) {
return stackTrace[i]; // Should this have been i-1 ?
}
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)