cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/java log.xsl
Date Mon, 14 May 2001 13:53:06 GMT
bloritsch    01/05/14 06:53:06

  Modified:    lib      maybeupload.jar
               src/org/apache/cocoon/components/language/markup/xsp/java
                        log.xsl
  Log:
  update maybeupload jar to be JDK 1.2 compliant.
  Update log taglib to be able to use <xsp:expr> inside
  the log messages.
  
  Revision  Changes    Path
  1.3       +84 -89    xml-cocoon2/lib/maybeupload.jar
  
  	<<Binary file>>
  
  
  1.2       +35 -11    xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/java/log.xsl
  
  Index: log.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/java/log.xsl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- log.xsl	2001/05/09 20:49:54	1.1
  +++ log.xsl	2001/05/14 13:53:02	1.2
  @@ -11,7 +11,7 @@
   
   <!--
    * @author <a href="mailto:bloritsch@apache.org>Berin Loritsch</a>
  - * @version CVS $Revision: 1.1 $ $Date: 2001/05/09 20:49:54 $
  + * @version CVS $Revision: 1.2 $ $Date: 2001/05/14 13:53:02 $
   -->
   
   <!-- XSP Response logicsheet for the Java language -->
  @@ -36,6 +36,18 @@
         </xsl:choose>
       </xsl:variable>
   
  +    <xsl:variable name="filename">
  +      <xsl:choose>
  +        <xsl:when test="@filename">"<xsl:value-of select="@filename"/>"</xsl:when>
  +        <xsl:when test="filename">
  +          <xsl:call-template name="get-nested-content">
  +            <xsl:with-param name="content" select="log:filename"/>
  +          </xsl:call-template>
  +        </xsl:when>
  +        <xsl:otherwise>""</xsl:otherwise>
  +      </xsl:choose>
  +    </xsl:variable>
  +
       <xsl:variable name="level">
         <xsl:choose>
           <xsl:when test="@level">"<xsl:value-of select="@level"/>"</xsl:when>
  @@ -53,11 +65,13 @@
             try {
               String category = <xsl:value-of select="$name"/>;
               org.apache.log.Logger logger = org.apache.log.Hierarchy.getDefaultHierarchy().getLoggerFor("cocoon"
+ (("".equals(category))? category : "." + category));
  -            String file = this.avalonContext.get(org.apache.cocoon.Constants.CONTEXT_LOG_DIR)
+ category + ".log";
  -            org.apache.log.LogTarget[] targets = new org.apache.log.LogTarget[] {
  -                new org.apache.log.output.FileOutputLogTarget(file)
  -            };
  -            logger.setLogTargets(targets);
  +            if ("".equals(<xsl:value-of select="$filename"/>) == false) {
  +                String file = this.avalonContext.get(org.apache.cocoon.Constants.CONTEXT_LOG_DIR)
+ <xsl:value-of select="$filename"/>;
  +                org.apache.log.LogTarget[] targets = new org.apache.log.LogTarget[] {
  +                    new org.apache.log.output.FileOutputLogTarget(file)
  +                };
  +                logger.setLogTargets(targets);
  +            }
               logger.setPriority(org.apache.log.Priority.getPriorityForName(<xsl:value-of
select="$level"/>));
               this.setLogger(logger);
             } catch (Exception e) {
  @@ -71,35 +85,35 @@
     <xsl:template match="log:debug">
       <xsp:logic>
         if(getLogger() != null)
  -        getLogger().debug("<xsl:value-of select="."/>");
  +        getLogger().debug(<xsl:call-template name="get-log-message"/>);
       </xsp:logic>
     </xsl:template>
   
     <xsl:template match="log:info">
       <xsp:logic>
         if(getLogger() != null)
  -        getLogger().info("<xsl:value-of select="."/>");
  +        getLogger().info(<xsl:call-template name="get-log-message"/>);
       </xsp:logic>
     </xsl:template>
   
     <xsl:template match="log:warn">
       <xsp:logic>
         if(getLogger() != null)
  -        getLogger().warn("<xsl:value-of select="."/>");
  +        getLogger().warn(<xsl:call-template name="get-log-message"/>);
       </xsp:logic>
     </xsl:template>
   
     <xsl:template match="log:error">
       <xsp:logic>
         if(getLogger() != null)
  -        getLogger().error("<xsl:value-of select="."/>");
  +        getLogger().error(<xsl:call-template name="get-log-message"/>);
       </xsp:logic>
     </xsl:template>
   
     <xsl:template match="log:fatal-error">
       <xsp:logic>
         if(getLogger() != null)
  -        getLogger().fatalError("<xsl:value-of select="."/>");
  +        getLogger().fatalError(<xsl:call-template name="get-log-message"/>);
       </xsp:logic>
     </xsl:template>
   
  @@ -111,6 +125,16 @@
         </xsl:when>
         <xsl:otherwise>"<xsl:value-of select="$content"/>"</xsl:otherwise>
       </xsl:choose>
  +  </xsl:template>
  +
  +  <xsl:template name="get-log-message">
  +    <xsl:for-each select="./child::node()">
  +      <xsl:choose>
  +        <xsl:when test="xsp:expr"><xsl:apply-templates select="node()"/></xsl:when>
  +        <xsl:otherwise>"<xsl:value-of select="."/>"</xsl:otherwise>
  +      </xsl:choose>
  +      <xsl:if test="not(position() = last())"> + </xsl:if>
  +    </xsl:for-each>
     </xsl:template>
   
     <xsl:template match="@*|*|text()|processing-instruction()">
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message