You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Leszek Gawron <ou...@vip.net.pl> on 2003/03/07 14:59:29 UTC
logging logicsheet still invalid
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 | \__/ |