diff options
author | Manuel Bentele | 2021-12-15 14:36:57 +0100 |
---|---|---|
committer | Manuel Bentele | 2021-12-15 14:36:57 +0100 |
commit | 2acd856c4cf1bcf8cc60a2852d0a548e49ec91b0 (patch) | |
tree | d4aac3b8a53489dbb191925821b79dd417ced25f | |
parent | Add firmware loader lookup algorithm for Libvirt/QEMU machines (diff) | |
download | master-sync-shared-2acd856c4cf1bcf8cc60a2852d0a548e49ec91b0.tar.gz master-sync-shared-2acd856c4cf1bcf8cc60a2852d0a548e49ec91b0.tar.xz master-sync-shared-2acd856c4cf1bcf8cc60a2852d0a548e49ec91b0.zip |
Update log4j because of the CVE-2021-44228 security flaw
40 files changed, 127 insertions, 97 deletions
@@ -135,15 +135,21 @@ <scope>test</scope> </dependency> <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <version>[1.2.10,1.2.20]</version> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-api</artifactId> + <version>[2.0,3.0)</version> <scope>compile</scope> </dependency> <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>1.7.25</version> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <version>[2.0,3.0)</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-slf4j-impl</artifactId> + <version>[2.0,3.0)</version> <scope>compile</scope> </dependency> <dependency> diff --git a/src/main/java/org/openslx/encryption/AsymEncryptionHandler.java b/src/main/java/org/openslx/encryption/AsymEncryptionHandler.java index 98109f2..8c074ca 100644 --- a/src/main/java/org/openslx/encryption/AsymEncryptionHandler.java +++ b/src/main/java/org/openslx/encryption/AsymEncryptionHandler.java @@ -13,11 +13,12 @@ import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class AsymEncryptionHandler { - private static final Logger LOG = Logger.getLogger( AsymEncryptionHandler.class ); + private static final Logger LOG = LogManager.getLogger( AsymEncryptionHandler.class ); private final Key key; diff --git a/src/main/java/org/openslx/encryption/AsymKeyHolder.java b/src/main/java/org/openslx/encryption/AsymKeyHolder.java index 6469f30..f0762bd 100644 --- a/src/main/java/org/openslx/encryption/AsymKeyHolder.java +++ b/src/main/java/org/openslx/encryption/AsymKeyHolder.java @@ -13,11 +13,12 @@ import java.security.spec.InvalidKeySpecException; import java.security.spec.RSAPrivateKeySpec; import java.security.spec.RSAPublicKeySpec; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class AsymKeyHolder { - private static final Logger LOG = Logger.getLogger( AsymKeyHolder.class ); + private static final Logger LOG = LogManager.getLogger( AsymKeyHolder.class ); private static RSAPrivateKey privKey = null; private static RSAPublicKey pubKey = null; diff --git a/src/main/java/org/openslx/filetransfer/ClassTest.java b/src/main/java/org/openslx/filetransfer/ClassTest.java index 9d5bc82..04dc40d 100644 --- a/src/main/java/org/openslx/filetransfer/ClassTest.java +++ b/src/main/java/org/openslx/filetransfer/ClassTest.java @@ -28,8 +28,8 @@ import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManagerFactory; -import org.apache.log4j.BasicConfigurator; -import org.slf4j.LoggerFactory; +import org.apache.logging.log4j.core.config.Configurator; +import org.apache.logging.log4j.core.config.DefaultConfiguration; public class ClassTest { @@ -39,15 +39,10 @@ public class ClassTest private static String inFile; private static String outFile; - static { - // This is a temporary workaround for this annoying log4j error msg. - // Initializing the logger before anything else is done. - BasicConfigurator.configure(); - LoggerFactory.getLogger( "ROOT" ); - } - public static void main( String[] args ) throws Exception { + Configurator.initialize(new DefaultConfiguration()); + if ( args.length != 4 ) { System.out.println( "Need 4 argument: <keystore> <passphrase> <infile> <outfile>" ); System.exit( 1 ); diff --git a/src/main/java/org/openslx/filetransfer/Downloader.java b/src/main/java/org/openslx/filetransfer/Downloader.java index 50162fc..13bd95c 100644 --- a/src/main/java/org/openslx/filetransfer/Downloader.java +++ b/src/main/java/org/openslx/filetransfer/Downloader.java @@ -12,12 +12,13 @@ import javax.net.ssl.SSLContext; import net.jpountz.lz4.LZ4FastDecompressor; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class Downloader extends Transfer { - private static final Logger log = Logger.getLogger( Downloader.class ); + private static final Logger log = LogManager.getLogger( Downloader.class ); private final LZ4FastDecompressor decompressor = lz4factory.fastDecompressor(); diff --git a/src/main/java/org/openslx/filetransfer/Listener.java b/src/main/java/org/openslx/filetransfer/Listener.java index a0fc172..92a26cd 100644 --- a/src/main/java/org/openslx/filetransfer/Listener.java +++ b/src/main/java/org/openslx/filetransfer/Listener.java @@ -13,7 +13,8 @@ import java.util.concurrent.TimeUnit; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLServerSocketFactory; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openslx.util.PrioThreadFactory; public class Listener @@ -29,7 +30,7 @@ public class Listener private static final byte CONNECTING_PEER_WANTS_TO_UPLOAD = 85; // hex - code 'U' = 85. private static final byte CONNECTING_PEER_WANTS_TO_DOWNLOAD = 68; // hex - code 'D' = 68. - private static Logger log = Logger.getLogger( Listener.class ); + private static Logger log = LogManager.getLogger( Listener.class ); /***********************************************************************/ /** diff --git a/src/main/java/org/openslx/filetransfer/Transfer.java b/src/main/java/org/openslx/filetransfer/Transfer.java index 589d142..c396d6e 100644 --- a/src/main/java/org/openslx/filetransfer/Transfer.java +++ b/src/main/java/org/openslx/filetransfer/Transfer.java @@ -15,7 +15,7 @@ import javax.net.ssl.SSLSocketFactory; import net.jpountz.lz4.LZ4Factory; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.Logger; import org.openslx.util.Util; public abstract class Transfer diff --git a/src/main/java/org/openslx/filetransfer/Uploader.java b/src/main/java/org/openslx/filetransfer/Uploader.java index 39bfea2..73445aa 100644 --- a/src/main/java/org/openslx/filetransfer/Uploader.java +++ b/src/main/java/org/openslx/filetransfer/Uploader.java @@ -12,12 +12,13 @@ import javax.net.ssl.SSLContext; import net.jpountz.lz4.LZ4Compressor; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class Uploader extends Transfer { - private static final Logger log = Logger.getLogger( Uploader.class ); + private static final Logger log = LogManager.getLogger( Uploader.class ); private final LZ4Compressor compressor = lz4factory.fastCompressor(); diff --git a/src/main/java/org/openslx/filetransfer/util/ChunkList.java b/src/main/java/org/openslx/filetransfer/util/ChunkList.java index 91d6f1e..ef327e5 100644 --- a/src/main/java/org/openslx/filetransfer/util/ChunkList.java +++ b/src/main/java/org/openslx/filetransfer/util/ChunkList.java @@ -10,14 +10,15 @@ import java.util.LinkedList; import java.util.List; import java.util.zip.CRC32; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openslx.filetransfer.LocalChunkSource.ChunkSource; import org.openslx.util.ThriftUtil; public class ChunkList { - private static final Logger LOGGER = Logger.getLogger( ChunkList.class ); + private static final Logger LOGGER = LogManager.getLogger( ChunkList.class ); /** * Here we keep a list of all chunks in the proper order, in case we quickly need to access one diff --git a/src/main/java/org/openslx/filetransfer/util/FileChunk.java b/src/main/java/org/openslx/filetransfer/util/FileChunk.java index 6594e31..99b30ea 100644 --- a/src/main/java/org/openslx/filetransfer/util/FileChunk.java +++ b/src/main/java/org/openslx/filetransfer/util/FileChunk.java @@ -5,14 +5,15 @@ import java.util.Iterator; import java.util.List; import java.util.zip.CRC32; -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.LocalChunkSource.ChunkSource; public class FileChunk { - private static final Logger LOGGER = Logger.getLogger( FileChunk.class ); + private static final Logger LOGGER = LogManager.getLogger( FileChunk.class ); /** * Length in bytes of binary sha1 representation diff --git a/src/main/java/org/openslx/filetransfer/util/HashChecker.java b/src/main/java/org/openslx/filetransfer/util/HashChecker.java index f6b27f7..f6f8876 100644 --- a/src/main/java/org/openslx/filetransfer/util/HashChecker.java +++ b/src/main/java/org/openslx/filetransfer/util/HashChecker.java @@ -9,7 +9,8 @@ import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class HashChecker { @@ -17,7 +18,7 @@ public class HashChecker public static final int CALC_HASH = 2; public static final int CALC_CRC32 = 4; - private static final Logger LOGGER = Logger.getLogger( HashChecker.class ); + private static final Logger LOGGER = LogManager.getLogger( HashChecker.class ); private final BlockingQueue<HashTask> queue; diff --git a/src/main/java/org/openslx/filetransfer/util/IncomingTransferBase.java b/src/main/java/org/openslx/filetransfer/util/IncomingTransferBase.java index 300a75f..cadcf3c 100644 --- a/src/main/java/org/openslx/filetransfer/util/IncomingTransferBase.java +++ b/src/main/java/org/openslx/filetransfer/util/IncomingTransferBase.java @@ -14,7 +14,8 @@ import java.util.Iterator; import java.util.List; import java.util.concurrent.ExecutorService; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openslx.bwlp.thrift.iface.TransferState; import org.openslx.bwlp.thrift.iface.TransferStatus; import org.openslx.filetransfer.DataReceivedCallback; @@ -30,7 +31,7 @@ import org.openslx.util.ThriftUtil; public abstract class IncomingTransferBase extends AbstractTransfer implements HashCheckCallback { - private static final Logger LOGGER = Logger.getLogger( IncomingTransferBase.class ); + private static final Logger LOGGER = LogManager.getLogger( IncomingTransferBase.class ); /** * Remote peer is uploading, so on our end, we have Downloaders diff --git a/src/main/java/org/openslx/filetransfer/util/LocalCopyManager.java b/src/main/java/org/openslx/filetransfer/util/LocalCopyManager.java index 54dd2d0..e1fad97 100644 --- a/src/main/java/org/openslx/filetransfer/util/LocalCopyManager.java +++ b/src/main/java/org/openslx/filetransfer/util/LocalCopyManager.java @@ -9,7 +9,8 @@ import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openslx.filetransfer.LocalChunkSource.ChunkSource; import org.openslx.filetransfer.LocalChunkSource.SourceFile; import org.openslx.util.Util; @@ -17,7 +18,7 @@ import org.openslx.util.Util; public class LocalCopyManager extends Thread { - private static final Logger LOGGER = Logger.getLogger( LocalCopyManager.class ); + private static final Logger LOGGER = LogManager.getLogger( LocalCopyManager.class ); private FileChunk currentChunk = null; diff --git a/src/main/java/org/openslx/filetransfer/util/OutgoingTransferBase.java b/src/main/java/org/openslx/filetransfer/util/OutgoingTransferBase.java index 18296c5..15c86fb 100644 --- a/src/main/java/org/openslx/filetransfer/util/OutgoingTransferBase.java +++ b/src/main/java/org/openslx/filetransfer/util/OutgoingTransferBase.java @@ -6,7 +6,8 @@ import java.util.List; import java.util.concurrent.ExecutorService; 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.TransferInformation; import org.openslx.filetransfer.Uploader; @@ -17,7 +18,7 @@ public abstract class OutgoingTransferBase extends AbstractTransfer * Constants */ - private static final Logger LOGGER = Logger.getLogger( OutgoingTransferBase.class ); + private static final Logger LOGGER = LogManager.getLogger( OutgoingTransferBase.class ); private static final long INACTIVITY_TIMEOUT = TimeUnit.MINUTES.toMillis( 5 ); diff --git a/src/main/java/org/openslx/imagemaster/crcchecker/CrcFile.java b/src/main/java/org/openslx/imagemaster/crcchecker/CrcFile.java index 17a44a2..4a05471 100644 --- a/src/main/java/org/openslx/imagemaster/crcchecker/CrcFile.java +++ b/src/main/java/org/openslx/imagemaster/crcchecker/CrcFile.java @@ -12,7 +12,8 @@ import java.util.Arrays; import java.util.List; import java.util.zip.CRC32; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; /** * Represents a crc file @@ -24,7 +25,7 @@ public class CrcFile private Boolean valid = null; private final File file; - private static Logger log = Logger.getLogger( CrcFile.class ); + private static Logger log = LogManager.getLogger( CrcFile.class ); /** * Loads a crcFile from file diff --git a/src/main/java/org/openslx/thrifthelper/ThriftHandler.java b/src/main/java/org/openslx/thrifthelper/ThriftHandler.java index 05563d0..28b0fa6 100644 --- a/src/main/java/org/openslx/thrifthelper/ThriftHandler.java +++ b/src/main/java/org/openslx/thrifthelper/ThriftHandler.java @@ -9,7 +9,8 @@ import java.util.Deque; import java.util.HashSet; import java.util.Set; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.apache.thrift.TException; import org.apache.thrift.TServiceClient; import org.apache.thrift.transport.TTransportException; @@ -18,7 +19,7 @@ import org.openslx.thrifthelper.ThriftManager.ErrorCallback; class ThriftHandler<T extends TServiceClient> implements InvocationHandler { - private final static Logger LOGGER = Logger.getLogger( ThriftHandler.class ); + private final static Logger LOGGER = LogManager.getLogger( ThriftHandler.class ); protected interface WantClientCallback<T> { diff --git a/src/main/java/org/openslx/thrifthelper/ThriftManager.java b/src/main/java/org/openslx/thrifthelper/ThriftManager.java index 099caaa..8bb5dd7 100644 --- a/src/main/java/org/openslx/thrifthelper/ThriftManager.java +++ b/src/main/java/org/openslx/thrifthelper/ThriftManager.java @@ -8,7 +8,8 @@ import java.net.Socket; import javax.net.SocketFactory; import javax.net.ssl.SSLContext; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.apache.thrift.TServiceClient; import org.apache.thrift.protocol.TBinaryProtocol; import org.apache.thrift.protocol.TProtocol; @@ -23,7 +24,7 @@ import org.openslx.util.Util; public class ThriftManager<T> { - private final static Logger LOGGER = Logger.getLogger( ThriftManager.class ); + private final static Logger LOGGER = LogManager.getLogger( ThriftManager.class ); public interface ErrorCallback { diff --git a/src/main/java/org/openslx/util/AppUtil.java b/src/main/java/org/openslx/util/AppUtil.java index c782cae..0ef4d8e 100644 --- a/src/main/java/org/openslx/util/AppUtil.java +++ b/src/main/java/org/openslx/util/AppUtil.java @@ -11,7 +11,7 @@ import java.time.format.DateTimeFormatter; import java.util.jar.JarInputStream; import java.util.jar.Manifest; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.Logger; public class AppUtil { diff --git a/src/main/java/org/openslx/util/FsUtil.java b/src/main/java/org/openslx/util/FsUtil.java index 76571ef..3f9731a 100644 --- a/src/main/java/org/openslx/util/FsUtil.java +++ b/src/main/java/org/openslx/util/FsUtil.java @@ -2,12 +2,13 @@ package org.openslx.util; import java.io.File; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class FsUtil { - private static final Logger LOGGER = Logger.getLogger( FsUtil.class ); + private static final Logger LOGGER = LogManager.getLogger( FsUtil.class ); public static String getRelativePath( File absolutePath, File parentDir ) { diff --git a/src/main/java/org/openslx/util/GenericDataCache.java b/src/main/java/org/openslx/util/GenericDataCache.java index 5ae73fb..a7116b7 100644 --- a/src/main/java/org/openslx/util/GenericDataCache.java +++ b/src/main/java/org/openslx/util/GenericDataCache.java @@ -2,12 +2,13 @@ package org.openslx.util; import java.util.concurrent.atomic.AtomicReference; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public abstract class GenericDataCache<T> { - private static final Logger LOGGER = Logger.getLogger( GenericDataCache.class ); + private static final Logger LOGGER = LogManager.getLogger( GenericDataCache.class ); /** * How long the cached data is valid after fetching diff --git a/src/main/java/org/openslx/util/Json.java b/src/main/java/org/openslx/util/Json.java index ab0087e..5e5fbcb 100644 --- a/src/main/java/org/openslx/util/Json.java +++ b/src/main/java/org/openslx/util/Json.java @@ -8,7 +8,8 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicReference; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.apache.thrift.TBase; import com.google.gson.Gson; @@ -25,7 +26,7 @@ import com.google.gson.JsonSyntaxException; public class Json { - private static final Logger LOGGER = Logger.getLogger(Json.class); + private static final Logger LOGGER = LogManager.getLogger(Json.class); /** * Global static instance. The Gson object is thread-safe. diff --git a/src/main/java/org/openslx/util/QuickTimer.java b/src/main/java/org/openslx/util/QuickTimer.java index ec7c2ed..a26fd76 100644 --- a/src/main/java/org/openslx/util/QuickTimer.java +++ b/src/main/java/org/openslx/util/QuickTimer.java @@ -3,7 +3,8 @@ package org.openslx.util; import java.util.Timer; import java.util.TimerTask; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; /** * This is a global, static {@link Timer} you can use anywhere for repeating @@ -15,7 +16,7 @@ import org.apache.log4j.Logger; */ public class QuickTimer { - private static final Logger LOGGER = Logger.getLogger(QuickTimer.class); + private static final Logger LOGGER = LogManager.getLogger(QuickTimer.class); private static final Timer timer = new Timer("QuickTimer", true); diff --git a/src/main/java/org/openslx/util/Util.java b/src/main/java/org/openslx/util/Util.java index 441bc88..f475d01 100644 --- a/src/main/java/org/openslx/util/Util.java +++ b/src/main/java/org/openslx/util/Util.java @@ -2,11 +2,12 @@ package org.openslx.util; import java.util.regex.Pattern; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class Util { - private static Logger log = Logger.getLogger( Util.class ); + private static Logger log = LogManager.getLogger( Util.class ); /** * Check if the given object is null, abort program if true. An optional diff --git a/src/main/java/org/openslx/util/XmlHelper.java b/src/main/java/org/openslx/util/XmlHelper.java index 6039b7b..e3607d9 100644 --- a/src/main/java/org/openslx/util/XmlHelper.java +++ b/src/main/java/org/openslx/util/XmlHelper.java @@ -20,7 +20,8 @@ import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -28,7 +29,7 @@ import org.xml.sax.SAXException; public class XmlHelper { - private final static Logger LOGGER = Logger.getLogger( XmlHelper.class ); + private final static Logger LOGGER = LogManager.getLogger( XmlHelper.class ); // TODO check thread-safety private static final XPath XPath = XPathFactory.newInstance().newXPath(); diff --git a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfiguration.java b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfiguration.java index 318aa4c..165b80b 100644 --- a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfiguration.java +++ b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfiguration.java @@ -7,7 +7,8 @@ import java.util.ArrayList; import java.util.Collections; 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.OperatingSystem; import org.openslx.virtualization.Version; import org.openslx.virtualization.hardware.VirtOptionValue; @@ -20,7 +21,7 @@ import org.openslx.virtualization.virtualizer.Virtualizer; */ public abstract class VirtualizationConfiguration { - private static final Logger LOGGER = Logger.getLogger( VirtualizationConfiguration.class ); + private static final Logger LOGGER = LogManager.getLogger( VirtualizationConfiguration.class ); private final Virtualizer virtualizer; diff --git a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationDocker.java b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationDocker.java index bcfbb19..9dfa0a6 100644 --- a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationDocker.java +++ b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationDocker.java @@ -6,7 +6,8 @@ import java.io.FileInputStream; import java.io.IOException; 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.OperatingSystem; import org.openslx.virtualization.Version; import org.openslx.virtualization.virtualizer.VirtualizerDocker; @@ -18,7 +19,7 @@ public class VirtualizationConfigurationDocker extends VirtualizationConfigurati */ private static final String FILE_NAME_EXTENSION = null; - private static final Logger LOGGER = Logger.getLogger( VirtualizationConfigurationDocker.class); + private static final Logger LOGGER = LogManager.getLogger( VirtualizationConfigurationDocker.class); /** * containerDefinition is a serialized tar.gz archive and represents a diff --git a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualBox.java b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualBox.java index 963179c..266f10e 100644 --- a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualBox.java +++ b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualBox.java @@ -10,7 +10,8 @@ import java.util.Arrays; 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.OperatingSystem; import org.openslx.thrifthelper.TConst; import org.openslx.util.Util; @@ -34,7 +35,7 @@ public class VirtualizationConfigurationVirtualBox extends VirtualizationConfigu */ public static final String FILE_NAME_EXTENSION = "vbox"; - private static final Logger LOGGER = Logger.getLogger( VirtualizationConfigurationVirtualBox.class ); + private static final Logger LOGGER = LogManager.getLogger( VirtualizationConfigurationVirtualBox.class ); private final VirtualizationConfigurationVirtualboxFileFormat config; diff --git a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualboxFileFormat.java b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualboxFileFormat.java index b2dcd48..032e36b 100644 --- a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualboxFileFormat.java +++ b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualboxFileFormat.java @@ -21,7 +21,8 @@ import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathExpressionException; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openslx.util.Util; import org.openslx.util.XmlHelper; import org.openslx.virtualization.Version; @@ -39,7 +40,7 @@ import org.xml.sax.SAXException; */ public class VirtualizationConfigurationVirtualboxFileFormat { - private static final Logger LOGGER = Logger.getLogger( VirtualizationConfigurationVirtualboxFileFormat.class ); + private static final Logger LOGGER = LogManager.getLogger( VirtualizationConfigurationVirtualboxFileFormat.class ); // key information set during initial parsing of the XML file private String osName = new String(); diff --git a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVmware.java b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVmware.java index 3a5a165..49f44df 100644 --- a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVmware.java +++ b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVmware.java @@ -12,7 +12,8 @@ import java.util.Map.Entry; import java.util.regex.Matcher; import java.util.regex.Pattern; -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.thrifthelper.TConst; import org.openslx.util.Util; @@ -32,7 +33,7 @@ public class VirtualizationConfigurationVmware extends VirtualizationConfigurati */ public static final String FILE_NAME_EXTENSION = "vmx"; - private static final Logger LOGGER = Logger.getLogger( VirtualizationConfigurationVmware.class ); + private static final Logger LOGGER = LogManager.getLogger( VirtualizationConfigurationVmware.class ); private static final Pattern HDD_PATTERN = Pattern.compile( "^(ide\\d|scsi\\d|sata\\d|nvme\\d):?(\\d?)\\.(.*)", Pattern.CASE_INSENSITIVE ); diff --git a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVmwareFileFormat.java b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVmwareFileFormat.java index 231b2f2..134ff30 100644 --- a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVmwareFileFormat.java +++ b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVmwareFileFormat.java @@ -16,7 +16,8 @@ import java.util.TreeMap; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.openslx.util.Util; class KeyValuePair @@ -34,7 +35,7 @@ class KeyValuePair public class VirtualizationConfigurationVmwareFileFormat { - private static final Logger LOGGER = Logger.getLogger( VirtualizationConfigurationVmwareFileFormat.class ); + private static final Logger LOGGER = LogManager.getLogger( VirtualizationConfigurationVmwareFileFormat.class ); private Map<String, ConfigEntry> entries = new TreeMap<>( String.CASE_INSENSITIVE_ORDER ); diff --git a/src/main/java/org/openslx/virtualization/configuration/container/ContainerDefinition.java b/src/main/java/org/openslx/virtualization/configuration/container/ContainerDefinition.java index 167a11f..91cf50c 100644 --- a/src/main/java/org/openslx/virtualization/configuration/container/ContainerDefinition.java +++ b/src/main/java/org/openslx/virtualization/configuration/container/ContainerDefinition.java @@ -3,7 +3,9 @@ package org.openslx.virtualization.configuration.container; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.stream.JsonReader; -import org.apache.log4j.Logger; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.kamranzafar.jtar.TarEntry; import org.kamranzafar.jtar.TarInputStream; import org.kamranzafar.jtar.TarOutputStream; @@ -22,7 +24,7 @@ public class ContainerDefinition { // TODO refatoring: tar.gz of this object is not useful, for smaller dockerfiles it makes the package lager. // remove the containerRecipe, ContainerMeta holds in build_context the dockerfile. - protected static final Logger LOGGER = Logger.getLogger(ContainerDefinition.class); + protected static final Logger LOGGER = LogManager.getLogger(ContainerDefinition.class); protected static final String CONTAINER_FILE = "dockerfile"; protected static final String CONTAINER_META_FILE = "container_meta.json"; diff --git a/src/main/java/org/openslx/virtualization/configuration/transformation/TransformationManager.java b/src/main/java/org/openslx/virtualization/configuration/transformation/TransformationManager.java index b28fb32..6bb5faa 100644 --- a/src/main/java/org/openslx/virtualization/configuration/transformation/TransformationManager.java +++ b/src/main/java/org/openslx/virtualization/configuration/transformation/TransformationManager.java @@ -2,7 +2,8 @@ package org.openslx.virtualization.configuration.transformation; import java.util.ArrayList; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; /** * A transformation manager is a class to manage several transformations and their application. @@ -37,7 +38,7 @@ public class TransformationManager<T, R> /** * Logger instance to log messages. */ - private static final Logger LOGGER = Logger.getLogger( TransformationManager.class ); + private static final Logger LOGGER = LogManager.getLogger( TransformationManager.class ); /** * Create a transformation manager. diff --git a/src/test/java/org/openslx/libvirt/capabilities/CapabilitiesTest.java b/src/test/java/org/openslx/libvirt/capabilities/CapabilitiesTest.java index e7d7651..fd90698 100644 --- a/src/test/java/org/openslx/libvirt/capabilities/CapabilitiesTest.java +++ b/src/test/java/org/openslx/libvirt/capabilities/CapabilitiesTest.java @@ -8,8 +8,8 @@ import static org.junit.jupiter.api.Assertions.fail; import java.math.BigInteger; import java.util.List; -import org.apache.log4j.Level; -import org.apache.log4j.LogManager; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.core.config.Configurator; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; @@ -32,7 +32,7 @@ public class CapabilitiesTest public static void setUp() { // disable logging with log4j - LogManager.getRootLogger().setLevel( Level.OFF ); + Configurator.setRootLevel( Level.OFF ); } private Capabilities newCapabilitiesInstance( String xmlFileName ) diff --git a/src/test/java/org/openslx/libvirt/domain/DomainTest.java b/src/test/java/org/openslx/libvirt/domain/DomainTest.java index f371e9e..f55c511 100644 --- a/src/test/java/org/openslx/libvirt/domain/DomainTest.java +++ b/src/test/java/org/openslx/libvirt/domain/DomainTest.java @@ -6,8 +6,8 @@ import static org.junit.jupiter.api.Assertions.fail; import java.math.BigInteger; -import org.apache.log4j.Level; -import org.apache.log4j.LogManager; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.core.config.Configurator; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; @@ -25,7 +25,7 @@ public class DomainTest public static void setUp() { // disable logging with log4j - LogManager.getRootLogger().setLevel( Level.OFF ); + Configurator.setRootLevel( Level.OFF ); } public static Domain getDomain( String xmlFileName ) diff --git a/src/test/java/org/openslx/libvirt/xml/LibvirtXmlDocumentTest.java b/src/test/java/org/openslx/libvirt/xml/LibvirtXmlDocumentTest.java index 75b934e..02c8b19 100644 --- a/src/test/java/org/openslx/libvirt/xml/LibvirtXmlDocumentTest.java +++ b/src/test/java/org/openslx/libvirt/xml/LibvirtXmlDocumentTest.java @@ -13,8 +13,8 @@ import java.io.InputStream; import java.nio.charset.StandardCharsets; import org.apache.commons.io.FileUtils; -import org.apache.log4j.Level; -import org.apache.log4j.LogManager; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.core.config.Configurator; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; @@ -43,7 +43,7 @@ public class LibvirtXmlDocumentTest public static void setUp() { // disable logging with log4j - LogManager.getRootLogger().setLevel( Level.OFF ); + Configurator.setRootLevel( Level.OFF ); } private LibvirtXmlDocument newLibvirtXmlDocumentInstance( String xmlFileName ) diff --git a/src/test/java/org/openslx/virtualization/configuration/VirtualizationConfigurationQemuTest.java b/src/test/java/org/openslx/virtualization/configuration/VirtualizationConfigurationQemuTest.java index 6e14c64..4b07adc 100644 --- a/src/test/java/org/openslx/virtualization/configuration/VirtualizationConfigurationQemuTest.java +++ b/src/test/java/org/openslx/virtualization/configuration/VirtualizationConfigurationQemuTest.java @@ -16,8 +16,8 @@ import java.util.List; import java.util.stream.Stream; import org.apache.commons.io.FileUtils; -import org.apache.log4j.Level; -import org.apache.log4j.LogManager; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.core.config.Configurator; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; @@ -57,7 +57,7 @@ public class VirtualizationConfigurationQemuTest public static void setUp() { // disable logging with log4j - LogManager.getRootLogger().setLevel( Level.OFF ); + Configurator.setRootLevel( Level.OFF ); } @Test diff --git a/src/test/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualBoxTest.java b/src/test/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualBoxTest.java index 1689007..4eae06b 100644 --- a/src/test/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualBoxTest.java +++ b/src/test/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualBoxTest.java @@ -12,8 +12,8 @@ import java.util.Arrays; import java.util.List; import java.util.stream.Stream; -import org.apache.log4j.Level; -import org.apache.log4j.LogManager; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.core.config.Configurator; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.params.ParameterizedTest; @@ -28,7 +28,7 @@ public class VirtualizationConfigurationVirtualBoxTest public static void setUp() { // disable logging with log4j - LogManager.getRootLogger().setLevel( Level.OFF ); + Configurator.setRootLevel( Level.OFF ); } @ParameterizedTest diff --git a/src/test/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModClientToDozModServerTest.java b/src/test/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModClientToDozModServerTest.java index 7493fec..0c164c6 100644 --- a/src/test/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModClientToDozModServerTest.java +++ b/src/test/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModClientToDozModServerTest.java @@ -5,8 +5,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; -import org.apache.log4j.Level; -import org.apache.log4j.LogManager; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.core.config.Configurator; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; @@ -21,7 +21,7 @@ public class ConfigurationLogicDozModClientToDozModServerTest public static void setUp() { // disable logging with log4j - LogManager.getRootLogger().setLevel( Level.OFF ); + Configurator.setRootLevel( Level.OFF ); } @Test diff --git a/src/test/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModServerToDozModClientTest.java b/src/test/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModServerToDozModClientTest.java index 5a1098a..4e49eab 100644 --- a/src/test/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModServerToDozModClientTest.java +++ b/src/test/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModServerToDozModClientTest.java @@ -5,8 +5,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; -import org.apache.log4j.Level; -import org.apache.log4j.LogManager; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.core.config.Configurator; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; @@ -36,7 +36,7 @@ public class ConfigurationLogicDozModServerToDozModClientTest public static void setUp() { // disable logging with log4j - LogManager.getRootLogger().setLevel( Level.OFF ); + Configurator.setRootLevel( Level.OFF ); } @Test diff --git a/src/test/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModServerToStatelessClientTest.java b/src/test/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModServerToStatelessClientTest.java index f6d56c3..7380277 100644 --- a/src/test/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModServerToStatelessClientTest.java +++ b/src/test/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModServerToStatelessClientTest.java @@ -5,8 +5,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; -import org.apache.log4j.Level; -import org.apache.log4j.LogManager; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.core.config.Configurator; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; @@ -30,7 +30,7 @@ public class ConfigurationLogicDozModServerToStatelessClientTest public static void setUp() { // disable logging with log4j - LogManager.getRootLogger().setLevel( Level.OFF ); + Configurator.setRootLevel( Level.OFF ); } @Test |