diff --git a/.classpath b/.classpath
index 3cdce40..714d253 100644
--- a/.classpath
+++ b/.classpath
@@ -8,5 +8,7 @@
+
+
diff --git a/lib/README b/lib/README
index d64c866..f7df234 100644
--- a/lib/README
+++ b/lib/README
@@ -2,3 +2,5 @@ Description of used libraries:
- hamcrest-core: required by junit
- junit: unit tests API
- log4j: log API
+- slf4j-api: facade log API
+- slf4j-log4j12: adaptation layer between slf4j and log4j
diff --git a/lib/slf4j-api-1.7.5-sources.jar b/lib/slf4j-api-1.7.5-sources.jar
new file mode 100644
index 0000000..51abe2b
Binary files /dev/null and b/lib/slf4j-api-1.7.5-sources.jar differ
diff --git a/lib/slf4j-api-1.7.5.jar b/lib/slf4j-api-1.7.5.jar
new file mode 100644
index 0000000..8766455
Binary files /dev/null and b/lib/slf4j-api-1.7.5.jar differ
diff --git a/lib/slf4j-log4j12-1.7.5-sources.jar b/lib/slf4j-log4j12-1.7.5-sources.jar
new file mode 100644
index 0000000..ea1b93b
Binary files /dev/null and b/lib/slf4j-log4j12-1.7.5-sources.jar differ
diff --git a/lib/slf4j-log4j12-1.7.5.jar b/lib/slf4j-log4j12-1.7.5.jar
new file mode 100644
index 0000000..afce5c2
Binary files /dev/null and b/lib/slf4j-log4j12-1.7.5.jar differ
diff --git a/src/fr/devinsy/util/DateHelper.java b/src/fr/devinsy/util/DateHelper.java
index 1c5a6ee..8bd6c39 100755
--- a/src/fr/devinsy/util/DateHelper.java
+++ b/src/fr/devinsy/util/DateHelper.java
@@ -17,8 +17,8 @@ import java.util.regex.Pattern;
*/
public class DateHelper
{
- // static private org.apache.log4j.Logger logger =
- // org.apache.log4j.Logger.getLogger (DateHelper.class);
+ // static private final Logger logger =
+ // LoggerFactory.getLogger(DateHelper.class);
static final String EUROPEAN_DATE_FORMAT = "%02d/%02d/%04d";
static final String SHORT_EUROPEAN_DATE_FORMAT = "%02d/%02d";
diff --git a/src/fr/devinsy/util/DateTimeHelper.java b/src/fr/devinsy/util/DateTimeHelper.java
index 0fc807f..89be3a4 100755
--- a/src/fr/devinsy/util/DateTimeHelper.java
+++ b/src/fr/devinsy/util/DateTimeHelper.java
@@ -7,13 +7,13 @@ package fr.devinsy.util;
import java.util.Calendar;
-
/**
* This class groups function to help in Calendar manipulation.
*/
public class DateTimeHelper
{
- //static private org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger (DateTimeHelper.class);
+ // static private final Logger logger =
+ // LoggerFactory.getLogger(DateTimeHelper.class);
static final String EUROPEAN_DATE_FORMAT = "%02d/%02d/%04d %02d:%02d:%02d";
static final String RAW_DATE_FORMAT = "%04d%02d%02d %02d:%02d:%02d";
@@ -25,11 +25,10 @@ public class DateTimeHelper
static final String ISO_DATE_PATTERN = "^(\\d\\d\\d\\d)-([01]\\d)-([0123]\\d)$";
static final String AMERICAN_DATE_PATTERN = "^([01]{0,1}\\d)/([0123]{0,1}\\d)/(\\d\\d\\d\\d)$";
-
/**
*
*/
- static public String europeanFormat (Calendar time)
+ static public String americanFormat(final Calendar time)
{
String result;
@@ -39,23 +38,18 @@ public class DateTimeHelper
}
else
{
- result = String.format (EUROPEAN_DATE_FORMAT, time.get(Calendar.DAY_OF_MONTH),
- time.get(Calendar.MONTH) + 1,
- time.get(Calendar.YEAR),
- time.get(Calendar.HOUR_OF_DAY),
- time.get(Calendar.MINUTE),
- time.get(Calendar.SECOND));
+ result = String.format(AMERICAN_DATE_FORMAT, time.get(Calendar.MONTH) + 1, time.get(Calendar.DAY_OF_MONTH), time.get(Calendar.YEAR), time.get(Calendar.HOUR_OF_DAY),
+ time.get(Calendar.MINUTE), time.get(Calendar.SECOND));
}
//
return (result);
}
-
/**
*
*/
- static public String ISOFormat (Calendar time)
+ static public String europeanFormat(final Calendar time)
{
String result;
@@ -65,23 +59,18 @@ public class DateTimeHelper
}
else
{
- result = String.format (ISO_DATE_FORMAT, time.get(Calendar.YEAR),
- time.get(Calendar.MONTH) + 1,
- time.get(Calendar.DAY_OF_MONTH),
- time.get(Calendar.HOUR_OF_DAY),
- time.get(Calendar.MINUTE),
- time.get(Calendar.SECOND));
+ result = String.format(EUROPEAN_DATE_FORMAT, time.get(Calendar.DAY_OF_MONTH), time.get(Calendar.MONTH) + 1, time.get(Calendar.YEAR), time.get(Calendar.HOUR_OF_DAY),
+ time.get(Calendar.MINUTE), time.get(Calendar.SECOND));
}
-
+
//
return (result);
}
-
/**
*
*/
- static public String americanFormat (Calendar time)
+ static public String ISOFormat(final Calendar time)
{
String result;
@@ -91,23 +80,18 @@ public class DateTimeHelper
}
else
{
- result = String.format (AMERICAN_DATE_FORMAT, time.get(Calendar.MONTH) + 1,
- time.get(Calendar.DAY_OF_MONTH),
- time.get(Calendar.YEAR),
- time.get(Calendar.HOUR_OF_DAY),
- time.get(Calendar.MINUTE),
- time.get(Calendar.SECOND));
+ result = String.format(ISO_DATE_FORMAT, time.get(Calendar.YEAR), time.get(Calendar.MONTH) + 1, time.get(Calendar.DAY_OF_MONTH), time.get(Calendar.HOUR_OF_DAY), time.get(Calendar.MINUTE),
+ time.get(Calendar.SECOND));
}
-
+
//
return (result);
}
-
/**
*
*/
- static public String rawFormat (Calendar time)
+ static public String rawFormat(final Calendar time)
{
String result;
@@ -117,14 +101,10 @@ public class DateTimeHelper
}
else
{
- result = String.format (RAW_DATE_FORMAT, time.get(Calendar.YEAR),
- time.get(Calendar.MONTH) + 1,
- time.get(Calendar.DAY_OF_MONTH),
- time.get(Calendar.HOUR_OF_DAY),
- time.get(Calendar.MINUTE),
- time.get(Calendar.SECOND));
+ result = String.format(RAW_DATE_FORMAT, time.get(Calendar.YEAR), time.get(Calendar.MONTH) + 1, time.get(Calendar.DAY_OF_MONTH), time.get(Calendar.HOUR_OF_DAY), time.get(Calendar.MINUTE),
+ time.get(Calendar.SECOND));
}
-
+
//
return (result);
}
diff --git a/src/fr/devinsy/util/cmdexec/CmdExec.java b/src/fr/devinsy/util/cmdexec/CmdExec.java
index 1dfbc4a..806c7fe 100644
--- a/src/fr/devinsy/util/cmdexec/CmdExec.java
+++ b/src/fr/devinsy/util/cmdexec/CmdExec.java
@@ -1,5 +1,8 @@
package fr.devinsy.util.cmdexec;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import fr.devinsy.util.StringConcatenator;
/**
@@ -8,7 +11,7 @@ import fr.devinsy.util.StringConcatenator;
*/
public class CmdExec
{
- static private org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(CmdExec.class);
+ static private final Logger logger = LoggerFactory.getLogger(CmdExec.class);
protected int exitValue;
protected String out;
diff --git a/src/fr/devinsy/util/cmdexec/StreamGobbler.java b/src/fr/devinsy/util/cmdexec/StreamGobbler.java
index f46c068..7c4f716 100644
--- a/src/fr/devinsy/util/cmdexec/StreamGobbler.java
+++ b/src/fr/devinsy/util/cmdexec/StreamGobbler.java
@@ -5,12 +5,15 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
*
*/
public class StreamGobbler extends Thread
{
- static private org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(CmdExec.class);
+ static private final Logger logger = LoggerFactory.getLogger(CmdExec.class);
static final public int NONE = 0;
static final public int PRINT = 1;
diff --git a/src/fr/devinsy/util/cmdexec/Wrapper.java b/src/fr/devinsy/util/cmdexec/Wrapper.java
index 64d7cd8..5acb43d 100644
--- a/src/fr/devinsy/util/cmdexec/Wrapper.java
+++ b/src/fr/devinsy/util/cmdexec/Wrapper.java
@@ -5,13 +5,16 @@ import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
*
*/
public class Wrapper
{
static private final Wrapper instance = new Wrapper();
- static private org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Wrapper.class);
+ static private final Logger logger = LoggerFactory.getLogger(Wrapper.class);
/**
* return instance of the controller
diff --git a/src/fr/devinsy/util/unix/CachedFile.java b/src/fr/devinsy/util/unix/CachedFile.java
index 017e29f..906f7c7 100644
--- a/src/fr/devinsy/util/unix/CachedFile.java
+++ b/src/fr/devinsy/util/unix/CachedFile.java
@@ -2,6 +2,9 @@ package fr.devinsy.util.unix;
import java.io.File;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
*
*/
@@ -12,7 +15,7 @@ public class CachedFile
NOT_LOAD, EXPIRED, UPDATED
}
- static private org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(CachedFile.class);
+ static private final Logger logger = LoggerFactory.getLogger(CachedFile.class);
protected String sourceName;
protected long sourceTime;
diff --git a/src/fr/devinsy/util/unix/EtcGroupFile.java b/src/fr/devinsy/util/unix/EtcGroupFile.java
index 4062e3d..2f76c6b 100644
--- a/src/fr/devinsy/util/unix/EtcGroupFile.java
+++ b/src/fr/devinsy/util/unix/EtcGroupFile.java
@@ -7,8 +7,8 @@ import java.util.Vector;
*/
public class EtcGroupFile extends CachedFile
{
- // static private org.apache.log4j.Logger logger =
- // org.apache.log4j.Logger.getLogger (EtcGroupFile.class);
+ // static private final Logger logger =
+ // LoggerFactory.getLogger(EtcGroupFile.class);
static EtcGroupFile instance = null;
protected Groups groups;
diff --git a/src/fr/devinsy/util/unix/EtcGroupFileReader.java b/src/fr/devinsy/util/unix/EtcGroupFileReader.java
index 91322c6..01d47d5 100644
--- a/src/fr/devinsy/util/unix/EtcGroupFileReader.java
+++ b/src/fr/devinsy/util/unix/EtcGroupFileReader.java
@@ -4,12 +4,15 @@ import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
*
*/
public class EtcGroupFileReader
{
- static private org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(EtcGroupFileReader.class);
+ static private final Logger logger = LoggerFactory.getLogger(EtcGroupFileReader.class);
/**
*
diff --git a/src/fr/devinsy/util/unix/EtcPasswdFile.java b/src/fr/devinsy/util/unix/EtcPasswdFile.java
index 323b262..6f73b39 100644
--- a/src/fr/devinsy/util/unix/EtcPasswdFile.java
+++ b/src/fr/devinsy/util/unix/EtcPasswdFile.java
@@ -1,11 +1,14 @@
package fr.devinsy.util.unix;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
*
*/
public class EtcPasswdFile extends CachedFile
{
- static private org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(EtcPasswdFile.class);
+ static private final Logger logger = LoggerFactory.getLogger(EtcPasswdFile.class);
static EtcPasswdFile instance = null;
protected Users users;
diff --git a/src/fr/devinsy/util/unix/EtcPasswdFileReader.java b/src/fr/devinsy/util/unix/EtcPasswdFileReader.java
index 4d77ffc..76cbe71 100644
--- a/src/fr/devinsy/util/unix/EtcPasswdFileReader.java
+++ b/src/fr/devinsy/util/unix/EtcPasswdFileReader.java
@@ -4,12 +4,15 @@ import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
*
*/
public class EtcPasswdFileReader
{
- static private org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(EtcPasswdFileReader.class);
+ static private final Logger logger = LoggerFactory.getLogger(EtcPasswdFileReader.class);
/**
*
diff --git a/src/fr/devinsy/util/unix/Group.java b/src/fr/devinsy/util/unix/Group.java
index 6ad14ae..3b3c5a5 100644
--- a/src/fr/devinsy/util/unix/Group.java
+++ b/src/fr/devinsy/util/unix/Group.java
@@ -7,8 +7,8 @@ import java.util.Vector;
*/
public class Group
{
- // static private org.apache.log4j.Logger logger =
- // org.apache.log4j.Logger.getLogger (Group.class);
+ // static private final Logger logger =
+ // LoggerFactory.getLogger(Group.class);
/*
* /usr/include/grp.h
diff --git a/src/fr/devinsy/util/unix/Groups.java b/src/fr/devinsy/util/unix/Groups.java
index 6904dee..5482f58 100644
--- a/src/fr/devinsy/util/unix/Groups.java
+++ b/src/fr/devinsy/util/unix/Groups.java
@@ -11,8 +11,8 @@ public class Groups extends Vector
private static final long serialVersionUID = 5802487312198869603L;
- // static private org.apache.log4j.Logger logger =
- // org.apache.log4j.Logger.getLogger (Groups.class);
+ // static private final Logger logger =
+ // LoggerFactory.getLogger(Groups.class);
/**
*
diff --git a/src/fr/devinsy/util/unix/Unix.java b/src/fr/devinsy/util/unix/Unix.java
index e9ad064..236e04c 100644
--- a/src/fr/devinsy/util/unix/Unix.java
+++ b/src/fr/devinsy/util/unix/Unix.java
@@ -3,6 +3,9 @@ package fr.devinsy.util.unix;
import java.io.File;
import java.util.Vector;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import fr.devinsy.util.StringConcatenator;
import fr.devinsy.util.cmdexec.CmdExec;
import fr.devinsy.util.unix.acl.Acl;
@@ -13,7 +16,7 @@ import fr.devinsy.util.unix.acl.AclManager;
*/
public class Unix
{
- static private org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Unix.class);
+ static private final Logger logger = LoggerFactory.getLogger(Unix.class);
static public final String SUDO = "/usr/bin/sudo";
/**
diff --git a/src/fr/devinsy/util/unix/User.java b/src/fr/devinsy/util/unix/User.java
index 249a801..358ccd9 100644
--- a/src/fr/devinsy/util/unix/User.java
+++ b/src/fr/devinsy/util/unix/User.java
@@ -1,12 +1,12 @@
package fr.devinsy.util.unix;
+
/**
*
*/
public class User
{
- // static private org.apache.log4j.Logger logger =
- // org.apache.log4j.Logger.getLogger (User.class);
+ // static private final Logger logger = LoggerFactory.getLogger(User.class);
/*
* /usr/include/pwd.h
diff --git a/src/fr/devinsy/util/unix/Users.java b/src/fr/devinsy/util/unix/Users.java
index 4d8b0e5..6ac7609 100644
--- a/src/fr/devinsy/util/unix/Users.java
+++ b/src/fr/devinsy/util/unix/Users.java
@@ -10,8 +10,8 @@ public class Users extends Vector
{
private static final long serialVersionUID = -7178304512851592399L;
- // static private org.apache.log4j.Logger logger =
- // org.apache.log4j.Logger.getLogger (Users.class);
+ // static private final Logger logger =
+ // LoggerFactory.getLogger(Users.class);
/**
*
diff --git a/src/fr/devinsy/util/unix/acl/Acl.java b/src/fr/devinsy/util/unix/acl/Acl.java
index 0fdad46..7426ac5 100644
--- a/src/fr/devinsy/util/unix/acl/Acl.java
+++ b/src/fr/devinsy/util/unix/acl/Acl.java
@@ -5,8 +5,7 @@ package fr.devinsy.util.unix.acl;
*/
public class Acl
{
- // static private org.apache.log4j.Logger logger =
- // org.apache.log4j.Logger.getLogger (Acl.class);
+ // static private final Logger logger = LoggerFactory.getLogger(Acl.class);
/*
# file: goo39
diff --git a/src/fr/devinsy/util/unix/acl/AclEntries.java b/src/fr/devinsy/util/unix/acl/AclEntries.java
index 8f3671b..957f4bb 100644
--- a/src/fr/devinsy/util/unix/acl/AclEntries.java
+++ b/src/fr/devinsy/util/unix/acl/AclEntries.java
@@ -10,8 +10,8 @@ public class AclEntries extends Vector
{
private static final long serialVersionUID = 5802487312198869603L;
- // static private org.apache.log4j.Logger logger =
- // org.apache.log4j.Logger.getLogger (AclEntries.class);
+ // static private final Logger logger =
+ // LoggerFactory.getLogger(AclEntries.class);
/**
*
diff --git a/src/fr/devinsy/util/unix/acl/AclEntry.java b/src/fr/devinsy/util/unix/acl/AclEntry.java
index b1dcf68..69b41f1 100644
--- a/src/fr/devinsy/util/unix/acl/AclEntry.java
+++ b/src/fr/devinsy/util/unix/acl/AclEntry.java
@@ -1,12 +1,13 @@
package fr.devinsy.util.unix.acl;
+
/**
*
*/
public class AclEntry
{
- // static private org.apache.log4j.Logger logger =
- // org.apache.log4j.Logger.getLogger (AclEntry.class);
+ // static private final Logger logger =
+ // LoggerFactory.getLogger(AclEntry.class);
/*
user::rwx
diff --git a/src/fr/devinsy/util/unix/acl/AclManager.java b/src/fr/devinsy/util/unix/acl/AclManager.java
index 787953d..82f0638 100644
--- a/src/fr/devinsy/util/unix/acl/AclManager.java
+++ b/src/fr/devinsy/util/unix/acl/AclManager.java
@@ -4,6 +4,9 @@ import java.io.File;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import fr.devinsy.util.StringConcatenator;
import fr.devinsy.util.cmdexec.CmdExec;
import fr.devinsy.util.unix.Unix;
@@ -13,7 +16,7 @@ import fr.devinsy.util.unix.Unix;
*/
public class AclManager
{
- static private org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(AclManager.class);
+ static private final Logger logger = LoggerFactory.getLogger(AclManager.class);
static public final String SUDO = "/usr/bin/sudo";
static final public Pattern USER_PATTERN = Pattern.compile("^user:(.*):(.*)$");
diff --git a/test/CmdExecPlayer.java b/test/CmdExecPlayer.java
index 9a4a0b3..3529dd4 100644
--- a/test/CmdExecPlayer.java
+++ b/test/CmdExecPlayer.java
@@ -1,3 +1,8 @@
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.PatternLayout;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import fr.devinsy.util.cmdexec.CmdExec;
import fr.devinsy.util.cmdexec.StreamGobbler;
@@ -6,30 +11,26 @@ import fr.devinsy.util.cmdexec.StreamGobbler;
*/
class CmdExecPlayer
{
- static private org.apache.log4j.Logger logger;
+ static private final Logger logger;
static
{
// Initialize logger.
- org.apache.log4j.Logger logger = null;
-
org.apache.log4j.BasicConfigurator.configure();
+ org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.INFO);
- logger = org.apache.log4j.Logger.getRootLogger();
- // logger.setLevel (org.apache.log4j.Level.INFO);
- logger.setLevel(org.apache.log4j.Level.INFO);
-
+ logger = LoggerFactory.getLogger(CmdExecPlayer.class);
logger.info("Enter");
//
logger.info("Set the log file format...");
+ org.apache.log4j.Logger defaultLogger = org.apache.log4j.Logger.getRootLogger();
+ defaultLogger.removeAllAppenders();
+ defaultLogger.addAppender(new ConsoleAppender(new PatternLayout("%d{ISO8601} - dutils [%-5p] %34.34c.%-25M - %m%n")));
- // log =
- // org.apache.log4j.Category.getInstance(Application.class.getName());
logger.info("... done.");
logger.debug("Exit");
- logger = org.apache.log4j.Logger.getLogger(CmdExecPlayer.class);
}
/**
diff --git a/test/FileIteratorPlayer.java b/test/FileIteratorPlayer.java
index 426c1cd..31ee6d4 100644
--- a/test/FileIteratorPlayer.java
+++ b/test/FileIteratorPlayer.java
@@ -1,9 +1,9 @@
import java.io.File;
-import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.ConsoleAppender;
-import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import fr.devinsy.util.FileIterator;
@@ -12,22 +12,23 @@ import fr.devinsy.util.FileIterator;
*/
public class FileIteratorPlayer
{
- static private org.apache.log4j.Logger logger;
+ static private final Logger logger;
static
{
// Initialize logger.
+ org.apache.log4j.BasicConfigurator.configure();
+ org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.DEBUG);
- BasicConfigurator.configure();
- Logger defaultLogger = org.apache.log4j.Logger.getRootLogger();
- defaultLogger.setLevel(org.apache.log4j.Level.DEBUG);
+ logger = LoggerFactory.getLogger(CmdExecPlayer.class);
+ //
+ org.apache.log4j.Logger defaultLogger = org.apache.log4j.Logger.getRootLogger();
defaultLogger.removeAllAppenders();
- defaultLogger.addAppender(new ConsoleAppender(new PatternLayout("%d{ISO8601} - FIT [%-5p] %34.34c.%-25M - %m%n")));
+ defaultLogger.addAppender(new ConsoleAppender(new PatternLayout("%d{ISO8601} - dutils [%-5p] %34.34c.%-25M - %m%n")));
- defaultLogger.debug("Log initialized.");
-
- logger = org.apache.log4j.Logger.getLogger(FileIteratorPlayer.class.getName());
+ //
+ logger.debug("Log initialized.");
}
/**
diff --git a/test/one/Foo2Test.java b/test/one/Foo2Test.java
index 0b98fdf..83d24a8 100644
--- a/test/one/Foo2Test.java
+++ b/test/one/Foo2Test.java
@@ -4,7 +4,7 @@ import org.junit.Test;
public class Foo2Test
{
- // private Logger logger =
+ // static private final Logger logger =
// LoggerFactory.getLogger(PdfGenerationAmqpServiceInjectedTest.class);
/**