Differences between revisions 5 and 6
Revision 5 as of 2007-01-02 18:36:12
Size: 1824
Comment:
Revision 6 as of 2009-09-20 22:48:57
Size: 1826
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 59: Line 59:
   For further information, please follow the link : [http://tomcat.apache.org/faq/logging.html Tomcat FAQ - Logging]    For further information, please follow the link : [[http://tomcat.apache.org/faq/logging.html|Tomcat FAQ - Logging]]

Logging Overview

Overview

Using log while contributting for Tuscany DAS code

  • While contributing to DAS code, please follow the following guidelines to add logging to your class

    Instantiate a logger - There is a logger factory available in org.apache.tuscany.das.rdb.util - To use it

    • private final Logger logger = LoggerFactory.INSTANCE.getLogger(MappingWrapper.class);

    - To instrument your code with logging capabilities
    • if(this.logger.isDebugEnabled())
      • this.logger.debug("your debug message");
    Note: As a performance enhancement, please surround your debug code with a check to see if debug is enabled or not.

Configuring DAS logging (log4j)

  • Configuring with Tomcat There are two ways to configure log4j in Tomcat :

    • - Having a global log4j.properties inside %CATALINA_HOME%\common\classes - Having a global log4j.properties inside your own web app at WEB-INF\classes

Sample log4j.properties

# Set root logger level to DEBUG and its only appender to A1.

log4j.rootLogger=INFO, A1

# A1 is set to be a ConsoleAppender.

log4j.appender.A1=org.apache.log4j.ConsoleAppender

# A1 uses PatternLayout.

log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[DAS RDB] - %c{1}.%M (%L) : %m %n

# Print only messages of level WARN or above in the package com.foo.

log4j.logger.org.apache.tuscany=OFF

Tuscany/TuscanyJava/DAS_Java_Overview/Improved_logging (last edited 2009-09-20 22:48:57 by localhost)