org.hd.d.pg2k.webSvr.util
Class WebUtils.ServletLogger
java.lang.Object
org.hd.d.pg2k.webSvr.util.WebUtils.ServletLogger
- All Implemented Interfaces:
- SimpleLoggerIF
- Enclosing class:
- WebUtils
public static final class WebUtils.ServletLogger
- extends java.lang.Object
- implements SimpleLoggerIF
Simple class to allow logging to the given servlet's log().
This holds only a WeakReference to the ServletContext
so as not to obstruct GC when all strong refs go away.
Stops logging when the referent becomes null.
|
Field Summary |
private java.lang.ref.WeakReference<javax.servlet.ServletContext> |
ctxtWR
Weak ref to servlet context; never null but the referent may be. |
|
Method Summary |
void |
log(java.lang.String message)
Log the given message. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ctxtWR
private volatile java.lang.ref.WeakReference<javax.servlet.ServletContext> ctxtWR
- Weak ref to servlet context; never null but the referent may be.
WebUtils.ServletLogger
public WebUtils.ServletLogger(javax.servlet.ServletContext ctxt)
log
public void log(java.lang.String message)
- Log the given message.
If the weak reference to the context has died
the log output is silently discarded.
- Specified by:
log in interface SimpleLoggerIF
Copyright (c) 1996-2009, Damon Hart-Davis. All rights reserved.