logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Deboy" <sde...@comotivsystems.com>
Subject RE: Chainsaw dependencies on log4j 1.3
Date Thu, 12 Apr 2007 23:31:19 GMT
Thanks Curt - 


I'll build it and let you know how it goes.

Scott Deboy
Principal Engineer
111 SW Columbia Street Ste. 950
Portland, OR  97201
Office: 503.224.7496
Direct Line: 503.821.6482
Cell: 503.997.1367
Fax: 503.222.0185
www.comotivsystems.com <http://www.comotivsystems.com/> 


From: Curt Arnold [mailto:carnold@apache.org] 
Sent: Thursday, April 12, 2007 4:26 PM
To: Log4J Developers List
Subject: Re: Chainsaw dependencies on log4j 1.3


Okay, I'm now able to successfully compile Chainsaw with only some minor
changes (more on that later).  The preliminaries are pretty brutal at
the moment, but hopefully they will get better as we decide how to
package these things.  To build Chainsaw on log4j 1.2.x, you need


log4j-1.2.15.jar built from SVN





The first you build as always.  The next two are build using Maven and
build against log4j 1.2.14 and should work, but haven't been tested in
any manner, with earlier log4j 1.2 jars.  To build these (adjust as
appropriate for your platform), each step assumes that you've changed
back to the base directory after the previous step:


Download and install Maven 2.0.4 or later

Open command shell

Place maven-2.0.4/bin on path


Checkout sandbox projects (where PROJECT is component, expression-filter
or receivers) using

   svn co https://svn.apache.org/repos/asf/logging/sandbox/log4j/PROJECT


Build and install expression-filter project

  cd expression-filter; mvn install


Build and install (into local Maven repo) component project:

  cd component; mvn install


Kludge an install of the freshly build log4j-1.2.15 into the local maven

  cd ~/.m2/repository/log4j/log4j

  mkdir 1.2.15

  cd 1.2.15

  # copy existing log4j-1.2.14.pom, but change version number

  sed s/1.2.14/1.2.15/ ../1.2.14/log4j-1.2.14.pom > log4j-1.2.15.pom

  # copy log4j-1.2.15.jar into same location


Build and install receivers


  cd receivers; mvn install


Replace log4j-1.3alpha-8.jar in chainsaw.lib with log4j-1.2.15.jar and
the three generated apache-log4j-*.jars (located in the target
subdirectory of each project).


Apply patch described below and build as normal



The following patch should allow chainsaw to build either against the
SVN head of log4j 1.3 or the 1.2 recipe described above:


Index: src/java/org/apache/log4j/chainsaw/LogUI.java


--- src/java/org/apache/log4j/chainsaw/LogUI.java (revision 527248)

+++ src/java/org/apache/log4j/chainsaw/LogUI.java (working copy)

@@ -103,7 +103,7 @@

 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.xml.DOMConfigurator;

 import org.apache.log4j.net.SocketNodeEventListener;

 import org.apache.log4j.plugins.Plugin;

 import org.apache.log4j.plugins.PluginEvent;

@@ -1888,8 +1888,7 @@

             try {

               // we temporarily swap the TCCL so that plugins can find


-              JoranConfigurator jc = new JoranConfigurator();

-              jc.doConfigure(url, LogManager.getLoggerRepository());

+              DOMConfigurator.configure(url);


                 // now switch it back...


Index: src/java/org/apache/log4j/chainsaw/layout/EventDetailLayout.java


--- src/java/org/apache/log4j/chainsaw/layout/EventDetailLayout.java
(revision 527248)

+++ src/java/org/apache/log4j/chainsaw/layout/EventDetailLayout.java
(working copy)

@@ -190,16 +190,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;


Index: src/java/org/apache/log4j/chainsaw/layout/LayoutEditorPane.java


--- src/java/org/apache/log4j/chainsaw/layout/LayoutEditorPane.java
(revision 527248)

+++ src/java/org/apache/log4j/chainsaw/layout/LayoutEditorPane.java
(working copy)

@@ -181,16 +181,16 @@


     ThrowableInformation tsr = new ThrowableInformation(new


-    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);






Basically, an equivalent DOMConfigurator method is used to replace a
call to JoranConfigurator and a call to the LoggingEvent constructor
newly added to both log4j 1.2.x and log4j 1.3 replaces the default
construction of LoggingEvent and subsequent mutator calls.  Duplicating
the LoggingEvent mutators would have required removing "final"
qualifiers from most members of LoggingEvent which was a more
substantial change than I wanted to do in 1.2.x.


I haven't had any success actually starting Chainsaw either against
log4j 1.2.x or 1.3.  So I'd appreciate feedback or fixes to anything
that I didn't get right.  I've now delayed income tax preparation by
several days and will now start working on that with a vengeance and
will not take offense if anyone wants to fix things directly in the SVN.


Hopefully the expression-filter project is usable with deployed versions
of log4j 1.2.  Any feedback on that would also be appreciated.


If anyone wants to add documentation, write test cases, or port test
cases over from log4j 1.3, more power to you.


For more info on Maven 2, you can download "Better Builds With Maven"
from http://www.mergere.com/m2book_download.jsp



View raw message