Updated log4j to log4j2
This commit is contained in:
parent
221a132b84
commit
ca781a807b
6
pom.xml
6
pom.xml
|
@ -322,9 +322,9 @@
|
|||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.17</version>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>2.15.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
|
|
|
@ -35,7 +35,8 @@ import javax.servlet.ServletContext;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.inject.*;
|
||||
import net.socialgamer.cah.data.GameOptions;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.hibernate.Session;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
@ -56,7 +57,7 @@ import net.socialgamer.cah.metrics.UniqueIds;
|
|||
*/
|
||||
public class CahModule extends AbstractModule {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(CahModule.class);
|
||||
private static final Logger LOG = LogManager.getLogger(CahModule.class);
|
||||
|
||||
private final Properties properties = new Properties();
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ package net.socialgamer.cah;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.net.URI;
|
||||
import java.util.Date;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||
|
@ -40,8 +41,8 @@ import net.socialgamer.cah.metrics.Metrics;
|
|||
import net.socialgamer.cah.task.BroadcastGameListUpdateTask;
|
||||
import net.socialgamer.cah.task.UserPingTask;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.PropertyConfigurator;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
@ -58,7 +59,7 @@ import com.google.inject.servlet.GuiceServletContextListener;
|
|||
*/
|
||||
public class StartupUtils extends GuiceServletContextListener {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(StartupUtils.class);
|
||||
private static final Logger LOG = LogManager.getLogger(StartupUtils.class);
|
||||
|
||||
/**
|
||||
* Context attribute key name for the Guice injector.
|
||||
|
@ -167,7 +168,8 @@ public class StartupUtils extends GuiceServletContextListener {
|
|||
public static void reconfigureLogging(final ServletContext context) {
|
||||
LOG.info("Reloading log4j.properties");
|
||||
|
||||
PropertyConfigurator.configure(context.getRealPath("/WEB-INF/log4j.properties"));
|
||||
URI log4jProps = URI.create(context.getRealPath("/WEB-INF/log4j.properties"));
|
||||
((org.apache.logging.log4j.core.LoggerContext) LogManager.getContext(false)).setConfigLocation(log4jProps);
|
||||
}
|
||||
|
||||
protected Injector getInjector(final ServletContext context) {
|
||||
|
|
|
@ -33,7 +33,8 @@ import net.socialgamer.cah.CahModule.CustomDecksAllowedUrls;
|
|||
import net.socialgamer.cah.CahModule.CustomDecksEnabled;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.JSONValue;
|
||||
|
@ -52,7 +53,7 @@ import java.util.regex.Pattern;
|
|||
|
||||
|
||||
public class CustomCardsService {
|
||||
private static final Logger LOG = Logger.getLogger(CustomCardsService.class);
|
||||
private static final Logger LOG = LogManager.getLogger(CustomCardsService.class);
|
||||
|
||||
private static final int GET_TIMEOUT = (int) TimeUnit.SECONDS.toMillis(3);
|
||||
|
||||
|
|
|
@ -37,7 +37,8 @@ import java.util.stream.Collectors;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
|
@ -65,7 +66,7 @@ import net.socialgamer.cah.metrics.Metrics;
|
|||
@Singleton
|
||||
public class ConnectedUsers {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(ConnectedUsers.class);
|
||||
private static final Logger logger = LogManager.getLogger(ConnectedUsers.class);
|
||||
|
||||
/**
|
||||
* Duration of a ping timeout, in nanoseconds.
|
||||
|
|
|
@ -34,7 +34,8 @@ import net.socialgamer.cah.data.QueuedMessage.MessageType;
|
|||
import net.socialgamer.cah.metrics.Metrics;
|
||||
import net.socialgamer.cah.task.SafeTimerTask;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.hibernate.Session;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
@ -76,7 +77,7 @@ public class Game {
|
|||
* We need 20 * maxPlayers cards. This allows black cards up to "draw 9" to work correctly.
|
||||
*/
|
||||
public final static int MINIMUM_WHITE_CARDS_PER_PLAYER = 20;
|
||||
private static final Logger logger = Logger.getLogger(Game.class);
|
||||
private static final Logger logger = LogManager.getLogger(Game.class);
|
||||
/**
|
||||
* Time, in milliseconds, to delay before starting a new round.
|
||||
*/
|
||||
|
|
|
@ -31,7 +31,8 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.inject.BindingAnnotation;
|
||||
|
@ -54,7 +55,7 @@ import net.socialgamer.cah.task.BroadcastGameListUpdateTask;
|
|||
@Singleton
|
||||
@GameId
|
||||
public class GameManager implements Provider<Integer> {
|
||||
private static final Logger logger = Logger.getLogger(GameManager.class);
|
||||
private static final Logger logger = LogManager.getLogger(GameManager.class);
|
||||
|
||||
private final Provider<Integer> maxGamesProvider;
|
||||
private final Map<Integer, Game> games = new TreeMap<Integer, Game>();
|
||||
|
|
|
@ -30,7 +30,8 @@ import java.util.concurrent.PriorityBlockingQueue;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
|
@ -48,7 +49,7 @@ import net.socialgamer.cah.Constants.Sigil;
|
|||
*/
|
||||
public class User {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(User.class);
|
||||
private static final Logger LOG = LogManager.getLogger(User.class);
|
||||
|
||||
private final String nickname;
|
||||
|
||||
|
|
|
@ -44,13 +44,14 @@ import net.socialgamer.cah.data.QueuedMessage;
|
|||
import net.socialgamer.cah.data.QueuedMessage.MessageType;
|
||||
import net.socialgamer.cah.data.User;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
|
||||
public class BanHandler extends Handler {
|
||||
protected final Logger logger = Logger.getLogger(BanHandler.class);
|
||||
protected final Logger logger = LogManager.getLogger(BanHandler.class);
|
||||
|
||||
public static final String OP = AjaxOperation.BAN.toString();
|
||||
|
||||
|
|
|
@ -28,7 +28,8 @@ import java.util.Map;
|
|||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
|
@ -54,7 +55,7 @@ import net.socialgamer.cah.util.ChatFilter;
|
|||
*/
|
||||
public class ChatHandler extends Handler {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(ChatHandler.class);
|
||||
private static final Logger LOG = LogManager.getLogger(ChatHandler.class);
|
||||
public static final String OP = AjaxOperation.CHAT.toString();
|
||||
|
||||
private final ChatFilter chatFilter;
|
||||
|
|
|
@ -32,7 +32,8 @@ import java.util.Set;
|
|||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.Transaction;
|
||||
|
||||
|
@ -67,7 +68,7 @@ import net.socialgamer.cah.db.PyxCardSet;
|
|||
*/
|
||||
public class FirstLoadHandler extends Handler {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(FirstLoadHandler.class);
|
||||
private static final Logger LOG = LogManager.getLogger(FirstLoadHandler.class);
|
||||
public static final String OP = AjaxOperation.FIRST_LOAD.toString();
|
||||
|
||||
private final Set<String> banList;
|
||||
|
|
|
@ -28,7 +28,8 @@ import java.util.Map;
|
|||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
|
@ -55,7 +56,7 @@ import net.socialgamer.cah.util.ChatFilter;
|
|||
*/
|
||||
public class GameChatHandler extends GameWithPlayerHandler {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(GameChatHandler.class);
|
||||
private static final Logger LOG = LogManager.getLogger(GameChatHandler.class);
|
||||
public static final String OP = AjaxOperation.GAME_CHAT.toString();
|
||||
|
||||
private final ChatFilter chatFilter;
|
||||
|
|
|
@ -19,13 +19,14 @@ import net.socialgamer.cah.data.QueuedMessage;
|
|||
import net.socialgamer.cah.data.QueuedMessage.MessageType;
|
||||
import net.socialgamer.cah.data.User;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
|
||||
public class KickHandler extends Handler {
|
||||
protected final Logger logger = Logger.getLogger(KickHandler.class);
|
||||
protected final Logger logger = LogManager.getLogger(KickHandler.class);
|
||||
|
||||
public static final String OP = AjaxOperation.KICK.toString();
|
||||
|
||||
|
|
|
@ -33,7 +33,8 @@ import javax.servlet.http.HttpSession;
|
|||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.HttpHeaders;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
|
@ -65,7 +66,7 @@ import net.socialgamer.cah.util.IdCodeMangler;
|
|||
*/
|
||||
public class RegisterHandler extends Handler {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(RegisterHandler.class);
|
||||
private static final Logger LOG = LogManager.getLogger(RegisterHandler.class);
|
||||
public static final String OP = AjaxOperation.REGISTER.toString();
|
||||
|
||||
private static final Pattern VALID_NAME = Pattern.compile("[a-zA-Z_][a-zA-Z0-9_]{2,29}");
|
||||
|
|
|
@ -37,7 +37,8 @@ import net.socialgamer.cah.data.Game;
|
|||
import net.socialgamer.cah.data.GameManager;
|
||||
import net.socialgamer.cah.data.User;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
|
@ -47,7 +48,7 @@ import com.google.inject.Inject;
|
|||
*/
|
||||
public class StopGameHandler extends GameWithPlayerHandler {
|
||||
|
||||
protected final Logger logger = Logger.getLogger(GameWithPlayerHandler.class);
|
||||
protected final Logger logger = LogManager.getLogger(GameWithPlayerHandler.class);
|
||||
|
||||
public static final String OP = AjaxOperation.STOP_GAME.toString();
|
||||
|
||||
|
|
|
@ -29,7 +29,8 @@ import java.net.InetAddress;
|
|||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
|
@ -48,7 +49,7 @@ import com.maxmind.geoip2.model.CityResponse;
|
|||
@Singleton
|
||||
public class GeoIP {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(GeoIP.class);
|
||||
private static final Logger LOG = LogManager.getLogger(GeoIP.class);
|
||||
|
||||
private DatabaseReader reader;
|
||||
private boolean initialized = false;
|
||||
|
|
|
@ -47,7 +47,8 @@ import org.apache.kafka.common.PartitionInfo;
|
|||
import org.apache.kafka.common.config.SaslConfigs;
|
||||
import org.apache.kafka.common.config.SslConfigs;
|
||||
import org.apache.kafka.common.serialization.StringSerializer;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.json.simple.JSONValue;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
@ -73,7 +74,7 @@ public class KafkaMetrics implements Metrics {
|
|||
// 0.1: initial version
|
||||
// 0.2: added cardDealt
|
||||
private static final String metricsVersion = "0.2";
|
||||
private static final Logger LOG = Logger.getLogger(KafkaMetrics.class);
|
||||
private static final Logger LOG = LogManager.getLogger(KafkaMetrics.class);
|
||||
|
||||
private final ProducerCallback callback = new ProducerCallback();
|
||||
private final String build;
|
||||
|
|
|
@ -27,7 +27,8 @@ import java.util.Collection;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.google.inject.Singleton;
|
||||
import com.maxmind.geoip2.model.CityResponse;
|
||||
|
@ -45,7 +46,7 @@ import net.socialgamer.cah.data.WhiteCard;
|
|||
@Singleton
|
||||
public class NoOpMetrics implements Metrics {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(NoOpMetrics.class);
|
||||
private static final Logger LOG = LogManager.getLogger(NoOpMetrics.class);
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
|
|
|
@ -31,7 +31,8 @@ import java.util.concurrent.atomic.AtomicLong;
|
|||
|
||||
import net.socialgamer.cah.CahModule.ServerStarted;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
|
@ -51,7 +52,7 @@ import com.google.inject.Singleton;
|
|||
@Singleton
|
||||
public class UniqueIds implements Provider<String> {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(UniqueIds.class);
|
||||
private static final Logger LOG = LogManager.getLogger(UniqueIds.class);
|
||||
|
||||
private static final String hostname;
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package net.socialgamer.cah.task;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
|
||||
public abstract class SafeTimerTask implements Runnable {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(SafeTimerTask.class);
|
||||
private static final Logger logger = LogManager.getLogger(SafeTimerTask.class);
|
||||
|
||||
@Override
|
||||
public final void run() {
|
||||
|
|
|
@ -35,7 +35,8 @@ import java.util.WeakHashMap;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.inject.Inject;
|
||||
|
@ -51,7 +52,7 @@ import net.socialgamer.cah.data.User;
|
|||
*/
|
||||
@Singleton
|
||||
public class ChatFilter {
|
||||
private static final Logger LOG = Logger.getLogger(ChatFilter.class);
|
||||
private static final Logger LOG = LogManager.getLogger(ChatFilter.class);
|
||||
|
||||
private static final int DEFAULT_CHAT_FLOOD_MESSAGE_COUNT = 4;
|
||||
private static final int DEFAULT_CHAT_FLOOD_TIME_SECONDS = 30;
|
||||
|
|
|
@ -28,7 +28,8 @@ import java.security.MessageDigest;
|
|||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Base64;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
|
@ -36,7 +37,7 @@ import net.socialgamer.cah.CahModule.IdCodeSalt;
|
|||
|
||||
|
||||
public class IdCodeMangler {
|
||||
private static final Logger LOG = Logger.getLogger(IdCodeMangler.class);
|
||||
private static final Logger LOG = LogManager.getLogger(IdCodeMangler.class);
|
||||
|
||||
private final String salt;
|
||||
private final Base64.Encoder encoder = Base64.getEncoder();
|
||||
|
|
Loading…
Reference in New Issue