summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pom.xml24
-rw-r--r--src/main/java/org/openslx/imagemaster/App.java13
-rw-r--r--src/main/java/org/openslx/imagemaster/Globals.java5
-rw-r--r--src/main/java/org/openslx/imagemaster/db/Database.java5
-rw-r--r--src/main/java/org/openslx/imagemaster/db/MysqlConnection.java5
-rw-r--r--src/main/java/org/openslx/imagemaster/db/mappers/DbImage.java5
-rw-r--r--src/main/java/org/openslx/imagemaster/db/mappers/DbImageBlock.java5
-rw-r--r--src/main/java/org/openslx/imagemaster/db/mappers/DbOrganization.java5
-rw-r--r--src/main/java/org/openslx/imagemaster/db/mappers/DbOsVirt.java5
-rw-r--r--src/main/java/org/openslx/imagemaster/db/mappers/DbPendingSatellite.java5
-rw-r--r--src/main/java/org/openslx/imagemaster/db/mappers/DbSatellite.java5
-rw-r--r--src/main/java/org/openslx/imagemaster/db/mappers/DbUser.java5
-rw-r--r--src/main/java/org/openslx/imagemaster/db/models/LocalOrganization.java5
-rw-r--r--src/main/java/org/openslx/imagemaster/localrpc/JsonUser.java5
-rw-r--r--src/main/java/org/openslx/imagemaster/localrpc/NetworkHandler.java5
-rw-r--r--src/main/java/org/openslx/imagemaster/serverconnection/ConnectionHandler.java5
-rw-r--r--src/main/java/org/openslx/imagemaster/serverconnection/IncomingTransfer.java5
-rw-r--r--src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java5
-rw-r--r--src/main/java/org/openslx/imagemaster/session/Authenticator.java5
-rw-r--r--src/main/java/org/openslx/imagemaster/session/SessionManager.java5
-rw-r--r--src/main/java/org/openslx/imagemaster/thrift/server/BinaryListener.java5
-rw-r--r--src/main/java/org/openslx/imagemaster/thrift/server/MasterServerHandler.java5
-rw-r--r--src/main/java/org/openslx/imagemaster/util/Util.java5
-rw-r--r--src/main/properties/log4j.properties14
-rw-r--r--src/main/properties/log4j2.properties44
25 files changed, 126 insertions, 74 deletions
diff --git a/pom.xml b/pom.xml
index 627c7e4..14f5c5f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -192,18 +192,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.17</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.7.25</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
<groupId>org.openslx.bwlp</groupId>
<artifactId>master-sync-shared</artifactId>
<version>1.1-SNAPSHOT</version>
@@ -221,5 +209,17 @@
<version>2.8.1</version>
<scope>compile</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
+ <version>[2.0,3.0)</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ <version>[2.0,3.0)</version>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
</project>
diff --git a/src/main/java/org/openslx/imagemaster/App.java b/src/main/java/org/openslx/imagemaster/App.java
index f9b5399..f3a0aee 100644
--- a/src/main/java/org/openslx/imagemaster/App.java
+++ b/src/main/java/org/openslx/imagemaster/App.java
@@ -6,9 +6,10 @@ import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
-import org.apache.log4j.BasicConfigurator;
-import org.apache.log4j.LogManager;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.core.config.Configurator;
+import org.apache.logging.log4j.core.config.DefaultConfiguration;
import org.apache.thrift.transport.TTransportException;
import org.openslx.imagemaster.localrpc.NetworkHandler;
import org.openslx.imagemaster.thrift.server.BinaryListener;
@@ -21,7 +22,7 @@ import org.openslx.util.AppUtil;
public class App
{
- private static Logger log = Logger.getLogger( App.class );
+ private static Logger log = LogManager.getLogger( App.class );
private static final String NAME = "Master-Server";
@@ -30,8 +31,8 @@ public class App
public static void main( String[] args ) throws TTransportException, NoSuchAlgorithmException, SocketException
{
// setup basic logging appender to log output on console if no external appender (log4j.properties) is configured
- if ( LogManager.getRootLogger().getAllAppenders() == null ) {
- BasicConfigurator.configure();
+ if (org.apache.logging.log4j.core.Logger.class.cast(LogManager.getRootLogger()).getAppenders().isEmpty()) {
+ Configurator.initialize(new DefaultConfiguration());
}
AppUtil.logHeader( log, App.NAME, App.class.getPackage().getImplementationVersion() );
diff --git a/src/main/java/org/openslx/imagemaster/Globals.java b/src/main/java/org/openslx/imagemaster/Globals.java
index 7b634f0..9ccaa4e 100644
--- a/src/main/java/org/openslx/imagemaster/Globals.java
+++ b/src/main/java/org/openslx/imagemaster/Globals.java
@@ -6,7 +6,8 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.openslx.imagemaster.util.Util;
/**
@@ -15,7 +16,7 @@ import org.openslx.imagemaster.util.Util;
public class Globals
{
- private static Logger LOGGER = Logger.getLogger( Globals.class );
+ private static Logger LOGGER = LogManager.getLogger( Globals.class );
private static final Properties properties = new Properties();
private static File imgPath = null;
diff --git a/src/main/java/org/openslx/imagemaster/db/Database.java b/src/main/java/org/openslx/imagemaster/db/Database.java
index 710dea0..7ff12a4 100644
--- a/src/main/java/org/openslx/imagemaster/db/Database.java
+++ b/src/main/java/org/openslx/imagemaster/db/Database.java
@@ -15,13 +15,14 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.openslx.imagemaster.util.Util;
public class Database
{
- private static final Logger LOGGER = Logger.getLogger( Database.class );
+ private static final Logger LOGGER = LogManager.getLogger( Database.class );
/**
* Pool of available connections.
*/
diff --git a/src/main/java/org/openslx/imagemaster/db/MysqlConnection.java b/src/main/java/org/openslx/imagemaster/db/MysqlConnection.java
index 10c263b..443fce0 100644
--- a/src/main/java/org/openslx/imagemaster/db/MysqlConnection.java
+++ b/src/main/java/org/openslx/imagemaster/db/MysqlConnection.java
@@ -5,11 +5,12 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
public class MysqlConnection implements AutoCloseable {
- private static final Logger LOGGER = Logger.getLogger(MysqlConnection.class);
+ private static final Logger LOGGER = LogManager.getLogger(MysqlConnection.class);
private static final int CONNECTION_TIMEOUT_MS = 5 * 60 * 1000;
diff --git a/src/main/java/org/openslx/imagemaster/db/mappers/DbImage.java b/src/main/java/org/openslx/imagemaster/db/mappers/DbImage.java
index 6fddf76..1f6189d 100644
--- a/src/main/java/org/openslx/imagemaster/db/mappers/DbImage.java
+++ b/src/main/java/org/openslx/imagemaster/db/mappers/DbImage.java
@@ -6,7 +6,8 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.openslx.bwlp.thrift.iface.ImageDetailsRead;
import org.openslx.bwlp.thrift.iface.ImagePermissions;
import org.openslx.bwlp.thrift.iface.ImagePublishData;
@@ -31,7 +32,7 @@ import org.openslx.util.Util;
public class DbImage
{
- private static final Logger LOGGER = Logger.getLogger( DbImage.class );
+ private static final Logger LOGGER = LogManager.getLogger( DbImage.class );
private static final ImagePermissions emptyPermissions = new ImagePermissions();
diff --git a/src/main/java/org/openslx/imagemaster/db/mappers/DbImageBlock.java b/src/main/java/org/openslx/imagemaster/db/mappers/DbImageBlock.java
index 155f522..74d2832 100644
--- a/src/main/java/org/openslx/imagemaster/db/mappers/DbImageBlock.java
+++ b/src/main/java/org/openslx/imagemaster/db/mappers/DbImageBlock.java
@@ -7,7 +7,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ArrayBlockingQueue;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.openslx.filetransfer.FileRange;
import org.openslx.filetransfer.util.ChunkStatus;
import org.openslx.filetransfer.util.FileChunk;
@@ -18,7 +19,7 @@ import org.openslx.imagemaster.db.MysqlStatement;
public class DbImageBlock
{
- private static final Logger LOGGER = Logger.getLogger( DbImageBlock.class );
+ private static final Logger LOGGER = LogManager.getLogger( DbImageBlock.class );
private static AsyncThread asyncBlockUpdate = null;
diff --git a/src/main/java/org/openslx/imagemaster/db/mappers/DbOrganization.java b/src/main/java/org/openslx/imagemaster/db/mappers/DbOrganization.java
index cf1a20a..4c094fe 100644
--- a/src/main/java/org/openslx/imagemaster/db/mappers/DbOrganization.java
+++ b/src/main/java/org/openslx/imagemaster/db/mappers/DbOrganization.java
@@ -5,7 +5,8 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.openslx.bwlp.thrift.iface.Organization;
import org.openslx.imagemaster.db.Database;
import org.openslx.imagemaster.db.MysqlConnection;
@@ -17,7 +18,7 @@ import org.openslx.imagemaster.db.MysqlStatement;
*/
public class DbOrganization
{
- private static final Logger LOGGER = Logger.getLogger( DbOrganization.class );
+ private static final Logger LOGGER = LogManager.getLogger( DbOrganization.class );
private static final String organizationBaseSql = "SELECT"
+ " o.organizationid, o.name, o.authmethod, o.publickey"
diff --git a/src/main/java/org/openslx/imagemaster/db/mappers/DbOsVirt.java b/src/main/java/org/openslx/imagemaster/db/mappers/DbOsVirt.java
index ee8a39a..259b75a 100644
--- a/src/main/java/org/openslx/imagemaster/db/mappers/DbOsVirt.java
+++ b/src/main/java/org/openslx/imagemaster/db/mappers/DbOsVirt.java
@@ -7,7 +7,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.openslx.bwlp.thrift.iface.OperatingSystem;
import org.openslx.bwlp.thrift.iface.Virtualizer;
import org.openslx.imagemaster.db.Database;
@@ -18,7 +19,7 @@ import org.openslx.imagemaster.util.Util;
public class DbOsVirt
{
- private static final Logger LOGGER = Logger.getLogger( DbOsVirt.class );
+ private static final Logger LOGGER = LogManager.getLogger( DbOsVirt.class );
public static List<OperatingSystem> getOsList() throws SQLException
{
diff --git a/src/main/java/org/openslx/imagemaster/db/mappers/DbPendingSatellite.java b/src/main/java/org/openslx/imagemaster/db/mappers/DbPendingSatellite.java
index 9ee00ca..03be323 100644
--- a/src/main/java/org/openslx/imagemaster/db/mappers/DbPendingSatellite.java
+++ b/src/main/java/org/openslx/imagemaster/db/mappers/DbPendingSatellite.java
@@ -3,7 +3,8 @@ package org.openslx.imagemaster.db.mappers;
import java.sql.SQLException;
import java.util.List;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.openslx.bwlp.thrift.iface.UserInfo;
import org.openslx.imagemaster.db.Database;
import org.openslx.imagemaster.db.MysqlConnection;
@@ -15,7 +16,7 @@ import com.google.gson.annotations.SerializedName;
public class DbPendingSatellite
{
- private static final Logger LOGGER = Logger.getLogger( DbPendingSatellite.class );
+ private static final Logger LOGGER = LogManager.getLogger( DbPendingSatellite.class );
public static int add( UserInfo user, String displayName, List<String> address, String modulus, String exponent )
throws SQLException
diff --git a/src/main/java/org/openslx/imagemaster/db/mappers/DbSatellite.java b/src/main/java/org/openslx/imagemaster/db/mappers/DbSatellite.java
index 2f72436..b9fa09a 100644
--- a/src/main/java/org/openslx/imagemaster/db/mappers/DbSatellite.java
+++ b/src/main/java/org/openslx/imagemaster/db/mappers/DbSatellite.java
@@ -7,7 +7,8 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.openslx.bwlp.thrift.iface.Satellite;
import org.openslx.bwlp.thrift.iface.UserInfo;
import org.openslx.imagemaster.db.Database;
@@ -19,7 +20,7 @@ import org.openslx.util.Json;
public class DbSatellite
{
- private static final Logger LOGGER = Logger.getLogger( DbSatellite.class );
+ private static final Logger LOGGER = LogManager.getLogger( DbSatellite.class );
public static LocalSatellite get( int satelliteId )
{
diff --git a/src/main/java/org/openslx/imagemaster/db/mappers/DbUser.java b/src/main/java/org/openslx/imagemaster/db/mappers/DbUser.java
index 00ec45e..d23cab4 100644
--- a/src/main/java/org/openslx/imagemaster/db/mappers/DbUser.java
+++ b/src/main/java/org/openslx/imagemaster/db/mappers/DbUser.java
@@ -5,7 +5,8 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.openslx.bwlp.thrift.iface.Role;
import org.openslx.bwlp.thrift.iface.TNotFoundException;
import org.openslx.bwlp.thrift.iface.UserInfo;
@@ -21,7 +22,7 @@ import org.openslx.imagemaster.util.Sha512Crypt;
public class DbUser
{
- private static final Logger LOGGER = Logger.getLogger( DbUser.class );
+ private static final Logger LOGGER = LogManager.getLogger( DbUser.class );
private static final String localUserSql = "SELECT"
+ " user.userid, user.password, user.organizationid, user.firstname, user.lastname, user.email"
diff --git a/src/main/java/org/openslx/imagemaster/db/models/LocalOrganization.java b/src/main/java/org/openslx/imagemaster/db/models/LocalOrganization.java
index 4b5f076..f416b56 100644
--- a/src/main/java/org/openslx/imagemaster/db/models/LocalOrganization.java
+++ b/src/main/java/org/openslx/imagemaster/db/models/LocalOrganization.java
@@ -5,13 +5,14 @@ import java.security.NoSuchAlgorithmException;
import java.security.PublicKey;
import java.security.spec.InvalidKeySpecException;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.openslx.encryption.AsymKeyHolder;
public class LocalOrganization
{
- private static final Logger LOGGER = Logger.getLogger( LocalOrganization.class );
+ private static final Logger LOGGER = LogManager.getLogger( LocalOrganization.class );
private PublicKey publickey;
diff --git a/src/main/java/org/openslx/imagemaster/localrpc/JsonUser.java b/src/main/java/org/openslx/imagemaster/localrpc/JsonUser.java
index 6b2769b..9c86ea7 100644
--- a/src/main/java/org/openslx/imagemaster/localrpc/JsonUser.java
+++ b/src/main/java/org/openslx/imagemaster/localrpc/JsonUser.java
@@ -1,6 +1,7 @@
package org.openslx.imagemaster.localrpc;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.openslx.bwlp.thrift.iface.Role;
import org.openslx.bwlp.thrift.iface.UserInfo;
import org.openslx.imagemaster.util.Util;
@@ -8,7 +9,7 @@ import org.openslx.imagemaster.util.Util;
public class JsonUser
{
- private static final Logger LOGGER = Logger.getLogger( JsonUser.class );
+ private static final Logger LOGGER = LogManager.getLogger( JsonUser.class );
private String userId = null;
private String organizationId = null;
diff --git a/src/main/java/org/openslx/imagemaster/localrpc/NetworkHandler.java b/src/main/java/org/openslx/imagemaster/localrpc/NetworkHandler.java
index 5caeab3..228d793 100644
--- a/src/main/java/org/openslx/imagemaster/localrpc/NetworkHandler.java
+++ b/src/main/java/org/openslx/imagemaster/localrpc/NetworkHandler.java
@@ -10,7 +10,8 @@ import java.nio.charset.StandardCharsets;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.openslx.bwlp.thrift.iface.ClientSessionData;
import org.openslx.bwlp.thrift.iface.UserInfo;
import org.openslx.imagemaster.session.Session;
@@ -25,7 +26,7 @@ import com.google.gson.Gson;
public class NetworkHandler implements Runnable
{
- private static final Logger log = Logger.getLogger( NetworkHandler.class );
+ private static final Logger log = LogManager.getLogger( NetworkHandler.class );
private Thread sendThread = null;
/**
diff --git a/src/main/java/org/openslx/imagemaster/serverconnection/ConnectionHandler.java b/src/main/java/org/openslx/imagemaster/serverconnection/ConnectionHandler.java
index f32c655..8b6d197 100644
--- a/src/main/java/org/openslx/imagemaster/serverconnection/ConnectionHandler.java
+++ b/src/main/java/org/openslx/imagemaster/serverconnection/ConnectionHandler.java
@@ -19,7 +19,8 @@ import javax.net.ssl.KeyManager;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.openslx.bwlp.thrift.iface.ImagePublishData;
import org.openslx.bwlp.thrift.iface.InvocationError;
import org.openslx.bwlp.thrift.iface.TInvocationException;
@@ -43,7 +44,7 @@ import org.openslx.util.QuickTimer.Task;
public class ConnectionHandler implements IncomingEvent
{
- private static final Logger LOGGER = Logger.getLogger( ConnectionHandler.class );
+ private static final Logger LOGGER = LogManager.getLogger( ConnectionHandler.class );
private static final int MAX_TRANSFERS = 12;
diff --git a/src/main/java/org/openslx/imagemaster/serverconnection/IncomingTransfer.java b/src/main/java/org/openslx/imagemaster/serverconnection/IncomingTransfer.java
index 004178d..7b499be 100644
--- a/src/main/java/org/openslx/imagemaster/serverconnection/IncomingTransfer.java
+++ b/src/main/java/org/openslx/imagemaster/serverconnection/IncomingTransfer.java
@@ -7,7 +7,8 @@ import java.sql.SQLException;
import java.util.List;
import java.util.UUID;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.openslx.bwlp.thrift.iface.ImagePublishData;
import org.openslx.bwlp.thrift.iface.TInvocationException;
import org.openslx.bwlp.thrift.iface.TransferInformation;
@@ -23,7 +24,7 @@ import org.openslx.util.ThriftUtil;
public class IncomingTransfer extends IncomingTransferBase
{
- private static final Logger LOGGER = Logger.getLogger( IncomingTransfer.class );
+ private static final Logger LOGGER = LogManager.getLogger( IncomingTransfer.class );
private static final long MIN_FREE_SPACE_BYTES = FileChunk.CHUNK_SIZE * 10;
diff --git a/src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java b/src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java
index ea22765..85e38ac 100644
--- a/src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java
+++ b/src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java
@@ -4,7 +4,8 @@ import java.nio.ByteBuffer;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.thrift.TException;
import org.openslx.bwlp.thrift.iface.AuthorizationError;
import org.openslx.bwlp.thrift.iface.TAuthorizationException;
@@ -18,7 +19,7 @@ import org.openslx.imagemaster.util.RandomString;
public class ServerAuthenticator
{
- private static Logger log = Logger.getLogger( ServerAuthenticator.class );
+ private static Logger log = LogManager.getLogger( ServerAuthenticator.class );
/**
* Servers currently doing authentication. Maps from organization to the challenge we sent.
diff --git a/src/main/java/org/openslx/imagemaster/session/Authenticator.java b/src/main/java/org/openslx/imagemaster/session/Authenticator.java
index c11e597..3e2e98f 100644
--- a/src/main/java/org/openslx/imagemaster/session/Authenticator.java
+++ b/src/main/java/org/openslx/imagemaster/session/Authenticator.java
@@ -2,7 +2,8 @@ package org.openslx.imagemaster.session;
import java.sql.SQLException;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.openslx.bwlp.thrift.iface.AuthorizationError;
import org.openslx.bwlp.thrift.iface.InvocationError;
import org.openslx.bwlp.thrift.iface.TAuthorizationException;
@@ -17,7 +18,7 @@ import org.openslx.imagemaster.db.models.LocalUser;
public class Authenticator
{
- private static Logger log = Logger.getLogger( Authenticator.class );
+ private static Logger log = LogManager.getLogger( Authenticator.class );
/**
* Authenticate the user against whatever backend
diff --git a/src/main/java/org/openslx/imagemaster/session/SessionManager.java b/src/main/java/org/openslx/imagemaster/session/SessionManager.java
index e9f133e..57973ac 100644
--- a/src/main/java/org/openslx/imagemaster/session/SessionManager.java
+++ b/src/main/java/org/openslx/imagemaster/session/SessionManager.java
@@ -8,7 +8,8 @@ import java.util.Map;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.openslx.bwlp.thrift.iface.ClientSessionData;
import org.openslx.bwlp.thrift.iface.Satellite;
import org.openslx.bwlp.thrift.iface.UserInfo;
@@ -23,7 +24,7 @@ import org.openslx.util.QuickTimer.Task;
*/
public class SessionManager
{
- private static Logger log = Logger.getLogger( SessionManager.class );
+ private static Logger log = LogManager.getLogger( SessionManager.class );
// Map of currently known sessions
private static final Map<String, Session> sessions = new LinkedHashMap<>();
diff --git a/src/main/java/org/openslx/imagemaster/thrift/server/BinaryListener.java b/src/main/java/org/openslx/imagemaster/thrift/server/BinaryListener.java
index bf015a1..fab1e05 100644
--- a/src/main/java/org/openslx/imagemaster/thrift/server/BinaryListener.java
+++ b/src/main/java/org/openslx/imagemaster/thrift/server/BinaryListener.java
@@ -6,7 +6,8 @@ import java.util.concurrent.TimeUnit;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.thrift.protocol.TProtocolFactory;
import org.apache.thrift.server.THsHaServer;
import org.apache.thrift.server.TServer;
@@ -30,7 +31,7 @@ public class BinaryListener implements Runnable
new MasterServerHandler() );
final TProtocolFactory protFactory = new TBinaryProtocolSafe.Factory( true, true );
- private static Logger log = Logger.getLogger( BinaryListener.class );
+ private static Logger log = LogManager.getLogger( BinaryListener.class );
final TServer server;
@Override
diff --git a/src/main/java/org/openslx/imagemaster/thrift/server/MasterServerHandler.java b/src/main/java/org/openslx/imagemaster/thrift/server/MasterServerHandler.java
index deb2a33..1a41e2d 100644
--- a/src/main/java/org/openslx/imagemaster/thrift/server/MasterServerHandler.java
+++ b/src/main/java/org/openslx/imagemaster/thrift/server/MasterServerHandler.java
@@ -9,7 +9,8 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.thrift.TException;
import org.openslx.bwlp.thrift.iface.AuthorizationError;
import org.openslx.bwlp.thrift.iface.ClientSessionData;
@@ -62,7 +63,7 @@ import org.openslx.thrifthelper.ImagePublishDataEx;
public class MasterServerHandler implements MasterServer.Iface
{
- private static final Logger LOGGER = Logger.getLogger( MasterServerHandler.class );
+ private static final Logger LOGGER = LogManager.getLogger( MasterServerHandler.class );
@Override
public boolean ping()
diff --git a/src/main/java/org/openslx/imagemaster/util/Util.java b/src/main/java/org/openslx/imagemaster/util/Util.java
index f8d9248..ac5cf9d 100644
--- a/src/main/java/org/openslx/imagemaster/util/Util.java
+++ b/src/main/java/org/openslx/imagemaster/util/Util.java
@@ -9,7 +9,8 @@ import java.util.Arrays;
import java.util.Random;
import java.util.UUID;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
/**
* Some utilities to make our lives easier.
@@ -17,7 +18,7 @@ import org.apache.log4j.Logger;
public class Util
{
- private static Logger LOGGER = Logger.getLogger( Util.class );
+ private static Logger LOGGER = LogManager.getLogger( Util.class );
/**
* Check if the given object is null, abort program if true.
diff --git a/src/main/properties/log4j.properties b/src/main/properties/log4j.properties
deleted file mode 100644
index 3baa9b6..0000000
--- a/src/main/properties/log4j.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-# root level logging configuration
-log4j.rootLogger=ALL, console
-
-# configuration for console output
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
-log4j.appender.console.layout.ConversionPattern=[%t] %-5p %F - %m%n
-log4j.appender.console.encoding=UTF-8
-log4j.appender.console.Threshold=INFO
-
-# overwrite logging level for specific packages and classes
-log4j.logger.org.apache.directory=ERROR
-log4j.logger.org.apache.mina=ERROR
-log4j.logger.org.apache.thrift.server.AbstractNonblockingServer=ERROR
diff --git a/src/main/properties/log4j2.properties b/src/main/properties/log4j2.properties
new file mode 100644
index 0000000..c4175b0
--- /dev/null
+++ b/src/main/properties/log4j2.properties
@@ -0,0 +1,44 @@
+status=error
+name=log4j2PropertiesConfig
+
+#
+# root level logging configuration
+#
+rootLogger.level=all
+rootLogger.appenderRefs=stdout
+rootLogger.appenderRef.stdout.ref=logToConsole
+
+#
+# configuration for console output
+#
+appenders=console
+
+appender.console.type=Console
+appender.console.name=logToConsole
+appender.console.layout.type=PatternLayout
+appender.console.layout.pattern=[%t] %-5p %F - %m%n
+appender.console.filter.threshold.type=ThresholdFilter
+appender.console.filter.threshold.level=info
+
+#
+# overwrite logging level for specific packages and classes
+#
+loggers=apacheDirectory,apacheMina,apacheThriftServer
+
+# overwrite logging level for org.apache.directory package
+logger.apacheDirectory.name=org.apache.directory
+logger.apacheDirectory.level=error
+logger.apacheDirectory.appenderRefs=stdout
+logger.apacheDirectory.appenderRef.stdout.ref=logToConsole
+
+# overwrite logging level for org.apache.mina package
+logger.apacheMina.name=org.apache.mina
+logger.apacheMina.level=error
+logger.apacheMina.appenderRefs=stdout
+logger.apacheMina.appenderRef.stdout.ref=logToConsole
+
+# overwrite logging level for org.apache.thrift.server.AbstractNonblockingServer class
+logger.apacheThriftServer.name=org.apache.thrift.server.AbstractNonblockingServer
+logger.apacheThriftServer.level=error
+logger.apacheThriftServer.appenderRefs=stdout
+logger.apacheThriftServer.appenderRef.stdout.ref=logToConsole