updated to log4j2

This commit is contained in:
jomu
2015-07-10 08:35:54 +00:00
parent 45600a0953
commit 27f20af9fe
3 changed files with 15 additions and 8 deletions

View File

@ -26,9 +26,13 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>log4j</groupId> <groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j</artifactId> <artifactId>log4j-core</artifactId>
<scope>provided</scope> </dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<type>jar</type>
</dependency> </dependency>
</dependencies> </dependencies>
<name>shared-util</name> <name>shared-util</name>

View File

@ -2,7 +2,9 @@ package de.muehlencord.shared.util;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.text.ParseException; import java.text.ParseException;
import org.apache.log4j.Logger; import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/** /**
* *
@ -11,7 +13,7 @@ import org.apache.log4j.Logger;
public abstract class StringUtil { public abstract class StringUtil {
/** the logging object */ /** the logging object */
private static final Logger LOGGER = Logger.getLogger(StringUtil.class); private static final Logger LOGGER = LogManager.getLogger(StringUtil.class);
/** /**
* returns the given string in ISO-8859-1 encoding * returns the given string in ISO-8859-1 encoding
@ -26,7 +28,7 @@ public abstract class StringUtil {
byte[] b = input.getBytes("UTF-8"); byte[] b = input.getBytes("UTF-8");
return new String(b, "ISO-8859-1"); return new String(b, "ISO-8859-1");
} catch (UnsupportedEncodingException ex) { } catch (UnsupportedEncodingException ex) {
LOGGER.debug(getStackTraceString(ex)); LOGGER.log (Level.DEBUG, ex.toString(), ex);
throw new StringEncodingException("Cannot convert string from UTF-8 to ISO-8859-1. Reason: " + ex.getMessage(), ex); throw new StringEncodingException("Cannot convert string from UTF-8 to ISO-8859-1. Reason: " + ex.getMessage(), ex);
} }
} }

View File

@ -19,7 +19,8 @@ import java.text.Format;
import static java.util.Arrays.asList; import static java.util.Arrays.asList;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/** /**
* *
@ -30,7 +31,7 @@ public abstract class FileUtil {
/** /**
* the logging object * the logging object
*/ */
private static final Logger LOGGER = Logger.getLogger(FileUtil.class); private static final Logger LOGGER = LogManager.getLogger(FileUtil.class);
/** /**
* returns a list of files found by the given regexp in the given folder * returns a list of files found by the given regexp in the given folder