com.ibm.websphere.als
Class AnalysisLogger
- java.lang.Object
com.ibm.websphere.als.AnalysisLogger
Deprecated.
- public class AnalysisLogger
- extends java.lang.Object
flush
method at the
appropriate interval. Method getLogSize
may be used as a
determination criteria.
There are 3 persistent storage implementations: Database, File, and
HTTP. Use appropriate constructor to enable each one. The Database
persistence is implemented by DatabaseLogger
class. The application
is responsible for setting up the database and the table as defined by
the DatabaseLogger
class. This class works with any database
supports JDBC. The File persistence is implemented by FileLogger
class.
FileLogger
is not clusterable; that is, it must be defined on
all machines participating in a cluster. The HTTP persistence is implemented
by HttpLogger
class. It supports both HTTP and HTTPS transport.
However, HTTPS is not recommended if the traffic volume is high.
Application may define custom-logger by implementing the interface Logger. To enable debug trace, set com.ibm.websphere.als.*=all=enabled.
Sample usage for IBM DB2: DatabaseLogger dblogger = new DatabaseLogger(ds, "CURRENT TIMESTAMP", "WAS.ALS", "db2admin", "db2admin"); AnalysisLogger logger = new AnalysisLogger(context, dblogger); ... logger.log(request, "sample=testing;");
Field Summary
Modifier and Type | Field and Description |
---|---|
|
myTracer
Deprecated.
|
Constructor Summary
Constructor and Description |
---|
AnalysisLogger(javax.servlet.ServletContext sc,Logger l)
Deprecated. Constructs an AnalysisLogger object with the default cache size
of 50 entries.
|
AnalysisLogger(javax.servlet.ServletContext sc,Logger l,int maxBufferSize)
Deprecated. Constructs an AnalysisLogger object.
|
Method Summary
Modifier and Type | Method and Description |
---|---|
|
debug(java.lang.Exception e)
Deprecated.
|
|
flush()
Deprecated. Flushes the data in the cache.
|
|
getAppID()
Deprecated. Returns the current application ID.
|
|
getAutoSession()
Deprecated. Returns the auto-create session flag.
|
|
getCookieLogging()
Deprecated. Returns the COOKIE logging flag.
|
|
getHttpLogging()
Deprecated. Returns the HTTP logging flag.
|
getLogger()
Deprecated. Returns the current Logger object.
|
|
|
getLogSize()
Deprecated. Returns the number of log entries currently in the buffer
awaiting to be written to the permanent storage.
|
|
isEnabled()
Deprecated. Returns the logging enabled flag.
|
|
log(javax.servlet.http.HttpServletRequest hsr,java.lang.String data)
Deprecated. Logs the specified data.
|
|
log(javax.servlet.http.HttpServletRequest hsr,java.lang.String key,java.lang.String value)
Deprecated. Logs the specified data.
|
|
setAppID(java.lang.String appID)
Deprecated. Sets the application ID.
|
|
setAutoSession(boolean value)
Deprecated. Sets the auto-create session flag to
value .
|
|
setCookieLogging(boolean value)
Deprecated. Sets the COOKIE logging flag to
value .
|
|
setEnabled(boolean value)
Deprecated. Sets the logging enabled flag to
value .
|
|
setHttpLogging(boolean value)
Deprecated. Sets the HTTP logging flag to
value .
|
|
terminate()
Deprecated. Stops logging and releases all associated resources.
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail
myTracer
- protected static com.ibm.ejs.ras.TraceComponent myTracer
Constructor Detail
AnalysisLogger
- public AnalysisLogger(javax.servlet.ServletContext sc,
- Logger l)
sc
- a ServletContext of the webapp requesting the
logging. If this param is null, flusing the cache
is done as part of log() invocation. This behavior
is necessary for EJB logging. l
- a Logger responsible for writing data to persistent
storage AnalysisLogger
- public AnalysisLogger(javax.servlet.ServletContext sc,
- Logger l,
- int maxBufferSize)
sc
- a ServletContext of the webapp requesting the
logging. If this param is null, flusing the cache
is done as part of log() invocation. This behavior
is necessary for EJB logging. l
- a Logger responsible for writing data to persistent
storage maxBufferSize
- a maximum number of entries cached in the buffer
before calling flush()
Method Detail
log
- public void log(javax.servlet.http.HttpServletRequest hsr,
- java.lang.String data)
- throws java.lang.Exception
maxBufferSize
specified in the constructor, or the time elapse since
last flush has been longer than a minute. The format
of the data is key=value;
. Note that the semicolon
is appended to the value automatically.
hsr
- - the HttpServletRequest of the request. If this param
is null, a unique sequence number is generated
for the REQID, and the session ID is zero data
- - a well-formated and semicolon-terminated string java.lang.Exception
- - thrown when unable to write data log
- public void log(javax.servlet.http.HttpServletRequest hsr,
- java.lang.String key,
- java.lang.String value)
- throws java.lang.Exception
maxBufferSize
specified in the constructor, or the time elapse since
last flush has been longer than a minute. The format
of the data is key=value;
. Note that the semicolon
is appended to the value automatically.
hsr
- - the HttpServletRequest of the request. If this param
is null, a unique sequence number is generated
for the REQID, and the session ID is zero key
- - the key of the data value
- - the value of the data java.lang.Exception
- - thrown when unable to write data flush
- public void flush()
- throws java.lang.Exception
setEnabled
- public void setEnabled(boolean value)
value
. This is a
convenient way for the application to turn logging on or off.
The default value is true
.
value
- - value to set enable flag to isEnabled
- public boolean isEnabled()
setHttpLogging
- public void setHttpLogging(boolean value)
value
. Application
should turn off HTTP logging if it is not needed. If this
flag is off, the HttpData field that is logged will be null.
The default value is true
.
value
- - value to set HTTP logging flag to getHttpLogging
- public boolean getHttpLogging()
setCookieLogging
- public void setCookieLogging(boolean value)
value
. Application
should turn off COOKIE logging if it is not needed. If this
flag is false, the COOKIE field that is logged will be null.
The default value is true
.
value
- - value to set COOKIE logging flag to getCookieLogging
- public boolean getCookieLogging( )
setAutoSession
- public void setAutoSession(boolean value)
value
. If this
flag is true and if the session object doesn't exist for a request,
a session object will be automatically created before processing
logging for that request. The default value is true
.
If the application doesn't track session and auto-create is true,
the log
method should be called at least once before
any output is written to the response object
value
- - value to set auto-create session flag to getAutoSession
- public boolean getAutoSession()
getLogger
- public Logger getLogger()
setAppID
- public void setAppID(java.lang.String appID)
appID
- - a String representing the application ID, limited
to 128 characters getAppID
- public java.lang.String getAppID( )
getLogSize
- public int getLogSize()
terminate
- public void terminate()
debug
- public static void debug(java.lang.Exception e)