[slf4j-dev] svn commit: r978 - in slf4j/trunk/slf4j-converter: . src/main/java/org/slf4j/converter src/main/java/org/slf4j/converter/internal

ceki at slf4j.org ceki at slf4j.org
Thu Feb 21 19:27:02 CET 2008


Author: ceki
Date: Thu Feb 21 19:27:02 2008
New Revision: 978

Modified:
   slf4j/trunk/slf4j-converter/LIMITATIONS.txt
   slf4j/trunk/slf4j-converter/src/main/java/org/slf4j/converter/Constant.java
   slf4j/trunk/slf4j-converter/src/main/java/org/slf4j/converter/RuleSetFactory.java
   slf4j/trunk/slf4j-converter/src/main/java/org/slf4j/converter/internal/MigratorFrame.java

Log:
- wired the actual conversion plumbing
- updated LIMITATION.txt file

Modified: slf4j/trunk/slf4j-converter/LIMITATIONS.txt
==============================================================================
--- slf4j/trunk/slf4j-converter/LIMITATIONS.txt	(original)
+++ slf4j/trunk/slf4j-converter/LIMITATIONS.txt	Thu Feb 21 19:27:02 2008
@@ -1,5 +1,14 @@
 
-The slf4j-converter aims to 
+The slf4j-migrator aims to 
+
+General limitations
+===================
+
+- the FATAL level is not supported. 
+
+  This is limitation is not deemed serious because there are usually
+  very few log statements bearing the FATAL level. 
+
 
 - if a method declares multipe loggers on the same line, the conversion will not be complete. Example:
 
@@ -15,8 +24,12 @@
   }
 
 
-  
-- the FATAL level is not supported. 
+When migrating from log4j 
+=========================
 
-  This is limitation is not deemed serious because there are usually
-  very few log statements bearing the FATAL level. 
+- Since NDC is not supported by SLF4J, the migrator cannot properly handle 
+  NDC statements.
+  
+- Calls to PropertyConfigurator or DomConfigurator cannot be migrated since
+  SLF4J the equivalents.
+  
\ No newline at end of file

Modified: slf4j/trunk/slf4j-converter/src/main/java/org/slf4j/converter/Constant.java
==============================================================================
--- slf4j/trunk/slf4j-converter/src/main/java/org/slf4j/converter/Constant.java	(original)
+++ slf4j/trunk/slf4j-converter/src/main/java/org/slf4j/converter/Constant.java	Thu Feb 21 19:27:02 2008
@@ -4,7 +4,7 @@
 
   public final static int JCL_TO_SLF4J = 0;
   public final static int LOG4J_TO_SLF4J = 1;
-  public final static int EMPTY_RULE_SET = 2;
+  public final static int NOP_TO_SLF4J = 2;
 
   public final static int NB_FILES_MAX = 1;
 

Modified: slf4j/trunk/slf4j-converter/src/main/java/org/slf4j/converter/RuleSetFactory.java
==============================================================================
--- slf4j/trunk/slf4j-converter/src/main/java/org/slf4j/converter/RuleSetFactory.java	(original)
+++ slf4j/trunk/slf4j-converter/src/main/java/org/slf4j/converter/RuleSetFactory.java	Thu Feb 21 19:27:02 2008
@@ -26,7 +26,7 @@
       return new JCLRuleSet();
     case Constant.LOG4J_TO_SLF4J:
       return new Log4jRuleSet();
-    case Constant.EMPTY_RULE_SET:
+    case Constant.NOP_TO_SLF4J:
       return new EmptyRuleSet();
     default:
       return null;

Modified: slf4j/trunk/slf4j-converter/src/main/java/org/slf4j/converter/internal/MigratorFrame.java
==============================================================================
--- slf4j/trunk/slf4j-converter/src/main/java/org/slf4j/converter/internal/MigratorFrame.java	(original)
+++ slf4j/trunk/slf4j-converter/src/main/java/org/slf4j/converter/internal/MigratorFrame.java	Thu Feb 21 19:27:02 2008
@@ -41,7 +41,6 @@
 import javax.swing.JRadioButton;
 import javax.swing.JTextField;
 import javax.swing.SpringLayout;
-import javax.swing.SwingUtilities;
 import javax.swing.WindowConstants;
 
 import org.slf4j.converter.Constant;
@@ -298,8 +297,17 @@
       } else {
 
         File projectFolder = new File(folderTextField.getText());
+        int conversionType;
+        if(radioJCL.isSelected()) {
+          conversionType = Constant.JCL_TO_SLF4J;
+        } else if (radioLog4j.isSelected()) {
+          conversionType = Constant.LOG4J_TO_SLF4J;
+        } else {
+          // we cannot possibly reach here
+          throw new IllegalStateException("One of JCL or log4j project must have been previously chosen.");
+        }
         ConversionTask task = new ConversionTask(projectFolder, this,
-            Constant.EMPTY_RULE_SET);
+            conversionType);
         task.launch();
       }
     } else if (BROWSE_COMMAND.equals(e.getActionCommand())) {



More information about the slf4j-dev mailing list