-
Type:
Bug
-
Status: Closed
-
Priority:
Trivial
-
Resolution: Fixed
-
Affects Version/s: liferay-faces-2.1.0-ga1, liferay-faces-3.0.0-legacy-ga1, liferay-faces-3.0.0-ga1, liferay-faces-3.1.0-ga1
-
Component/s: Liferay Faces Util
-
Labels:
com.liferay.faces.util.logging.LoggerDefaultImpl shows wrong caller method in JDK log. It takes place because of log() method of JDK logger use name of methos that has has called the JDK logger. So we can use simple fix by using LogRecord object.
com.liferay.faces.util.logging.LoggerDefaultImpl
public void info(String message, Object... arguments) {
if (isInfoEnabled())
{ Throwable throwable = getThrowable(arguments); this.doLog(java.util.logging.Level.INFO, formatMessage(message, arguments), throwable); }}
private void doLog(Level level, String message, Throwable thr)
{ Throwable stackStource = new Throwable(); StackTraceElement[] stackTrace = stackStource.getStackTrace(); StackTraceElement callerStack = stackTrace[2]; LogRecord logRecord = new LogRecord(level, message); if (thr==null) logRecord.setThrown(thr); logRecord.setSourceClassName(callerStack.getClassName()); logRecord.setSourceMethodName(callerStack.getMethodName()); logger.log(logRecord); }