
For larger projects, tracing is vital. Smaller projects can get away
with printing to stderr for debugging or stepping through statements.
Larger projects need to have tracing in place before debugging. When
debugging, you turn on the tracing. When you deploy the application,
you turn off the tracing.
In Resin, logging is just another stream, similar to the familiar
print writer. It's enabled by the configuration file. Using the
following idiom adds tracing with essentially no performance penalty.
<%@ page import='com.caucho.vfs.*' %>
<%!
static WriteStream dbg = LogStream.open("/foo.com/jsp");
%>
<%
if (dbg.canWrite())
dbg.log("starting page");
%>
|
When you run this, nothing will get logged until the configuration
file enables '/foo.com/test'. You could also enable '/foo.com' to
get all logging from foo.com.
Here's the configuration file for logging to a log file in log/foo.log.
<caucho.com>
<log id='/foo.com/jsp' href='log/foo.log'/>
<http-config>
...
</http-config>
</caucho.com>
|
href can be any VFS path known to Resin. 'stderr:' will
log to the standard error.
Copyright © 1998-2002 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark,
and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc. |  |
|