Monitoring hook usage information

This hook displays Liferay's basic monitoring information at the bottom of every page (if you configure Liferay to display this information).

By default Liferay would embed information similar to this as an HTML comment at the end of each page - this is nice for environments where you don't want to see this, but might be hard to use in test environments (where you want to see the information during your tests)

The output looks like this:

Name Namespace Description Duration User Status URL/DisplayName Timeout/Portlet Id Attributes Type
103 c.l.m.Portlet null 0 null SUCCESS Tags Compiler 103   RENDER
56 c.l.m.Portlet null 36 null SUCCESS Journal Content 56_INSTANCE_JaLJR3MQtAYm   RENDER
101 c.l.m.Portlet null 130 null SUCCESS Asset Publisher 101_INSTANCE_0BVmhEtIm8dR   RENDER
/h/c/t/portal.jsp c.l.m.Portal Portal Request 629 null SUCCESS .../portal.jsp.jsp_display -1

(Note: There are some abbreviations to shorten the display - hover your mouse over them to see them in detail)

Not much work has been done to make this beautiful or functionally advanced - this is just the basic information that's available with the following configuration (changes to default in bold) in your portal-ext.properties:

##
## Spring
##

    #
    # Input a list of comma delimited Spring configurations. These will be
    # loaded after the bean definitions specified in the contextConfigLocation
    # parameter in web.xml.
    #
    # Note that there is a special case for hibernate-spring.xml and
    # jpa-spring.xml. Even though both files are specified, only one will
    # actually load at runtime based on the property "persistence.provider".
    #
    spring.configs=\
        META-INF/base-spring.xml,\
        \
        META-INF/hibernate-spring.xml,\
        META-INF/infrastructure-spring.xml,\
        META-INF/management-spring.xml,\
        \
        META-INF/util-spring.xml,\
        \
        META-INF/jpa-spring.xml,\
        \
        META-INF/executor-spring.xml,\
        \
        META-INF/audit-spring.xml,\
        META-INF/cluster-spring.xml,\
        META-INF/editor-spring.xml,\
        META-INF/jcr-spring.xml,\
        META-INF/ldap-spring.xml,\
        META-INF/messaging-core-spring.xml,\
        META-INF/messaging-misc-spring.xml,\
        META-INF/mobile-device-spring.xml,\
        META-INF/notifications-spring.xml,\
        META-INF/poller-spring.xml,\
        META-INF/rules-spring.xml,\
        META-INF/scheduler-spring.xml,\
        META-INF/scripting-spring.xml,\
        META-INF/search-spring.xml,\
        META-INF/workflow-spring.xml,\
        \
        META-INF/counter-spring.xml,\
        META-INF/mail-spring.xml,\
        META-INF/portal-spring.xml,\
        META-INF/portlet-container-spring.xml,\
        META-INF/staging-spring.xml,\
        META-INF/virtual-layouts-spring.xml,\
         \
        #META-INF/dynamic-data-source-spring.xml,\
        #META-INF/shard-data-source-spring.xml,\
        #META-INF/memcached-spring.xml,\
        META-INF/monitoring-spring.xml,\
        \
        META-INF/ext-spring.xml

##
## Monitoring
##

    #
    # Configure the appropriate level for monitoring Liferay.
    # Valid values are: HIGH, LOW, MEDIUM, OFF.
    #
    monitoring.level.com.liferay.monitoring.Portal=HIGH
    monitoring.level.com.liferay.monitoring.Portlet=HIGH

    #
    # Set this to true to store data samples of the current request as a thread
    # local variable. This allows you to obtain each request's statistics for
    # further processing
    #
    monitoring.data.sample.thread.local=true

    #
    # Set this to true to monitor portal requests.
    #
    monitoring.portal.request=true

    #
    # Set this to true to monitor portlet action requests.
    #
    monitoring.portlet.action.request=true

    #
    # Set this to true to monitor portlet event requests.
    #
    monitoring.portlet.event.request=true

    #
    # Set this to true to monitor portlet render requests.
    #
    monitoring.portlet.render.request=true
 
    #
    # Set this to true to monitor portlet resource requests.
    #
    monitoring.portlet.resource.request=true

    #
    # Set this to true to show data samples at the bottom of each portal page.
    # In order for data to show, the property
    # "monitoring.data.sample.thread.local" must be set to true.
    #
    monitoring.show.per.request.data.sample=true
	

As always, when you change your portal-ext.properties in Liferay, remember that you need to restart your server.

Extension ideas

History & Feedback

The idea for this plugin came when I prepared my "Well Hidden Features of Liferay" presentation that you can listen to on Radio Liferay. As you can see there, the actual appearance of the HTML comments that Liferay embeds by default is quite hard to read, but in some cases the information will be quite useful.

Let me know what you think, either at the blogpost introducing this plugin or on twitter: @olafk