[slf4j-dev] svn commit: r1005 - in slf4j/trunk: slf4j-migrator/src/main/java/org/slf4j/migrator/line slf4j-site/src/site/pages slf4j-site/src/site/resources/images

ceki at slf4j.org ceki at slf4j.org
Tue Apr 29 18:04:22 CEST 2008


Author: ceki
Date: Tue Apr 29 18:04:22 2008
New Revision: 1005

Modified:
   slf4j/trunk/slf4j-migrator/src/main/java/org/slf4j/migrator/line/JULRuleSet.java
   slf4j/trunk/slf4j-site/src/site/pages/migrator.html
   slf4j/trunk/slf4j-site/src/site/pages/news.html
   slf4j/trunk/slf4j-site/src/site/resources/images/slf4j-migrator.gif

Log:
- documenting JUL to SLF4J migration
- added migration rule for .severe( and .warning(

Modified: slf4j/trunk/slf4j-migrator/src/main/java/org/slf4j/migrator/line/JULRuleSet.java
==============================================================================
--- slf4j/trunk/slf4j-migrator/src/main/java/org/slf4j/migrator/line/JULRuleSet.java	(original)
+++ slf4j/trunk/slf4j-migrator/src/main/java/org/slf4j/migrator/line/JULRuleSet.java	Tue Apr 29 18:04:22 2008
@@ -38,12 +38,20 @@
     SingleConversionRule crFactory1 = new SingleConversionRule(Pattern
         .compile("LogManager.getLogger\\("), "LoggerFactory.getLogger(");
 
+    SingleConversionRule crWarning = new SingleConversionRule(Pattern
+            .compile("\\.warning\\("), ".warn(");
+    SingleConversionRule crSevere = new SingleConversionRule(Pattern
+            .compile("\\.severe\\("), ".error(");
+  
+    
     conversionRuleList = new ArrayList<ConversionRule>();
     conversionRuleList.add(crImport0);
     conversionRuleList.add(crImport1);
     conversionRuleList.add(crImport2);
     conversionRuleList.add(crFactory0);
     conversionRuleList.add(crFactory1);
+    conversionRuleList.add(crWarning);
+    conversionRuleList.add(crSevere);
   }
 
   public Iterator<ConversionRule> iterator() {

Modified: slf4j/trunk/slf4j-site/src/site/pages/migrator.html
==============================================================================
--- slf4j/trunk/slf4j-site/src/site/pages/migrator.html	(original)
+++ slf4j/trunk/slf4j-site/src/site/pages/migrator.html	Tue Apr 29 18:04:22 2008
@@ -24,7 +24,8 @@
 
   <p>The SLF4J migrator is a small Java tool for migrating Java source
   files from the Jakarta Commons Logging (JCL) API to SLF4J. It can
-  also migrate from the log4j API to SLF4J.
+  also migrate from the log4j API to SLF4J, or from
+  <code>java.util.logging</code> API to SLF4J.
   </p>
 
   <p>The SLF4J migrator consists of a single jar file that can be
@@ -52,9 +53,9 @@
   <h2>Limitations</h2>
 
   <p>SLF4J migrator is intended as a simple tool to help you to
-  migrate your project source using JCL or log4j to SLF4J. It can only
-  perform elementary conversion steps. Essentially it will replace
-  appropriate import lines and logger declarations.
+  migrate your project source using JCL, log4j or JUL to SLF4J. It can
+  only perform elementary conversion steps. Essentially, it will
+  replace appropriate import lines and logger declarations.
   </p>
   
   <p>MyClass is a sample class using JCL. Here it is before:</p>
@@ -97,7 +98,8 @@
   Java project from JCL to SLF4J.
   </p>
 
-  <p>Migration rules for log4j to SLF4J are similar.</p>
+  <p>Migration rules from log4j to SLF4J, or from JUL to SLF4J are
+  similar.</p>
 
   <h3>General limitations</h3>
 
@@ -182,6 +184,48 @@
     </li> 
   </ul>
 
+  <h3>Limitations when migrating from JUL</h3>
+
+  
+  <ul>
+    <li>Calls to <code>finest()</code>, <code>finer()</code> or
+    <code>finest()</code> methods of
+    <code>java.util.loggging.Logger</code> are left as is.
+
+    <p>Given that <code>finest()</code>, <code>finer()</code> or
+    <code>finest()</code> calls could map to both trace() or debug()
+    calls in SLF4J, it is impossible to guess how the user wants to
+    map these calls.
+    </p>
+
+    <p>
+    </p>
+
+    </li>
+
+
+    <li>All strings matching ".severe(" are replaced by the string
+    ".error(" without any contexual analysys. Similarly, all strings
+    matching ".warning(" are replaced by ".warn(".
+
+    <p>Since the match/replace operation is not contextual, if your
+    code contains methods named "severe" or "warning", then the
+    migration results will have compilation errors. Fortunately, such
+    errors should be rare and easy to identify.
+    </p>
+
+    <p>
+    </p>
+
+    </li>
+
+    <li>Invocations of the following methods in the
+    <code>java.util.logging.Logger</code> class need to be migrated
+    manually: <code>log</code>, <code>logp</code>, <code>logrb</code>,
+    <code>entering</code>, <code>exiting</code>.
+      
+    </li>
+  </ul>
 
  </div> 
 </body>

Modified: slf4j/trunk/slf4j-site/src/site/pages/news.html
==============================================================================
--- slf4j/trunk/slf4j-site/src/site/pages/news.html	(original)
+++ slf4j/trunk/slf4j-site/src/site/pages/news.html	Tue Apr 29 18:04:22 2008
@@ -30,6 +30,14 @@
 
   <hr noshade="noshade" size="1"/>
 
+
+  <h3>XXX, 2008 - Release of SLF4J 1.5.1</h3>
+
+
+  <p>The <a href="migrator.html">SLF4J Migrator</a> tool has been
+  improved to support migration from JUL to SLF4J.
+  </p>
+
   <h3>February 26th, 2008 - Release of SLF4J 1.5.0</h3>
 
 

Modified: slf4j/trunk/slf4j-site/src/site/resources/images/slf4j-migrator.gif
==============================================================================
Binary files. No diff available.



More information about the slf4j-dev mailing list