01: /*
02: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05: package com.sun.portal.desktop.taglib.providerContext;
06:
07: import java.util.logging.Level;
08: import java.util.logging.LogRecord;
09: import java.util.logging.Logger;
10:
11: import javax.servlet.jsp.JspException;
12:
13: import com.sun.portal.log.common.PortalLogger;
14: import com.sun.portal.providers.context.ProviderContext;
15:
16: import com.sun.portal.desktop.context.ContextException;
17: import com.sun.portal.desktop.taglib.DesktopTaglibException;
18:
19: /**
20: * This tag is deprecated.
21: * @deprecated
22: */
23:
24: public class LogMessageTag extends BaseProviderContextTagSupport {
25: private Object m_value = null;
26: private Throwable m_throwable = null;
27: private static Logger logger = PortalLogger
28: .getLogger(LogMessageTag.class);
29:
30: public void setValue(String value) throws DesktopTaglibException {
31: m_value = resolveParameter(value);
32: }
33:
34: public void setThrowable(String throwable)
35: throws DesktopTaglibException {
36: Object t = resolveParameter(throwable);
37: if (t instanceof Throwable) {
38: m_throwable = (Throwable) t;
39: } else {
40: throw new DesktopTaglibException(
41: DesktopTaglibException.INVALID_PARAMETER, throwable);
42: }
43: }
44:
45: public int doStartTag() throws JspException {
46: if (m_throwable != null) {
47: if (logger.isLoggable(Level.FINER)) {
48: LogRecord logRecord = new LogRecord(Level.FINER,
49: m_value.toString());
50: logRecord.setThrown(m_throwable);
51: }
52: } else {
53: logger.finer(m_value.toString());
54: }
55: return SKIP_BODY;
56: }
57: }
|