cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leszek Gawron <o...@vip.net.pl>
Subject logging logicsheet still invalid
Date Fri, 07 Mar 2003 13:59:29 GMT
I forgot something: the logging category is now ok but logger is set only if
no logger existed before:

    <xsp:logic>
      if (getLogger() == null) {
          try {
            String category = <xsl:value-of select="$name"/>;
            org.apache.log.Logger logger = org.apache.log.Hierarchy.getDefaultHierarchy().getLoggerFor(
category );
<!--
            if (!"".equals(<xsl:value-of select="$filename"/>)) {
                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.enableLogging(new org.apache.avalon.framework.logger.LogKitLogger(logger));
          } catch (Exception e) {
            getLogger().error("Could not create logger for \"" +
                               <xsl:value-of select="$name"/> + "\".", e);
          }
      }
    </xsp:logic>

so in xsp this code never gets executed. Am I right? Could someone fix this
one ? 

another error is :
if getLogger() is null the content would get executed but suppose setting new
logger fails. What happens ? getLogger().error( "could not create ..  " ) gets
executed. But if setting logger failed getLogger() might return null.

	ouzo
-- 
            __
         | /  \ |        Leszek Gawron            //  \\
        \_\\  //_/      ouzo@vip.net.pl          _\\()//_
         .'/()\'.     Phone: +48(600)341118     / //  \\ \
          \\  //  recursive: adj; see recursive  | \__/ |


Mime
View raw message