[jboss-svn-commits] JBL Code SVN: r38146 - labs/jbossesb/branches/JBESB_4_11_CP/product/rosetta/src/org/jboss/soa/esb/actions.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Jul 19 12:51:05 EDT 2012


Author: tcunning
Date: 2012-07-19 12:51:04 -0400 (Thu, 19 Jul 2012)
New Revision: 38146

Modified:
   labs/jbossesb/branches/JBESB_4_11_CP/product/rosetta/src/org/jboss/soa/esb/actions/ServiceLoggerAction.java
Log:
JBESB-3728
Change the log4j category to <JBOSSESB-COMMON-STRING>.<DEPLOYMENT>
.<SERVICE-CATEGORY>.<SERVICE-NAME> so that we can filter by
deployment and provide a case where all ServiceLoggerActions are
configured.


Modified: labs/jbossesb/branches/JBESB_4_11_CP/product/rosetta/src/org/jboss/soa/esb/actions/ServiceLoggerAction.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_11_CP/product/rosetta/src/org/jboss/soa/esb/actions/ServiceLoggerAction.java	2012-07-19 14:23:13 UTC (rev 38145)
+++ labs/jbossesb/branches/JBESB_4_11_CP/product/rosetta/src/org/jboss/soa/esb/actions/ServiceLoggerAction.java	2012-07-19 16:51:04 UTC (rev 38146)
@@ -33,7 +33,7 @@
 
 /**
  * Simple action that logs custom text and possibly the message to a logger using the 
- * "<service-category>.<service-name>" appender.    This action differs from LogAction
+ * "<jbossesb-common-string>.<deployment-name>.<service-category>.<service-name>" appender.    This action differs from LogAction
  * in that it allows you to set LogLevelAction on a per service basis, rather
  * than on a per-action basis, and that it allows you to log custom text.
  * Debug level setting will result in the ESB message being output.
@@ -45,15 +45,30 @@
  * &lt;action name="ServiceLoggerAction"
  * 		class="org.jboss.soa.esb.actions.ServiceLoggerAction"&gt;<br/>
  * &nbsp;&nbsp;&nbsp;&lt;property name="text" value="Reached here"/&gt;<br/>
- * &nbsp;&nbsp;&nbsp;&lt;property name="get-payload-location" value="true"/&gt;<br/>
+ * &nbsp;&nbsp;&nbsp;&lt;property name="log-payload-location" value="true"/&gt;<br/>
  * &lt;/action&gt;<br/>
  * </code>
  * <p/>
  * 
+ * jboss-log4j.xml:
+ * When configuring the jboss-log4j.xml, use the pattern :
+ * JBOSSESB_COMMON_STRING.DEPLOYMENT_NAME.SERVICE_CATEGORY.SERVICE_NAME
+ * 
+ * This allows you to log all instances of this action (by just using the JBOSSESB_COMMON_STRING),
+ * log all instances within a deployment (JBOSSESB_COMMON_STRING.DEPLOYMENT_NAME), by service category name,
+ * and by service name.
+ * 
+ * <code>
+ * &lt;category name="jbossesb.helloworld.esb.FirstServiceESB.SimpleListener"&gt;<br/>
+ *     &lt;priority value="TRACE"/&gt;<br/>
+ * &lt;/category&gt;<br/>
+ * </code>
+ * 
+ * 
  * Property description:
  * <ul>
  * <li><i>text</i>  Custom text to be output, defaults to action name
- * <li><i>get-payload-location</i> True or False value which specifies
+ * <li><i>log-payload-location</i> True or False value which specifies
  * whether the payload location should be logged in Trace 
  * </ul>         
  * 
@@ -63,12 +78,22 @@
  */
 public class ServiceLoggerAction extends AbstractActionLifecycle {
 	public static final String TEXT_TAG = "text";
-	public static final String LOG_PAYLOAD_LOCATION_TAG = "get-payload-location";
+	public static final String LOG_PAYLOAD_LOCATION_TAG = "log-payload-location";
+	public static final String COMMON_LOG4J_CATEGORY_STRING = "jbossesb";
 	
 	protected ConfigTree _config;
 	private Logger myLogger;
 	private MessagePayloadProxy payloadProxy;
 
+	private boolean logPayloadLocation;
+	
+	private String currCategoryName;
+	private String currServiceName;
+	private String currActionName;
+	private String currDeploymentName;
+	private String text;
+
+	
 	public ServiceLoggerAction() {	
 		myLogger = Logger.getLogger(this.getClass());
 	}
@@ -89,19 +114,17 @@
 		this.text = text;
 	}
 
-	private boolean logPayloadLocation;
-	
-	private String currCategoryName;
-	private String currServiceName;
-	private String currActionName;
-	private String text;
-
 	public Logger getLogger() {
 		return myLogger;
 	}
 	
 	public ServiceLoggerAction(ConfigTree configTree) {
-		myLogger = Logger.getLogger(configTree.getParent().getAttribute(
+		currDeploymentName = configTree.getParent().getParent().getAttribute(ListenerTagNames.DEPLOYMENT_NAME_TAG);
+		
+		myLogger = Logger.getLogger(
+				COMMON_LOG4J_CATEGORY_STRING + "."
+				+ currDeploymentName + "."
+				+ configTree.getParent().getAttribute(
 				ListenerTagNames.SERVICE_CATEGORY_NAME_TAG) + "."
 				+ configTree.getParent().getAttribute(ListenerTagNames.SERVICE_NAME_TAG));
 		



More information about the jboss-svn-commits mailing list