From 200a40b332420f94992eb39a6d0ea1cf1490ffc4 Mon Sep 17 00:00:00 2001 From: coreyg Date: Fri, 21 Nov 2014 09:30:19 +0000 Subject: Adding tuscany's website to their svn repo for svnpubsub git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1640879 13f79535-47bb-0310-9956-ffa450edef68 --- ...scanyjavadas-java-overviewimproved-logging.html | 183 +++++++++++++++++++++ 1 file changed, 183 insertions(+) create mode 100644 site/trunk/site-publish/tuscanytuscanyjavadas-java-overviewimproved-logging.html (limited to 'site/trunk/site-publish/tuscanytuscanyjavadas-java-overviewimproved-logging.html') diff --git a/site/trunk/site-publish/tuscanytuscanyjavadas-java-overviewimproved-logging.html b/site/trunk/site-publish/tuscanytuscanyjavadas-java-overviewimproved-logging.html new file mode 100644 index 0000000000..0db676e83a --- /dev/null +++ b/site/trunk/site-publish/tuscanytuscanyjavadas-java-overviewimproved-logging.html @@ -0,0 +1,183 @@ + + + + + + + + + + + + + + + Apache Tuscany : Tuscany.TuscanyJava.DAS Java Overview.Improved logging + + + + + + + + + + + + + + + +
+ + + + +   + +
+ + +
+
+ + + + + + + + + +
+  Apache Tuscany > Home > DAS Overview > DAS Java > DAS Java Documentation Menu > DAS Java Developer Guide > RDB DAS Java > RDB DAS - User Guide > Tuscany.TuscanyJava.DAS Java Overview.Improved logging + + User List | Dev List | Issue Tracker   +
+ + + + + + + +
+ + +
+ +
+
+

Tuscany/TuscanyJava/DAS Java Overview/Improved 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 ** For further information, please follow the link : Tomcat FAQ - Logging

+
+
+
+ + +
+ + + + + + website stats + + + + + + -- cgit v1.2.3