You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CommonsTrace.java 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*******************************************************************************
  2. * Copyright (c) 2006 IBM Corporation and others.
  3. * All rights reserved. This program and the accompanying materials
  4. * are made available under the terms of the Eclipse Public License v1.0
  5. * which accompanies this distribution, and is available at
  6. * http://www.eclipse.org/legal/epl-v10.html
  7. *
  8. * Contributors:
  9. * Matthew Webster - initial implementation
  10. *******************************************************************************/
  11. package org.aspectj.weaver.tools;
  12. import org.apache.commons.logging.Log;
  13. import org.apache.commons.logging.LogFactory;
  14. public class CommonsTrace extends AbstractTrace {
  15. private Log log;
  16. private String className;
  17. public CommonsTrace (Class clazz) {
  18. super(clazz);
  19. this.log = LogFactory.getLog(clazz);
  20. this.className = tracedClass.getName();
  21. }
  22. public void enter(String methodName, Object thiz, Object[] args) {
  23. if (log.isDebugEnabled()) {
  24. log.debug("> " + formatMessage(className, methodName, thiz, args));
  25. }
  26. }
  27. public void enter(String methodName, Object thiz) {
  28. if (log.isDebugEnabled()) {
  29. log.debug("> " + formatMessage(className, methodName, thiz, null));
  30. }
  31. }
  32. public void exit(String methodName, Object ret) {
  33. if (log.isDebugEnabled()) {
  34. log.debug("< " + formatMessage(className, methodName, ret, null));
  35. }
  36. }
  37. public void exit(String methodName, Throwable th) {
  38. if (log.isDebugEnabled()) {
  39. log.debug("< " + formatMessage(className, methodName, th, null));
  40. }
  41. }
  42. public void exit(String methodName) {
  43. if (log.isDebugEnabled()) {
  44. log.debug("< " + formatMessage(className, methodName, null, null));
  45. }
  46. }
  47. }