From c5f9e2fcd9bcadb541d6f5bc601dfc298faac063 Mon Sep 17 00:00:00 2001 From: Ceki Gulcu Date: Thu, 21 Feb 2008 18:27:02 +0000 Subject: [PATCH] - wired the actual conversion plumbing - updated LIMITATION.txt file --- slf4j-converter/LIMITATIONS.txt | 23 +++++++++++++++---- .../java/org/slf4j/converter/Constant.java | 2 +- .../org/slf4j/converter/RuleSetFactory.java | 2 +- .../converter/internal/MigratorFrame.java | 12 ++++++++-- 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/slf4j-converter/LIMITATIONS.txt b/slf4j-converter/LIMITATIONS.txt index 8d7e0d6e..dcba5dc9 100644 --- a/slf4j-converter/LIMITATIONS.txt +++ b/slf4j-converter/LIMITATIONS.txt @@ -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 slf4j-converter aims to } - -- 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 diff --git a/slf4j-converter/src/main/java/org/slf4j/converter/Constant.java b/slf4j-converter/src/main/java/org/slf4j/converter/Constant.java index 73e6311c..8912e10b 100644 --- a/slf4j-converter/src/main/java/org/slf4j/converter/Constant.java +++ b/slf4j-converter/src/main/java/org/slf4j/converter/Constant.java @@ -4,7 +4,7 @@ public class Constant { 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; diff --git a/slf4j-converter/src/main/java/org/slf4j/converter/RuleSetFactory.java b/slf4j-converter/src/main/java/org/slf4j/converter/RuleSetFactory.java index 82d037df..fabcb658 100644 --- a/slf4j-converter/src/main/java/org/slf4j/converter/RuleSetFactory.java +++ b/slf4j-converter/src/main/java/org/slf4j/converter/RuleSetFactory.java @@ -26,7 +26,7 @@ public abstract class RuleSetFactory { 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; diff --git a/slf4j-converter/src/main/java/org/slf4j/converter/internal/MigratorFrame.java b/slf4j-converter/src/main/java/org/slf4j/converter/internal/MigratorFrame.java index 779e4f93..d61a4fc7 100644 --- a/slf4j-converter/src/main/java/org/slf4j/converter/internal/MigratorFrame.java +++ b/slf4j-converter/src/main/java/org/slf4j/converter/internal/MigratorFrame.java @@ -41,7 +41,6 @@ import javax.swing.JProgressBar; 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 @@ public class MigratorFrame extends JFrame implements ActionListener { } 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())) {