Re: [slf4j-dev] svn commit: r1155 - in slf4j/trunk/slf4j-ext/src/main/java/org/slf4j: agent instrumentation

2008-10-02 Thread Ralph Goers
Thanks,

I'm quite interested in this, but not only for entering and exiting but 
eventually for other logging as well.  However,  I wouldn't want it in 
all classes. I'd prefer to see additional configuration to define which 
classes should be instrumented.

Also, once the logging is injected would it be able to be removed?

In other words, eventually I'd like to see enabling and disabling of 
logging (i.e. the equivalent of configuring Loggers) done via AOP.

Thorbjørn Ravn Andersen wrote:
 Ralph Goers skrev:
   
 Can you describe how this is intended to work? Does this inject logging 
 at runtime or build time?

   
 
 Naturally. 

 It will inject logging statements at runtime (specifically class load 
 time) in all classes (which I am reconsidering) except some which are 
 blacklisted. 

 These log statements are placed at the entering and exiting of each 
 method and logs the parameters and the return value.

 It is not intended to grow to a full aspect environment - just a poor 
 mans give me something I can see!.

 You use it by setting up a java agent.

 When I have something which can be used by others I will write usage 
 documentation :)

 /Thorbjørn

 ___
 dev mailing list
 dev@slf4j.org
 http://www.slf4j.org/mailman/listinfo/dev
___
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev

[slf4j-dev] svn commit: r1158 - slf4j/trunk/slf4j-api/src/main/java/org/slf4j/spi

2008-10-02 Thread ceki
Author: ceki
Date: Thu Oct  2 17:08:15 2008
New Revision: 1158

Modified:
   slf4j/trunk/slf4j-api/src/main/java/org/slf4j/spi/LocationAwareLogger.java

Log:
- minor javadoc fix

Modified: 
slf4j/trunk/slf4j-api/src/main/java/org/slf4j/spi/LocationAwareLogger.java
==
--- slf4j/trunk/slf4j-api/src/main/java/org/slf4j/spi/LocationAwareLogger.java  
(original)
+++ slf4j/trunk/slf4j-api/src/main/java/org/slf4j/spi/LocationAwareLogger.java  
Thu Oct  2 17:08:15 2008
@@ -47,7 +47,7 @@
   
   
   /**
-   * Printing method which support for location information. 
+   * Printing method with support for location information. 
* 
* @param marker
* @param fqcn The fully qualified class name of the bcaller/b
___
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev


[slf4j-dev] svn commit: r1159 - slf4j/trunk/jcl-over-slf4j/src/main/java/org/apache/commons/logging

2008-10-02 Thread ceki
Author: ceki
Date: Thu Oct  2 17:10:19 2008
New Revision: 1159

Modified:
   slf4j/trunk/jcl-over-slf4j/src/main/java/org/apache/commons/logging/Log.java

Log:
- minor javadoc fix 
- noting that jcl-over-slf4j is compatible with JCL 1.1.1

Modified: 
slf4j/trunk/jcl-over-slf4j/src/main/java/org/apache/commons/logging/Log.java
==
--- 
slf4j/trunk/jcl-over-slf4j/src/main/java/org/apache/commons/logging/Log.java
(original)
+++ 
slf4j/trunk/jcl-over-slf4j/src/main/java/org/apache/commons/logging/Log.java
Thu Oct  2 17:10:19 2008
@@ -34,7 +34,7 @@
  * /ol
  * The mapping of these log levels to the concepts used by the underlying
  * logging system is implementation dependent.
- * The implemention should ensure, though, that this ordering behaves
+ * The implementation should ensure, though, that this ordering behaves
  * as expected./p
  *
  * pPerformance is often a logging concern.
@@ -55,7 +55,7 @@
  * external to the Logging APIs, through whatever mechanism is supported by
  * that system./p
  *
- * p style=color: #E40; font-weight: bold;Please note that this interface 
is identical to that found in JCL 1.0.4./p
+ * p style=color: #E40; font-weight: bold;Please note that this interface 
is identical to that found in JCL 1.1.1./p
  * 
  * @author a href=mailto:[EMAIL PROTECTED]Scott Sanders/a
  * @author Rod Waldhoff
___
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev


[slf4j-dev] svn commit: r1161 - slf4j/trunk/slf4j-api

2008-10-02 Thread ceki
Author: ceki
Date: Thu Oct  2 17:11:58 2008
New Revision: 1161

Modified:
   slf4j/trunk/slf4j-api/pom.xml

Log:
- clirr compatibility report should be with respect to 1.5.3

Modified: slf4j/trunk/slf4j-api/pom.xml
==
--- slf4j/trunk/slf4j-api/pom.xml   (original)
+++ slf4j/trunk/slf4j-api/pom.xml   Thu Oct  2 17:11:58 2008
@@ -92,7 +92,7 @@
 groupIdorg.codehaus.mojo/groupId
 artifactIdclirr-maven-plugin/artifactId
 configuration
-  comparisonVersion1.5.2/comparisonVersion
+  comparisonVersion1.5.3/comparisonVersion
 /configuration
   /plugin
 /plugins
___
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev


[slf4j-dev] svn commit: r1163 - slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/ext

2008-10-02 Thread ceki
Author: ceki
Date: Thu Oct  2 17:38:39 2008
New Revision: 1163

Added:
   slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/ext/ListAppender.java
Modified:
   slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/ext/XLoggerTest.java

Log:
- adding test cases as requested by Raph Goers in bug 104
  This is an intermediary commit (the test case does not pass). Complete fix
  to follow.

Added: slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/ext/ListAppender.java
==
--- (empty file)
+++ slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/ext/ListAppender.java Thu Oct 
 2 17:38:39 2008
@@ -0,0 +1,30 @@
+package org.slf4j.ext;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.AppenderSkeleton;
+import org.apache.log4j.spi.LoggingEvent;
+
+public class ListAppender extends AppenderSkeleton {
+
+  public ListLoggingEvent list = new ArrayListLoggingEvent();
+  
+  public boolean extractLocationInfo = false;
+  
+  protected void append(LoggingEvent event) {
+list.add(event);
+if(extractLocationInfo) {
+  event.getLocationInformation();
+}
+  }
+
+  public void close() {
+  }
+
+  public boolean requiresLayout() {
+return false;
+  }
+
+}
+

Modified: slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/ext/XLoggerTest.java
==
--- slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/ext/XLoggerTest.java  
(original)
+++ slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/ext/XLoggerTest.java  Thu Oct 
 2 17:38:39 2008
@@ -2,15 +2,107 @@
 
 import junit.framework.TestCase;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.spi.LoggingEvent;
 
 public class XLoggerTest extends TestCase {
 
-  Logger logger = LoggerFactory.getLogger(this.getClass());
-  
-  public void testSmoke() {
-XLogger xLogger = new XLogger(logger);
-xLogger.entry(logger);
+  ListAppender listAppender;
+  org.apache.log4j.Logger log4jRoot;
+
+  public XLoggerTest(String name) {
+super(name);
+  }
+
+  public void setUp() throws Exception {
+super.setUp();
+
+// start from a clean slate for each test
+
+listAppender = new ListAppender();
+listAppender.extractLocationInfo = true;
+log4jRoot = org.apache.log4j.Logger.getRootLogger();
+log4jRoot.addAppender(listAppender);
+log4jRoot.setLevel(org.apache.log4j.Level.TRACE);
+  }
+
+  public void tearDown() throws Exception {
+super.tearDown();
+  }
+
+  public void testEntering() {
+XLogger logger = XLoggerFactory.getXLogger(UnitTest);
+logger.entry();
+logger.entry(1);
+logger.entry(test);
+
+assertEquals(3, listAppender.list.size());
+
+LoggingEvent le0 = (LoggingEvent) listAppender.list.get(0);
+assertEquals(entry, le0.getMessage());
+System.out.println(*+le0.getLocationInformation().fullInfo);
+
+assertEquals(XLoggerTest.java, 
le0.getLocationInformation().getFileName());
+LoggingEvent le1 = (LoggingEvent) listAppender.list.get(1);
+assertEquals(entry with (1), le1.getMessage());
+
+LoggingEvent le2 = (LoggingEvent) listAppender.list.get(2);
+assertEquals(entry with (test), le2.getMessage());
+  }
+
+  public void testExiting() {
+XLogger logger = XLoggerFactory.getXLogger(UnitTest);
+logger.exit();
+// assertEquals(exit, logMessage);
+// logger.exit(0);
+// assertEquals(exit 0, logMessage);
+// logger.exit(false);
+// assertEquals(exit false, logMessage);
+  }
+
+  public void testThrowing() {
+XLogger logger = XLoggerFactory.getXLogger(UnitTest);
+logger.throwing(new UnsupportedOperationException(Test));
+// assertTrue(logMessage.startsWith(throwing
+// java.lang.UnsupportedOperationException:));
   }
+
+  public void testCaught() {
+XLogger logger = XLoggerFactory.getXLogger(UnitTest);
+long x = 5;
+try {
+  @SuppressWarnings(unused)
+  long y = x / 0;
+} catch (Exception ex) {
+  logger.catching(ex);
+}
+// assertTrue(logMessage.startsWith(caught
+// java.lang.ArithmeticException:));
+  }
+
+  // public void testDump() {
+  // XLogger logger = XLoggerFactory.getXLogger(UnitTest);
+  // String dumpData = ?xml version=\1.0\ 
encoding=\UTF-8\?\nDocument\n
+  // DataTest/Data\n/Document;
+  // logger.
+  //
+  // dump(logger, dumpData.getBytes());
+  // String expected = 3c 3f 78 6d 6c 20 76 65 72 73 69 6f 6e 3d 22 31;
+  // assertTrue(logMessage.trim().startsWith(expected));
+  // }
+
+  // public void testTimer() {
+  // Timer timer = new Timer(TestTimer);
+  // LoggerUtil.startTimer(timer);
+  // assertEquals(Timer TestTimer started, logMessage);
+  // LoggerUtil.pauseTimer(timer);
+  // assertEquals(Timer TestTimer paused, logMessage);
+  // LoggerUtil.resumeTimer(timer);
+  // assertEquals(Timer TestTimer resumed, logMessage);
+  // LoggerUtil.stopTimer(timer);
+  // 

[slf4j-dev] svn commit: r1164 - in slf4j/trunk/slf4j-ext/src: main/java/org/slf4j/ext test/java/org/slf4j/dummyExt test/java/org/slf4j/ext

2008-10-02 Thread ceki
Author: ceki
Date: Thu Oct  2 18:09:45 2008
New Revision: 1164

Added:
   slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/dummyExt/
  - copied from r1157, /slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/ext/
   slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/dummyExt/ListAppender.java
  - copied, changed from r1163, 
/slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/ext/ListAppender.java
   slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/dummyExt/XLoggerTest.java
  - copied, changed from r1163, 
/slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/ext/XLoggerTest.java
   slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/dummyExt/package.html
Removed:
   slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/ext/
Modified:
   slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/ext/XLogger.java

Log:
- test cases pass. The tests are in a different package because
  log4j location information extraction code requires this.

Explanation:
  
Tests related to the org.slfj.ext package. However, location information code
required the caller class (XLogger) to have a different prefix than
the test class XLoggerTest. This is ensured by having the test class
placed in a different package.

Modified: slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/ext/XLogger.java
==
--- slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/ext/XLogger.java  
(original)
+++ slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/ext/XLogger.java  Thu Oct 
 2 18:09:45 2008
@@ -25,7 +25,7 @@
   static Marker CATCHING_MARKER = MarkerFactory.getMarker(EXCEPTION);
 
   static String EXIT_MESSAGE_0 = exit;
-  static String EXIT_MESSAGE_1 = exit with {};
+  static String EXIT_MESSAGE_1 = exit with ({});
 
   static String ENTRY_MESSAGE_0 = entry;
   static String ENTRY_MESSAGE_1 = entry with ({});
@@ -96,7 +96,7 @@
*/
   public void exit(Object result) {
 if (instanceofLAL  logger.isTraceEnabled(ENTRY_MARKER)) {
-  String formattedMessage = MessageFormatter.format(EXIT_MESSAGE_0, 
result);
+  String formattedMessage = MessageFormatter.format(EXIT_MESSAGE_1, 
result);
   ((LocationAwareLogger) logger).log(EXIT_MARKER, FQCN,
   LocationAwareLogger.TRACE_INT, formattedMessage, null);
 }

Copied: 
slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/dummyExt/ListAppender.java (from 
r1163, /slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/ext/ListAppender.java)
==
--- /slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/ext/ListAppender.java
(original)
+++ slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/dummyExt/ListAppender.java
Thu Oct  2 18:09:45 2008
@@ -1,4 +1,4 @@
-package org.slf4j.ext;
+package org.slf4j.dummyExt;
 
 import java.util.ArrayList;
 import java.util.List;

Copied: slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/dummyExt/XLoggerTest.java 
(from r1163, 
/slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/ext/XLoggerTest.java)
==
--- /slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/ext/XLoggerTest.java 
(original)
+++ slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/dummyExt/XLoggerTest.java 
Thu Oct  2 18:09:45 2008
@@ -1,15 +1,18 @@
-package org.slf4j.ext;
+package org.slf4j.dummyExt;
 
 import junit.framework.TestCase;
 
-import org.apache.log4j.LogManager;
 import org.apache.log4j.spi.LoggingEvent;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
 
 public class XLoggerTest extends TestCase {
 
   ListAppender listAppender;
   org.apache.log4j.Logger log4jRoot;
-
+  
+  final static String EXPECTED_FILE_NAME = XLoggerTest.java;
+  
   public XLoggerTest(String name) {
 super(name);
   }
@@ -30,6 +33,17 @@
 super.tearDown();
   }
 
+  
+  void verify(LoggingEvent le, String expectedMsg) {
+assertEquals(expectedMsg, le.getMessage());
+assertEquals(EXPECTED_FILE_NAME, 
le.getLocationInformation().getFileName());
+  }
+
+  void verifyWithException(LoggingEvent le, String expectedMsg, Throwable t) {
+verify(le, expectedMsg);
+assertEquals(t.toString(), le.getThrowableStrRep()[0]);
+  }
+  
   public void testEntering() {
 XLogger logger = XLoggerFactory.getXLogger(UnitTest);
 logger.entry();
@@ -37,47 +51,43 @@
 logger.entry(test);
 
 assertEquals(3, listAppender.list.size());
-
-LoggingEvent le0 = (LoggingEvent) listAppender.list.get(0);
-assertEquals(entry, le0.getMessage());
-System.out.println(*+le0.getLocationInformation().fullInfo);
-
-assertEquals(XLoggerTest.java, 
le0.getLocationInformation().getFileName());
-LoggingEvent le1 = (LoggingEvent) listAppender.list.get(1);
-assertEquals(entry with (1), le1.getMessage());
-
-LoggingEvent le2 = (LoggingEvent) listAppender.list.get(2);
-assertEquals(entry with (test), le2.getMessage());
-  }
+verify((LoggingEvent) listAppender.list.get(0), entry);
+

[slf4j-dev] [Bug 104] XLogger does not implement Logger

2008-10-02 Thread bugzilla-daemon
http://bugzilla.slf4j.org/show_bug.cgi?id=104





--- Comment #8 from Ceki Gulcu [EMAIL PROTECTED]  2008-10-02 18:15:35 ---
Added appropriate test cases which were useful enough to catch a bug. 

On a related note, Ralph, have you noticed that the dump() method is not part
of XLogger?


-- 
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev


Re: [slf4j-dev] [Fwd: FW: FW: New logging]

2008-10-02 Thread Ceki Gulcu

Hello Ralph,

As you are the driving force behind XLogger would you mind adding a 
documentation about XLogger? The extensions.html page would be a good place.

BTW, since you have filed an ICLA, should we create a user for you in SVN?

Cheers,

Ralph Goers wrote:
 I'm posting this to the dev list to help maintain the public record.
 
  Original Message 
 Subject:  FW: FW: New logging
 Date: Wed, 24 Sep 2008 06:22:44 -0700
 From: Goers, Ralph [EMAIL PROTECTED]
 To:   [EMAIL PROTECTED]
 CC:   
 
 
 
 Thanks for the quick response. I will open a bug report for this.
 
 -Original Message-
 From: Ceki Gulcu [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, September 24, 2008 2:49 AM
 To: Goers, Ralph
 Subject: Re: FW: New logging
 
 Hi Ralph,
 
 Thank you for your input. I agree that having to declare both an xlogger and 
 a 
 logger is cumbersome. May I suggest that you enter a bug report for this 
 item, 
 so that I can refer to it when describing the new release. Do I have your 
 permission to quote your message so that the rest of the SLF4J community is 
 kept 
 informed? Alternatively, you could forward it to [EMAIL PROTECTED] yourself.
 
 To keep the ball rolling, I've already committed relevant changes. In 
 revision 
 1149, XLogger implements the org.slfj4j.Logger interface. Could you please 
 have 
 a look?
 
 http://svn.slf4j.org/viewvc?view=revrevision=1149
 
 Cheers,
 
 Goers, Ralph wrote:
  

 *From:* Goers, Ralph
 *Sent:* Tuesday, September 23, 2008 2:58 PM
 *To:* Perrine, Andy; Buckley, Krista
 *Cc:* '[EMAIL PROTECTED]'
 *Subject:* RE: New logging

  

 I'm forwarding this to Ceki. For some reason it didn't dawn on me that 
 XLogger doesn't extend Logger. This is why the version is marked as 
 alpha0 by the way.

  

 You can certainly use the LoggerUtil.entering methods in our framework 
 extensions until Ceki fixes this. 

  

 FWIW , Logger logger = new XLogger(LoggerFactory.getLogger(name)); 
 wouldn't really amount to much in the way of extra garbage.

  

 *From:* Perrine, Andy
 *Sent:* Tuesday, September 23, 2008 2:52 PM
 *To:* Buckley, Krista; Goers, Ralph
 *Subject:* RE: New logging

  

 That's ugly and it's creating a lot of extra garbage to be collected 
 compared to the previous version, surely there must be a better way?

 
 

 *From:* Buckley, Krista
 *Sent:* Tuesday, September 23, 2008 2:49 PM
 *To:* Goers, Ralph
 *Cc:* Perrine, Andy
 *Subject:* RE: New logging

  

 So now that we discovered XLogger does not extend Logger, we are doing 
 it this way.  We use XLogger for entry, exit, catching, throwing; we use 
 Logger for all else.

  

 import org.slf4j.Logger;

 import org.slf4j.LoggerFactory;

 import org.slf4j.ext.XLogger;

  

 public class AccountSelector

 {

 private Logger logger = LoggerFactory.getLogger(getClass().getName());

 private XLogger xlogger = new XLogger(logger);

  

 // No getLogger() method

  

 xlogger.entry(); 

  

 ve = new ValidationException(Password validation Failed 
 (consecutive char));

 logger.debug(Password must not contain more then the 
 following consective characters: {},

   passwordMaxConsecutive);

 xlogger.throwing(ve);

  

  

 logger.info(Password must not exceed the maximum length 
 of {}, passwordMaxLength);

  

 try

 {

  ...

 }

catch (Exception e)

 {

 xlogger.catching(e);

 }

  

 xlogger.exit();  // Alternately:  xlogger.exit(result);

  
 
 

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch
___
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev


[slf4j-dev] svn commit: r1165 - slf4j/trunk

2008-10-02 Thread ceki
Author: ceki
Date: Thu Oct  2 20:14:25 2008
New Revision: 1165

Added:
   slf4j/trunk/binderVersion.pl
Modified:
   slf4j/trunk/goVersion.sh
   slf4j/trunk/version.pl

Log:
- a perl script to edit the version number of  StaticLoggerBinder.java files
  This is used for version checking done by LoggerFactory

Added: slf4j/trunk/binderVersion.pl
==
--- (empty file)
+++ slf4j/trunk/binderVersion.plThu Oct  2 20:14:25 2008
@@ -0,0 +1,39 @@
+
+if ($#ARGV  1) {
+  print Usage: binderVersion.pl VER FILE {FILE, FILE}\n;
+  exit;
+}
+
+$V= $ARGV[0];
+print VER:${V}\r\n;
+shift(@ARGV);
+
+sub replace () {
+  my $filename = $_[0];
+
+  if(-s $filename) {
+print Processing [ . $filename . ]\r\n;
+
+my $original = $filename.original;
+
+rename($filename, $original);
+open(OUT, $filename);
+open(IN, $original);
+
+while(IN) {
+  if(/VERSION\s+=\s+.*;/) {
+s/VERSION\s+=\s+.*;/VERSION = ${V};/;
+  } 
+  print OUT;
+}
+close(IN);
+close(OUT);
+unlink($original);
+  } else {
+print File [ . $filename . ] does not exist\r\n 
+  }
+}
+
+foreach $ARG (@ARGV) {
+  do replace($ARG);
+}

Modified: slf4j/trunk/goVersion.sh
==
--- slf4j/trunk/goVersion.sh(original)
+++ slf4j/trunk/goVersion.shThu Oct  2 20:14:25 2008
@@ -1,6 +1,8 @@
-VER=$1
-echo Will use version $VER
-echo Changing pom.xml files
-find . -name pom.xml |grep -v archetype-resources|xargs perl version.pl $VER 
-echo Changing Java files
-find . -name StaticLoggerBinder.java |grep -v archetype-resources|xargs perl 
binderVersion.pl $VER
+
+
+VER=$1
+echo Will use version '${VER}'
+echo Changing pom.xml files
+find . -name pom.xml |grep -v archetype-resources|xargs perl version.pl 
${VER}
+echo Changing Java files
+find . -name StaticLoggerBinder.java |grep -v archetype-resources|xargs perl 
binderVersion.pl ${VER}

Modified: slf4j/trunk/version.pl
==
--- slf4j/trunk/version.pl  (original)
+++ slf4j/trunk/version.pl  Thu Oct  2 20:14:25 2008
@@ -4,8 +4,8 @@
   exit;
 }
 
-$V= $ARGV[0];
-print VER:$V\r\n;
+$V=$ARGV[0];
+print VER:'${V}'\r\n;
 shift(@ARGV);
 
 sub replace () {
@@ -23,7 +23,7 @@
 my $hitCount=0;
 while(IN) {
   if($hitCount == 0  /version.*\/version/) {
-s/version.*\/version/version$V\/version/;
+s/version.*\/version/version${V}\/version/;
 $hitCount++;
   } 
   print OUT;
___
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev


[slf4j-dev] svn commit: r1167 - in slf4j/trunk: . slf4j-api/src/main/java/org/slf4j slf4j-ext

2008-10-02 Thread ceki
Author: ceki
Date: Thu Oct  2 20:44:12 2008
New Revision: 1167

Modified:
   slf4j/trunk/goVersion.sh
   slf4j/trunk/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java
   slf4j/trunk/slf4j-ext/pom.xml

Log:
- Adding version check support in each slf4j-binding 
  Each copy of StaticLoggerBinder.java found in each binding now contains a 
field called
  VERSION. LoggerFactory checks that the version value found in the binding 
matches
  the expected version number as declared in LoggerFactory

Modified: slf4j/trunk/goVersion.sh
==
--- slf4j/trunk/goVersion.sh(original)
+++ slf4j/trunk/goVersion.shThu Oct  2 20:44:12 2008
@@ -1,8 +1,11 @@
 
 
+
 VER=$1
 echo Will use version '${VER}'
 echo Changing pom.xml files
-find . -name pom.xml |grep -v archetype-resources|xargs perl version.pl 
${VER}
+find . -name pom.xml |xargs perl version.pl ${VER}
 echo Changing Java files
-find . -name StaticLoggerBinder.java |grep -v archetype-resources|xargs perl 
binderVersion.pl ${VER}
+find . -name StaticLoggerBinder.java |xargs perl binderVersion.pl ${VER}
+find slf4j-api -name LoggerFactory.java |xargs perl binderVersion.pl ${VER}
+

Modified: slf4j/trunk/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java
==
--- slf4j/trunk/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java
(original)
+++ slf4j/trunk/slf4j-api/src/main/java/org/slf4j/LoggerFactory.javaThu Oct 
 2 20:44:12 2008
@@ -51,7 +51,7 @@
   static final String NULL_LF_URL = http://www.slf4j.org/codes.html#null_LF;;
   static final String VERSION_MISMATCH = 
http://www.slf4j.org/codes.html#version_mismatch;;
   
-  static private final String EXPECTED_VERSION = ;
+  static private final String EXPECTED_VERSION = 1.5.4-SNAPSHOT;

   // private constructor prevents instantiation
   private LoggerFactory() {

Modified: slf4j/trunk/slf4j-ext/pom.xml
==
--- slf4j/trunk/slf4j-ext/pom.xml   (original)
+++ slf4j/trunk/slf4j-ext/pom.xml   Thu Oct  2 20:44:12 2008
@@ -5,7 +5,7 @@
   parent
 groupIdorg.slf4j/groupId
 artifactIdslf4j-parent/artifactId
-version1.5.4-SNAPSHOT
/version
+version1.5.4-SNAPSHOT/version
   /parent
 
   modelVersion4.0.0/modelVersion
___
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev


[slf4j-dev] Unit tests in slf4j-ext and Maven

2008-10-02 Thread Ceki Gulcu


Thorbjørn Ravn Andersen wrote:

 I'm trying to get unit tests up and running in Maven for the agent, but 
 I am unfamiliar with the Maven way of doing things, so I'd appreciate 
 some comments.
 
 I've figured out how to use the argLine tag to get -javaagent:foobar 
 put in the right place of the surefire invocation, but unfortunately it 
 is a hard requirement that the _jar_file is used, and it appears to me 
 that the test-phase is before the jar-file is built, so it is not even 
 available at that time.
 
 Is there a good way to run unit tests after the jar file is built, and 
 how do I refer to the jar file in pom.xml?  

Hello Thorbjørn,

It is quite difficult to get Maven to do things it is not designed for, at 
least 
not out of the box. I do not know how to run unit tests after the jar is built. 
Usually, the jar is built, only if the tests pass. (Tests always come before 
the 
packaging.) For the various Maven2 test phases, see

   http://cvs.peopleware.be/training/maven/maven2/buildLifecyclePhases.html

We could run the test after the packaging phase, for example during the 
integration-test phase. I'll see what I can do.

On a related note, the addition of 
argLine-javaagent:${project.build.outputDirectory}=time/argLine
seems to cause Continuum to fail. Here is the error message:

  [INFO] Scanning for projects...
[INFO] 
[INFO] Building SLF4J Extensions Module
[INFO]task-segment: [clean, install]
[INFO] 
[INFO] [clean:clean]
[INFO] Deleting directory /opt/continuum-1.1/working-directory/8/target
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Compiling 14 source files to 
/opt/continuum-1.1/working-directory/8/target/classes
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] Compiling 10 source files to 
/opt/continuum-1.1/working-directory/8/target/test-classes
[INFO] [surefire:test]
[INFO] Surefire report directory: 
/opt/continuum-1.1/working-directory/8/target/surefire-reports
Error occurred during initialization of VM
Error opening zip file: /opt/continuum-1.1/working-directory/8/target/classes
agent library failed to init: instrument
[INFO] 
[ERROR] BUILD FAILURE
[INFO] 
[INFO] There are test failures.

I'll look into this some more and get back to you.

 /Thorbjørn

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch
___
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev

[slf4j-dev] svn commit: r1168 - slf4j/trunk/slf4j-ext

2008-10-02 Thread ravn
Author: ravn
Date: Thu Oct  2 21:11:01 2008
New Revision: 1168

Modified:
   slf4j/trunk/slf4j-ext/pom.xml

Log:
cannot test the resulting jar yet.

Modified: slf4j/trunk/slf4j-ext/pom.xml
==
--- slf4j/trunk/slf4j-ext/pom.xml   (original)
+++ slf4j/trunk/slf4j-ext/pom.xml   Thu Oct  2 21:11:01 2008
@@ -59,13 +59,6 @@
 exclude**/AllTest.java/exclude
 exclude**/PackageTest.java/exclude
   /excludes
- argLine-javaagent:${project.build.outputDirectory}=time/argLine
-  systemProperties
-property
-  namemaven.surefire.debug/name
-  value-ververbose/value
-/property
-  /systemProperties
 /configuration
   /plugin
 
___
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev


Re: [slf4j-dev] svn commit: r1155 - in slf4j/trunk/slf4j-ext/src/main/java/org/slf4j: agent instrumentation

2008-10-02 Thread Ceki Gulcu


Thorbjørn Ravn Andersen wrote:
 Ralph Goers skrev:
 Thanks,

 I'm quite interested in this, but not only for entering and exiting but 
 eventually for other logging as well.  However,  I wouldn't want it in 
 all classes. I'd prefer to see additional configuration to define which 
 classes should be instrumented.
   
 You are welcome.
 
 Basically, all this does is inserting a if (_log.isDebugEnabled()) 
 _log.debug(entering XXX with arguments Y=..., Z=) and a 
 corresponding exit logger to each method. It _IS_ simple and I do not 
 want to build it to be some large instrumentation framework.It is 
 just to allow people to very easily get extra information - a quick win 
 - without having to do a lot of stuff.

Does _log field refers to a logger named after the containing class? If so, you 
could enable/disable logging for each java class separately using the 
configuration mechanism provided in log4j/jul/logback. In other words, 
additional configuration in the agent is *unnecessary*. Is that nice or what?

The only problem with this approach is that you would be enabling/disabling 
logging for the entire class. Had you used markers, one could enable/disable 
entry/exit logging without necessarily affecting logging in the rest of the 
containing class. By the way, XLogger.enter() and exit() methods use the 
appropriate markers.

I'd also like to point that XLogger.enter and exit() method use the TRACE level 
whereas LogTransformer uses DEBUG. A little consistency is in oder... Either 
both use TRACE or both should use DEBUG.

Cheers,

  [snip]

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch
___
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev

Re: [slf4j-dev] svn commit: r1165 - slf4j/trunk

2008-10-02 Thread Thorbjørn Ravn Andersen
[EMAIL PROTECTED] skrev:
 Author: ceki
 Date: Thu Oct  2 20:14:25 2008
 New Revision: 1165

 Added:
slf4j/trunk/binderVersion.pl
 Modified:
slf4j/trunk/goVersion.sh
slf4j/trunk/version.pl

 Log:
 - a perl script to edit the version number of  StaticLoggerBinder.java files
   This is used for version checking done by LoggerFactory

   
Any particular reason you wrote a Perl script instead of using the Ant 
Replace task? 

/Thorbjørn
___
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev

Re: [slf4j-dev] Unit tests in slf4j-ext and Maven

2008-10-02 Thread Ceki Gulcu

Thorbjørn Ravn Andersen wrote:
 I read up a bit on this.  It appears that maven-surefire-plugin cannot 
 both do unit tests and integration tests in the same life cycle (as far 
 as I understood).
 
 Oh the joy of other peoples tools :)

Maven is far from perfect.

 On a related note, the addition of 
 argLine-javaagent:${project.build.outputDirectory}=time/argLine
 seems to cause Continuum to fail. Here is the error message:

   
 That is because it is wrong (not a valid zip file), and I can see that I 
 have removed that line in my local copy.  My bad. Duly updated.  
 Shouldn't Continuum tell me that I broke the build?

Yes but. Well, Continnum generates tons of notifications which become quite 
annoying after a while. However, if you wish, I can have Continuum forward them 
to you as well although I don't think you would put up with it for long.

 Also it confused me a bit in the beginning to see stack traces in the 
 maven output, but apparently that is intentional.  I am not used to such 
 verbosity when tests actually pass :)

Yah, the slf4j tests are too verbose. I totally agree.


 /Thorbjørn

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch
___
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev

Re: [slf4j-dev] svn commit: r1165 - slf4j/trunk

2008-10-02 Thread Ceki Gulcu


Thorbjørn Ravn Andersen wrote:

   
 Any particular reason you wrote a Perl script instead of using the Ant 
 Replace task? 

Here is the rationale. As the release manager, I am the only one who runs the 
script. The Ant equivalent of the script would not gain much except the 
dependency on Perl (which I don't mind). Again, running the script is not an 
operation other developers are supposed to perform. Does that make sense?

Anyway, if you care to write the equivalent Ant script, I'd happily get rid of 
the perl one.

 /Thorbjørn

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch
___
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev

Re: [slf4j-dev] svn commit: r1165 - slf4j/trunk

2008-10-02 Thread Thorbjørn Ravn Andersen
Ceki Gulcu skrev:
 Thorbjørn Ravn Andersen wrote:

   
   
   
 Any particular reason you wrote a Perl script instead of using the Ant 
 Replace task? 
 

 Here is the rationale. As the release manager, I am the only one who runs the 
 script. The Ant equivalent of the script would not gain much except the 
 dependency on Perl (which I don't mind). Again, running the script is not an 
 operation other developers are supposed to perform. Does that make sense?

   
Sure.   I was just wondering why.   As you know my personal preference 
is to be able to automatically bring up the build environment and then 
do the complete build all the way to the dry run simulating the release 
(otherwise you cannot test it).  Bringing in non-Java dependencies 
complicates this unnecessarily, and tie you to a given platform.

But again, this is your project and  you can do as you like :)
 Anyway, if you care to write the equivalent Ant script, I'd happily get rid 
 of 
 the perl one.
   

For now, no.  Such things needs to be done just-in-time by the person 
who needs it.

/Thorbjørn
___
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev

Re: [slf4j-dev] svn commit: r1155 - in slf4j/trunk/slf4j-ext/src/main/java/org/slf4j: agent instrumentation

2008-10-02 Thread Ceki Gulcu


Thorbjørn Ravn Andersen wrote:
 Ceki Gulcu skrev:
 Does _log field refers to a logger named after the containing class? If so, 
 you 
 could enable/disable logging for each java class separately using the 
 configuration mechanism provided in log4j/jul/logback. In other words, 
 additional configuration in the agent is *unnecessary*. Is that nice or what?

   
 Yes.  It is initialized based on the name of the class being instrumented.
 
 The name _log is currently hardcoded, but it should be anonymous/an 
 unused name. 
 
 The only problem with this approach is that you would be enabling/disabling 
 logging for the entire class. Had you used markers, one could enable/disable 
 entry/exit logging without necessarily affecting logging in the rest of the 
 containing class. By the way, XLogger.enter() and exit() methods use the 
 appropriate markers.
   
 As I mentioned in another mail, this is intentionally kept very simple.

I don't believe using xlogger instead of logger would be any more complex, 
probably the contrary is true.

 I'd also like to point that XLogger.enter and exit() method use the TRACE 
 level 
 whereas LogTransformer uses DEBUG. A little consistency is in oder... Either 
  both use TRACE or both should use DEBUG.

 Actually in the article I used the INFO level as it is the lowest level 
 printed out by j.u.l without a configuration file.  I think it would be 
 a valid default level to keep the entry barrier as low as possible, and 
 then have a level keyword to the agent to override this.

User comfortable with java bytecode changing can probably deal with setting the 
level of the root logger.

 /Thorbjørn

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch
___
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev

Re: [slf4j-dev] Unit tests in slf4j-ext and Maven

2008-10-02 Thread Thorbjørn Ravn Andersen
Ceki Gulcu skrev:
 Thorbjørn Ravn Andersen wrote:
   
 I read up a bit on this.  It appears that maven-surefire-plugin cannot 
 both do unit tests and integration tests in the same life cycle (as far 
 as I understood).

 Oh the joy of other peoples tools :)
 

 Maven is far from perfect.
   
As long as it is Good Enough it is usually a matter of finding out how 
to tweak it to do your bidding.  Currently I am working with a new Java 
project outside of SVN with a dependency on the generated snapshot to 
see how it works, and hopefully to write a few tests.  Works for now.


   
 On a related note, the addition of 
 argLine-javaagent:${project.build.outputDirectory}=time/argLine
 seems to cause Continuum to fail. Here is the error message:

   
   
 That is because it is wrong (not a valid zip file), and I can see that I 
 have removed that line in my local copy.  My bad. Duly updated.  
 Shouldn't Continuum tell me that I broke the build?
 

 Yes but. Well, Continnum generates tons of notifications which become quite 
 annoying after a while. However, if you wish, I can have Continuum forward 
 them 
 to you as well although I don't think you would put up with it for long.

   
Frankly I just want to know to know when I was (one of the) responsible 
for the build breaking and when it was ok again.

Used to work on a project using CruiseControl for this - worked well.  
At work I have a project in the pipeline with lots of legacy code, so we 
will NEED a CI tool.  I looked at Hudson - it appears to be very nice 
with a good feeling and finish.


 Also it confused me a bit in the beginning to see stack traces in the 
 maven output, but apparently that is intentional.  I am not used to such 
 verbosity when tests actually pass :)
 

 Yah, the slf4j tests are too verbose. I totally agree.
   
Any particular reason for them being so?


/Thorbjørn
___
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev

Re: [slf4j-dev] svn commit: r1155 - in slf4j/trunk/slf4j-ext/src/main/java/org/slf4j: agent instrumentation

2008-10-02 Thread Thorbjørn Ravn Andersen
Ceki Gulcu skrev:

 Actually in the article I used the INFO level as it is the lowest level 
 printed out by j.u.l without a configuration file.  I think it would be 
 a valid default level to keep the entry barrier as low as possible, and 
 then have a level keyword to the agent to override this.
 

 User comfortable with java bytecode changing can probably deal with setting 
 the 
 level of the root logger.
   
Depends on which users you want to reach.

I was thinking of those who needs the log method calls functionality 
and not using slf4j already.  If you can say drop these jars in your 
project, add this javaagent, and rerun you have a very low entry barrier.

Why make it more complicated than that?
___
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev


Re: [slf4j-dev] Unit tests in slf4j-ext and Maven

2008-10-02 Thread Ceki Gulcu


Thorbjørn Ravn Andersen wrote:
   
 Frankly I just want to know to know when I was (one of the) responsible 
 for the build breaking and when it was ok again.

If the problem persists we'll tackle it.

 Also it confused me a bit in the beginning to see stack traces in the 
 maven output, but apparently that is intentional.  I am not used to such 
 verbosity when tests actually pass :)
 
 Yah, the slf4j tests are too verbose. I totally agree.
   
 Any particular reason for them being so?

Many of the tests attempt to log (on the console) and see if things go well. 
Admittedly, these tests are not perfect but they still exercise relevant code.

I am open to suggestions about reducing the noise in these tests.

 /Thorbjørn

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch
___
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev

[slf4j-dev] svn commit: r1169 - slf4j/trunk/slf4j-jdk14/src/test/java/org/slf4j

2008-10-02 Thread ceki
Author: ceki
Date: Thu Oct  2 23:05:01 2008
New Revision: 1169

Modified:
   slf4j/trunk/slf4j-jdk14/src/test/java/org/slf4j/InvocationTest.java

Log:
keep JDK logging quite during tests...

Modified: slf4j/trunk/slf4j-jdk14/src/test/java/org/slf4j/InvocationTest.java
==
--- slf4j/trunk/slf4j-jdk14/src/test/java/org/slf4j/InvocationTest.java 
(original)
+++ slf4j/trunk/slf4j-jdk14/src/test/java/org/slf4j/InvocationTest.java Thu Oct 
 2 23:05:01 2008
@@ -33,6 +33,8 @@
 
 package org.slf4j;
 
+import java.util.logging.Level;
+
 import junit.framework.TestCase;
 
 
@@ -44,16 +46,22 @@
  */
 public class InvocationTest extends TestCase {
 
+  Level oldLevel;
+  java.util.logging.Logger root = java.util.logging.Logger.getLogger();
+  
   public InvocationTest (String arg0) {
 super(arg0);
   }
 
   protected void setUp() throws Exception {
 super.setUp();
+oldLevel = root.getLevel();
+root.setLevel(Level.OFF);
   }
 
   protected void tearDown() throws Exception {
 super.tearDown();
+root.setLevel(oldLevel);
   }
   
   public void test1() {
___
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev


[slf4j-dev] svn commit: r1170 - in slf4j/trunk/jcl-over-slf4j: . src/test/java/org/apache/commons/logging

2008-10-02 Thread ceki
Author: ceki
Date: Thu Oct  2 23:08:48 2008
New Revision: 1170

Modified:
   slf4j/trunk/jcl-over-slf4j/pom.xml
   
slf4j/trunk/jcl-over-slf4j/src/test/java/org/apache/commons/logging/InvokeJCLTest.java

Log:
keep tests silent...

Modified: slf4j/trunk/jcl-over-slf4j/pom.xml
==
--- slf4j/trunk/jcl-over-slf4j/pom.xml  (original)
+++ slf4j/trunk/jcl-over-slf4j/pom.xml  Thu Oct  2 23:08:48 2008
@@ -21,10 +21,10 @@
   dependencies
 dependency
   groupIdorg.slf4j/groupId
-  artifactIdslf4j-simple/artifactId
+  artifactIdslf4j-nop/artifactId
   version${project.version}/version
   scopeprovided/scope
-   /dependency
+  /dependency

   /dependencies
 

Modified: 
slf4j/trunk/jcl-over-slf4j/src/test/java/org/apache/commons/logging/InvokeJCLTest.java
==
--- 
slf4j/trunk/jcl-over-slf4j/src/test/java/org/apache/commons/logging/InvokeJCLTest.java
  (original)
+++ 
slf4j/trunk/jcl-over-slf4j/src/test/java/org/apache/commons/logging/InvokeJCLTest.java
  Thu Oct  2 23:08:48 2008
@@ -44,10 +44,10 @@
 Log log = LogFactory.getLog(InvokeJCLTest.class);
 assertFalse(log.isTraceEnabled());
 assertFalse(log.isDebugEnabled());
-assertTrue(log.isInfoEnabled());
-assertTrue(log.isWarnEnabled());
-assertTrue(log.isErrorEnabled());
-assertTrue(log.isFatalEnabled());
+assertFalse(log.isInfoEnabled());
+assertFalse(log.isWarnEnabled());
+assertFalse(log.isErrorEnabled());
+assertFalse(log.isFatalEnabled());
   }
   
   public void testPrintAPI() {
___
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev


[slf4j-dev] svn commit: r1171 - slf4j/trunk/slf4j-api/src/main/java/org/slf4j

2008-10-02 Thread ceki
Author: ceki
Date: Thu Oct  2 23:15:06 2008
New Revision: 1171

Modified:
   slf4j/trunk/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java

Log:
- keep tests quiet
- fixed bug in version check code

Modified: slf4j/trunk/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java
==
--- slf4j/trunk/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java
(original)
+++ slf4j/trunk/slf4j-api/src/main/java/org/slf4j/LoggerFactory.javaThu Oct 
 2 23:15:06 2008
@@ -61,7 +61,7 @@
   static {
 try { 
   String actualVer = StaticLoggerBinder.VERSION;
-  if(EXPECTED_VERSION.equals(actualVer)) {
+  if(!EXPECTED_VERSION.equals(actualVer)) {
 Util.reportFailure(Actual version +actualVer+ differs from expected 
version +EXPECTED_VERSION);
 Util.reportFailure(See +VERSION_MISMATCH+ for further details.);
   }
___
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev


[slf4j-dev] svn commit: r1172 - slf4j/trunk/slf4j-jcl/src/test/java/org/slf4j

2008-10-02 Thread ceki
Author: ceki
Date: Thu Oct  2 23:15:07 2008
New Revision: 1172

Modified:
   slf4j/trunk/slf4j-jcl/src/test/java/org/slf4j/InvocationTest.java

Log:
- keep tests quiet
- fixed bug in version check code

Modified: slf4j/trunk/slf4j-jcl/src/test/java/org/slf4j/InvocationTest.java
==
--- slf4j/trunk/slf4j-jcl/src/test/java/org/slf4j/InvocationTest.java   
(original)
+++ slf4j/trunk/slf4j-jcl/src/test/java/org/slf4j/InvocationTest.java   Thu Oct 
 2 23:15:07 2008
@@ -33,6 +33,8 @@
 
 package org.slf4j;
 
+import java.util.logging.Level;
+
 import junit.framework.TestCase;
 
 
@@ -44,16 +46,23 @@
  */
 public class InvocationTest extends TestCase {
 
+  Level oldLevel;
+  java.util.logging.Logger root = java.util.logging.Logger.getLogger();
+  
+  
   public InvocationTest (String arg0) {
 super(arg0);
   }
 
   protected void setUp() throws Exception {
 super.setUp();
+oldLevel = root.getLevel();
+root.setLevel(Level.OFF);
   }
 
   protected void tearDown() throws Exception {
 super.tearDown();
+root.setLevel(oldLevel);
   }
   
   public void test1() {
___
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev


[slf4j-dev] svn commit: r1173 - slf4j/trunk/slf4j-simple/src/test/java/org/slf4j

2008-10-02 Thread ceki
Author: ceki
Date: Thu Oct  2 23:31:23 2008
New Revision: 1173

Added:
   slf4j/trunk/slf4j-simple/src/test/java/org/slf4j/SilentPrintStream.java
Modified:
   slf4j/trunk/slf4j-simple/src/test/java/org/slf4j/InvocationTest.java

Log:
keep slfj-simple tests silent as well...

Modified: slf4j/trunk/slf4j-simple/src/test/java/org/slf4j/InvocationTest.java
==
--- slf4j/trunk/slf4j-simple/src/test/java/org/slf4j/InvocationTest.java
(original)
+++ slf4j/trunk/slf4j-simple/src/test/java/org/slf4j/InvocationTest.java
Thu Oct  2 23:31:23 2008
@@ -32,6 +32,8 @@
 
 package org.slf4j;
 
+import java.io.PrintStream;
+
 import junit.framework.TestCase;
 
 
@@ -43,16 +45,20 @@
  */
 public class InvocationTest extends TestCase {
 
+  PrintStream old = System.err;
+  
   public InvocationTest (String arg0) {
 super(arg0);
   }
 
   protected void setUp() throws Exception {
 super.setUp();
+System.setErr(new SilentPrintStream(old));
   }
 
   protected void tearDown() throws Exception {
 super.tearDown();
+System.setErr(old);
   }
   
   public void test1() {

Added: slf4j/trunk/slf4j-simple/src/test/java/org/slf4j/SilentPrintStream.java
==
--- (empty file)
+++ slf4j/trunk/slf4j-simple/src/test/java/org/slf4j/SilentPrintStream.java 
Thu Oct  2 23:31:23 2008
@@ -0,0 +1,22 @@
+package org.slf4j;
+
+import java.io.PrintStream;
+
+public class SilentPrintStream extends PrintStream {
+
+  PrintStream other;
+
+  public SilentPrintStream(PrintStream ps) {
+super(ps);
+other = ps;
+  }
+
+  public void print(String s) {
+  }
+
+  public void println(String s) {
+  }
+  
+  public void println(Object x) {
+  }
+}
___
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev


[slf4j-dev] slf4j test are now silent

2008-10-02 Thread Ceki Gulcu
Hello all,

Thorbjørn has observed that slf4j test spewed a lot of garbage on the console. 
I 
just modified the various tests so that the unit test are silent. This has been 
done by

- In slf4j-jdk14, setting the level of the root logger to OFF
- In jcl-over-slf4j, replacing slf4j-simple by slf4j-nop
- In slf4j-jcl, setting the level of the root logger to OFF (in JDK4 logging)
- In slf4j-simple, while the tests run, replace System.err by a PrintStream 
which gobbles all data sent to it. When the test finishes, the original 
System.err is restored.

Cheers,

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch
___
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev

Re: [slf4j-dev] [Fwd: FW: FW: New logging]

2008-10-02 Thread Ralph Goers
I assume that would give me rights to commit? That would be great.

I'd be happy to write some documentation on XLogger.

Ceki Gulcu wrote:
 Hello Ralph,

 As you are the driving force behind XLogger would you mind adding a 
 documentation about XLogger? The extensions.html page would be a good place.

 BTW, since you have filed an ICLA, should we create a user for you in SVN?

 Cheers,

 Ralph Goers wrote:
   
 I'm posting this to the dev list to help maintain the public record.

  Original Message 
 Subject: FW: FW: New logging
 Date:Wed, 24 Sep 2008 06:22:44 -0700
 From:Goers, Ralph [EMAIL PROTECTED]
 To:  [EMAIL PROTECTED]
 CC:  



 Thanks for the quick response. I will open a bug report for this.

 -Original Message-
 From: Ceki Gulcu [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, September 24, 2008 2:49 AM
 To: Goers, Ralph
 Subject: Re: FW: New logging

 Hi Ralph,

 Thank you for your input. I agree that having to declare both an xlogger and 
 a 
 logger is cumbersome. May I suggest that you enter a bug report for this 
 item, 
 so that I can refer to it when describing the new release. Do I have your 
 permission to quote your message so that the rest of the SLF4J community is 
 kept 
 informed? Alternatively, you could forward it to [EMAIL PROTECTED] yourself.

 To keep the ball rolling, I've already committed relevant changes. In 
 revision 
 1149, XLogger implements the org.slfj4j.Logger interface. Could you please 
 have 
 a look?

 http://svn.slf4j.org/viewvc?view=revrevision=1149

 Cheers,

 Goers, Ralph wrote:
 
  

 *From:* Goers, Ralph
 *Sent:* Tuesday, September 23, 2008 2:58 PM
 *To:* Perrine, Andy; Buckley, Krista
 *Cc:* '[EMAIL PROTECTED]'
 *Subject:* RE: New logging

  

 I'm forwarding this to Ceki. For some reason it didn't dawn on me that 
 XLogger doesn't extend Logger. This is why the version is marked as 
 alpha0 by the way.

  

 You can certainly use the LoggerUtil.entering methods in our framework 
 extensions until Ceki fixes this. 

  

 FWIW , Logger logger = new XLogger(LoggerFactory.getLogger(name)); 
 wouldn't really amount to much in the way of extra garbage.

  

 *From:* Perrine, Andy
 *Sent:* Tuesday, September 23, 2008 2:52 PM
 *To:* Buckley, Krista; Goers, Ralph
 *Subject:* RE: New logging

  

 That's ugly and it's creating a lot of extra garbage to be collected 
 compared to the previous version, surely there must be a better way?

   
 

 *From:* Buckley, Krista
 *Sent:* Tuesday, September 23, 2008 2:49 PM
 *To:* Goers, Ralph
 *Cc:* Perrine, Andy
 *Subject:* RE: New logging

  

 So now that we discovered XLogger does not extend Logger, we are doing 
 it this way.  We use XLogger for entry, exit, catching, throwing; we use 
 Logger for all else.

  

 import org.slf4j.Logger;

 import org.slf4j.LoggerFactory;

 import org.slf4j.ext.XLogger;

  

 public class AccountSelector

 {

 private Logger logger = LoggerFactory.getLogger(getClass().getName());

 private XLogger xlogger = new XLogger(logger);

  

 // No getLogger() method

  

 xlogger.entry(); 

  

 ve = new ValidationException(Password validation Failed 
 (consecutive char));

 logger.debug(Password must not contain more then the 
 following consective characters: {},

   passwordMaxConsecutive);

 xlogger.throwing(ve);

  

  

 logger.info(Password must not exceed the maximum length 
 of {}, passwordMaxLength);

  

 try

 {

  ...

 }

catch (Exception e)

 {

 xlogger.catching(e);

 }

  

 xlogger.exit();  // Alternately:  xlogger.exit(result);

  
   
 

   
___
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev


Re: [slf4j-dev] Unit tests in slf4j-ext and Maven

2008-10-02 Thread Ralph Goers


Thorbjørn Ravn Andersen wrote:

 I read up a bit on this.  It appears that maven-surefire-plugin cannot 
 both do unit tests and integration tests in the same life cycle (as far 
 as I understood).

   
Actually you can. I've done it.  I'll dig around and find an example of 
how to do it.

Ralph

___
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev

Re: [slf4j-dev] svn commit: r1155 - in slf4j/trunk/slf4j-ext/src/main/java/org/slf4j: agent instrumentation

2008-10-02 Thread Ralph Goers


Ceki Gulcu wrote:
 logging for the entire class. Had you used markers, one could enable/disable 
 entry/exit logging without necessarily affecting logging in the rest of the 
 containing class. By the way, XLogger.enter() and exit() methods use the 
 appropriate markers.
   
I mentioned this as well. It makes more sense to me to use the XLogger 
methods for this.
 I'd also like to point that XLogger.enter and exit() method use the TRACE 
 level 
 whereas LogTransformer uses DEBUG. A little consistency is in oder... Either 
 both use TRACE or both should use DEBUG.

   
Obviously, I prefer TRACE for this. Logging with flow tracing enabled is 
very high overhead. Enabling DEBUG shouldn't enable it.

Ralph
___
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev


[slf4j-dev] [Bug 104] XLogger does not implement Logger

2008-10-02 Thread bugzilla-daemon
http://bugzilla.slf4j.org/show_bug.cgi?id=104





--- Comment #9 from Ralph Goers [EMAIL PROTECTED]  2008-10-03 07:55:18 ---
Yes, I noticed that dump wasn't added when you created it. I assumed you had a
good reason for not adding it. Although it isn't as critical to me as the other
methods it is still nice to have.


-- 
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev