logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject svn commit: r568823 - in /logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw: ChainsawAppenderHandler.java LogUI.java
Date Thu, 23 Aug 2007 05:17:33 GMT
Author: sdeboy
Date: Wed Aug 22 22:17:32 2007
New Revision: 568823

URL: http://svn.apache.org/viewvc?rev=568823&view=rev
Log:
- Use MDC entries to send chainsaw-generated logging events 
to a chainsaw-log tab by default.
- Clearing the same MDC entries in ChainsawAppenderHandler 
in order to prevent receiver-initiated events from routing to the 
chainsaw-log tab

Modified:
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawAppenderHandler.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawAppenderHandler.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawAppenderHandler.java?rev=568823&r1=568822&r2=568823&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawAppenderHandler.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawAppenderHandler.java
Wed Aug 22 22:17:32 2007
@@ -26,6 +26,7 @@
 import javax.swing.event.EventListenerList;
 import org.apache.log4j.AppenderSkeleton;
 import org.apache.log4j.LogManager;
+import org.apache.log4j.MDC;
 import org.apache.log4j.helpers.Constants;
 import org.apache.log4j.net.SocketReceiver;
 import org.apache.log4j.rule.ExpressionRule;
@@ -221,6 +222,10 @@
 
     protected WorkQueue() {
       workerThread = new WorkerThread();
+      //clear the chainsaw-log mdc entries which is used to send Chainsaw-generated
+      //logging events to a special chainsaw-log tab
+      MDC.remove(Constants.HOSTNAME_KEY);
+      MDC.remove(Constants.APPLICATION_KEY);
       workerThread.start();
     }
 

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java?rev=568823&r1=568822&r2=568823&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java (original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java Wed Aug 22 22:17:32
2007
@@ -88,6 +88,7 @@
 import org.apache.log4j.LogManager;
 import org.apache.log4j.Logger;
 import org.apache.log4j.LoggerRepositoryExImpl;
+import org.apache.log4j.MDC;
 import org.apache.log4j.chainsaw.dnd.FileDnDTarget;
 import org.apache.log4j.chainsaw.help.HelpManager;
 import org.apache.log4j.chainsaw.help.Tutorial;
@@ -263,7 +264,11 @@
             return repositoryExImpl;
         }}, repositorySelectorGuard);
     
-    
+    //set hostname & application properties which will cause Chainsaw-generated
+    //logging events to route (by default) to a tab named 'chainsaw-log'
+    MDC.put(Constants.HOSTNAME_KEY, "chainsaw");
+    MDC.put(Constants.APPLICATION_KEY, "log");
+
     ApplicationPreferenceModel model = new ApplicationPreferenceModel();
 
     SettingsManager.getInstance().configure(new ApplicationPreferenceModelSaver(model));



Mime
View raw message