Skip to content

Commit

Permalink
Log4j update (2.1) (#896)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brett Berenz authored Dec 17, 2021
1 parent f4e8dba commit f28baee
Show file tree
Hide file tree
Showing 106 changed files with 373 additions and 371 deletions.
1 change: 1 addition & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
<attribute name="Application-Name" value="${project.name}"/>
<attribute name="Main-Class" value="qz.ws.PrintSocketServer"/>
<attribute name="Permissions" value="all-permissions"/>
<attribute name="Multi-Release" value="true"/>
</manifest>
</jar>

Expand Down
Binary file removed lib/logging/apache-log4j-extras-1.2.17.jar
Binary file not shown.
Binary file removed lib/logging/log4j-1.2.17.jar
Binary file not shown.
Binary file added lib/logging/log4j-api-2.16.0.jar
Binary file not shown.
Binary file added lib/logging/log4j-core-2.16.0.jar
Binary file not shown.
Binary file removed lib/logging/slf4j-api-1.7.12.jar
Binary file not shown.
Binary file removed lib/logging/slf4j-log4j12-1.7.12.jar
Binary file not shown.
6 changes: 3 additions & 3 deletions src/com/apple/OSXAdapterWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
Expand Down
29 changes: 0 additions & 29 deletions src/log4j.xml

This file was deleted.

16 changes: 16 additions & 0 deletions src/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="[%p] %d{ISO8601} @ %c:%L%n\t%m%n"/>
</Console>
</Appenders>
<Loggers>
<!-- Packages -->
<Logger name="qz" level="trace"/>
<!-- Default -->
<Root level="warn">
<AppenderRef ref="console"/>
</Root>
</Loggers>
</Configuration>
6 changes: 3 additions & 3 deletions src/qz/auth/CRL.java
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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";
Expand Down
6 changes: 3 additions & 3 deletions src/qz/auth/Certificate.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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";
Expand Down
6 changes: 3 additions & 3 deletions src/qz/common/AboutInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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";

Expand Down
7 changes: 4 additions & 3 deletions src/qz/common/PropertyHelper.java
Original file line number Diff line number Diff line change
@@ -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;

/**
Expand Down
14 changes: 7 additions & 7 deletions src/qz/common/SecurityInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -26,7 +26,7 @@ public class SecurityInfo {
* Wrap throwable operations into a try/catch
*/
private static class CheckedTreeMap<K, V> extends TreeMap<K, V> {
private static final Logger log = LoggerFactory.getLogger(CheckedTreeMap.class);
private static final Logger log = LogManager.getLogger(CheckedTreeMap.class);

interface CheckedValue {
Object check() throws Throwable;
Expand All @@ -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) {
Expand Down Expand Up @@ -102,9 +102,9 @@ public static SortedMap<String,String> getLibVersions() {
// Fallback to maven manifest information
HashMap<String,String> 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"};
Expand Down
6 changes: 3 additions & 3 deletions src/qz/common/TrayManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions src/qz/communication/H4J_HidListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
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;

import javax.usb.util.UsbUtil;

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;

Expand Down
8 changes: 4 additions & 4 deletions src/qz/communication/PJHA_HidIO.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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");
Expand Down
6 changes: 3 additions & 3 deletions src/qz/communication/PJHA_HidListener.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/qz/communication/SerialIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/qz/communication/SerialOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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";
Expand Down
6 changes: 3 additions & 3 deletions src/qz/communication/SocketIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/qz/installer/Installer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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"));
Expand Down
6 changes: 3 additions & 3 deletions src/qz/installer/LinuxInstaller.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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/";
Expand Down
Loading

0 comments on commit f28baee

Please sign in to comment.