logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From psm...@apache.org
Subject svn commit: r544010 - in /logging/chainsaw/trunk: ./ src/main/java/org/apache/log4j/chainsaw/ src/main/java/org/apache/log4j/chainsaw/layout/
Date Sun, 03 Jun 2007 23:27:07 GMT
Author: psmith
Date: Sun Jun  3 16:27:06 2007
New Revision: 544010

URL: http://svn.apache.org/viewvc?view=rev&rev=544010
Log:
Initial pom, and patched version of code to support log4j 1.2.15.

Note the snapshot requirements in the pom, since these log4j-* snapshots
are not in any repository as yet, one needs to install them ala maven install.
This is the same steps required to build log4j 1.2.15 with maven,
plus the extra step of mvn installing the log4j 1.2.15 snapshot.

I will updated the HOWTOBUILD section soon.


Added:
    logging/chainsaw/trunk/pom.xml
Modified:
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/layout/EventDetailLayout.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/layout/LayoutEditorPane.java

Added: logging/chainsaw/trunk/pom.xml
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/pom.xml?view=auto&rev=544010
==============================================================================
--- logging/chainsaw/trunk/pom.xml (added)
+++ logging/chainsaw/trunk/pom.xml Sun Jun  3 16:27:06 2007
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>log4j</groupId>
+  <artifactId>log4j-chainsaw</artifactId>
+  <version>1.99.0</version>
+  <description>Graphical Viewer for Logging events from a local or remote log4j event
system</description>
+  <build>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>apache-log4j-component</artifactId>
+      <version>0.1-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>apache-log4j-expression-filter</artifactId>
+      <version>0.1-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>apache-log4j-receivers</artifactId>
+      <version>0.1-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <version>1.2.15</version>
+    </dependency>
+    <dependency>
+      <groupId>ant</groupId>
+      <artifactId>ant</artifactId>
+      <version>1.6.5</version>
+    </dependency>
+    <dependency>
+      <groupId>jmdns</groupId>
+      <artifactId>jmdns</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>xstream</groupId>
+      <artifactId>xstream</artifactId>
+      <version>1.1.2</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-vfs</groupId>
+      <artifactId>commons-vfs</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging-api</artifactId>
+      <version>1.0.4</version>
+    </dependency>
+    <dependency>
+      <groupId>jakarta-regexp</groupId>
+      <artifactId>jakarta-regexp</artifactId>
+      <version>1.4</version>
+    </dependency>
+  <dependency>
+    <groupId>junit</groupId>
+    <artifactId>junit</artifactId>
+    <version>3.8.1</version>
+	<scope>test</scope>
+  </dependency>
+  </dependencies>
+</project>
+

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java?view=diff&rev=544010&r1=544009&r2=544010
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java
Sun Jun  3 16:27:06 2007
@@ -437,7 +437,7 @@
 
     default:
 
-      if (columnIndex <= columnNames.size()) {
+      if (columnIndex < columnNames.size()) {
         return event.getProperty(columnNames.get(columnIndex).toString());
       }
     }

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?view=diff&rev=544010&r1=544009&r2=544010
==============================================================================
--- 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 Sun Jun  3 16:27:06
2007
@@ -53,6 +53,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+
 import javax.swing.AbstractAction;
 import javax.swing.Action;
 import javax.swing.BorderFactory;
@@ -83,10 +84,12 @@
 import javax.swing.event.EventListenerList;
 import javax.swing.event.HyperlinkEvent;
 import javax.swing.event.HyperlinkListener;
+
 import org.apache.log4j.AppenderSkeleton;
 import org.apache.log4j.Level;
 import org.apache.log4j.LogManager;
 import org.apache.log4j.Logger;
+import org.apache.log4j.LoggerRepositoryExImpl;
 import org.apache.log4j.chainsaw.dnd.FileDnDTarget;
 import org.apache.log4j.chainsaw.help.HelpManager;
 import org.apache.log4j.chainsaw.help.Tutorial;
@@ -104,9 +107,9 @@
 import org.apache.log4j.chainsaw.receivers.ReceiversPanel;
 import org.apache.log4j.chainsaw.version.VersionManager;
 import org.apache.log4j.helpers.Constants;
-import org.apache.log4j.joran.JoranConfigurator;
 import org.apache.log4j.net.SocketNodeEventListener;
 import org.apache.log4j.plugins.Plugin;
+import org.apache.log4j.plugins.PluginConfigurator;
 import org.apache.log4j.plugins.PluginEvent;
 import org.apache.log4j.plugins.PluginListener;
 import org.apache.log4j.plugins.PluginRegistry;
@@ -114,9 +117,11 @@
 import org.apache.log4j.rule.ExpressionRule;
 import org.apache.log4j.rule.Rule;
 import org.apache.log4j.spi.Decoder;
-import org.apache.log4j.spi.LoggingEvent;
 import org.apache.log4j.spi.LoggerRepository;
 import org.apache.log4j.spi.LoggerRepositoryEx;
+import org.apache.log4j.spi.LoggingEvent;
+import org.apache.log4j.spi.RepositorySelector;
+import org.apache.log4j.xml.DOMConfigurator;
 import org.apache.log4j.xml.XMLDecoder;
 
 
@@ -190,6 +195,10 @@
    */
   private EventListenerList shutdownListenerList = new EventListenerList();
   private WelcomePanel welcomePanel;
+
+  private static final Object repositorySelectorGuard = new Object();
+  private static final LoggerRepositoryExImpl repositoryExImpl = new LoggerRepositoryExImpl(LogManager.getLoggerRepository());
+  
   private PluginRegistry pluginRegistry;
 
   /**
@@ -245,9 +254,19 @@
    * @param args
    */
   public static void main(String[] args) {
+  
       if(OSXIntegration.IS_OSX) {
           System.setProperty("apple.laf.useScreenMenuBar", "true");
       }
+      
+    
+    LogManager.setRepositorySelector(new RepositorySelector() {
+
+        public LoggerRepository getLoggerRepository() {
+            return repositoryExImpl;
+        }}, repositorySelectorGuard);
+    
+    
     ApplicationPreferenceModel model = new ApplicationPreferenceModel();
 
     SettingsManager.getInstance().configure(new ApplicationPreferenceModelSaver(model));
@@ -298,6 +317,7 @@
       showSplash(logUI);
     }
     logUI.cyclicBufferSize = model.getCyclicBufferSize();
+    logUI.pluginRegistry = repositoryExImpl.getPluginRegistry();
 
     logUI.handler = new ChainsawAppenderHandler();
     logUI.handler.addEventBatchListener(logUI.new NewTabEventBatchReceiver());
@@ -1889,8 +1909,7 @@
             try {
               // we temporarily swap the TCCL so that plugins can find resources
               Thread.currentThread().setContextClassLoader(classLoader);
-              JoranConfigurator jc = new JoranConfigurator();
-              jc.doConfigure(url, LogManager.getLoggerRepository());
+              PluginConfigurator.configure(url);
             }finally{
                 // now switch it back...
                 Thread.currentThread().setContextClassLoader(previousTCCL);

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/layout/EventDetailLayout.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/layout/EventDetailLayout.java?view=diff&rev=544010&r1=544009&r2=544010
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/layout/EventDetailLayout.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/layout/EventDetailLayout.java
Sun Jun  3 16:27:06 2007
@@ -191,16 +191,15 @@
         li = formatLocationInfo(event);
     }
     Hashtable properties = formatProperties(event);
-    LoggingEvent copy = new LoggingEvent();
-    copy.setLogger(logger);
-    copy.setTimeStamp(event.getTimeStamp());
-    copy.setLevel(event.getLevel());
-    copy.setThreadName(threadName);
-    copy.setMessage(msg);
-    copy.setNDC(ndc);
-    copy.setThrowableInformation(event.getThrowableInformation());
-    copy.setLocationInformation(li);
-    copy.setProperties(properties);
+    LoggingEvent copy = new LoggingEvent(null,
+	   logger, event.getTimeStamp(),
+	   event.getLevel(),
+	   msg,
+	   threadName,
+	   event.getThrowableInformation(),
+	   ndc,
+	   li,
+	   properties);
     
     return copy;
   }

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/layout/LayoutEditorPane.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/layout/LayoutEditorPane.java?view=diff&rev=544010&r1=544009&r2=544010
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/layout/LayoutEditorPane.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/layout/LayoutEditorPane.java
Sun Jun  3 16:27:06 2007
@@ -182,16 +182,16 @@
 
     ThrowableInformation tsr = new ThrowableInformation(new Exception());
 
-    event = new LoggingEvent();
-    event.setLogger(Logger.getLogger("com.mycompany.mylogger"));
-    event.setTimeStamp(new Date().getTime());
-    event.setLevel(org.apache.log4j.Level.DEBUG);
-    event.setThreadName("Thread-1");
-    event.setMessage("The quick brown fox jumped over the lazy dog");
-    event.setNDC("NDC string");
-    event.setThrowableInformation(tsr);
-    event.setLocationInformation(li);
-    event.setProperties(hashTable);
+    event = new LoggingEvent("org.apache.log4j.Logger",
+	    Logger.getLogger("com.mycompany.mylogger"),
+		new Date().getTime(),
+		org.apache.log4j.Level.DEBUG,
+		"The quick brown fox jumped over the lazy dog",
+		"Thread-1",
+		tsr,
+		"NDC string",
+		li,
+		hashTable);
     
   }
 



Mime
View raw message