How to I trace user login issues in Liferay Portal 6.0 and 6.1?

Overview

If you are facing Liferay Portal login issues (eg. unexpected user session timeouts, unexpected double login prompts), you can perform high level tracing by enabling logging in the primary request dispatcher (the Main Servlet).

For the following trace steps, we will use a Liferay Portal 6.1 + Tomcat bundle.

Trace Steps

Step 1 - Enable Main Servlet Logging

  • Login as admin user (i.e. user with Admin role).
  • Navigate to "Control Panel > Server Administration > Logging"
  • Add or update category "com.liferay.portal.servlet.MainServlet" with level DEBUG.
  • Logout as admin user.

Step 2 - Login as Test User

  • Login as test user (i.e. user exhibiting user session issues).

Step 3 - Review Apache Tomcat Logs

Step 3.1 - Sample Valid User Session

2013-06-19 11:44:16,392 DEBUG [http-bio-8080-exec-5][MainServlet:381] Process service request
2013-06-19 11:44:16,393 DEBUG [http-bio-8080-exec-5][MainServlet:401] Get company id
2013-06-19 11:44:16,393 DEBUG [http-bio-8080-exec-5][MainServlet:428] Set portal port
2013-06-19 11:44:16,394 DEBUG [http-bio-8080-exec-5][MainServlet:434] Check variables
2013-06-19 11:44:16,394 DEBUG [http-bio-8080-exec-5][MainServlet:443] Handle non-serializable request
2013-06-19 11:44:16,394 DEBUG [http-bio-8080-exec-5][MainServlet:447] Encrypt request
2013-06-19 11:44:16,394 DEBUG [http-bio-8080-exec-5][MainServlet:457] Protect request
2013-06-19 11:44:16,395 DEBUG [http-bio-8080-exec-5][MainServlet:463] Set principal
2013-06-19 11:44:16,395 DEBUG [http-bio-8080-exec-5][MainServlet:472] Authenticate user id 10196 and remote user 10196 2013-06-19 11:44:16,395 DEBUG [http-bio-8080-exec-5][MainServlet:480] Authenticated user id 10196
2013-06-19 11:44:16,395 DEBUG [http-bio-8080-exec-5][MainServlet:488] Set session thread local
2013-06-19 11:44:16,395 DEBUG [http-bio-8080-exec-5][MainServlet:494] Process service pre events
2013-06-19 11:44:16,408 DEBUG [http-bio-8080-exec-5][MainServlet:530] Call parent service
2013-06-19 11:44:16,803 DEBUG [http-bio-8080-exec-5][MainServlet:537] Process service post events

NOTE: The user id exists in this user session.

Step 3.2 - Sample Invalid User Session

2013-06-19 11:44:16,392 DEBUG [http-bio-8080-exec-5][MainServlet:381] Process service request
2013-06-19 11:44:16,393 DEBUG [http-bio-8080-exec-5][MainServlet:401] Get company id
2013-06-19 11:44:16,393 DEBUG [http-bio-8080-exec-5][MainServlet:428] Set portal port
2013-06-19 11:44:16,394 DEBUG [http-bio-8080-exec-5][MainServlet:434] Check variables
2013-06-19 11:44:16,394 DEBUG [http-bio-8080-exec-5][MainServlet:443] Handle non-serializable request
2013-06-19 11:44:16,394 DEBUG [http-bio-8080-exec-5][MainServlet:447] Encrypt request
2013-06-19 11:44:16,394 DEBUG [http-bio-8080-exec-5][MainServlet:457] Protect request
2013-06-19 11:44:16,395 DEBUG [http-bio-8080-exec-5][MainServlet:463] Set principal
2013-06-19 11:44:16,395 DEBUG [http-bio-8080-exec-5][MainServlet:472] Authenticate user id 0 and remote user null 2013-06-19 11:44:16,395 DEBUG [http-bio-8080-exec-5][MainServlet:480] Authenticated user id 0
2013-06-19 11:44:16,395 DEBUG [http-bio-8080-exec-5][MainServlet:488] Set session thread local
2013-06-19 11:44:16,395 DEBUG [http-bio-8080-exec-5][MainServlet:494] Process service pre events
2013-06-19 11:44:16,408 DEBUG [http-bio-8080-exec-5][MainServlet:530] Call parent service
2013-06-19 11:44:16,803 DEBUG [http-bio-8080-exec-5][MainServlet:537] Process service post events


NOTE: The user id is missing in this user session.

Step 4 - Disable Main Servlet Logging

After reviewing the logs, disable logging.

  • Login as admin user (i.e. user with Admin role).
  • Navigate to "Control Panel > Server Administration > Logging"
  • Update category "com.liferay.portal.servlet.MainServlet" with level INFO.
  • Logout as admin user.

Solution Checklist

  • Review DNS configuration for web servers when round-robin dispatch strategy is active.
  • Review DNS configuration for web servers (eg. Apache HTTPD).
  • Review session replication for load balancer, web servers or app servers, if user sessions are spanning nodes in a cluster.
  • Review Liferay Portal property "web.server.host" and ensure it matches the required web server name.
  • Add Liferay Portal property "web.server.display.node" to portal-ext.properties to review node name for active web server.
  • Review Liferay Portal session property "session.timeout".
  • Use HTTP traffic monitor (eg. Firefox + Live HTTP Headers plugin).