10-Dec-04 (Created: 10-Dec-04) | More in 'Howto-Advanced'

How to log messages from your JSP page?

Import the following at the top of your jsp page


<%@ page import="com.ai.application.utils.AppObjects" %>

Logging classified messages

Then you can log classified messages as follows


<%
AppObjects.info("your-jsp-page-name","some message");
AppObjects.warn("your-jsp-page-name","some message");
AppObjects.trace("your-jsp-page-name","some message");
AppObjects.error("your-jsp-page-name","some message");
%>

Logging any unclassified message


<%
AppObjects.log("Any message goes here");
%>

Logging exceptions


<%
try
{
   //somethign
} 
catch(SomeException x)
{
	AppObjects.log("Error:some exception",x);
	//Rethrow if you have to
}
%>