jstrachan 01/05/10 12:30:07
Modified: . build.xml
src/doc index.xml project.xml
Added: log build.xml
log/conf log.tld
log/doc/conf web.xml
log/doc/web changes.xml intro.xml log.html taglib.css
log/examples/conf web.xml
log/examples/web index.html test1.jsp test2.jsp test3.jsp
test4.jsp test5.jsp
log/lib log4j-core.jar
log/src/org/apache/taglibs/log DebugTag.java DumpTag.java
ErrorTag.java InfoTag.java LoggerTag.java
WarnTag.java
log/xml log.xml
Log:
The first checkin of Joseph Ottinger's log tag library. I've ported it over to the
jakarta-taglibs directory structure and build system. It seems to be working nicely.
(I made a small patch so that it works on WebLogic 6.0 SP1 too)
Revision Changes Path
1.26 +6 -2 jakarta-taglibs/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-taglibs/build.xml,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- build.xml 2001/05/05 18:24:50 1.25
+++ build.xml 2001/05/10 19:29:42 1.26
@@ -1,5 +1,5 @@
<!-- ANT Build Script for the JAKARTA-TAGLIBS Project -->
-<!-- $Id: build.xml,v 1.25 2001/05/05 18:24:50 jstrachan Exp $ -->
+<!-- $Id: build.xml,v 1.26 2001/05/10 19:29:42 jstrachan Exp $ -->
<project name="jakarta-taglibs" default="dist" basedir=".">
@@ -186,6 +186,10 @@
<ant dir="./xtags" target="dist"/>
</target>
+ <target name="log">
+ <ant dir="./log" target="dist"/>
+ </target>
+
<target name="ctlx">
<ant dir="./tools/UltraDev/4.0/ctlx" target="dist"/>
</target>
@@ -193,7 +197,7 @@
<!-- *********************** Overall Build Command ********************** -->
- <target name="dist"
depends="prepare,static,compile.documentation,bsf,input,jspspec,sql,utility,xsl,request,session,response,application,page,datetime,regexp,jndi,jdbc,scrape,mailer,i18n,io,xtags"/>
+ <target name="dist"
depends="prepare,static,compile.documentation,bsf,input,jspspec,sql,utility,xsl,request,session,response,application,page,datetime,regexp,jndi,jdbc,scrape,mailer,i18n,io,xtags,log"/>
<!-- *********************** Clean Command ****************************** -->
1.1 jakarta-taglibs/log/build.xml
Index: build.xml
===================================================================
<?xml version="1.0"?>
<!DOCTYPE project [
<!ENTITY common SYSTEM "file:../common.xml">
]>
<project name="log" default="main">
<property environment="env"/>
<property name="classpath" value="${env.SERVLET_JAR}:lib/log4j-core.jar" />
<property name="library.pre" value="library.pre"/>
<!-- =================================================================== -->
<!-- copy the dom4j and log4j jars into the examples lib dir -->
<!-- =================================================================== -->
<target name="library.pre" depends="gen-docs">
<copy todir="${build.examples}/WEB-INF/lib">
<fileset dir="lib" includes="*.jar"/>
</copy>
</target>
&common;
</project>
1.1 jakarta-taglibs/log/conf/log.tld
Index: log.tld
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>log</shortname>
<uri>/WEB-INF/log.tld</uri>
<tag>
<name>debug</name>
<tagclass>org.apache.taglibs.log.DebugTag</tagclass>
<attribute>
<name>category</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>message</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<name>info</name>
<tagclass>org.apache.taglibs.log.InfoTag</tagclass>
<attribute>
<name>category</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>message</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<name>warn</name>
<tagclass>org.apache.taglibs.log.WarnTag</tagclass>
<attribute>
<name>category</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>message</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<name>error</name>
<tagclass>org.apache.taglibs.log.ErrorTag</tagclass>
<attribute>
<name>category</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>message</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<name>dump</name>
<tagclass>org.apache.taglibs.log.DumpTag</tagclass>
<attribute>
<name>scope</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>
1.1 jakarta-taglibs/log/doc/conf/web.xml
Index: web.xml
===================================================================
<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<display-name>IO Taglib Documentation</display-name>
<description>HTML and Javadocs for the IO JSP tag library.</description>
<welcome-file-list>
<welcome-file>io.html</welcome-file>
</welcome-file-list>
</web-app>
1.1 jakarta-taglibs/log/doc/web/changes.xml
Index: changes.xml
===================================================================
<?xml version="1.0"?>
<document url="./changes.xml">
<properties>
<author>Joseph B. Ottinger</author>
<author>James Strachan</author>
<title>Log Tag Library: The Jakarta-Taglibs Project</title>
</properties>
<body>
<section name="Log Tag Library Revision History" href="Changes">
<p>Initial check into CVS from Joe's original code, ported to the Jakarta-Taglibs
directory structure and build process.
</p>
</section>
</body>
</document>
1.1 jakarta-taglibs/log/doc/web/intro.xml
Index: intro.xml
===================================================================
<?xml version="1.0"?>
<document url="./intro.xml">
<properties>
<author>Joseph B. Ottinger</author>
<author>James Strachan</author>
<title>Log Tag Library: Jakarta-Taglibs Project</title>
</properties>
<body>
<section name="Log Tag Library" href="Welcome">
<p>
The Log library allows you to embed logging calls in your JSP which can be
output to a variety of destinations thanks to the power of the
<a href="http://jakarta.apache.org/log4j/docs/index.html">log4j</a> project.
</p>
</section>
<section name="Documentation" href="Documentation">
<p>For more information about the Log Tag Library, look at the on-line
documentation:</p>
<ul>
<li>View the <a href="log.html">Log Taglib Documentation</a></li>
</ul>
<p>For information on how to use the distributions, look at the following
documentation:</p>
<ul>
<li>Using the Jakarta-Taglibs <a
href="http://jakarta.apache.org/taglibs/binarydist.html">Binary Distribution</a></li>
<li>Using the Jakarta-Taglibs <a
href="http://jakarta.apache.org/taglibs/sourcedist.html">Source Distribution</a></li>
</ul>
</section>
<section name="Download" href="Download">
<p>A binary download of the Log Tag Library is available</p>
<ul>
<li><strong>Download <a
href="http://jakarta.apache.org/builds/jakarta-taglibs/nightly/projects/io/">Log Tag
Library</a></strong></li>
</ul>
<p>The following distributions are also available for download:</p>
<ul>
<li>Download <a
href="http://jakarta.apache.org/builds/jakarta-taglibs/nightly/src/">Jakarta-Taglibs
Source</a></li>
<li>Download entire <a
href="http://jakarta.apache.org/builds/jakarta-taglibs/nightly">Jakarta-Taglibs
Distribution</a></li>
</ul>
</section>
<section name="Contributors" href="Contributors">
<p>List of contributors:</p>
<ul>
<li>Joseph B. Ottinger</li>
<li>James Strachan</li>
</ul>
</section>
</body>
</document>
1.1 jakarta-taglibs/log/doc/web/log.html
Index: log.html
===================================================================
<html>
<head>
<meta name="author" content="Joseph B. Ottinger">
<title>Jakarta Project: Log Tag Library</title>
<link type="text/css" href="taglib.css" rel="stylesheet">
</head>
<body>
<h1>Jakarta Project: Log Tag library</h1>
<h3 class="middle">Version: 1.0</h3>
<h3>Table of Contents</h3>
<a href="#overview">Overview</a>
<br>
<a href="#requirements">Requirements</a>
<br>
<a href="#config">Configuration</a>
<br>
<a href="#summary">Tag Summary</a>
<br>
<a href="#reference">Tag Reference</a>
<br>
<a href="#examples">Examples</a>
<br>
<a href="#javadocs">Javadocs</a>
<br>
<a href="#history">Revision History</a>
<br>
<a name="overview"></a>
<h3>Overview</h3>
<p>
The Log library allows you to embed logging calls in your JSP which can be
output to a variety of destinations thanks to the power of the
<a href="http://jakarta.apache.org/log4j/docs/index.html">log4j</a> project.
</p>
<a name="requirements"></a>
<h3>Requirements</h3>
<p>
This custom tag library requires a servlet container
that supports the JavaServer Pages Specification, version 1.1 or higher
together with a distribution of
<a href="http://jakarta.apache.org/log4j/docs/index.html">log4j</a>.
</p>
<a name="config"></a>
<h3>Configuration</h3>
<p>Follow these steps to configure your web application with this tag
library:</p>
<ul>
<li>Copy the tag library descriptor file to the /WEB-INF subdirectory
of your web application.</li>
<li>Copy the tag library JAR file to the /WEB-INF/lib subdirectory
of your web application.</li>
<li>Add a <taglib> element to your web application deployment
descriptor in /WEB-INF/web.xml like this:
<pre>
<taglib>
<taglib-uri>http://jakarta.apache.org/taglibs/log-1.0</taglib-uri>
<taglib-location>/WEB-INF/log.tld</taglib-location>
</taglib>
</pre>
</li>
</ul>
<p>To use the tags from this library in your JSP pages, add the following
directive at the top of each page: </p>
<pre>
<%@ taglib uri="http://jakarta.apache.org/taglibs/log-1.0" prefix="log" %>
</pre>
<p>where "<i>log</i>" is the tag name prefix you wish to use for tags
from this library. You can change this value to any prefix you like.</p>
<a name="summary"></a>
<h3>Tag Summary</h3>
<table summary="summary list of tags with short description of each.">
<tr>
<td><a href="#debug">debug</a></td><td>Displays a debug-level
message</td>
</tr>
<tr>
<td><a href="#info">info</a></td><td>Displays a info-level
message</td>
</tr>
<tr>
<td><a href="#warn">warn</a></td><td>Displays a warn-level
message</td>
</tr>
<tr>
<td><a href="#error">error</a></td><td>Displays a error-level
message</td>
</tr>
<tr>
<td><a href="#dump">dump</a></td><td>Displays all vars in the
specified scope</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
</table>
<a name="reference"></a>
<h3>Tag Reference</h3>
<table summary="This table is for visual formatting of tag reference
information." cellspacing="0" cellpadding="3" width="90%" border="0">
<tr>
<td colspan="2">
<table summary="name and tag library version availability of
tag." cellspacing="0" width="100%" bgcolor="#cccccc" border="0">
<tr>
<td><b><font size="+1"><a
name="debug">debug</a></font></b></td><td align="right">Availability: version 1.0</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">Displays a debug-level message</td>
</tr>
<tr>
<td width="2%"> </td><td width="98%">
<table summary="Tag class, tag name, script variable (if any),
and restrictions (if any)." width="100%" border="0">
<tr>
<td width="20%"><span class="tclass">Tag
Class</span></td><td width="80%">org.apache.taglibs.log.DebugTag</td>
</tr>
<tr>
<td width="20%"><span class="tbody">Tag
Body</span></td><td width="80%"></td>
</tr>
<tr>
<td width="20%"><span class="scriptvar">Script
Variable</span></td><td width="80%">No</td>
</tr>
<tr>
<td width="20%"><span
class="restrictions">Restrictions</span></td><td width="80%"></td>
</tr>
<tr>
<td width="20%"><span
class="attributes">Attributes</span></td><td width="80%"> </td>
</tr>
<tr>
<td width="20%"> </td><td width="80%">
<table summary="Tag attribute name, whether
required, and whether rtexprvalue allowed." width="100%" border="0">
<tr>
<td width="40%">Name</td><td
width="20%">Required</td><td width="40%">Runtime Expression Evaluation</td>
</tr>
<tr bgcolor="#cccccc">
<td width="40%"><b>category</b></td><td
width="20%">false</td><td width="40%">true</td>
</tr>
<tr>
<td colspan="3"></td>
</tr>
<tr bgcolor="#cccccc">
<td width="40%"><b>message</b></td><td
width="20%">false</td><td width="40%">true</td>
</tr>
<tr>
<td colspan="3"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" width="20%"><span
class="example">Example</span></td><td width="80%">
<ol>
<li>
<span class="comment"><%--
--%></span>
<br>
<p>
<pre>
<code>
<log:debug message="this is a message"/>
<log:debug category="foo.bar" message="this is a message"/>
<log:debug category="foo.bar">
this is a message
</log:debug>
</code>
</pre>
</p>
</li>
</ol>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table summary="This table is for visual formatting of tag reference
information." cellspacing="0" cellpadding="3" width="90%" border="0">
<tr>
<td colspan="2">
<table summary="name and tag library version availability of
tag." cellspacing="0" width="100%" bgcolor="#cccccc" border="0">
<tr>
<td><b><font size="+1"><a
name="info">info</a></font></b></td><td align="right">Availability: version 1.0</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">Displays a info-level message</td>
</tr>
<tr>
<td width="2%"> </td><td width="98%">
<table summary="Tag class, tag name, script variable (if any),
and restrictions (if any)." width="100%" border="0">
<tr>
<td width="20%"><span class="tclass">Tag
Class</span></td><td width="80%">org.apache.taglibs.log.InfoTag</td>
</tr>
<tr>
<td width="20%"><span class="tbody">Tag
Body</span></td><td width="80%"></td>
</tr>
<tr>
<td width="20%"><span class="scriptvar">Script
Variable</span></td><td width="80%">No</td>
</tr>
<tr>
<td width="20%"><span
class="restrictions">Restrictions</span></td><td width="80%"></td>
</tr>
<tr>
<td width="20%"><span
class="attributes">Attributes</span></td><td width="80%"> </td>
</tr>
<tr>
<td width="20%"> </td><td width="80%">
<table summary="Tag attribute name, whether
required, and whether rtexprvalue allowed." width="100%" border="0">
<tr>
<td width="40%">Name</td><td
width="20%">Required</td><td width="40%">Runtime Expression Evaluation</td>
</tr>
<tr bgcolor="#cccccc">
<td width="40%"><b>category</b></td><td
width="20%">false</td><td width="40%">true</td>
</tr>
<tr>
<td colspan="3"></td>
</tr>
<tr bgcolor="#cccccc">
<td width="40%"><b>message</b></td><td
width="20%">false</td><td width="40%">true</td>
</tr>
<tr>
<td colspan="3"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" width="20%"><span
class="example">Example</span></td><td width="80%">
<ol>
<li>
<span class="comment"><%--
--%></span>
<br>
<p>
<pre>
<code>
<log:info message="this is a message"/>
<log:info category="foo.bar" message="this is a message"/>
<log:info category="foo.bar">
this is a message
</log:info>
</code>
</pre>
</p>
</li>
</ol>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table summary="This table is for visual formatting of tag reference
information." cellspacing="0" cellpadding="3" width="90%" border="0">
<tr>
<td colspan="2">
<table summary="name and tag library version availability of
tag." cellspacing="0" width="100%" bgcolor="#cccccc" border="0">
<tr>
<td><b><font size="+1"><a
name="warn">warn</a></font></b></td><td align="right">Availability: version 1.0</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">Displays a warn-level message</td>
</tr>
<tr>
<td width="2%"> </td><td width="98%">
<table summary="Tag class, tag name, script variable (if any),
and restrictions (if any)." width="100%" border="0">
<tr>
<td width="20%"><span class="tclass">Tag
Class</span></td><td width="80%">org.apache.taglibs.log.WarnTag</td>
</tr>
<tr>
<td width="20%"><span class="tbody">Tag
Body</span></td><td width="80%"></td>
</tr>
<tr>
<td width="20%"><span class="scriptvar">Script
Variable</span></td><td width="80%">No</td>
</tr>
<tr>
<td width="20%"><span
class="restrictions">Restrictions</span></td><td width="80%"></td>
</tr>
<tr>
<td width="20%"><span
class="attributes">Attributes</span></td><td width="80%"> </td>
</tr>
<tr>
<td width="20%"> </td><td width="80%">
<table summary="Tag attribute name, whether
required, and whether rtexprvalue allowed." width="100%" border="0">
<tr>
<td width="40%">Name</td><td
width="20%">Required</td><td width="40%">Runtime Expression Evaluation</td>
</tr>
<tr bgcolor="#cccccc">
<td width="40%"><b>category</b></td><td
width="20%">false</td><td width="40%">true</td>
</tr>
<tr>
<td colspan="3"></td>
</tr>
<tr bgcolor="#cccccc">
<td width="40%"><b>message</b></td><td
width="20%">false</td><td width="40%">true</td>
</tr>
<tr>
<td colspan="3"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" width="20%"><span
class="example">Example</span></td><td width="80%">
<ol>
<li>
<span class="comment"><%--
--%></span>
<br>
<p>
<pre>
<code>
<log:warn message="this is a message"/>
<log:warn category="foo.bar" message="this is a message"/>
<log:warn category="foo.bar">
this is a message
</log:warn>
</code>
</pre>
</p>
</li>
</ol>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table summary="This table is for visual formatting of tag reference
information." cellspacing="0" cellpadding="3" width="90%" border="0">
<tr>
<td colspan="2">
<table summary="name and tag library version availability of
tag." cellspacing="0" width="100%" bgcolor="#cccccc" border="0">
<tr>
<td><b><font size="+1"><a
name="error">error</a></font></b></td><td align="right">Availability: version 1.0</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">Displays a error-level message</td>
</tr>
<tr>
<td width="2%"> </td><td width="98%">
<table summary="Tag class, tag name, script variable (if any),
and restrictions (if any)." width="100%" border="0">
<tr>
<td width="20%"><span class="tclass">Tag
Class</span></td><td width="80%">org.apache.taglibs.log.ErrorTag</td>
</tr>
<tr>
<td width="20%"><span class="tbody">Tag
Body</span></td><td width="80%"></td>
</tr>
<tr>
<td width="20%"><span class="scriptvar">Script
Variable</span></td><td width="80%">No</td>
</tr>
<tr>
<td width="20%"><span
class="restrictions">Restrictions</span></td><td width="80%"></td>
</tr>
<tr>
<td width="20%"><span
class="attributes">Attributes</span></td><td width="80%"> </td>
</tr>
<tr>
<td width="20%"> </td><td width="80%">
<table summary="Tag attribute name, whether
required, and whether rtexprvalue allowed." width="100%" border="0">
<tr>
<td width="40%">Name</td><td
width="20%">Required</td><td width="40%">Runtime Expression Evaluation</td>
</tr>
<tr bgcolor="#cccccc">
<td width="40%"><b>category</b></td><td
width="20%">false</td><td width="40%">true</td>
</tr>
<tr>
<td colspan="3"></td>
</tr>
<tr bgcolor="#cccccc">
<td width="40%"><b>message</b></td><td
width="20%">false</td><td width="40%">true</td>
</tr>
<tr>
<td colspan="3"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" width="20%"><span
class="example">Example</span></td><td width="80%">
<ol>
<li>
<span class="comment"><%--
--%></span>
<br>
<p>
<pre>
<code>
<log:error message="this is a message"/>
<log:error category="foo.bar" message="this is a message"/>
<log:error category="foo.bar">
this is a message
</log:error>
</code>
</pre>
</p>
</li>
</ol>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table summary="This table is for visual formatting of tag reference
information." cellspacing="0" cellpadding="3" width="90%" border="0">
<tr>
<td colspan="2">
<table summary="name and tag library version availability of
tag." cellspacing="0" width="100%" bgcolor="#cccccc" border="0">
<tr>
<td><b><font size="+1"><a
name="dump">dump</a></font></b></td><td align="right">Availability: version 1.0</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">Displays all vars in the specified scope</td>
</tr>
<tr>
<td width="2%"> </td><td width="98%">
<table summary="Tag class, tag name, script variable (if any),
and restrictions (if any)." width="100%" border="0">
<tr>
<td width="20%"><span class="tclass">Tag
Class</span></td><td width="80%">org.apache.taglibs.log.DumpTag</td>
</tr>
<tr>
<td width="20%"><span class="tbody">Tag
Body</span></td><td width="80%"></td>
</tr>
<tr>
<td width="20%"><span class="scriptvar">Script
Variable</span></td><td width="80%">No</td>
</tr>
<tr>
<td width="20%"><span
class="restrictions">Restrictions</span></td><td width="80%"></td>
</tr>
<tr>
<td width="20%"><span
class="attributes">Attributes</span></td><td width="80%"> </td>
</tr>
<tr>
<td width="20%"> </td><td width="80%">
<table summary="Tag attribute name, whether
required, and whether rtexprvalue allowed." width="100%" border="0">
<tr>
<td width="40%">Name</td><td
width="20%">Required</td><td width="40%">Runtime Expression Evaluation</td>
</tr>
<tr bgcolor="#cccccc">
<td width="40%"><b>scope</b></td><td
width="20%">true</td><td width="40%">true</td>
</tr>
<tr>
<td colspan="3"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" width="20%"><span
class="example">Example</span></td><td width="80%">
<ol>
<li>
<span class="comment"><%--
--%></span>
<br>
<p>
<pre>
<code>
<log:dump scope="page"/>
<log:dump scope="request"/>
<log:dump scope="session"/>
<log:dump scope="application"/>
</code>
</pre>
</p>
</li>
</ol>
</td>
</tr>
</table>
</td>
</tr>
</table>
<a name="examples">
<h3>Examples</h3>
</a>
<p>See the example application log-examples.war for examples of the usage
of the tags from this custom tag library.</p>
<a name="javadocs">
<h3>Java Docs</h3>
</a>
<p>Java programmers can view the java class documentation for this tag
library
as <a href="javadoc/index.html">javadocs</a>.</p>
<a name="history">
<h3>Revision History</h3>
</a>
<p>Review the complete <a href="changes.html">revision history</a> of this
tag
library.</p>
</body>
</html>
1.1 jakarta-taglibs/log/doc/web/taglib.css
Index: taglib.css
===================================================================
body { background-color: #ffffff; }
h1 { text-align: center; }
code { font: medium sans-serif; color: #990099; }
.middle { text-align: center; }
.comment { color: #3300cc; }
.jsp-squig { color: #009999; }
.scriptlet { color: #666666; }
.tclass { font-weight: bold; }
.tbody { font-weight: bold; }
.scriptvar { font-weight: bold; }
.restrictions { font-weight: bold; }
.attributes { font-weight: bold; }
.example { font-weight: bold; }
1.1 jakarta-taglibs/log/examples/conf/web.xml
Index: web.xml
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<display-name>Log Taglib Sample</display-name>
<description>A sample web app demonstrating the Log TagLib</description>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<taglib>
<taglib-uri>http://jakarta.apache.org/taglibs/log-1.0</taglib-uri>
<taglib-location>/WEB-INF/log.tld</taglib-location>
</taglib>
</web-app>
1.1 jakarta-taglibs/log/examples/web/index.html
Index: index.html
===================================================================
<HTML>
<HEAD>
<TITLE>Debug Tags Demo</TITLE>
</HEAD>
<BODY>
<OL>
<LI><A HREF="test1.jsp">Test #1</A> - tests <log:debug />
<LI><A HREF="test2.jsp">Test #2</A> - tests <log:info />
<LI><A HREF="test3.jsp">Test #3</A> - tests <log:warn />
<LI><A HREF="test4.jsp">Test #4</A> - tests <log:error />
<LI><A HREF="test5.jsp">Test #5</A> - tests <log:dump />
</OL>
</BODY>
</HTML>
1.1 jakarta-taglibs/log/examples/web/test1.jsp
Index: test1.jsp
===================================================================
<%@ taglib uri="http://jakarta.apache.org/taglibs/log-1.0" prefix="log" %>
<HTML>
<HEAD>
<TITLE>Test #1</TITLE>
</HEAD>
<BODY>
<log:debug>This is body content.</log:debug>
<log:debug message="This is attribute content." />
<log:debug category="test1">This is body content in category test1.</log:debug>
You should see output in the debug logs now.
<H2>File source</H2>
<PRE><%@include file="test1.txt"%></PRE>
</BODY>
</HTML>
1.1 jakarta-taglibs/log/examples/web/test2.jsp
Index: test2.jsp
===================================================================
<%@ taglib uri="http://jakarta.apache.org/taglibs/log-1.0" prefix="log" %>
<HTML>
<HEAD>
<TITLE>Test #2</TITLE>
</HEAD>
<BODY>
<log:info>This is body content.</log:info>
<log:info message="This is attribute content." />
<log:info category="test2">This is body content in category test2.</log:info>
You should see output in the info logs now.
<H2>File source</H2>
<PRE><%@include file="test2.txt"%></PRE>
</BODY>
</HTML>
1.1 jakarta-taglibs/log/examples/web/test3.jsp
Index: test3.jsp
===================================================================
<%@ taglib uri="http://jakarta.apache.org/taglibs/log-1.0" prefix="log" %>
<HTML>
<HEAD>
<TITLE>Test #3</TITLE>
</HEAD>
<BODY>
<log:warn>This is body content.</log:warn>
<log:warn message="This is attribute content." />
<log:warn category="test3">This is body content in category test3.</log:warn>
You should see output in the warn logs now.
<H2>File source</H2>
<PRE><%@include file="test3.txt"%></PRE>
</BODY>
</HTML>
1.1 jakarta-taglibs/log/examples/web/test4.jsp
Index: test4.jsp
===================================================================
<%@ taglib uri="http://jakarta.apache.org/taglibs/log-1.0" prefix="log" %>
<HTML>
<HEAD>
<TITLE>Test #4</TITLE>
</HEAD>
<BODY>
<log:error>This is body content.</log:error>
<log:error message="This is attribute content." />
<log:error category="test4">This is body content in category test4.</log:error>
You should see output in the error logs now.
<H2>File source</H2>
<PRE><%@include file="test4.txt"%></PRE>
</BODY>
</HTML>
1.1 jakarta-taglibs/log/examples/web/test5.jsp
Index: test5.jsp
===================================================================
<%@ taglib uri="http://jakarta.apache.org/taglibs/log-1.0" prefix="log" %>
<HTML>
<HEAD>
<TITLE>Test #5</TITLE>
</HEAD>
<BODY>
<jsp:useBean id="p1" class="java.lang.String" scope="page" />
<H4>request</H4>
<log:dump scope="request" />
<H4>page</H4>
<log:dump scope="page" />
<H4>session</H4>
<log:dump scope="session" />
<H4>application</H4>
<log:dump scope="application" />
<H2>File source</H2>
<PRE><%@include file="test5.txt"%></PRE>
</BODY>
</HTML>
1.1 jakarta-taglibs/log/lib/log4j-core.jar
<<Binary file>>
1.1 jakarta-taglibs/log/src/org/apache/taglibs/log/DebugTag.java
Index: DebugTag.java
===================================================================
/*
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.taglibs.log;
import org.apache.log4j.Category;
/** Logs a debug message to the current log4j category.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Joseph Ottinger</a>
* @author <a href="mailto:[EMAIL PROTECTED]">James Strachan</a>
*/
public class DebugTag extends LoggerTag {
protected void log( String message ) {
getCategory().debug( message );
}
}
1.1 jakarta-taglibs/log/src/org/apache/taglibs/log/DumpTag.java
Index: DumpTag.java
===================================================================
/*
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.taglibs.log;
import java.util.Enumeration;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.TagSupport;
public class DumpTag extends TagSupport {
private int scope;
public void setScope(String sc) throws JspException {
if (sc.equalsIgnoreCase("session")) {
this.scope = PageContext.SESSION_SCOPE;
}
else if (sc.equalsIgnoreCase("request")) {
this.scope = PageContext.REQUEST_SCOPE;
}
else if (sc.equalsIgnoreCase("application")) {
this.scope = PageContext.APPLICATION_SCOPE;
}
else if (sc.equalsIgnoreCase("page")) {
this.scope = PageContext.PAGE_SCOPE;
}
else {
throw new JspException(
"Scope must be page, request, session or application."
);
}
}
public int doEndTag() throws JspException {
try {
Enumeration names = pageContext.getAttributeNamesInScope(scope);
pageContext.getOut().write("<dl>");
while(names.hasMoreElements()) {
String name = (String) names.nextElement();
Object value = pageContext.getAttribute(name, scope);
pageContext.getOut().write("<dt><code>"+name+"</code></dt>");
pageContext.getOut().write("<dd><code>"+value+"</code></dd>");
}
pageContext.getOut().write("</dl>");
}
catch (Exception e) {
throw new JspException("Exception: "+e.getMessage());
}
return EVAL_PAGE;
}
}
1.1 jakarta-taglibs/log/src/org/apache/taglibs/log/ErrorTag.java
Index: ErrorTag.java
===================================================================
/*
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.taglibs.log;
import org.apache.log4j.Category;
/** Logs an error message to the current log4j category.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Joseph Ottinger</a>
* @author <a href="mailto:[EMAIL PROTECTED]">James Strachan</a>
*/
public class ErrorTag extends LoggerTag {
protected void log( String message ) {
getCategory().error( message );
}
}
1.1 jakarta-taglibs/log/src/org/apache/taglibs/log/InfoTag.java
Index: InfoTag.java
===================================================================
/*
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.taglibs.log;
import org.apache.log4j.Category;
/** Logs an info message to the current log4j category.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Joseph Ottinger</a>
* @author <a href="mailto:[EMAIL PROTECTED]">James Strachan</a>
*/
public class InfoTag extends LoggerTag {
protected void log( String message ) {
getCategory().info( message );
}
}
1.1 jakarta-taglibs/log/src/org/apache/taglibs/log/LoggerTag.java
Index: LoggerTag.java
===================================================================
/*
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.taglibs.log;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.BodyTagSupport;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Category;
import org.apache.log4j.PropertyConfigurator;
/** Abstract base class for the logging tags which log a message to a
* log4j category.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Joseph Ottinger</a>
* @author <a href="mailto:[EMAIL PROTECTED]">James Strachan</a>
*/
public abstract class LoggerTag extends BodyTagSupport {
static {
// Force log4j to be initialised on Class load...
// XXXX: Is there a better, more deployment descriptor
// way of doing this?
BasicConfigurator.configure();
//PropertyConfigurator.configure("debug.properties");
}
private String category = "";
private String message;
public void setCategory(String category) {
this.category = category;
}
public void setMessage(String message) {
this.message = message;
}
// Tag interface
//-------------------------------------------------------------------------
public int doStartTag() throws JspException {
if ( message != null ) {
/** Log now as doAfterBody() may not be called for an empty body tag */
log( message );
return SKIP_BODY;
}
return EVAL_BODY_TAG;
}
public int doAfterBody() throws JspException {
if (message == null) {
log( getBodyContent().getString().trim() );
}
return SKIP_BODY;
}
// Implementation methods
//-------------------------------------------------------------------------
protected Category getCategory() {
return Category.getInstance(category);
}
protected abstract void log( String message );
}
1.1 jakarta-taglibs/log/src/org/apache/taglibs/log/WarnTag.java
Index: WarnTag.java
===================================================================
/*
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.taglibs.log;
import org.apache.log4j.Category;
/** Logs an info message to the current log4j category.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Joseph Ottinger</a>
* @author <a href="mailto:[EMAIL PROTECTED]">James Strachan</a>
*/
public class WarnTag extends LoggerTag {
protected void log( String message ) {
getCategory().warn( message );
}
}
1.1 jakarta-taglibs/log/xml/log.xml
Index: log.xml
===================================================================
<?xml version="1.0" ?>
<document url="./log.xml">
<properties>
<title>Jakarta Project: Log Tag Library</title>
<author>Joseph B. Ottinger</author>
<author>James Strachan</author>
</properties>
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>log</shortname>
<taglib-location>/WEB-INF/log.tld</taglib-location>
<uri>/WEB-INF/log.tld</uri>
<prefix>log</prefix>
<info>Log Tag library</info>
<overview>
<p>
The Log library allows you to embed logging calls in your JSP which can be
output to a variety of destinations thanks to the power of the
<a href="http://jakarta.apache.org/log4j/docs/index.html">log4j</a> project.
</p>
</overview>
<requirements-info>
This custom tag library requires a servlet container
that supports the JavaServer Pages Specification, version 1.1 or higher
together with a distribution of
<a href="http://jakarta.apache.org/log4j/docs/index.html">log4j</a>.
</requirements-info>
<tag>
<name>debug</name>
<tagclass>org.apache.taglibs.log.DebugTag</tagclass>
<bodycontents>JSP</bodycontents>
<info>Displays a debug-level message</info>
<script-variable>No</script-variable>
<attribute>
<name>category</name>
<rtexprvalue>true</rtexprvalue>
<required>false</required>
</attribute>
<attribute>
<name>message</name>
<rtexprvalue>true</rtexprvalue>
<required>false</required>
</attribute>
<restrictions></restrictions>
<usage>
<comment>
</comment>
<code><![CDATA[
<log:debug message="this is a message"/>
<log:debug category="foo.bar" message="this is a message"/>
<log:debug category="foo.bar">
this is a message
</log:debug>
]]></code>
</usage>
</tag>
<tag>
<name>info</name>
<tagclass>org.apache.taglibs.log.InfoTag</tagclass>
<bodycontents>JSP</bodycontents>
<info>Displays a info-level message</info>
<script-variable>No</script-variable>
<attribute>
<name>category</name>
<rtexprvalue>true</rtexprvalue>
<required>false</required>
</attribute>
<attribute>
<name>message</name>
<rtexprvalue>true</rtexprvalue>
<required>false</required>
</attribute>
<restrictions></restrictions>
<usage>
<comment>
</comment>
<code><![CDATA[
<log:info message="this is a message"/>
<log:info category="foo.bar" message="this is a message"/>
<log:info category="foo.bar">
this is a message
</log:info>
]]></code>
</usage>
</tag>
<tag>
<name>warn</name>
<tagclass>org.apache.taglibs.log.WarnTag</tagclass>
<bodycontents>JSP</bodycontents>
<info>Displays a warn-level message</info>
<script-variable>No</script-variable>
<attribute>
<name>category</name>
<rtexprvalue>true</rtexprvalue>
<required>false</required>
</attribute>
<attribute>
<name>message</name>
<rtexprvalue>true</rtexprvalue>
<required>false</required>
</attribute>
<restrictions></restrictions>
<usage>
<comment>
</comment>
<code><![CDATA[
<log:warn message="this is a message"/>
<log:warn category="foo.bar" message="this is a message"/>
<log:warn category="foo.bar">
this is a message
</log:warn>
]]></code>
</usage>
</tag>
<tag>
<name>error</name>
<tagclass>org.apache.taglibs.log.ErrorTag</tagclass>
<bodycontents>JSP</bodycontents>
<info>Displays a error-level message</info>
<script-variable>No</script-variable>
<attribute>
<name>category</name>
<rtexprvalue>true</rtexprvalue>
<required>false</required>
</attribute>
<attribute>
<name>message</name>
<rtexprvalue>true</rtexprvalue>
<required>false</required>
</attribute>
<restrictions></restrictions>
<usage>
<comment>
</comment>
<code><![CDATA[
<log:error message="this is a message"/>
<log:error category="foo.bar" message="this is a message"/>
<log:error category="foo.bar">
this is a message
</log:error>
]]></code>
</usage>
</tag>
<tag>
<name>dump</name>
<tagclass>org.apache.taglibs.log.DumpTag</tagclass>
<bodycontents>empty</bodycontents>
<info>Displays all vars in the specified scope</info>
<script-variable>No</script-variable>
<attribute>
<name>scope</name>
<rtexprvalue>true</rtexprvalue>
<required>true</required>
</attribute>
<restrictions></restrictions>
<usage>
<comment>
</comment>
<code><![CDATA[
<log:dump scope="page"/>
<log:dump scope="request"/>
<log:dump scope="session"/>
<log:dump scope="application"/>
]]></code>
</usage>
</tag>
</taglib>
</document>
1.7 +34 -23 jakarta-taglibs/src/doc/index.xml
Index: index.xml
===================================================================
RCS file: /home/cvs/jakarta-taglibs/src/doc/index.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- index.xml 2001/05/09 21:09:12 1.6
+++ index.xml 2001/05/10 19:30:03 1.7
@@ -17,13 +17,18 @@
</section>
<section name="Taglibs News" href="News">
- <news>
- <newsitem date="05/09/2001" libname="Taglibs">
- We have a new CVS module! The Sandbox module (jakarta-taglibs-sandbox)
- is intended to be a playground/staging area for new tag library ideas.
- Any Jakarta user may download tags from this module, but these tags will
- not be officially supported unless they are voted into the main
- repository (jakarta-taglibs).
+ <news>
+ <newsitem date="05/10/2001" libname="Log">
+ The Log library has been added to CVS.
+ The Log tag library allows you to perform logging from inside your JSP
+ using log4j. See the Log home page for details!
+ </newsitem>
+ <newsitem date="05/09/2001" libname="Taglibs">
+ We have a new CVS module! The Sandbox module (jakarta-taglibs-sandbox)
+ is intended to be a playground/staging area for new tag library ideas.
+ Any Jakarta user may download tags from this module, but these tags will
+ not be officially supported unless they are voted into the main
+ repository (jakarta-taglibs).
</newsitem>
<newsitem date="05/05/2001" libname="IO">
The IO library has been added to CVS.
@@ -49,23 +54,23 @@
the latest info on our tags.
</newsitem>
</news>
- </section>
-
- <section name="Taglibs Overview" href="Overview">
-
- <p>Tag libraries are composed of a set of custom tags. These custom tags help
separate
- presentation from implementation. What this means is that web designers can
change the
- layout without worrying about modifying the underlying logic. Custom tags
also help developers avoid
- embedding scripting code within the JSP page as well as encourage reuse and
ease
- maintainability.</p>
-
- <p>Custom tags are not just bean tags. Custom tags can modify the content
within the tag
- body and have access to the application context. Some of the ways they can be
used include
- dynamically generating page content and implementing flow of control. They
can interact with
- each other including being nested.</p>
-
- </section>
+ </section>
+
+ <section name="Taglibs Overview" href="Overview">
+ <p>Tag libraries are composed of a set of custom tags. These custom tags help
separate
+ presentation from implementation. What this means is that web designers can
change the
+ layout without worrying about modifying the underlying logic. Custom tags
also help developers avoid
+ embedding scripting code within the JSP page as well as encourage reuse and
ease
+ maintainability.</p>
+
+ <p>Custom tags are not just bean tags. Custom tags can modify the content
within the tag
+ body and have access to the application context. Some of the ways they can be
used include
+ dynamically generating page content and implementing flow of control. They
can interact with
+ each other including being nested.</p>
+
+ </section>
+
<section name="Taglibs Descriptions" href="Libs">
<tagindex>
@@ -124,6 +129,12 @@
Version 1.1. As such, the tags are focused more on being
examples of custom tag library code techniques, and less on
being useful in production applications.
+ </taginfo>
+
+ <taginfo name="Log" state="develop">
+ The "Log" tag library contains tags that allow you to log
+ messages from inside your JSP to the log4j subsystem which can then
+ write these messages to a variety of sources such as files, JMS, RPC etc.
</taginfo>
<taginfo name="Mailer" state="develop">
1.10 +1 -0 jakarta-taglibs/src/doc/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/jakarta-taglibs/src/doc/project.xml,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- project.xml 2001/05/05 18:24:50 1.9
+++ project.xml 2001/05/10 19:30:04 1.10
@@ -21,6 +21,7 @@
<item name="IO Taglib"
href="http://jakarta.apache.org/taglibs/doc/io-doc/intro.html"/>
<item name="JNDI Taglib"
href="http://jakarta.apache.org/taglibs/doc/jndi-doc/intro.html"/>
<item name="JSP Spec Taglib"
href="http://jakarta.apache.org/taglibs/doc/jspspec-doc/intro.html"/>
+ <item name="Log Taglib"
href="http://jakarta.apache.org/taglibs/doc/log-doc/intro.html"/>
<item name="Mailer Taglib"
href="http://jakarta.apache.org/taglibs/doc/mailer-doc/intro.html"/>
<item name="Page Taglib"
href="http://jakarta.apache.org/taglibs/doc/page-doc/intro.html"/>
<item name="Regexp Taglib"
href="http://jakarta.apache.org/taglibs/doc/regexp-doc/intro.html"/>