Skip to content

Commit

Permalink
LPS-31363 Logging refactoring in AutoLoginFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
Mate Thurzo authored and brianchandotcom committed Dec 7, 2012
1 parent 8d85c5d commit 2599ed4
Showing 1 changed file with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.liferay.portal.kernel.servlet.ProtectedServletRequest;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.InstancePool;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.model.User;
Expand Down Expand Up @@ -219,23 +220,24 @@ protected void processFilter(
}
}
catch (Exception e) {
if (_log.isWarnEnabled()) {
_log.warn(e, e);
}

String currentURL = PortalUtil.getCurrentURL(request);

StringBundler sb = new StringBundler(4);

sb.append("Current URL ");
sb.append(currentURL);
sb.append(" generates exception: ");
sb.append(e.getMessage());

if (currentURL.endsWith(_PATH_CHAT_LATEST)) {
if (_log.isWarnEnabled()) {
_log.warn(
"Current URL " + currentURL +
" generates exception: " + e.getMessage());
_log.warn(sb.toString());
}
}
else {
_log.error(
"Current URL " + currentURL +
" generates exception: " + e.getMessage());
if (_log.isErrorEnabled()) {
_log.error(sb.toString());
}
}
}
}
Expand Down

0 comments on commit 2599ed4

Please sign in to comment.