diff --git a/build.xml b/build.xml
index a56bea06a..0086a5ecc 100644
--- a/build.xml
+++ b/build.xml
@@ -98,6 +98,7 @@
+
diff --git a/lib/logging/apache-log4j-extras-1.2.17.jar b/lib/logging/apache-log4j-extras-1.2.17.jar
deleted file mode 100644
index b08d8d56e..000000000
Binary files a/lib/logging/apache-log4j-extras-1.2.17.jar and /dev/null differ
diff --git a/lib/logging/log4j-1.2.17.jar b/lib/logging/log4j-1.2.17.jar
deleted file mode 100644
index 068867ebf..000000000
Binary files a/lib/logging/log4j-1.2.17.jar and /dev/null differ
diff --git a/lib/logging/log4j-api-2.16.0.jar b/lib/logging/log4j-api-2.16.0.jar
new file mode 100644
index 000000000..2fea718f2
Binary files /dev/null and b/lib/logging/log4j-api-2.16.0.jar differ
diff --git a/lib/logging/log4j-core-2.16.0.jar b/lib/logging/log4j-core-2.16.0.jar
new file mode 100644
index 000000000..6a2365bab
Binary files /dev/null and b/lib/logging/log4j-core-2.16.0.jar differ
diff --git a/lib/logging/slf4j-api-1.7.12.jar b/lib/logging/slf4j-api-1.7.12.jar
deleted file mode 100644
index e357ddc7f..000000000
Binary files a/lib/logging/slf4j-api-1.7.12.jar and /dev/null differ
diff --git a/lib/logging/slf4j-log4j12-1.7.12.jar b/lib/logging/slf4j-log4j12-1.7.12.jar
deleted file mode 100644
index 8035e08cc..000000000
Binary files a/lib/logging/slf4j-log4j12-1.7.12.jar and /dev/null differ
diff --git a/src/com/apple/OSXAdapterWrapper.java b/src/com/apple/OSXAdapterWrapper.java
index fa9c62f26..83d9451e9 100644
--- a/src/com/apple/OSXAdapterWrapper.java
+++ b/src/com/apple/OSXAdapterWrapper.java
@@ -11,8 +11,8 @@
package com.apple;
import com.github.zafarkhaja.semver.Version;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.common.Constants;
import qz.utils.MacUtilities;
@@ -27,7 +27,7 @@
* @author Tres Finocchiaro
*/
public class OSXAdapterWrapper implements InvocationHandler {
- private static final Logger log = LoggerFactory.getLogger(OSXAdapterWrapper.class);
+ private static final Logger log = LogManager.getLogger(OSXAdapterWrapper.class);
public static final boolean legacyMode = Constants.JAVA_VERSION.lessThan(Version.valueOf("9.0.0"));
private Object target;
diff --git a/src/log4j.xml b/src/log4j.xml
deleted file mode 100644
index b0d0ce326..000000000
--- a/src/log4j.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/log4j2.xml b/src/log4j2.xml
new file mode 100644
index 000000000..0deee7757
--- /dev/null
+++ b/src/log4j2.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/qz/auth/CRL.java b/src/qz/auth/CRL.java
index 519b7458e..47cee2067 100644
--- a/src/qz/auth/CRL.java
+++ b/src/qz/auth/CRL.java
@@ -1,7 +1,7 @@
package qz.auth;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.utils.ConnectionUtilities;
@@ -16,7 +16,7 @@
*/
public class CRL {
- private static final Logger log = LoggerFactory.getLogger(CRL.class);
+ private static final Logger log = LogManager.getLogger(CRL.class);
/** The URL to the QZ CRL. Should not be changed except for dev tests */
public static final String CRL_URL = "https://crl.qz.io";
diff --git a/src/qz/auth/Certificate.java b/src/qz/auth/Certificate.java
index 9ce511d04..4e3250236 100644
--- a/src/qz/auth/Certificate.java
+++ b/src/qz/auth/Certificate.java
@@ -10,8 +10,8 @@
import org.bouncycastle.asn1.x509.X509Name;
import org.bouncycastle.jce.PrincipalUtil;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.common.Constants;
import qz.utils.ByteUtilities;
import qz.utils.FileUtilities;
@@ -37,7 +37,7 @@
*/
public class Certificate {
- private static final Logger log = LoggerFactory.getLogger(Certificate.class);
+ private static final Logger log = LogManager.getLogger(Certificate.class);
private static final String QUIETLY_FAIL = "quiet";
public static final String OVERRIDE_CA_FLAG = "trustedRootCert";
public static final String OVERRIDE_CA_PROPERTY = "authcert.override";
diff --git a/src/qz/common/AboutInfo.java b/src/qz/common/AboutInfo.java
index a5dd48b67..7341abcb9 100644
--- a/src/qz/common/AboutInfo.java
+++ b/src/qz/common/AboutInfo.java
@@ -10,8 +10,8 @@
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.installer.certificate.KeyPairWrapper;
import qz.installer.certificate.CertificateManager;
import qz.utils.SystemUtilities;
@@ -30,7 +30,7 @@
public class AboutInfo {
- private static final Logger log = LoggerFactory.getLogger(AboutInfo.class);
+ private static final Logger log = LogManager.getLogger(AboutInfo.class);
private static String preferredHostname = "localhost";
diff --git a/src/qz/common/PropertyHelper.java b/src/qz/common/PropertyHelper.java
index fce7f8f93..edd069f83 100644
--- a/src/qz/common/PropertyHelper.java
+++ b/src/qz/common/PropertyHelper.java
@@ -1,18 +1,19 @@
package qz.common;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;
-import java.util.logging.Level;
+
/**
* Created by Tres on 12/16/2015.
*/
public class PropertyHelper extends Properties {
- private static final org.slf4j.Logger log = LoggerFactory.getLogger(TrayManager.class);
+ private static final Logger log = LogManager.getLogger(TrayManager.class);
private String file;
/**
diff --git a/src/qz/common/SecurityInfo.java b/src/qz/common/SecurityInfo.java
index c88b8d34b..652b40ff5 100644
--- a/src/qz/common/SecurityInfo.java
+++ b/src/qz/common/SecurityInfo.java
@@ -3,8 +3,8 @@
import com.sun.jna.Native;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.eclipse.jetty.util.Jetty;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import purejavahidapi.PureJavaHidApi;
import qz.utils.SystemUtilities;
@@ -26,7 +26,7 @@ public class SecurityInfo {
* Wrap throwable operations into a try/catch
*/
private static class CheckedTreeMap extends TreeMap {
- private static final Logger log = LoggerFactory.getLogger(CheckedTreeMap.class);
+ private static final Logger log = LogManager.getLogger(CheckedTreeMap.class);
interface CheckedValue {
Object check() throws Throwable;
@@ -43,7 +43,7 @@ public V put(K key, CheckedValue value) {
}
}
- private static final Logger log = LoggerFactory.getLogger(SecurityInfo.class);
+ private static final Logger log = LogManager.getLogger(SecurityInfo.class);
public static KeyStore getKeyStore(Properties props) {
if (props != null) {
@@ -102,9 +102,9 @@ public static SortedMap getLibVersions() {
// Fallback to maven manifest information
HashMap mavenVersions = getMavenVersions();
- String[] mavenLibs = {"jetty-servlet", "apache-log4j-extras", "jetty-io", "websocket-common",
- "slf4j-log4j12", "usb4java-javax", "java-semver", "commons-pool2",
- "websocket-server", "jettison", "commons-codec", "log4j", "slf4j-api",
+ String[] mavenLibs = {"jetty-servlet", "jetty-io", "websocket-common",
+ "usb4java-javax", "java-semver", "commons-pool2",
+ "websocket-server", "jettison", "commons-codec", "log4j-api", "log4j-core",
"websocket-servlet", "jetty-http", "commons-lang3", "javax-websocket-server-impl",
"javax.servlet-api", "usb4java", "websocket-api", "jetty-util", "websocket-client",
"javax.websocket-api", "commons-io", "jetty-security"};
diff --git a/src/qz/common/TrayManager.java b/src/qz/common/TrayManager.java
index a612eeffe..d8d79c826 100644
--- a/src/qz/common/TrayManager.java
+++ b/src/qz/common/TrayManager.java
@@ -14,8 +14,8 @@
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.auth.Certificate;
import qz.auth.RequestState;
import qz.installer.shortcut.ShortcutCreator;
@@ -47,7 +47,7 @@
*/
public class TrayManager {
- private static final Logger log = LoggerFactory.getLogger(TrayManager.class);
+ private static final Logger log = LogManager.getLogger(TrayManager.class);
private boolean headless;
diff --git a/src/qz/communication/H4J_HidListener.java b/src/qz/communication/H4J_HidListener.java
index 4f44ace81..032492d15 100644
--- a/src/qz/communication/H4J_HidListener.java
+++ b/src/qz/communication/H4J_HidListener.java
@@ -6,8 +6,8 @@
import org.hid4java.HidManager;
import org.hid4java.HidServicesListener;
import org.hid4java.event.HidServicesEvent;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.ws.PrintSocketClient;
import qz.ws.StreamEvent;
@@ -15,7 +15,7 @@
public class H4J_HidListener implements DeviceListener, HidServicesListener {
- private static final Logger log = LoggerFactory.getLogger(H4J_HidListener.class);
+ private static final Logger log = LogManager.getLogger(H4J_HidListener.class);
private Session session;
diff --git a/src/qz/communication/PJHA_HidIO.java b/src/qz/communication/PJHA_HidIO.java
index 0bbfb0018..e942f510f 100644
--- a/src/qz/communication/PJHA_HidIO.java
+++ b/src/qz/communication/PJHA_HidIO.java
@@ -1,7 +1,7 @@
package qz.communication;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import purejavahidapi.HidDevice;
import purejavahidapi.HidDeviceInfo;
import purejavahidapi.InputReportListener;
@@ -14,7 +14,7 @@
public class PJHA_HidIO implements DeviceIO {
- private static final Logger log = LoggerFactory.getLogger(PJHA_HidIO.class);
+ private static final Logger log = LogManager.getLogger(PJHA_HidIO.class);
private HidDeviceInfo deviceInfo;
private HidDevice device;
@@ -121,7 +121,7 @@ public byte[] getFeatureReport(int responseSize, Byte unused) throws DeviceExcep
public void sendFeatureReport(byte[] data, Byte reportId) throws DeviceException {
if (reportId == null) { reportId = (byte)0x00; }
- int wrote = device.setFeatureReport(reportId, data, data.length);
+ int wrote = device.setFeatureReport(reportId, data, data.length);
if (wrote == -1) {
throw new DeviceException("Failed to write to device");
diff --git a/src/qz/communication/PJHA_HidListener.java b/src/qz/communication/PJHA_HidListener.java
index e12fa6325..ed8d04ad5 100644
--- a/src/qz/communication/PJHA_HidListener.java
+++ b/src/qz/communication/PJHA_HidListener.java
@@ -1,8 +1,8 @@
package qz.communication;
import org.eclipse.jetty.websocket.api.Session;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import purejavahidapi.DeviceRemovalListener;
import purejavahidapi.HidDevice;
import qz.ws.PrintSocketClient;
@@ -12,7 +12,7 @@
public class PJHA_HidListener implements DeviceListener, DeviceRemovalListener {
- private static final Logger log = LoggerFactory.getLogger(PJHA_HidListener.class);
+ private static final Logger log = LogManager.getLogger(PJHA_HidListener.class);
private Session session;
private HidDevice device;
diff --git a/src/qz/communication/SerialIO.java b/src/qz/communication/SerialIO.java
index cad5ecf0b..f19ae0dc8 100644
--- a/src/qz/communication/SerialIO.java
+++ b/src/qz/communication/SerialIO.java
@@ -4,8 +4,8 @@
import org.apache.commons.codec.binary.StringUtils;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.common.ByteArrayBuilder;
import qz.utils.ByteUtilities;
import qz.utils.DeviceUtilities;
@@ -17,7 +17,7 @@
*/
public class SerialIO {
- private static final Logger log = LoggerFactory.getLogger(SerialIO.class);
+ private static final Logger log = LogManager.getLogger(SerialIO.class);
// Timeout to wait before giving up on reading the specified amount of bytes
private static final int TIMEOUT = 1200;
diff --git a/src/qz/communication/SerialOptions.java b/src/qz/communication/SerialOptions.java
index eb13f4ece..a574ec5c0 100644
--- a/src/qz/communication/SerialOptions.java
+++ b/src/qz/communication/SerialOptions.java
@@ -5,8 +5,8 @@
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.utils.ByteUtilities;
import qz.utils.DeviceUtilities;
import qz.utils.LoggerUtilities;
@@ -18,7 +18,7 @@
public class SerialOptions {
- private static final Logger log = LoggerFactory.getLogger(SerialOptions.class);
+ private static final Logger log = LogManager.getLogger(SerialOptions.class);
private static final String DEFAULT_BEGIN = "0x0002";
private static final String DEFAULT_END = "0x000D";
diff --git a/src/qz/communication/SocketIO.java b/src/qz/communication/SocketIO.java
index 69e5d0213..cde26fdc6 100644
--- a/src/qz/communication/SocketIO.java
+++ b/src/qz/communication/SocketIO.java
@@ -3,8 +3,8 @@
import org.apache.commons.lang3.ArrayUtils;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.utils.DeviceUtilities;
import java.io.DataInputStream;
@@ -16,7 +16,7 @@
public class SocketIO {
- private static final Logger log = LoggerFactory.getLogger(SocketIO.class);
+ private static final Logger log = LogManager.getLogger(SocketIO.class);
private String host;
private int port;
diff --git a/src/qz/installer/Installer.java b/src/qz/installer/Installer.java
index a39dcc19a..d22aa16bd 100644
--- a/src/qz/installer/Installer.java
+++ b/src/qz/installer/Installer.java
@@ -11,8 +11,8 @@
package qz.installer;
import org.apache.commons.io.FileUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.auth.Certificate;
import qz.installer.certificate.*;
import qz.installer.certificate.firefox.FirefoxCertificateInstaller;
@@ -39,7 +39,7 @@
* - Used by PrintSocketServer at startup to ensure SSL is functioning
*/
public abstract class Installer {
- protected static final Logger log = LoggerFactory.getLogger(Installer.class);
+ protected static final Logger log = LogManager.getLogger(Installer.class);
// Silence prompts within our control
public static boolean IS_SILENT = "1".equals(System.getenv(DATA_DIR + "_silent"));
diff --git a/src/qz/installer/LinuxInstaller.java b/src/qz/installer/LinuxInstaller.java
index 0499c85e7..728e48725 100644
--- a/src/qz/installer/LinuxInstaller.java
+++ b/src/qz/installer/LinuxInstaller.java
@@ -1,8 +1,8 @@
package qz.installer;
import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.utils.FileUtilities;
import qz.utils.ShellUtilities;
import qz.utils.SystemUtilities;
@@ -16,7 +16,7 @@
import static qz.common.Constants.*;
public class LinuxInstaller extends Installer {
- protected static final Logger log = LoggerFactory.getLogger(LinuxInstaller.class);
+ protected static final Logger log = LogManager.getLogger(LinuxInstaller.class);
public static final String SHORTCUT_NAME = PROPS_FILE + ".desktop";
public static final String STARTUP_DIR = "/etc/xdg/autostart/";
diff --git a/src/qz/installer/MacInstaller.java b/src/qz/installer/MacInstaller.java
index 070523039..0d4a76734 100644
--- a/src/qz/installer/MacInstaller.java
+++ b/src/qz/installer/MacInstaller.java
@@ -10,8 +10,8 @@
*/
import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.utils.FileUtilities;
import qz.utils.ShellUtilities;
import qz.utils.SystemUtilities;
@@ -24,7 +24,7 @@
import static qz.common.Constants.*;
public class MacInstaller extends Installer {
- protected static final Logger log = LoggerFactory.getLogger(MacInstaller.class);
+ protected static final Logger log = LogManager.getLogger(MacInstaller.class);
private static final String PACKAGE_NAME = getPackageName();
public static final String LAUNCH_AGENT_PATH = String.format("/Library/LaunchAgents/%s.plist", MacInstaller.PACKAGE_NAME);
private String destination = "/Applications/" + ABOUT_TITLE + ".app";
diff --git a/src/qz/installer/TaskKiller.java b/src/qz/installer/TaskKiller.java
index 80fab2973..ee1436d63 100644
--- a/src/qz/installer/TaskKiller.java
+++ b/src/qz/installer/TaskKiller.java
@@ -2,8 +2,8 @@
import com.sun.jna.platform.win32.Kernel32;
import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.installer.certificate.firefox.locator.AppLocator;
import qz.utils.MacUtilities;
import qz.utils.ShellUtilities;
@@ -18,7 +18,7 @@
import static qz.common.Constants.PROPS_FILE;
public class TaskKiller {
- protected static final Logger log = LoggerFactory.getLogger(TaskKiller.class);
+ protected static final Logger log = LogManager.getLogger(TaskKiller.class);
private static final String[] TRAY_PID_QUERY_POSIX = {"pgrep", "-f", PROPS_FILE + ".jar" };
private static final String[] KILL_PID_CMD_POSIX = {"kill", "-9", ""/*pid placeholder*/};
diff --git a/src/qz/installer/WindowsInstaller.java b/src/qz/installer/WindowsInstaller.java
index c7ae2aae2..5cfc576cb 100644
--- a/src/qz/installer/WindowsInstaller.java
+++ b/src/qz/installer/WindowsInstaller.java
@@ -14,8 +14,8 @@
import mslinks.ShellLink;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.utils.ShellUtilities;
import qz.utils.SystemUtilities;
import qz.utils.WindowsUtilities;
@@ -35,7 +35,7 @@
public class WindowsInstaller extends Installer {
- protected static final Logger log = LoggerFactory.getLogger(WindowsInstaller.class);
+ protected static final Logger log = LogManager.getLogger(WindowsInstaller.class);
private String destination = getDefaultDestination();
private String destinationExe = getDefaultDestination() + File.separator + PROPS_FILE + ".exe";
diff --git a/src/qz/installer/certificate/CertificateManager.java b/src/qz/installer/certificate/CertificateManager.java
index 3094b0ae8..1e52d992f 100644
--- a/src/qz/installer/certificate/CertificateManager.java
+++ b/src/qz/installer/certificate/CertificateManager.java
@@ -20,8 +20,8 @@
import org.bouncycastle.openssl.jcajce.JcaPEMWriter;
import org.bouncycastle.operator.OperatorException;
import org.eclipse.jetty.util.ssl.SslContextFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.common.Constants;
import qz.installer.Installer;
import qz.utils.FileUtilities;
@@ -50,7 +50,7 @@ public class CertificateManager {
// See also https://github.com/qzind/tray/issues/814
SystemUtilities.clearAlgorithms();
}
- private static final Logger log = LoggerFactory.getLogger(CertificateManager.class);
+ private static final Logger log = LogManager.getLogger(CertificateManager.class);
public static String DEFAULT_KEYSTORE_FORMAT = "PKCS12";
public static String DEFAULT_KEYSTORE_EXTENSION = ".p12";
diff --git a/src/qz/installer/certificate/ExpiryTask.java b/src/qz/installer/certificate/ExpiryTask.java
index ebfdc14c4..8bbd786bd 100644
--- a/src/qz/installer/certificate/ExpiryTask.java
+++ b/src/qz/installer/certificate/ExpiryTask.java
@@ -14,8 +14,8 @@
import org.bouncycastle.asn1.x500.style.BCStyle;
import org.bouncycastle.asn1.x509.GeneralName;
import org.bouncycastle.cert.jcajce.JcaX509CertificateHolder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.common.Constants;
import qz.utils.ShellUtilities;
import qz.utils.SystemUtilities;
@@ -33,7 +33,7 @@
import static qz.utils.FileUtilities.*;
public class ExpiryTask extends TimerTask {
- private static final Logger log = LoggerFactory.getLogger(CertificateManager.class);
+ private static final Logger log = LogManager.getLogger(CertificateManager.class);
public static final int DEFAULT_INITIAL_DELAY = 60 * 1000; // 1 minute
public static final int DEFAULT_CHECK_FREQUENCY = 3600 * 1000; // 1 hour
private static final int DEFAULT_GRACE_PERIOD_DAYS = 5;
diff --git a/src/qz/installer/certificate/LinuxCertificateInstaller.java b/src/qz/installer/certificate/LinuxCertificateInstaller.java
index e7f8a0d04..964871bda 100644
--- a/src/qz/installer/certificate/LinuxCertificateInstaller.java
+++ b/src/qz/installer/certificate/LinuxCertificateInstaller.java
@@ -10,8 +10,8 @@
package qz.installer.certificate;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.common.Constants;
import qz.installer.Installer;
import qz.utils.ShellUtilities;
@@ -32,7 +32,7 @@
* @author Tres Finocchiaro
*/
public class LinuxCertificateInstaller extends NativeCertificateInstaller {
- private static final Logger log = LoggerFactory.getLogger(LinuxCertificateInstaller.class);
+ private static final Logger log = LogManager.getLogger(LinuxCertificateInstaller.class);
private static String[] NSSDB_URLS = {
// Conventional cert store
diff --git a/src/qz/installer/certificate/MacCertificateInstaller.java b/src/qz/installer/certificate/MacCertificateInstaller.java
index c547a182b..b82b4286a 100644
--- a/src/qz/installer/certificate/MacCertificateInstaller.java
+++ b/src/qz/installer/certificate/MacCertificateInstaller.java
@@ -10,8 +10,8 @@
package qz.installer.certificate;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.common.Constants;
import qz.installer.Installer;
import qz.utils.ShellUtilities;
@@ -24,7 +24,7 @@
import java.util.List;
public class MacCertificateInstaller extends NativeCertificateInstaller {
- private static final Logger log = LoggerFactory.getLogger(MacCertificateInstaller.class);
+ private static final Logger log = LogManager.getLogger(MacCertificateInstaller.class);
public static final String USER_STORE = System.getProperty("user.home") + "/Library/Keychains/login.keychain"; // aka login.keychain-db
public static final String SYSTEM_STORE = "/Library/Keychains/System.keychain";
diff --git a/src/qz/installer/certificate/NativeCertificateInstaller.java b/src/qz/installer/certificate/NativeCertificateInstaller.java
index dcc14c7f9..238b71e8e 100644
--- a/src/qz/installer/certificate/NativeCertificateInstaller.java
+++ b/src/qz/installer/certificate/NativeCertificateInstaller.java
@@ -12,8 +12,8 @@
import org.bouncycastle.openssl.jcajce.JcaMiscPEMGenerator;
import org.bouncycastle.openssl.jcajce.JcaPEMWriter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.installer.Installer;
import qz.utils.SystemUtilities;
@@ -26,7 +26,7 @@
import java.util.List;
public abstract class NativeCertificateInstaller {
- private static final Logger log = LoggerFactory.getLogger(NativeCertificateInstaller.class);
+ private static final Logger log = LogManager.getLogger(NativeCertificateInstaller.class);
protected static NativeCertificateInstaller instance;
public static NativeCertificateInstaller getInstance() {
diff --git a/src/qz/installer/certificate/WindowsCertificateInstaller.java b/src/qz/installer/certificate/WindowsCertificateInstaller.java
index 3764053fa..4f20ca10d 100644
--- a/src/qz/installer/certificate/WindowsCertificateInstaller.java
+++ b/src/qz/installer/certificate/WindowsCertificateInstaller.java
@@ -20,8 +20,8 @@
import com.sun.jna.win32.W32APIOptions;
import org.bouncycastle.cert.X509CertificateHolder;
import org.bouncycastle.openssl.PEMParser;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.common.Constants;
import qz.installer.Installer;
@@ -31,7 +31,7 @@
import java.util.List;
public class WindowsCertificateInstaller extends NativeCertificateInstaller {
- private static final Logger log = LoggerFactory.getLogger(WindowsCertificateInstaller.class);
+ private static final Logger log = LogManager.getLogger(WindowsCertificateInstaller.class);
private WinCrypt.HCERTSTORE store;
private byte[] certBytes;
private Installer.PrivilegeLevel certType;
diff --git a/src/qz/installer/certificate/WindowsCertificateInstallerCli.java b/src/qz/installer/certificate/WindowsCertificateInstallerCli.java
index 66c27de5b..ff7cf05a3 100644
--- a/src/qz/installer/certificate/WindowsCertificateInstallerCli.java
+++ b/src/qz/installer/certificate/WindowsCertificateInstallerCli.java
@@ -10,8 +10,8 @@
package qz.installer.certificate;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.common.Constants;
import qz.installer.Installer;
import qz.utils.ShellUtilities;
@@ -27,7 +27,7 @@
*/
@SuppressWarnings("UnusedDeclaration") //Library class
public class WindowsCertificateInstallerCli extends NativeCertificateInstaller {
- private static final Logger log = LoggerFactory.getLogger(WindowsCertificateInstallerCli.class);
+ private static final Logger log = LogManager.getLogger(WindowsCertificateInstallerCli.class);
private Installer.PrivilegeLevel certType;
public WindowsCertificateInstallerCli(Installer.PrivilegeLevel certType) {
diff --git a/src/qz/installer/certificate/firefox/FirefoxCertificateInstaller.java b/src/qz/installer/certificate/firefox/FirefoxCertificateInstaller.java
index e2ea019df..78055bb19 100644
--- a/src/qz/installer/certificate/firefox/FirefoxCertificateInstaller.java
+++ b/src/qz/installer/certificate/firefox/FirefoxCertificateInstaller.java
@@ -13,8 +13,8 @@
import com.github.zafarkhaja.semver.Version;
import com.sun.jna.platform.win32.WinReg;
import org.codehaus.jettison.json.JSONException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.common.Constants;
import qz.installer.Installer;
import qz.installer.certificate.CertificateManager;
@@ -38,7 +38,7 @@
* Installs the Firefox Policy file via Enterprise Policy, Distribution Policy file or AutoConfig, depending on OS & version
*/
public class FirefoxCertificateInstaller {
- protected static final Logger log = LoggerFactory.getLogger(FirefoxCertificateInstaller.class);
+ protected static final Logger log = LogManager.getLogger(FirefoxCertificateInstaller.class);
/**
* Versions are for Mozilla's official Firefox release.
diff --git a/src/qz/installer/certificate/firefox/LegacyFirefoxCertificateInstaller.java b/src/qz/installer/certificate/firefox/LegacyFirefoxCertificateInstaller.java
index da7cad9fb..d69a9831a 100644
--- a/src/qz/installer/certificate/firefox/LegacyFirefoxCertificateInstaller.java
+++ b/src/qz/installer/certificate/firefox/LegacyFirefoxCertificateInstaller.java
@@ -10,8 +10,8 @@
package qz.installer.certificate.firefox;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.common.Constants;
import qz.installer.certificate.CertificateChainBuilder;
import qz.installer.certificate.firefox.locator.AppInfo;
@@ -29,7 +29,7 @@
* For old Firefox-compatible browsers still in the wild such as Firefox 52 ESR, SeaMonkey, WaterFox, etc.
*/
public class LegacyFirefoxCertificateInstaller {
- private static final Logger log = LoggerFactory.getLogger(CertificateChainBuilder.class);
+ private static final Logger log = LogManager.getLogger(CertificateChainBuilder.class);
private static final String CFG_TEMPLATE = "assets/firefox-autoconfig.js.in";
private static final String CFG_FILE = Constants.PROPS_FILE + ".cfg";
diff --git a/src/qz/installer/certificate/firefox/locator/AppLocator.java b/src/qz/installer/certificate/firefox/locator/AppLocator.java
index 026c1f947..f643c85b0 100644
--- a/src/qz/installer/certificate/firefox/locator/AppLocator.java
+++ b/src/qz/installer/certificate/firefox/locator/AppLocator.java
@@ -1,6 +1,7 @@
package qz.installer.certificate.firefox.locator;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.utils.ShellUtilities;
import qz.utils.SystemUtilities;
@@ -10,7 +11,7 @@
import java.util.Collections;
public abstract class AppLocator {
- protected static final org.slf4j.Logger log = LoggerFactory.getLogger(AppLocator.class);
+ protected static final Logger log = LogManager.getLogger(AppLocator.class);
private static AppLocator INSTANCE = getPlatformSpecificAppLocator();
@@ -79,4 +80,4 @@ private static AppLocator getPlatformSpecificAppLocator() {
}
return new LinuxAppLocator();
}
-}
\ No newline at end of file
+}
diff --git a/src/qz/installer/certificate/firefox/locator/LinuxAppLocator.java b/src/qz/installer/certificate/firefox/locator/LinuxAppLocator.java
index cb82127b0..eda74cad9 100644
--- a/src/qz/installer/certificate/firefox/locator/LinuxAppLocator.java
+++ b/src/qz/installer/certificate/firefox/locator/LinuxAppLocator.java
@@ -1,8 +1,8 @@
package qz.installer.certificate.firefox.locator;
import org.apache.commons.io.FilenameUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.utils.SystemUtilities;
import java.io.*;
@@ -12,7 +12,7 @@
import java.util.ArrayList;
public class LinuxAppLocator extends AppLocator {
- private static final Logger log = LoggerFactory.getLogger(LinuxAppLocator.class);
+ private static final Logger log = LogManager.getLogger(LinuxAppLocator.class);
public ArrayList locate(AppAlias appAlias) {
ArrayList appList = new ArrayList<>();
@@ -97,7 +97,7 @@ public ArrayList locate(AppAlias appAlias) {
}
}
}
-
+
return appList;
}
diff --git a/src/qz/installer/certificate/firefox/locator/MacAppLocator.java b/src/qz/installer/certificate/firefox/locator/MacAppLocator.java
index 641b8cfbd..38cd73738 100644
--- a/src/qz/installer/certificate/firefox/locator/MacAppLocator.java
+++ b/src/qz/installer/certificate/firefox/locator/MacAppLocator.java
@@ -5,8 +5,8 @@
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.IntByReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -23,7 +23,7 @@
import java.util.Iterator;
public class MacAppLocator extends AppLocator{
- protected static final Logger log = LoggerFactory.getLogger(MacAppLocator.class);
+ protected static final Logger log = LogManager.getLogger(MacAppLocator.class);
private static String[] BLACKLISTED_PATHS = new String[]{"/Volumes/", "/.Trash/", "/Applications (Parallels)/" };
diff --git a/src/qz/installer/certificate/firefox/locator/WindowsAppLocator.java b/src/qz/installer/certificate/firefox/locator/WindowsAppLocator.java
index 793a4a30f..8df5436c0 100644
--- a/src/qz/installer/certificate/firefox/locator/WindowsAppLocator.java
+++ b/src/qz/installer/certificate/firefox/locator/WindowsAppLocator.java
@@ -11,8 +11,8 @@
package qz.installer.certificate.firefox.locator;
import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.installer.certificate.firefox.locator.AppAlias.Alias;
import qz.utils.ShellUtilities;
import qz.utils.SystemUtilities;
@@ -28,7 +28,7 @@
import static com.sun.jna.platform.win32.WinReg.HKEY_LOCAL_MACHINE;
public class WindowsAppLocator extends AppLocator{
- protected static final Logger log = LoggerFactory.getLogger(MacAppLocator.class);
+ protected static final Logger log = LogManager.getLogger(MacAppLocator.class);
private static final String[] WIN32_PID_QUERY = {"wmic.exe", "process", "where", null, "get", "processid"};
private static final int WIN32_PID_QUERY_INPUT_INDEX = 3;
diff --git a/src/qz/installer/shortcut/LinuxShortcutCreator.java b/src/qz/installer/shortcut/LinuxShortcutCreator.java
index e9c3768f5..16d38e9c0 100644
--- a/src/qz/installer/shortcut/LinuxShortcutCreator.java
+++ b/src/qz/installer/shortcut/LinuxShortcutCreator.java
@@ -14,8 +14,8 @@
import java.nio.file.Files;
import java.nio.file.Paths;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.installer.LinuxInstaller;
/**
@@ -23,7 +23,7 @@
*/
class LinuxShortcutCreator extends ShortcutCreator {
- private static final Logger log = LoggerFactory.getLogger(LinuxShortcutCreator.class);
+ private static final Logger log = LogManager.getLogger(LinuxShortcutCreator.class);
private static String DESKTOP = System.getProperty("user.home") + "/Desktop/";
public boolean canAutoStart() {
diff --git a/src/qz/installer/shortcut/MacShortcutCreator.java b/src/qz/installer/shortcut/MacShortcutCreator.java
index 2290034a6..011b03655 100644
--- a/src/qz/installer/shortcut/MacShortcutCreator.java
+++ b/src/qz/installer/shortcut/MacShortcutCreator.java
@@ -9,8 +9,8 @@
*/
package qz.installer.shortcut;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -33,7 +33,7 @@
*/
class MacShortcutCreator extends ShortcutCreator {
- private static final Logger log = LoggerFactory.getLogger(MacShortcutCreator.class);
+ private static final Logger log = LogManager.getLogger(MacShortcutCreator.class);
private static String SHORTCUT_PATH = System.getProperty("user.home") + "/Desktop/" + Constants.ABOUT_TITLE;
/**
diff --git a/src/qz/installer/shortcut/ShortcutCreator.java b/src/qz/installer/shortcut/ShortcutCreator.java
index 6d7458d84..376c2e0b1 100644
--- a/src/qz/installer/shortcut/ShortcutCreator.java
+++ b/src/qz/installer/shortcut/ShortcutCreator.java
@@ -10,8 +10,8 @@
package qz.installer.shortcut;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.utils.SystemUtilities;
/**
@@ -22,7 +22,7 @@
*/
public abstract class ShortcutCreator {
private static ShortcutCreator instance;
- protected static final Logger log = LoggerFactory.getLogger(ShortcutCreator.class);
+ protected static final Logger log = LogManager.getLogger(ShortcutCreator.class);
public abstract boolean canAutoStart();
public abstract void createDesktopShortcut();
diff --git a/src/qz/printer/BookBundle.java b/src/qz/printer/BookBundle.java
index d1fd051f8..845aade55 100644
--- a/src/qz/printer/BookBundle.java
+++ b/src/qz/printer/BookBundle.java
@@ -1,7 +1,7 @@
package qz.printer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import java.awt.*;
import java.awt.print.Book;
@@ -15,7 +15,7 @@
*/
public class BookBundle extends Book {
- private static final Logger log = LoggerFactory.getLogger(BookBundle.class);
+ private static final Logger log = LogManager.getLogger(BookBundle.class);
private Printable lastPrint;
private int lastStarted;
diff --git a/src/qz/printer/ImageWrapper.java b/src/qz/printer/ImageWrapper.java
index c15cf747c..3932f7d5f 100644
--- a/src/qz/printer/ImageWrapper.java
+++ b/src/qz/printer/ImageWrapper.java
@@ -12,8 +12,8 @@
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.common.ByteArrayBuilder;
import qz.exception.InvalidRawImageException;
import qz.utils.ByteUtilities;
@@ -48,7 +48,7 @@
@SuppressWarnings("UnusedDeclaration") //Library class
public class ImageWrapper {
- private static final Logger log = LoggerFactory.getLogger(ImageWrapper.class);
+ private static final Logger log = LogManager.getLogger(ImageWrapper.class);
/**
* Represents the CHECK_BLACK quantization method, where only fully black
diff --git a/src/qz/printer/PDFWrapper.java b/src/qz/printer/PDFWrapper.java
index bfb7c7df1..2a89c4831 100644
--- a/src/qz/printer/PDFWrapper.java
+++ b/src/qz/printer/PDFWrapper.java
@@ -4,8 +4,8 @@
import org.apache.pdfbox.pdmodel.common.PDRectangle;
import org.apache.pdfbox.printing.PDFPrintable;
import org.apache.pdfbox.printing.Scaling;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.utils.SystemUtilities;
import javax.print.attribute.standard.OrientationRequested;
@@ -16,7 +16,7 @@
public class PDFWrapper implements Printable {
- private static final Logger log = LoggerFactory.getLogger(PDFWrapper.class);
+ private static final Logger log = LogManager.getLogger(PDFWrapper.class);
private PDDocument document;
private Scaling scaling;
diff --git a/src/qz/printer/PrintOptions.java b/src/qz/printer/PrintOptions.java
index 40dc9e7d1..687345283 100644
--- a/src/qz/printer/PrintOptions.java
+++ b/src/qz/printer/PrintOptions.java
@@ -3,8 +3,8 @@
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.utils.LoggerUtilities;
import qz.utils.PrintingUtilities;
import qz.utils.SystemUtilities;
@@ -25,7 +25,7 @@
public class PrintOptions {
- private static final Logger log = LoggerFactory.getLogger(PrintOptions.class);
+ private static final Logger log = LogManager.getLogger(PrintOptions.class);
private Pixel psOptions = new Pixel();
private Raw rawOptions = new Raw();
diff --git a/src/qz/printer/PrintServiceMatcher.java b/src/qz/printer/PrintServiceMatcher.java
index c420c9d9f..15af0187d 100644
--- a/src/qz/printer/PrintServiceMatcher.java
+++ b/src/qz/printer/PrintServiceMatcher.java
@@ -13,8 +13,8 @@
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.printer.info.NativePrinter;
import qz.printer.info.NativePrinterMap;
import qz.utils.SystemUtilities;
@@ -29,7 +29,7 @@
import java.util.Locale;
public class PrintServiceMatcher {
- private static final Logger log = LoggerFactory.getLogger(PrintServiceMatcher.class);
+ private static final Logger log = LogManager.getLogger(PrintServiceMatcher.class);
public static NativePrinterMap getNativePrinterList(boolean silent, boolean withAttributes) {
NativePrinterMap printers = NativePrinterMap.getInstance();
diff --git a/src/qz/printer/action/PrintDirect.java b/src/qz/printer/action/PrintDirect.java
index 74e7cb4d7..225b93458 100644
--- a/src/qz/printer/action/PrintDirect.java
+++ b/src/qz/printer/action/PrintDirect.java
@@ -4,8 +4,8 @@
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.common.Constants;
import qz.printer.PrintOptions;
import qz.printer.PrintOutput;
@@ -28,7 +28,7 @@
public class PrintDirect extends PrintRaw {
- private static final Logger log = LoggerFactory.getLogger(PrintDirect.class);
+ private static final Logger log = LogManager.getLogger(PrintDirect.class);
private ArrayList prints = new ArrayList<>();
private ArrayList flavors = new ArrayList<>();
diff --git a/src/qz/printer/action/PrintHTML.java b/src/qz/printer/action/PrintHTML.java
index a01900274..9b4a30b9b 100644
--- a/src/qz/printer/action/PrintHTML.java
+++ b/src/qz/printer/action/PrintHTML.java
@@ -18,8 +18,8 @@
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.common.Constants;
import qz.printer.PrintOptions;
import qz.printer.PrintOutput;
@@ -46,7 +46,7 @@
public class PrintHTML extends PrintImage implements PrintProcessor {
- private static final Logger log = LoggerFactory.getLogger(PrintHTML.class);
+ private static final Logger log = LogManager.getLogger(PrintHTML.class);
private List models;
diff --git a/src/qz/printer/action/PrintImage.java b/src/qz/printer/action/PrintImage.java
index 82e471792..d4fe87e16 100644
--- a/src/qz/printer/action/PrintImage.java
+++ b/src/qz/printer/action/PrintImage.java
@@ -14,8 +14,8 @@
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.common.Constants;
import qz.printer.PrintOptions;
import qz.printer.PrintOutput;
@@ -47,7 +47,7 @@
*/
public class PrintImage extends PrintPixel implements PrintProcessor, Printable {
- private static final Logger log = LoggerFactory.getLogger(PrintImage.class);
+ private static final Logger log = LogManager.getLogger(PrintImage.class);
protected List images;
diff --git a/src/qz/printer/action/PrintPDF.java b/src/qz/printer/action/PrintPDF.java
index f2a173e13..27cf028c5 100644
--- a/src/qz/printer/action/PrintPDF.java
+++ b/src/qz/printer/action/PrintPDF.java
@@ -13,8 +13,8 @@
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.common.Constants;
import qz.printer.BookBundle;
import qz.printer.PDFWrapper;
@@ -40,7 +40,7 @@
public class PrintPDF extends PrintPixel implements PrintProcessor {
- private static final Logger log = LoggerFactory.getLogger(PrintPDF.class);
+ private static final Logger log = LogManager.getLogger(PrintPDF.class);
private List originals;
private List printables;
diff --git a/src/qz/printer/action/PrintPixel.java b/src/qz/printer/action/PrintPixel.java
index 67673eebb..cb488fee6 100644
--- a/src/qz/printer/action/PrintPixel.java
+++ b/src/qz/printer/action/PrintPixel.java
@@ -2,8 +2,8 @@
import javafx.print.PaperSource;
import org.apache.commons.lang3.ArrayUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.printer.PrintOptions;
import qz.printer.PrintOutput;
import qz.utils.SystemUtilities;
@@ -28,7 +28,7 @@
public abstract class PrintPixel {
- private static final Logger log = LoggerFactory.getLogger(PrintPixel.class);
+ private static final Logger log = LogManager.getLogger(PrintPixel.class);
private static final List MAC_BAD_IMAGE_TYPES = Arrays.asList(BufferedImage.TYPE_BYTE_BINARY, BufferedImage.TYPE_CUSTOM);
diff --git a/src/qz/printer/action/PrintRaw.java b/src/qz/printer/action/PrintRaw.java
index 9d8e6ad40..6525d5a46 100644
--- a/src/qz/printer/action/PrintRaw.java
+++ b/src/qz/printer/action/PrintRaw.java
@@ -18,8 +18,8 @@
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.common.ByteArrayBuilder;
import qz.common.Constants;
import qz.exception.NullCommandException;
@@ -56,7 +56,7 @@
*/
public class PrintRaw implements PrintProcessor {
- private static final Logger log = LoggerFactory.getLogger(PrintRaw.class);
+ private static final Logger log = LogManager.getLogger(PrintRaw.class);
private ByteArrayBuilder commands;
diff --git a/src/qz/printer/action/WebApp.java b/src/qz/printer/action/WebApp.java
index 8472c1a1f..acba0e0af 100644
--- a/src/qz/printer/action/WebApp.java
+++ b/src/qz/printer/action/WebApp.java
@@ -18,8 +18,8 @@
import javafx.scene.transform.Translate;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
@@ -46,7 +46,7 @@
*/
public class WebApp extends Application {
- private static final Logger log = LoggerFactory.getLogger(WebApp.class);
+ private static final Logger log = LogManager.getLogger(WebApp.class);
private static WebApp instance = null;
private static Version webkitVersion = null;
diff --git a/src/qz/printer/info/CupsPrinterMap.java b/src/qz/printer/info/CupsPrinterMap.java
index e93a47064..d6982b838 100644
--- a/src/qz/printer/info/CupsPrinterMap.java
+++ b/src/qz/printer/info/CupsPrinterMap.java
@@ -1,7 +1,7 @@
package qz.printer.info;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.utils.ShellUtilities;
import qz.utils.SystemUtilities;
@@ -15,7 +15,7 @@
public class CupsPrinterMap extends NativePrinterMap {
private static final String DEFAULT_CUPS_DRIVER = "TEXTONLY.ppd";
- private static final Logger log = LoggerFactory.getLogger(CupsPrinterMap.class);
+ private static final Logger log = LogManager.getLogger(CupsPrinterMap.class);
private Map> resolutionMap = new HashMap<>();
public synchronized NativePrinterMap putAll(PrintService[] services) {
diff --git a/src/qz/printer/info/NativePrinter.java b/src/qz/printer/info/NativePrinter.java
index 6edf77ef1..5e9d2f816 100644
--- a/src/qz/printer/info/NativePrinter.java
+++ b/src/qz/printer/info/NativePrinter.java
@@ -1,7 +1,7 @@
package qz.printer.info;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.utils.SystemUtilities;
import javax.print.PrintService;
@@ -11,7 +11,7 @@
import java.util.List;
public class NativePrinter {
- private static final Logger log = LoggerFactory.getLogger(NativePrinter.class);
+ private static final Logger log = LogManager.getLogger(NativePrinter.class);
/**
* Simple object wrapper allowing lazy fetching of values
* @param
diff --git a/src/qz/printer/info/NativePrinterMap.java b/src/qz/printer/info/NativePrinterMap.java
index ec4997c9a..eb5a0de2b 100644
--- a/src/qz/printer/info/NativePrinterMap.java
+++ b/src/qz/printer/info/NativePrinterMap.java
@@ -1,7 +1,7 @@
package qz.printer.info;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.printer.PrintServiceMatcher;
import qz.utils.SystemUtilities;
@@ -13,7 +13,7 @@
import java.util.concurrent.ConcurrentHashMap;
public abstract class NativePrinterMap extends ConcurrentHashMap {
- private static final Logger log = LoggerFactory.getLogger(NativePrinterMap.class);
+ private static final Logger log = LogManager.getLogger(NativePrinterMap.class);
private static NativePrinterMap instance;
diff --git a/src/qz/printer/info/WindowsPrinterMap.java b/src/qz/printer/info/WindowsPrinterMap.java
index 030603cfc..0e604d04f 100644
--- a/src/qz/printer/info/WindowsPrinterMap.java
+++ b/src/qz/printer/info/WindowsPrinterMap.java
@@ -1,8 +1,8 @@
package qz.printer.info;
import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.utils.WindowsUtilities;
import javax.print.PrintService;
@@ -10,7 +10,7 @@
import static com.sun.jna.platform.win32.WinReg.*;
public class WindowsPrinterMap extends NativePrinterMap {
- private static final Logger log = LoggerFactory.getLogger(WindowsPrinterMap.class);
+ private static final Logger log = LogManager.getLogger(WindowsPrinterMap.class);
public synchronized NativePrinterMap putAll(PrintService[] services) {
for (PrintService service : findMissing(services)) {
diff --git a/src/qz/printer/status/CupsStatusHandler.java b/src/qz/printer/status/CupsStatusHandler.java
index e9f5359ff..e366e92e1 100644
--- a/src/qz/printer/status/CupsStatusHandler.java
+++ b/src/qz/printer/status/CupsStatusHandler.java
@@ -3,8 +3,8 @@
import com.sun.jna.Pointer;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.handler.AbstractHandler;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.printer.status.job.NativeJobStatus;
import javax.servlet.ServletException;
@@ -18,7 +18,7 @@
* Created by kyle on 4/27/17.
*/
public class CupsStatusHandler extends AbstractHandler {
- private static final Logger log = LoggerFactory.getLogger(CupsStatusHandler.class);
+ private static final Logger log = LogManager.getLogger(CupsStatusHandler.class);
private static Cups cups = Cups.INSTANCE;
private int lastEventNumber = 0;
diff --git a/src/qz/printer/status/CupsStatusServer.java b/src/qz/printer/status/CupsStatusServer.java
index e1e59a512..41e43128a 100644
--- a/src/qz/printer/status/CupsStatusServer.java
+++ b/src/qz/printer/status/CupsStatusServer.java
@@ -1,8 +1,8 @@
package qz.printer.status;
import org.eclipse.jetty.server.Server;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.common.Constants;
import java.util.Arrays;
@@ -14,7 +14,7 @@
* Created by kyle on 4/27/17.
*/
public class CupsStatusServer {
- private static final Logger log = LoggerFactory.getLogger(CupsStatusServer.class);
+ private static final Logger log = LogManager.getLogger(CupsStatusServer.class);
public static final List CUPS_RSS_PORTS = Collections.unmodifiableList(Arrays.asList(Constants.CUPS_RSS_PORTS));
diff --git a/src/qz/printer/status/CupsUtils.java b/src/qz/printer/status/CupsUtils.java
index 2e88c1760..987e2f0e0 100644
--- a/src/qz/printer/status/CupsUtils.java
+++ b/src/qz/printer/status/CupsUtils.java
@@ -3,8 +3,8 @@
import com.sun.jna.Pointer;
import com.sun.jna.StringArray;
import org.eclipse.jetty.util.URIUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.printer.status.Cups.IPP;
import java.net.URI;
@@ -14,7 +14,7 @@
* Created by kyle on 5/17/17.
*/
public class CupsUtils {
- private static final Logger log = LoggerFactory.getLogger(CupsUtils.class);
+ private static final Logger log = LogManager.getLogger(CupsUtils.class);
public static String USER = System.getProperty("user.name");
public static String CHARSET = "";
diff --git a/src/qz/printer/status/NativeStatus.java b/src/qz/printer/status/NativeStatus.java
index f376faf5d..c8ab4d21a 100644
--- a/src/qz/printer/status/NativeStatus.java
+++ b/src/qz/printer/status/NativeStatus.java
@@ -1,6 +1,6 @@
package qz.printer.status;
-import org.apache.log4j.Level;
+import org.apache.logging.log4j.Level;
import qz.printer.status.job.CupsJobStatusMap;
import qz.printer.status.job.NativeJobStatus;
import qz.printer.status.job.WmiJobStatusMap;
@@ -14,7 +14,7 @@ interface NativeMap {
NativeStatus getParent();
Object getRawCode();
}
-
+
NativeStatus getDefault(); //static
String name();
Level getLevel();
diff --git a/src/qz/printer/status/StatusMonitor.java b/src/qz/printer/status/StatusMonitor.java
index ad6d2a6ee..97617be77 100644
--- a/src/qz/printer/status/StatusMonitor.java
+++ b/src/qz/printer/status/StatusMonitor.java
@@ -5,8 +5,8 @@
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
import org.eclipse.jetty.util.MultiMap;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.printer.PrintServiceMatcher;
import qz.printer.info.NativePrinterMap;
import qz.utils.SystemUtilities;
@@ -20,7 +20,7 @@
* Created by Kyle on 2/23/2017.
*/
public class StatusMonitor {
- private static final Logger log = LoggerFactory.getLogger(StatusMonitor.class);
+ private static final Logger log = LogManager.getLogger(StatusMonitor.class);
private static final String ALL_PRINTERS = "";
diff --git a/src/qz/printer/status/WmiPrinterConnectionsThread.java b/src/qz/printer/status/WmiPrinterConnectionsThread.java
index e7b54a385..553a191a5 100644
--- a/src/qz/printer/status/WmiPrinterConnectionsThread.java
+++ b/src/qz/printer/status/WmiPrinterConnectionsThread.java
@@ -2,12 +2,12 @@
import com.sun.jna.platform.win32.Winspool;
import com.sun.jna.platform.win32.WinspoolUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
public class WmiPrinterConnectionsThread extends Thread {
- private static final Logger log = LoggerFactory.getLogger(WmiPrinterConnectionsThread.class);
+ private static final Logger log = LogManager.getLogger(WmiPrinterConnectionsThread.class);
private boolean running = true;
diff --git a/src/qz/printer/status/WmiPrinterStatusThread.java b/src/qz/printer/status/WmiPrinterStatusThread.java
index b768421c8..a86c97291 100644
--- a/src/qz/printer/status/WmiPrinterStatusThread.java
+++ b/src/qz/printer/status/WmiPrinterStatusThread.java
@@ -3,8 +3,8 @@
import com.sun.jna.Structure;
import com.sun.jna.platform.win32.*;
import com.sun.jna.ptr.PointerByReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.printer.status.job.WmiJobStatusMap;
import qz.printer.status.printer.NativePrinterStatus;
import qz.printer.status.printer.WmiPrinterStatusMap;
@@ -13,7 +13,7 @@
public class WmiPrinterStatusThread extends Thread {
- private static final Logger log = LoggerFactory.getLogger(StatusMonitor.class);
+ private static final Logger log = LogManager.getLogger(StatusMonitor.class);
private boolean closing = false;
private final String printerName;
diff --git a/src/qz/printer/status/job/CupsJobStatusMap.java b/src/qz/printer/status/job/CupsJobStatusMap.java
index 8cab6c5a6..0f4b711eb 100644
--- a/src/qz/printer/status/job/CupsJobStatusMap.java
+++ b/src/qz/printer/status/job/CupsJobStatusMap.java
@@ -1,7 +1,7 @@
package qz.printer.status.job;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.printer.status.NativeStatus;
import java.util.Locale;
@@ -94,7 +94,7 @@ public enum CupsJobStatusMap implements NativeStatus.NativeMap {
WAITING_FOR_USER_ACTION(REASON, NativeJobStatus.USER_INTERVENTION), // waiting-for-user-action
WARNINGS_DETECTED(REASON, NativeJobStatus.UNKNOWN); // warnings-detected
- private static final Logger log = LoggerFactory.getLogger(CupsJobStatusMap.class);
+ private static final Logger log = LogManager.getLogger(CupsJobStatusMap.class);
private static SortedMap sortedReasonLookupTable;
private static SortedMap sortedStateLookupTable;
diff --git a/src/qz/printer/status/job/NativeJobStatus.java b/src/qz/printer/status/job/NativeJobStatus.java
index ac36cd587..3ff061808 100644
--- a/src/qz/printer/status/job/NativeJobStatus.java
+++ b/src/qz/printer/status/job/NativeJobStatus.java
@@ -1,6 +1,6 @@
package qz.printer.status.job;
-import org.apache.log4j.Level;
+import org.apache.logging.log4j.Level;
import qz.printer.status.NativeStatus;
/**
diff --git a/src/qz/printer/status/printer/CupsPrinterStatusMap.java b/src/qz/printer/status/printer/CupsPrinterStatusMap.java
index 3670cb3ab..aca2afe86 100644
--- a/src/qz/printer/status/printer/CupsPrinterStatusMap.java
+++ b/src/qz/printer/status/printer/CupsPrinterStatusMap.java
@@ -1,7 +1,7 @@
package qz.printer.status.printer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.printer.status.NativeStatus;
import java.util.Locale;
@@ -861,7 +861,7 @@ public enum CupsPrinterStatusMap implements NativeStatus.NativeMap {
WRAPPER_UNRECOVERABLE_STORAGE_ERROR(REASON, NativePrinterStatus.UNMAPPED), // wrapper-unrecoverable-storage-error
WRAPPER_WARMING_UP(REASON, NativePrinterStatus.UNMAPPED); // wrapper-warming-up
- private static final Logger log = LoggerFactory.getLogger(CupsPrinterStatusMap.class);
+ private static final Logger log = LogManager.getLogger(CupsPrinterStatusMap.class);
public static SortedMap sortedReasonLookupTable;
public static SortedMap sortedStateLookupTable;
diff --git a/src/qz/printer/status/printer/NativePrinterStatus.java b/src/qz/printer/status/printer/NativePrinterStatus.java
index 93710bfeb..2aa41de2e 100644
--- a/src/qz/printer/status/printer/NativePrinterStatus.java
+++ b/src/qz/printer/status/printer/NativePrinterStatus.java
@@ -1,9 +1,9 @@
package qz.printer.status.printer;
-import org.apache.log4j.Level;
+import org.apache.logging.log4j.Level;
import qz.printer.status.NativeStatus;
-import static org.apache.log4j.Level.*;
+import static org.apache.logging.log4j.Level.*;
/**
* Created by kyle on 7/7/17.
diff --git a/src/qz/ui/AboutDialog.java b/src/qz/ui/AboutDialog.java
index 5a48680cf..99e63cb8c 100644
--- a/src/qz/ui/AboutDialog.java
+++ b/src/qz/ui/AboutDialog.java
@@ -2,8 +2,8 @@
import com.github.zafarkhaja.semver.Version;
import org.eclipse.jetty.server.Server;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.common.AboutInfo;
import qz.common.Constants;
import qz.ui.component.EmLabel;
@@ -26,7 +26,7 @@
*/
public class AboutDialog extends BasicDialog implements Themeable {
- private static final Logger log = LoggerFactory.getLogger(AboutDialog.class);
+ private static final Logger log = LogManager.getLogger(AboutDialog.class);
private Server server;
diff --git a/src/qz/ui/LogDialog.java b/src/qz/ui/LogDialog.java
index 4f72fb989..1b0487ba1 100644
--- a/src/qz/ui/LogDialog.java
+++ b/src/qz/ui/LogDialog.java
@@ -1,19 +1,21 @@
package qz.ui;
-import org.apache.log4j.Level;
-import org.apache.log4j.PatternLayout;
-import org.apache.log4j.WriterAppender;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.core.Filter;
+import org.apache.logging.log4j.core.appender.OutputStreamAppender;
+import org.apache.logging.log4j.core.filter.ThresholdFilter;
+import org.apache.logging.log4j.core.layout.PatternLayout;
+import org.apache.logging.log4j.LogManager;
import qz.ui.component.IconCache;
import qz.ui.component.LinkLabel;
import qz.utils.FileUtilities;
-import qz.utils.SystemUtilities;
+import qz.utils.LoggerUtilities;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.io.File;
-import java.io.IOException;
import java.io.OutputStream;
/**
@@ -29,7 +31,7 @@ public class LogDialog extends BasicDialog {
private JButton clearButton;
- private WriterAppender logStream;
+ private OutputStreamAppender logStream;
public LogDialog(JMenuItem caller, IconCache iconCache) {
@@ -61,25 +63,29 @@ public void actionPerformed(ActionEvent e) {
setResizable(true);
// add new appender to Log4J just for text area
- logStream = new WriterAppender(new PatternLayout("[%p] %d{ISO8601} @ %c:%L%n\t%m%n"), new OutputStream() {
- @Override
- public void write(final int b) {
- SwingUtilities.invokeLater(() -> {
- logArea.append(String.valueOf((char)b));
- logPane.getVerticalScrollBar().setValue(logPane.getVerticalScrollBar().getMaximum());
- });
- }
- });
- logStream.setThreshold(Level.TRACE);
+ logStream = OutputStreamAppender.newBuilder()
+ .setName("ui-dialog")
+ .setLayout(PatternLayout.newBuilder().withPattern("[%p] %d{ISO8601} @ %c:%L%n\t%m%n").build())
+ .setFilter(ThresholdFilter.createFilter(Level.TRACE, Filter.Result.ACCEPT, Filter.Result.DENY))
+ .setTarget(new OutputStream() {
+ @Override
+ public void write(final int b) {
+ SwingUtilities.invokeLater(() -> {
+ logArea.append(String.valueOf((char)b));
+ logPane.getVerticalScrollBar().setValue(logPane.getVerticalScrollBar().getMaximum());
+ });
+ }
+ }).build();
+ logStream.start();
}
@Override
public void setVisible(boolean visible) {
if (visible) {
logArea.setText(null);
- org.apache.log4j.Logger.getRootLogger().addAppender(logStream);
+ LoggerUtilities.getRootLogger().addAppender(logStream);
} else {
- org.apache.log4j.Logger.getRootLogger().removeAppender(logStream);
+ LoggerUtilities.getRootLogger().removeAppender(logStream);
}
super.setVisible(visible);
diff --git a/src/qz/ui/SiteManagerDialog.java b/src/qz/ui/SiteManagerDialog.java
index 18ca7f7b2..1bbe2b8a7 100644
--- a/src/qz/ui/SiteManagerDialog.java
+++ b/src/qz/ui/SiteManagerDialog.java
@@ -2,8 +2,8 @@
import org.bouncycastle.util.io.pem.PemObject;
import org.bouncycastle.util.io.pem.PemWriter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.auth.Certificate;
import qz.common.Constants;
import qz.common.PropertyHelper;
@@ -37,7 +37,7 @@
*/
public class SiteManagerDialog extends BasicDialog implements Runnable {
- private static final Logger log = LoggerFactory.getLogger(SiteManagerDialog.class);
+ private static final Logger log = LogManager.getLogger(SiteManagerDialog.class);
private static final String IMPORT_NEEDED = "The provided certificate \"%s\" is unrecognized and not yet trusted.\n" +
"Would you like to automatically copy it to \"%s\"?";
diff --git a/src/qz/ui/component/IconCache.java b/src/qz/ui/component/IconCache.java
index 9bce86016..f001d231e 100644
--- a/src/qz/ui/component/IconCache.java
+++ b/src/qz/ui/component/IconCache.java
@@ -11,8 +11,8 @@
package qz.ui.component;
import com.github.zafarkhaja.semver.Version;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.utils.ColorUtilities;
import qz.utils.SystemUtilities;
import qz.utils.UbuntuUtilities;
@@ -31,7 +31,7 @@
*/
public class IconCache {
- private static final Logger log = LoggerFactory.getLogger(IconCache.class);
+ private static final Logger log = LogManager.getLogger(IconCache.class);
// Internal Jar path containing the images
static String RESOURCES_DIR = "/qz/ui/resources/";
diff --git a/src/qz/ui/component/LinkLabel.java b/src/qz/ui/component/LinkLabel.java
index 987ab3134..4e885b062 100644
--- a/src/qz/ui/component/LinkLabel.java
+++ b/src/qz/ui/component/LinkLabel.java
@@ -1,7 +1,7 @@
package qz.ui.component;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.common.Constants;
import qz.ui.Themeable;
import qz.utils.ShellUtilities;
@@ -26,7 +26,7 @@
*/
public class LinkLabel extends EmLabel implements Themeable {
- private static final Logger log = LoggerFactory.getLogger(LinkLabel.class);
+ private static final Logger log = LogManager.getLogger(LinkLabel.class);
private ArrayList actionListeners;
diff --git a/src/qz/utils/ArgParser.java b/src/qz/utils/ArgParser.java
index 688748e27..6244f10bb 100644
--- a/src/qz/utils/ArgParser.java
+++ b/src/qz/utils/ArgParser.java
@@ -11,8 +11,8 @@
package qz.utils;
import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.common.Constants;
import qz.common.SecurityInfo;
import qz.exception.MissingArgException;
@@ -44,7 +44,7 @@ public int getCode() {
}
}
- protected static final Logger log = LoggerFactory.getLogger(ArgParser.class);
+ protected static final Logger log = LogManager.getLogger(ArgParser.class);
private static final String USAGE_COMMAND = String.format("java -jar %s.jar", PROPS_FILE);
private static final int DESCRIPTION_COLUMN = 30;
private static final int INDENT_SIZE = 2;
diff --git a/src/qz/utils/ColorUtilities.java b/src/qz/utils/ColorUtilities.java
index 308a5236d..25a38a77c 100644
--- a/src/qz/utils/ColorUtilities.java
+++ b/src/qz/utils/ColorUtilities.java
@@ -16,8 +16,8 @@
package qz.utils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import java.awt.*;
import java.awt.image.BufferedImage;
@@ -29,7 +29,7 @@
*/
public class ColorUtilities {
- private static final Logger log = LoggerFactory.getLogger(ColorUtilities.class);
+ private static final Logger log = LogManager.getLogger(ColorUtilities.class);
public static final Color DEFAULT_COLOR = Color.WHITE;
diff --git a/src/qz/utils/ConnectionUtilities.java b/src/qz/utils/ConnectionUtilities.java
index 0be2602ca..6f2c0f430 100644
--- a/src/qz/utils/ConnectionUtilities.java
+++ b/src/qz/utils/ConnectionUtilities.java
@@ -22,14 +22,15 @@
import org.apache.commons.lang3.StringUtils;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.common.Constants;
import javax.net.ssl.*;
public final class ConnectionUtilities {
- private static final org.slf4j.Logger log = LoggerFactory.getLogger(ConnectionUtilities.class);
+ private static final Logger log = LogManager.getLogger(ConnectionUtilities.class);
private static Map requestProps;
/**
diff --git a/src/qz/utils/DeviceUtilities.java b/src/qz/utils/DeviceUtilities.java
index feaa70668..3cd0e29db 100644
--- a/src/qz/utils/DeviceUtilities.java
+++ b/src/qz/utils/DeviceUtilities.java
@@ -7,8 +7,8 @@
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import java.io.IOException;
import java.net.URL;
@@ -20,7 +20,7 @@
*/
public class DeviceUtilities {
- private static final Logger log = LoggerFactory.getLogger(DeviceUtilities.class);
+ private static final Logger log = LogManager.getLogger(DeviceUtilities.class);
public enum DataType {
diff --git a/src/qz/utils/FileUtilities.java b/src/qz/utils/FileUtilities.java
index 8483ac47c..c64b46f94 100644
--- a/src/qz/utils/FileUtilities.java
+++ b/src/qz/utils/FileUtilities.java
@@ -15,8 +15,8 @@
import org.apache.commons.lang3.text.translate.LookupTranslator;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
@@ -55,7 +55,7 @@
*/
public class FileUtilities {
- private static final Logger log = LoggerFactory.getLogger(FileUtilities.class);
+ private static final Logger log = LogManager.getLogger(FileUtilities.class);
public static final Path USER_DIR = getUserDirectory();
public static final Path SHARED_DIR = getSharedDirectory();
public static final Path TEMP_DIR = getTempDirectory();
diff --git a/src/qz/utils/FileWatcher.java b/src/qz/utils/FileWatcher.java
index 38a3d1aa3..285bf1524 100644
--- a/src/qz/utils/FileWatcher.java
+++ b/src/qz/utils/FileWatcher.java
@@ -2,8 +2,8 @@
import org.apache.commons.io.input.ReversedLinesFileReader;
import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.communication.FileIO;
import java.io.BufferedReader;
@@ -18,7 +18,7 @@
public class FileWatcher {
- private static final Logger log = LoggerFactory.getLogger(FileWatcher.class);
+ private static final Logger log = LogManager.getLogger(FileWatcher.class);
private static Thread watchThread;
private static WatchService watchService;
diff --git a/src/qz/utils/GtkUtilities.java b/src/qz/utils/GtkUtilities.java
index 191ec4be2..fcabd5347 100644
--- a/src/qz/utils/GtkUtilities.java
+++ b/src/qz/utils/GtkUtilities.java
@@ -3,13 +3,13 @@
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import java.lang.reflect.Method;
public class GtkUtilities {
- private static final Logger log = LoggerFactory.getLogger(GtkUtilities.class);
+ private static final Logger log = LogManager.getLogger(GtkUtilities.class);
/**
* Initializes Gtk2/3 and returns the desktop scaling factor, usually 1.0 or 2.0
diff --git a/src/qz/utils/JsonWriter.java b/src/qz/utils/JsonWriter.java
index eecb3ad45..7eafddf18 100644
--- a/src/qz/utils/JsonWriter.java
+++ b/src/qz/utils/JsonWriter.java
@@ -16,8 +16,8 @@
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import java.io.File;
import java.io.IOException;
@@ -28,7 +28,7 @@
* A minimally intrusive JSON writer
*/
public class JsonWriter {
- protected static final Logger log = LoggerFactory.getLogger(JsonWriter.class);
+ protected static final Logger log = LogManager.getLogger(JsonWriter.class);
public static boolean write(String path, String data, boolean overwrite, boolean delete) throws IOException, JSONException {
File f = new File(path);
diff --git a/src/qz/utils/LinuxUtilities.java b/src/qz/utils/LinuxUtilities.java
index 2744a56da..08d33882a 100644
--- a/src/qz/utils/LinuxUtilities.java
+++ b/src/qz/utils/LinuxUtilities.java
@@ -1,14 +1,14 @@
package qz.utils;
import org.apache.commons.io.FileUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import java.io.IOException;
import java.nio.file.Path;
public class LinuxUtilities {
- private static final Logger log = LoggerFactory.getLogger(LinuxUtilities.class);
+ private static final Logger log = LogManager.getLogger(LinuxUtilities.class);
private static String foundElevator = null;
private static final String[] KNOWN_ELEVATORS = {"pkexec", "gksu", "gksudo", "kdesudo" };
diff --git a/src/qz/utils/LoggerUtilities.java b/src/qz/utils/LoggerUtilities.java
index 4dbd7b252..11d54c254 100644
--- a/src/qz/utils/LoggerUtilities.java
+++ b/src/qz/utils/LoggerUtilities.java
@@ -1,6 +1,7 @@
package qz.utils;
-import org.slf4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
public class LoggerUtilities {
@@ -16,4 +17,9 @@ public static void optionWarn(Logger log, String expectedType, String name, Obje
log.warn("Cannot read {} as a {} for {}, using default", actualValue, expectedType, name);
}
+ /** Gets a correctly cast root logger to add appenders on top */
+ public static org.apache.logging.log4j.core.Logger getRootLogger() {
+ return (org.apache.logging.log4j.core.Logger)LogManager.getRootLogger();
+ }
+
}
diff --git a/src/qz/utils/MacUtilities.java b/src/qz/utils/MacUtilities.java
index e506bb890..7b8015316 100644
--- a/src/qz/utils/MacUtilities.java
+++ b/src/qz/utils/MacUtilities.java
@@ -19,8 +19,8 @@
import org.dyorgio.jna.platform.mac.ActionCallback;
import org.dyorgio.jna.platform.mac.Foundation;
import org.dyorgio.jna.platform.mac.FoundationUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.common.Constants;
import qz.common.TrayManager;
import qz.ui.component.IconCache;
@@ -45,7 +45,7 @@
*/
public class MacUtilities {
- private static final Logger log = LoggerFactory.getLogger(IconCache.class);
+ private static final Logger log = LogManager.getLogger(IconCache.class);
private static Dialog aboutDialog;
private static TrayManager trayManager;
private static String bundleId;
diff --git a/src/qz/utils/NetworkUtilities.java b/src/qz/utils/NetworkUtilities.java
index c011bd105..87d3168bc 100644
--- a/src/qz/utils/NetworkUtilities.java
+++ b/src/qz/utils/NetworkUtilities.java
@@ -12,8 +12,8 @@
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import java.io.IOException;
import java.net.*;
@@ -26,7 +26,7 @@
*/
public class NetworkUtilities {
- private static final Logger log = LoggerFactory.getLogger(NetworkUtilities.class);
+ private static final Logger log = LogManager.getLogger(NetworkUtilities.class);
private static NetworkUtilities instance;
private static String systemName = ShellUtilities.getHostName();
diff --git a/src/qz/utils/PrintingUtilities.java b/src/qz/utils/PrintingUtilities.java
index e880f5146..ded2a00f3 100644
--- a/src/qz/utils/PrintingUtilities.java
+++ b/src/qz/utils/PrintingUtilities.java
@@ -5,8 +5,8 @@
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
import org.eclipse.jetty.websocket.api.Session;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.common.Constants;
import qz.printer.PrintOptions;
import qz.printer.PrintOutput;
@@ -20,7 +20,7 @@
public class PrintingUtilities {
- private static final Logger log = LoggerFactory.getLogger(PrintingUtilities.class);
+ private static final Logger log = LogManager.getLogger(PrintingUtilities.class);
private static GenericKeyedObjectPool processorPool;
diff --git a/src/qz/utils/SerialUtilities.java b/src/qz/utils/SerialUtilities.java
index a1ddb6247..6fbf8fefa 100644
--- a/src/qz/utils/SerialUtilities.java
+++ b/src/qz/utils/SerialUtilities.java
@@ -7,8 +7,8 @@
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
import org.eclipse.jetty.websocket.api.Session;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.communication.SerialIO;
import qz.communication.SerialOptions;
import qz.ws.PrintSocketClient;
@@ -24,7 +24,7 @@
*/
public class SerialUtilities {
- private static final Logger log = LoggerFactory.getLogger(SerialUtilities.class);
+ private static final Logger log = LogManager.getLogger(SerialUtilities.class);
private static final List VALID_BAUD = Arrays.asList(SerialPort.BAUDRATE_110, SerialPort.BAUDRATE_300,
SerialPort.BAUDRATE_600, SerialPort.BAUDRATE_1200,
diff --git a/src/qz/utils/ShellUtilities.java b/src/qz/utils/ShellUtilities.java
index e49590ac1..abbdf7075 100644
--- a/src/qz/utils/ShellUtilities.java
+++ b/src/qz/utils/ShellUtilities.java
@@ -11,8 +11,8 @@
package qz.utils;
import org.apache.commons.io.Charsets;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import java.awt.*;
import java.io.*;
@@ -29,7 +29,7 @@
*/
public class ShellUtilities {
- private static final Logger log = LoggerFactory.getLogger(ShellUtilities.class);
+ private static final Logger log = LogManager.getLogger(ShellUtilities.class);
// Shell environment overrides. null = don't override
public static String[] envp = null;
@@ -265,4 +265,4 @@ public static void browseDirectory(File directory) {
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/qz/utils/SocketUtilities.java b/src/qz/utils/SocketUtilities.java
index 842a2b80c..e178821a5 100644
--- a/src/qz/utils/SocketUtilities.java
+++ b/src/qz/utils/SocketUtilities.java
@@ -3,8 +3,8 @@
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
import org.eclipse.jetty.websocket.api.Session;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.communication.SocketIO;
import qz.ws.PrintSocketClient;
import qz.ws.SocketConnection;
@@ -16,7 +16,7 @@
public class SocketUtilities {
- private static final Logger log = LoggerFactory.getLogger(SocketUtilities.class);
+ private static final Logger log = LogManager.getLogger(SocketUtilities.class);
public static void setupSocket(final Session session, String UID, SocketConnection connection, JSONObject params) throws JSONException {
final String host = params.getString("host");
diff --git a/src/qz/utils/SystemUtilities.java b/src/qz/utils/SystemUtilities.java
index a85e1037e..8aad8dd29 100644
--- a/src/qz/utils/SystemUtilities.java
+++ b/src/qz/utils/SystemUtilities.java
@@ -15,8 +15,8 @@
import org.apache.commons.ssl.Base64;
import org.joor.Reflect;
import org.joor.ReflectException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.common.Constants;
import qz.common.TrayManager;
@@ -47,7 +47,7 @@ public class SystemUtilities {
// Name of the os, i.e. "Windows XP", "Mac OS X"
private static final String OS_NAME = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
- private static final Logger log = LoggerFactory.getLogger(TrayManager.class);
+ private static final Logger log = LogManager.getLogger(TrayManager.class);
private static final Locale defaultLocale = Locale.getDefault();
static {
@@ -404,7 +404,7 @@ public static boolean setSystemLookAndFeel() {
adjustThemeColors();
return true;
} catch (Throwable t) {
- LoggerFactory.getLogger(SystemUtilities.class).warn("Error getting the default look and feel");
+ log.warn("Error getting the default look and feel");
}
return false;
}
diff --git a/src/qz/utils/UsbUtilities.java b/src/qz/utils/UsbUtilities.java
index 2bfe01161..77d9865fd 100644
--- a/src/qz/utils/UsbUtilities.java
+++ b/src/qz/utils/UsbUtilities.java
@@ -5,8 +5,8 @@
import org.codehaus.jettison.json.JSONObject;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.WebSocketException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.communication.DeviceException;
import qz.communication.DeviceIO;
import qz.communication.DeviceOptions;
@@ -21,7 +21,7 @@
public class UsbUtilities {
- private static final Logger log = LoggerFactory.getLogger(UsbUtilities.class);
+ private static final Logger log = LogManager.getLogger(UsbUtilities.class);
public static Integer hexToInt(String hex) {
if (hex == null || hex.isEmpty()) {
diff --git a/src/qz/utils/WindowsUtilities.java b/src/qz/utils/WindowsUtilities.java
index 6d6992e6b..14a80e472 100644
--- a/src/qz/utils/WindowsUtilities.java
+++ b/src/qz/utils/WindowsUtilities.java
@@ -4,8 +4,8 @@
import com.sun.jna.Native;
import com.sun.jna.platform.win32.*;
import com.sun.jna.win32.W32APIOptions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.common.Constants;
import java.awt.*;
@@ -23,7 +23,7 @@
import static java.nio.file.attribute.AclEntryFlag.*;
public class WindowsUtilities {
- protected static final Logger log = LoggerFactory.getLogger(WindowsUtilities.class);
+ protected static final Logger log = LogManager.getLogger(WindowsUtilities.class);
private static String THEME_REG_KEY = "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize";
private static final String AUTHENTICATED_USERS_SID = "S-1-5-11";
diff --git a/src/qz/ws/HttpAboutServlet.java b/src/qz/ws/HttpAboutServlet.java
index 802ef3fc2..745f74b97 100644
--- a/src/qz/ws/HttpAboutServlet.java
+++ b/src/qz/ws/HttpAboutServlet.java
@@ -4,8 +4,8 @@
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
import org.eclipse.jetty.servlet.DefaultServlet;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.common.AboutInfo;
import qz.installer.certificate.CertificateManager;
@@ -19,7 +19,7 @@
*/
public class HttpAboutServlet extends DefaultServlet {
- private static final Logger log = LoggerFactory.getLogger(PrintSocketServer.class);
+ private static final Logger log = LogManager.getLogger(PrintSocketServer.class);
private static final int JSON_INDENT = 2;
private CertificateManager certificateManager;
diff --git a/src/qz/ws/PrintSocketClient.java b/src/qz/ws/PrintSocketClient.java
index 7f0457046..c19889dab 100644
--- a/src/qz/ws/PrintSocketClient.java
+++ b/src/qz/ws/PrintSocketClient.java
@@ -10,8 +10,8 @@
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.WebSocketException;
import org.eclipse.jetty.websocket.api.annotations.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.auth.Certificate;
import qz.auth.RequestState;
import qz.common.Constants;
@@ -41,7 +41,7 @@
@WebSocket
public class PrintSocketClient {
- private static final Logger log = LoggerFactory.getLogger(PrintSocketClient.class);
+ private static final Logger log = LogManager.getLogger(PrintSocketClient.class);
private final TrayManager trayManager = PrintSocketServer.getTrayManager();
private static final Semaphore dialogAvailable = new Semaphore(1, true);
diff --git a/src/qz/ws/PrintSocketServer.java b/src/qz/ws/PrintSocketServer.java
index 78973c5aa..5109d1695 100644
--- a/src/qz/ws/PrintSocketServer.java
+++ b/src/qz/ws/PrintSocketServer.java
@@ -10,11 +10,14 @@
package qz.ws;
-import org.apache.log4j.Level;
-import org.apache.log4j.PatternLayout;
-import org.apache.log4j.rolling.FixedWindowRollingPolicy;
-import org.apache.log4j.rolling.RollingFileAppender;
-import org.apache.log4j.rolling.SizeBasedTriggeringPolicy;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.core.Filter;
+import org.apache.logging.log4j.core.appender.RollingFileAppender;
+import org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy;
+import org.apache.logging.log4j.core.appender.rolling.SizeBasedTriggeringPolicy;
+import org.apache.logging.log4j.core.filter.ThresholdFilter;
+import org.apache.logging.log4j.core.layout.PatternLayout;
import org.eclipse.jetty.http.HttpVersion;
import org.eclipse.jetty.http.pathmap.ServletPathSpec;
import org.eclipse.jetty.server.*;
@@ -22,8 +25,6 @@
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.util.MultiException;
import org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import qz.common.Constants;
import qz.common.TrayManager;
import qz.installer.Installer;
@@ -31,6 +32,7 @@
import qz.installer.certificate.ExpiryTask;
import qz.installer.certificate.KeyPairWrapper;
import qz.installer.certificate.NativeCertificateInstaller;
+import org.apache.logging.log4j.LogManager;
import qz.utils.*;
import javax.swing.*;
@@ -44,7 +46,6 @@
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
-import static qz.utils.ArgParser.ExitStatus.SUCCESS;
import static qz.utils.ArgValue.STEAL;
/**
@@ -53,7 +54,7 @@
public class PrintSocketServer {
- private static final Logger log = LoggerFactory.getLogger(PrintSocketServer.class);
+ private static final Logger log = LogManager.getLogger(PrintSocketServer.class);
private static final int MAX_MESSAGE_SIZE = Integer.MAX_VALUE;
public static final List SECURE_PORTS = Collections.unmodifiableList(Arrays.asList(Constants.WSS_PORTS));
@@ -118,24 +119,24 @@ public static void main(String[] args) {
}
private static void setupFileLogging() {
- FixedWindowRollingPolicy rollingPolicy = new FixedWindowRollingPolicy();
- rollingPolicy.setFileNamePattern(FileUtilities.USER_DIR + File.separator + Constants.LOG_FILE + ".log.%i");
- rollingPolicy.setMaxIndex(Constants.LOG_ROTATIONS);
-
- SizeBasedTriggeringPolicy triggeringPolicy = new SizeBasedTriggeringPolicy(Constants.LOG_SIZE);
-
- RollingFileAppender fileAppender = new RollingFileAppender();
- fileAppender.setLayout(new PatternLayout("%d{ISO8601} [%p] %m%n"));
- fileAppender.setThreshold(Level.DEBUG);
- fileAppender.setFile(FileUtilities.USER_DIR + File.separator + Constants.LOG_FILE + ".log");
- fileAppender.setRollingPolicy(rollingPolicy);
- fileAppender.setTriggeringPolicy(triggeringPolicy);
- fileAppender.setEncoding("UTF-8");
-
- fileAppender.setImmediateFlush(true);
- fileAppender.activateOptions();
-
- org.apache.log4j.Logger.getRootLogger().addAppender(fileAppender);
+ RollingFileAppender fileAppender = RollingFileAppender.newBuilder()
+ .setName("log-file")
+ .withAppend(true)
+ .setLayout(PatternLayout.newBuilder().withPattern("%d{ISO8601} [%p] %m%n").build())
+ .setFilter(ThresholdFilter.createFilter(Level.DEBUG, Filter.Result.ACCEPT, Filter.Result.DENY))
+ .withFileName(FileUtilities.USER_DIR + File.separator + Constants.LOG_FILE + ".log")
+ .withFilePattern(FileUtilities.USER_DIR + File.separator + Constants.LOG_FILE + ".log.%i")
+ .withStrategy(DefaultRolloverStrategy.newBuilder().withMax(String.valueOf(Constants.LOG_ROTATIONS)).build())
+ .withPolicy(SizeBasedTriggeringPolicy.createPolicy(String.valueOf(Constants.LOG_SIZE)))
+ .withImmediateFlush(true)
+ .build();
+ fileAppender.start();
+
+ LoggerUtilities.getRootLogger().addAppender(fileAppender);
+
+ //disable jetty logging
+ System.setProperty("org.eclipse.jetty.util.log.class", "org.eclipse.jetty.util.log.StdErrLog");
+ System.setProperty("org.eclipse.jetty.LEVEL", "OFF");
}
public static void runServer() {
diff --git a/src/qz/ws/SingleInstanceChecker.java b/src/qz/ws/SingleInstanceChecker.java
index e6f266b68..6af4269cc 100644
--- a/src/qz/ws/SingleInstanceChecker.java
+++ b/src/qz/ws/SingleInstanceChecker.java
@@ -17,8 +17,8 @@
import org.eclipse.jetty.websocket.api.annotations.*;
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
import org.eclipse.jetty.websocket.client.WebSocketClient;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.common.Constants;
import qz.common.TrayManager;
import qz.utils.ArgValue;
@@ -35,7 +35,7 @@
@WebSocket
public class SingleInstanceChecker {
- private static final Logger log = LoggerFactory.getLogger(SingleInstanceChecker.class);
+ private static final Logger log = LogManager.getLogger(SingleInstanceChecker.class);
public static CloseStatus INSTANCE_ALREADY_RUNNING = new CloseStatus(4441, "Already running");
public static CloseStatus REQUEST_INSTANCE_TAKEOVER = new CloseStatus(4442, "WebSocket stolen");
diff --git a/src/qz/ws/SocketConnection.java b/src/qz/ws/SocketConnection.java
index b9af87186..20603ba50 100644
--- a/src/qz/ws/SocketConnection.java
+++ b/src/qz/ws/SocketConnection.java
@@ -1,8 +1,8 @@
package qz.ws;
import jssc.SerialPortException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.auth.Certificate;
import qz.communication.*;
import qz.printer.status.StatusMonitor;
@@ -15,7 +15,7 @@
public class SocketConnection {
- private static final Logger log = LoggerFactory.getLogger(SocketConnection.class);
+ private static final Logger log = LogManager.getLogger(SocketConnection.class);
private Certificate certificate;
diff --git a/src/qz/ws/StreamEvent.java b/src/qz/ws/StreamEvent.java
index 908a392ad..a675bfb44 100644
--- a/src/qz/ws/StreamEvent.java
+++ b/src/qz/ws/StreamEvent.java
@@ -2,8 +2,8 @@
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
public class StreamEvent {
@@ -15,7 +15,7 @@ public enum Type {
RECEIVE, ERROR, ACTION
}
- private static final Logger log = LoggerFactory.getLogger(StreamEvent.class);
+ private static final Logger log = LogManager.getLogger(StreamEvent.class);
private Stream streamType;
private Type eventType;
diff --git a/test/log4j.xml b/test/log4j.xml
deleted file mode 100644
index ab7c300cb..000000000
--- a/test/log4j.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/test/log4j2.xml b/test/log4j2.xml
new file mode 100644
index 000000000..459f11ae1
--- /dev/null
+++ b/test/log4j2.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/qz/installer/browser/AppFinderTests.java b/test/qz/installer/browser/AppFinderTests.java
index 1537e1788..ef1a699b4 100644
--- a/test/qz/installer/browser/AppFinderTests.java
+++ b/test/qz/installer/browser/AppFinderTests.java
@@ -1,7 +1,7 @@
package qz.installer.browser;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.installer.Installer;
import qz.installer.certificate.firefox.FirefoxCertificateInstaller;
import qz.installer.certificate.firefox.locator.AppAlias;
@@ -13,7 +13,7 @@
import java.util.Date;
public class AppFinderTests {
- private static final Logger log = LoggerFactory.getLogger(AppFinderTests.class);
+ private static final Logger log = LogManager.getLogger(AppFinderTests.class);
public static void main(String ... args) throws Exception {
runTest(AppAlias.FIREFOX);
@@ -42,4 +42,4 @@ private static void runTest(AppAlias app) {
log.debug(output.toString());
log.debug("Time to find and execute {}: {}s", app.name(), (end.getTime() - begin.getTime())/1000.0f);
}
-}
\ No newline at end of file
+}
diff --git a/test/qz/printer/action/WebAppTest.java b/test/qz/printer/action/WebAppTest.java
index e5e5fd48f..ea1e257d0 100644
--- a/test/qz/printer/action/WebAppTest.java
+++ b/test/qz/printer/action/WebAppTest.java
@@ -1,8 +1,8 @@
package qz.printer.action;
import javafx.print.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.common.Constants;
import javax.imageio.ImageIO;
@@ -17,7 +17,7 @@
public class WebAppTest {
- private static final Logger log = LoggerFactory.getLogger(WebAppTest.class);
+ private static final Logger log = LogManager.getLogger(WebAppTest.class);
private static final int SPOOLER_WAIT = 2000; // millis
private static final Path RASTER_OUTPUT_DIR = Paths.get("./out"); // see ant ${out.dir}
private static final String RASTER_OUTPUT_FORMAT = "png";
diff --git a/test/qz/printer/info/NativePrinterTests.java b/test/qz/printer/info/NativePrinterTests.java
index 8e58707a6..428cf1476 100644
--- a/test/qz/printer/info/NativePrinterTests.java
+++ b/test/qz/printer/info/NativePrinterTests.java
@@ -1,7 +1,7 @@
package tests.qz.printer.info;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import qz.printer.PrintServiceMatcher;
import qz.printer.info.NativePrinter;
import qz.printer.info.NativePrinterMap;
@@ -9,7 +9,7 @@
import java.util.Date;
public class NativePrinterTests {
- private static final Logger log = LoggerFactory.getLogger(NativePrinterTests.class);
+ private static final Logger log = LogManager.getLogger(NativePrinterTests.class);
public static void main(String ... args) {
for (int i = 0; i < 10; i++) {
diff --git a/test/qz/utils/JsonWriterTests.java b/test/qz/utils/JsonWriterTests.java
index b3a945b57..7146cb4db 100644
--- a/test/qz/utils/JsonWriterTests.java
+++ b/test/qz/utils/JsonWriterTests.java
@@ -1,14 +1,14 @@
package qz.utils;
import org.codehaus.jettison.json.JSONException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import java.io.IOException;
public class JsonWriterTests {
- private static final Logger log = LoggerFactory.getLogger(JsonWriterTests.class);
+ private static final Logger log = LogManager.getLogger(JsonWriterTests.class);
private static String DEFAULT_PATH = "/Applications/Firefox.app/Contents/Resources/distribution/policies.json";
private static String DEFAULT_DATA = "{ \"policies\": { \"Certificates\": { \"ImportEnterpriseRoots\": true } } }";