/*
* Copyright 2001 Sun Microsystems, Inc. All rights reserved.
* PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
*/
package com.sun.portal.desktop.taglib.providerContext;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import javax.servlet.jsp.JspException;
import com.sun.portal.log.common.PortalLogger;
import com.sun.portal.providers.context.ProviderContext;
import com.sun.portal.desktop.context.ContextException;
import com.sun.portal.desktop.taglib.DesktopTaglibException;
/**
* This tag is deprecated.
* @deprecated
*/
public class LogMessageTag
extends BaseProviderContextTagSupport
{
private Object m_value = null;
private Throwable m_throwable = null;
private static Logger logger = PortalLogger.getLogger(LogMessageTag.class);
public void setValue( String value )
throws DesktopTaglibException
{
m_value = resolveParameter( value );
}
public void setThrowable( String throwable )
throws DesktopTaglibException
{
Object t = resolveParameter( throwable );
if( t instanceof Throwable ) {
m_throwable = (Throwable)t;
} else {
throw new DesktopTaglibException( DesktopTaglibException.INVALID_PARAMETER, throwable );
}
}
public int doStartTag() throws JspException {
if( m_throwable != null ) {
if(logger.isLoggable(Level.FINER)) {
LogRecord logRecord = new LogRecord(Level.FINER, m_value.toString());
logRecord.setThrown(m_throwable);
}
} else {
logger.finer(m_value.toString());
}
return SKIP_BODY;
}
}
|