You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2008/05/04 19:31:46 UTC
svn commit: r653256 - in /tapestry/tapestry5/trunk: tapestry-annotations/
tapestry-annotations/src/test/ tapestry-annotations/src/test/conf/
tapestry-component-report/ tapestry-component-report/src/test/
tapestry-component-report/src/test/conf/ tapestr...
Author: hlship
Date: Sun May 4 10:31:46 2008
New Revision: 653256
URL: http://svn.apache.org/viewvc?rev=653256&view=rev
Log:
TAPESTRY-2405: Add @Log annotation for component methods, that will log (at debug level) entry, exit and fail conditions
Added:
tapestry/tapestry5/trunk/tapestry-annotations/src/test/
tapestry/tapestry5/trunk/tapestry-annotations/src/test/conf/
tapestry/tapestry5/trunk/tapestry-annotations/src/test/conf/testng.xml
tapestry/tapestry5/trunk/tapestry-component-report/src/test/
tapestry/tapestry5/trunk/tapestry-component-report/src/test/conf/
tapestry/tapestry5/trunk/tapestry-component-report/src/test/conf/testng.xml
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/annotations/Log.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/transform/LogWorker.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/LoggingAdvice.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/MethodLogger.java
- copied, changed from r649954, tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ServiceLogger.java
tapestry/tapestry5/trunk/tapestry-test/src/test/
tapestry/tapestry5/trunk/tapestry-test/src/test/conf/
tapestry/tapestry5/trunk/tapestry-test/src/test/conf/testng.xml
Removed:
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ServiceLogger.java
Modified:
tapestry/tapestry5/trunk/tapestry-annotations/pom.xml
tapestry/tapestry5/trunk/tapestry-component-report/pom.xml
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java
tapestry/tapestry5/trunk/tapestry-core/src/site/apt/guide/logging.apt
tapestry/tapestry5/trunk/tapestry-core/src/site/apt/index.apt
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/ZoneDemo.java
tapestry/tapestry5/trunk/tapestry-hibernate/src/main/java/org/apache/tapestry/hibernate/HibernateModule.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/LoggingDecoratorImpl.java
Modified: tapestry/tapestry5/trunk/tapestry-annotations/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-annotations/pom.xml?rev=653256&r1=653255&r2=653256&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-annotations/pom.xml (original)
+++ tapestry/tapestry5/trunk/tapestry-annotations/pom.xml Sun May 4 10:31:46 2008
@@ -1,4 +1,5 @@
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.tapestry</groupId>
<artifactId>tapestry-annotations</artifactId>
@@ -15,6 +16,16 @@
</description>
<inceptionYear>2007</inceptionYear>
+ <dependencies>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>5.7</version>
+ <classifier>jdk15</classifier>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
<build>
<plugins>
<plugin>
Added: tapestry/tapestry5/trunk/tapestry-annotations/src/test/conf/testng.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-annotations/src/test/conf/testng.xml?rev=653256&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-annotations/src/test/conf/testng.xml (added)
+++ tapestry/tapestry5/trunk/tapestry-annotations/src/test/conf/testng.xml Sun May 4 10:31:46 2008
@@ -0,0 +1,21 @@
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<!--
+ Copyright 2008 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<suite name="Tapestry Annotations" annotations="1.5" verbose="2">
+ <!-- This avoids a build error when performing a non-clean build. Just another Maven fuckup to be worked around. -->
+ <test name="Placeholder (no tests)"/>
+</suite>
Modified: tapestry/tapestry5/trunk/tapestry-component-report/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-component-report/pom.xml?rev=653256&r1=653255&r2=653256&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-component-report/pom.xml (original)
+++ tapestry/tapestry5/trunk/tapestry-component-report/pom.xml Sun May 4 10:31:46 2008
@@ -1,4 +1,5 @@
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.tapestry</groupId>
<artifactId>tapestry-component-report</artifactId>
@@ -103,6 +104,15 @@
<artifactId>xom</artifactId>
<version>1.1</version>
</dependency>
+
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>5.7</version>
+ <classifier>jdk15</classifier>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
<reporting>
<plugins>
Added: tapestry/tapestry5/trunk/tapestry-component-report/src/test/conf/testng.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-component-report/src/test/conf/testng.xml?rev=653256&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-component-report/src/test/conf/testng.xml (added)
+++ tapestry/tapestry5/trunk/tapestry-component-report/src/test/conf/testng.xml Sun May 4 10:31:46 2008
@@ -0,0 +1,21 @@
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<!--
+ Copyright 2008 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<suite name="Tapestry Component Report" annotations="1.5" verbose="2">
+ <!-- This avoids a build error when performing a non-clean build. Just another Maven fuckup to be worked around. -->
+ <test name="Placeholder (no tests)"/>
+</suite>
Added: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/annotations/Log.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/annotations/Log.java?rev=653256&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/annotations/Log.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/annotations/Log.java Sun May 4 10:31:46 2008
@@ -0,0 +1,31 @@
+// Copyright 2008 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.annotations;
+
+import java.lang.annotation.*;
+
+
+/**
+ * Marker annotation for component methods to enable debug-level logging. Annotated methods will log method entry (with
+ * parameters), method exit (with return value, for non-void methods) and any thrown exceptions.
+ *
+ * @see org.apache.tapestry.internal.transform.LogWorker
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface Log
+{
+}
Added: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/transform/LogWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/transform/LogWorker.java?rev=653256&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/transform/LogWorker.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/transform/LogWorker.java Sun May 4 10:31:46 2008
@@ -0,0 +1,61 @@
+// Copyright 2008 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.internal.transform;
+
+import org.apache.tapestry.annotations.Log;
+import org.apache.tapestry.ioc.MethodAdvice;
+import org.apache.tapestry.ioc.internal.services.LoggingAdvice;
+import org.apache.tapestry.ioc.services.ExceptionTracker;
+import org.apache.tapestry.model.MutableComponentModel;
+import org.apache.tapestry.services.*;
+
+import java.util.List;
+
+/**
+ * Looks for the {@link org.apache.tapestry.annotations.Log} marker annotation and adds method advice to perform the
+ * logging. This is similar to what the {@link org.apache.tapestry.ioc.services.LoggingDecorator} does for service
+ * interface methods.
+ */
+public class LogWorker implements ComponentClassTransformWorker
+{
+ private final ExceptionTracker _exceptionTracker;
+
+ public LogWorker(ExceptionTracker exceptionTracker)
+ {
+ _exceptionTracker = exceptionTracker;
+ }
+
+ public void transform(ClassTransformation transformation, MutableComponentModel model)
+ {
+ List<TransformMethodSignature> signatures = transformation.findMethodsWithAnnotation(Log.class);
+
+ if (signatures.isEmpty()) return;
+
+ // Re-use the logging advice from LoggingDecorator
+ final MethodAdvice loggingAdvice = new LoggingAdvice(model.getLogger(), _exceptionTracker);
+
+ // ... but wrap it for use at the component level.
+ ComponentMethodAdvice advice = new ComponentMethodAdvice()
+ {
+ public void advise(ComponentMethodInvocation invocation)
+ {
+ loggingAdvice.advise(invocation);
+ }
+ };
+
+ for (TransformMethodSignature signature : signatures)
+ transformation.advise(signature, advice);
+ }
+}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java?rev=653256&r1=653255&r2=653256&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java Sun May 4 10:31:46 2008
@@ -297,7 +297,8 @@
* annotation</dd> <dt>ResponseEncoding</dt> <dd>Checks for the {@link org.apache.tapestry.annotations.ResponseEncoding}
* annotation</dd> <dt>GenerateAccessors</dt> <dd>Generates accessor methods if {@link
* org.apache.tapestry.annotations.Property} annotation is present </dd> <dt>Cached</dt> <dd>Checks for the {@link
- * Cached} annotation</dd></dl>
+ * org.apache.tapestry.annotations.Cached} annotation</dd><dt>Log</dt> <dd>Checks for the {@link
+ * org.apache.tapestry.annotations.Log} annotation</dd></dl>
*/
public static void contributeComponentClassTransformWorker(
OrderedConfiguration<ComponentClassTransformWorker> configuration,
@@ -376,6 +377,8 @@
"after:Property");
configuration.add("Environment", locator.autobuild(EnvironmentalWorker.class), "after:Property");
+ configuration.add("Log", locator.autobuild(LogWorker.class));
+
// This one is always last. Any additional private fields that aren't annotated will
// be converted to clear out at the end of the request.
Modified: tapestry/tapestry5/trunk/tapestry-core/src/site/apt/guide/logging.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/site/apt/guide/logging.apt?rev=653256&r1=653255&r2=653256&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/site/apt/guide/logging.apt (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/site/apt/guide/logging.apt Sun May 4 10:31:46 2008
@@ -35,6 +35,13 @@
. . .
---
+@Log annotation
+
+ You may mark a method with the {{{../../apidocs/org/apache/tapestry/annotations/Log.html}Log}} annotation.
+ Method entry, exit (and any thrown exceptions) will be logged at DEBUG level. This is very convienient for
+ debugging, especially when placed on event handler methods.
+
+
DEBUG Level
When a component's logger is configured at the DEBUG level, you will see added output when the class is first
Modified: tapestry/tapestry5/trunk/tapestry-core/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/site/apt/index.apt?rev=653256&r1=653255&r2=653256&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/site/apt/index.apt (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/site/apt/index.apt Sun May 4 10:31:46 2008
@@ -10,6 +10,9 @@
New And Of Note
+ * Component methods may be marked with the @Log annotation, to enable debug logging of
+ method entry (with parameters) and exit (with return value, or thrown exception).
+
* It is now possible to provide method invocation advice to component methods. This opens up
a very powerful Aspect Oriented Programming approach to Tapestry components.
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/ZoneDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/ZoneDemo.java?rev=653256&r1=653255&r2=653256&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/ZoneDemo.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/ZoneDemo.java Sun May 4 10:31:46 2008
@@ -17,20 +17,17 @@
import org.apache.tapestry.Block;
import org.apache.tapestry.annotations.ApplicationState;
import org.apache.tapestry.annotations.Component;
+import org.apache.tapestry.annotations.Log;
import org.apache.tapestry.corelib.components.BeanEditForm;
import org.apache.tapestry.integration.app1.data.RegistrationData;
import org.apache.tapestry.ioc.annotations.Inject;
import org.apache.tapestry.json.JSONObject;
-import org.slf4j.Logger;
public class ZoneDemo
{
@Component
private BeanEditForm _form;
- @Inject
- private Logger _logger;
-
private String _name;
@ApplicationState
@@ -63,13 +60,11 @@
_name = name;
}
+ @Log
Object onActionFromSelect(String name)
{
_name = name;
- _logger.info("Selected: '" + _name + "'");
-
-
if (name.equals("Registration")) return _registrationForm;
return _showName;
Modified: tapestry/tapestry5/trunk/tapestry-hibernate/src/main/java/org/apache/tapestry/hibernate/HibernateModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-hibernate/src/main/java/org/apache/tapestry/hibernate/HibernateModule.java?rev=653256&r1=653255&r2=653256&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-hibernate/src/main/java/org/apache/tapestry/hibernate/HibernateModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-hibernate/src/main/java/org/apache/tapestry/hibernate/HibernateModule.java Sun May 4 10:31:46 2008
@@ -184,7 +184,9 @@
OrderedConfiguration<ComponentClassTransformWorker> configuration,
ObjectLocator locator)
{
- configuration.add("CommitAfter", locator.autobuild(CommitAfterWorker.class));
+ // If logging is enabled, we want logging to be the first advice, wrapping around the commit advice.
+
+ configuration.add("CommitAfter", locator.autobuild(CommitAfterWorker.class), "after:Log");
}
}
Added: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/LoggingAdvice.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/LoggingAdvice.java?rev=653256&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/LoggingAdvice.java (added)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/LoggingAdvice.java Sun May 4 10:31:46 2008
@@ -0,0 +1,65 @@
+// Copyright 2008 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.ioc.internal.services;
+
+import org.apache.tapestry.ioc.Invocation;
+import org.apache.tapestry.ioc.MethodAdvice;
+import org.apache.tapestry.ioc.services.ExceptionTracker;
+import org.slf4j.Logger;
+
+public class LoggingAdvice implements MethodAdvice
+{
+ private final MethodLogger _methodLogger;
+
+ public LoggingAdvice(Logger logger, ExceptionTracker exceptionTracker)
+ {
+ _methodLogger = new MethodLogger(logger, exceptionTracker);
+ }
+
+ public void advise(Invocation invocation)
+ {
+ boolean debug = _methodLogger.isDebugEnabled();
+
+ if (!debug)
+ {
+ invocation.proceed();
+ return;
+ }
+
+ _methodLogger.entry(invocation);
+
+ try
+ {
+ invocation.proceed();
+ }
+ catch (RuntimeException ex)
+ {
+ _methodLogger.fail(invocation, ex);
+
+ throw ex;
+ }
+
+ if (invocation.isFail())
+ {
+ Exception thrown = invocation.getThrown(Exception.class);
+
+ _methodLogger.fail(invocation, thrown);
+
+ return;
+ }
+
+ _methodLogger.exit(invocation);
+ }
+}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/LoggingDecoratorImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/LoggingDecoratorImpl.java?rev=653256&r1=653255&r2=653256&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/LoggingDecoratorImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/LoggingDecoratorImpl.java Sun May 4 10:31:46 2008
@@ -14,7 +14,6 @@
package org.apache.tapestry.ioc.internal.services;
-import org.apache.tapestry.ioc.Invocation;
import org.apache.tapestry.ioc.MethodAdvice;
import org.apache.tapestry.ioc.services.AspectDecorator;
import org.apache.tapestry.ioc.services.ExceptionTracker;
@@ -35,41 +34,7 @@
public <T> T build(Class<T> serviceInterface, T delegate, String serviceId, final Logger logger)
{
- final ServiceLogger serviceLogger = new ServiceLogger(logger, _exceptionTracker);
-
- MethodAdvice advice = new MethodAdvice()
- {
- public void advise(Invocation invocation)
- {
- boolean debug = logger.isDebugEnabled();
-
- if (debug) serviceLogger.entry(invocation);
-
- try
- {
- invocation.proceed();
- }
- catch (RuntimeException ex)
- {
- if (debug) serviceLogger.fail(invocation, ex);
-
- throw ex;
- }
-
- if (!debug) return;
-
- if (invocation.isFail())
- {
- Exception thrown = invocation.getThrown(Exception.class);
-
- serviceLogger.fail(invocation, thrown);
-
- return;
- }
-
- serviceLogger.exit(invocation);
- }
- };
+ MethodAdvice advice = new LoggingAdvice(logger, _exceptionTracker);
return _aspectDecorator.build(serviceInterface, delegate, advice,
String.format("<Logging interceptor for %s(%s)>", serviceId,
Copied: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/MethodLogger.java (from r649954, tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ServiceLogger.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/MethodLogger.java?p2=tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/MethodLogger.java&p1=tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ServiceLogger.java&r1=649954&r2=653256&rev=653256&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ServiceLogger.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/MethodLogger.java Sun May 4 10:31:46 2008
@@ -23,9 +23,9 @@
/**
* Used by {@link org.apache.tapestry.ioc.internal.services.LoggingDecoratorImpl} to delegate out logging behavior to a
- * seperate object (helps ensure no naming conflicts).
+ * seperate object.
*/
-public final class ServiceLogger
+public final class MethodLogger
{
private static final int BUFFER_SIZE = 200;
@@ -39,12 +39,17 @@
private final ExceptionTracker _exceptionTracker;
- public ServiceLogger(Logger logger, ExceptionTracker exceptionTracker)
+ public MethodLogger(Logger logger, ExceptionTracker exceptionTracker)
{
_logger = logger;
_exceptionTracker = exceptionTracker;
}
+ public boolean isDebugEnabled()
+ {
+ return _logger.isDebugEnabled();
+ }
+
/**
* Invoked when a method is first entered
*
Added: tapestry/tapestry5/trunk/tapestry-test/src/test/conf/testng.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-test/src/test/conf/testng.xml?rev=653256&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-test/src/test/conf/testng.xml (added)
+++ tapestry/tapestry5/trunk/tapestry-test/src/test/conf/testng.xml Sun May 4 10:31:46 2008
@@ -0,0 +1,21 @@
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<!--
+ Copyright 2008 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<suite name="Tapestry Test" annotations="1.5" verbose="2">
+ <!-- This avoids a build error when performing a non-clean build. Just another Maven fuckup to be worked around. -->
+ <test name="Placeholder (no tests)"/>
+</suite>