P. 1
Liferay Administration Guide

Liferay Administration Guide

|Views: 574|Likes:
Publicado pornicolargo
THE administration guide provided by Liferay
THE administration guide provided by Liferay

More info:

Published by: nicolargo on Oct 09, 2009
Direitos Autorais:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less






Liferay uses Log4j extensively to implement logging for nearly every class in the
portal. If you need to debug something specific while a system is running, you can use
the Control Panel to set logging levels by class dynamically.
To view the log levels, go to the Control Panel, click Server Administration in the
Server section, and then click the Log Levels tab.
You will then see a paginated list of logging categories. These categories corres-
pond to Liferay classes that have log messages in them. By default, all categories are
set to display messages only if there is an error that occurs in the class. This is why
you see ERROR displayed in all of the drop down list boxes on the right side of the

Each category is filtered by its place in the class hierarchy. For example, if you
wanted to see logging for a specific class that is registered in Liferay, you would
browse to that specific class and change its log level to something that is more de-
scriptive, such as DEBUG. Once you click the Save button at the bottom of the list, you

Liferay's Logging System


Maintaining A Liferay Portal

will start seeing DEBUG messages from that class in your application server's log file.
If you are not sure which class you want to see log messages for, you can find a
place higher up in the hierarchy and select the package name instead of an individual
class name. If you do this, messages for every class lower in the hierarchy will be dis-
played in your application server's log file.

Be careful when you do this. If you set the log level to DEBUG somewhere near
the top of the hierarchy (such as com.liferay, for example), you may wind up with a lot
of messages in your log file. This could make it difficult to find the one you were look-
ing for, and causes the server to do more work writing messages to its log file.
If you are working in the extension environment or have created a plugin and
want to set the log level for one of your own classes, you can register that class (so
long as it uses Log4J to do its logging) with Liferay so that you can control the log
levels more easily.

You will first need to implement Log4J logging in your class, with a statement
such as the following (taken from Liferay's JCRHook class):

private static Log _log = LogFactory.getLog(JCRHook.class);

You would then use this _log variable to create log messages in your code for the

various logging levels:

_log.error("Reindexing " + node.getName(), e1);

To enable your logging messages to appear in your server's log file via the Con-
trol Panel, click the Add Category tab on the same Log Levels page.
You will see that you can add a logging category. Simply put in the fully qualified
name of your class or of the package that contains the classes whose log messages you
want to view, choose a log level, and then click the Save button. You will now start to
see log messages from your own class or classes in the server's log file.


Liferay's Logging System

Illustration 89: Changing Logging Levels

Maintaining A Liferay Portal

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->