Replace log4j with slf4j
This commit is contained in:
@@ -29,8 +29,8 @@ dependencies {
|
||||
implementation 'com.google.guava:guava:33.4.0-jre'
|
||||
implementation 'commons-cli:commons-cli:1.9.0'
|
||||
implementation 'net.sourceforge.argparse4j:argparse4j:0.9.0'
|
||||
implementation 'org.apache.logging.log4j:log4j-api:2.12.3'
|
||||
implementation 'org.apache.logging.log4j:log4j-core:2.12.3'
|
||||
implementation 'org.slf4j:slf4j-api:1.6.1'
|
||||
implementation 'org.slf4j:slf4j-simple:1.6.1'
|
||||
implementation 'javax.xml.bind:jaxb-api:2.4.0-b180830.0359'
|
||||
implementation 'software.amazon.awssdk:s3:2.30.6'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
package de.jeyp91;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.core.config.Configurator;
|
||||
import org.apache.logging.log4j.core.config.builder.api.ConfigurationBuilder;
|
||||
import org.apache.logging.log4j.core.config.builder.api.ConfigurationBuilderFactory;
|
||||
import org.apache.logging.log4j.core.config.builder.api.RootLoggerComponentBuilder;
|
||||
import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import de.jeyp91.apifootball.APIFootballUpdater;
|
||||
import de.jeyp91.tippliga.TLWMatchdaysUpdater;
|
||||
@@ -33,18 +28,11 @@ public class App {
|
||||
private static int season;
|
||||
private static int league;
|
||||
private static String configFile;
|
||||
private static final Logger logger = LogManager.getLogger(App.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(App.class);
|
||||
|
||||
public static void main(String[] args) {
|
||||
ConfigurationBuilder<BuiltConfiguration> builder
|
||||
= ConfigurationBuilderFactory.newConfigurationBuilder();
|
||||
|
||||
RootLoggerComponentBuilder rootLogger
|
||||
= builder.newRootLogger(Level.ERROR);
|
||||
|
||||
builder.add(rootLogger);
|
||||
Configurator.initialize(builder.build());
|
||||
Configurator.setRootLevel(Level.INFO);
|
||||
// SLF4J does not require explicit configuration here
|
||||
// Configuration can be done via an external configuration file (e.g., logback.xml)
|
||||
initOptions(args);
|
||||
String sql = "";
|
||||
String beautifulInfo = "";
|
||||
|
||||
@@ -3,8 +3,8 @@ package de.jeyp91.apifootball;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
@@ -17,7 +17,7 @@ public class APIFootballConnector {
|
||||
private final int season;
|
||||
private final HashMap<Integer, JSONObject> rounds = new HashMap<>();
|
||||
private final HashMap<Integer, JSONObject> matches = new HashMap<>();
|
||||
private static final Logger logger = LogManager.getLogger(APIFootballConnector.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(APIFootballConnector.class);
|
||||
|
||||
private APIFootballConnector(int season) {
|
||||
this.season = season;
|
||||
|
||||
@@ -8,8 +8,8 @@ import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
@@ -19,7 +19,7 @@ import de.jeyp91.S3Provider;
|
||||
|
||||
public class APIFootballUpdater {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(APIFootballUpdater.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(APIFootballUpdater.class);
|
||||
private static final String baseurl = "https://v3.football.api-sports.io/";
|
||||
|
||||
public APIFootballUpdater() {
|
||||
|
||||
@@ -11,7 +11,6 @@ import com.google.auth.oauth2.GoogleCredentials;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class GoogleCalendarConnector {
|
||||
private static final String APPLICATION_NAME = "Google Calendar API Java Quickstart";
|
||||
|
||||
@@ -7,8 +7,8 @@ import com.google.api.services.calendar.model.EventDateTime;
|
||||
import com.google.api.services.calendar.model.Events;
|
||||
import de.jeyp91.tippliga.TLWMatchday;
|
||||
import de.jeyp91.tippligaforum.TippligaSQLConnector;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
@@ -23,7 +23,7 @@ import static de.jeyp91.googlecalendar.GoogleCalendarConnector.getSerivce;
|
||||
public class TippligaGoogleEventManager {
|
||||
|
||||
private static List<Event> allEvents = null;
|
||||
private static final Logger logger = LogManager.getLogger(TippligaGoogleEventManager.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(TippligaGoogleEventManager.class);
|
||||
|
||||
private static final HashMap<String, String> allLeagueNames = new HashMap<>();
|
||||
|
||||
|
||||
@@ -4,14 +4,15 @@ import com.google.common.collect.HashBiMap;
|
||||
import de.jeyp91.ResourceProvider;
|
||||
import de.jeyp91.StatusHolder;
|
||||
import de.jeyp91.apifootball.APIFootballMatch;
|
||||
import org.apache.logging.log4j.*;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class TeamIDMatcher {
|
||||
|
||||
private static HashBiMap<Integer, Integer> ids = null;
|
||||
private static final Logger logger = LogManager.getLogger(TeamIDMatcher.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(TeamIDMatcher.class);
|
||||
private static JSONArray teams;
|
||||
private static boolean init = false;
|
||||
public static final int HOME = 0;
|
||||
|
||||
@@ -8,14 +8,14 @@ import de.jeyp91.App;
|
||||
import de.jeyp91.BaseMatch;
|
||||
import de.jeyp91.teamidmatcher.TeamIDMatcher;
|
||||
import de.jeyp91.apifootball.APIFootballMatch;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class TLWMatch extends BaseMatch{
|
||||
private static final Logger logger = LogManager.getLogger(TLWMatch.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(TLWMatch.class);
|
||||
|
||||
private Integer season = null;
|
||||
private Integer league = null;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package de.jeyp91.tippliga;
|
||||
|
||||
import de.jeyp91.tippligaforum.TippligaSQLConnector;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
@@ -13,7 +13,7 @@ import static de.jeyp91.googlecalendar.TippligaGoogleEventManager.*;
|
||||
|
||||
public class TLWMatchdaysUpdater {
|
||||
|
||||
private final Logger logger = LogManager.getLogger(TLWMatch.class);
|
||||
private final Logger logger = LoggerFactory.getLogger(TLWMatch.class);
|
||||
|
||||
int season;
|
||||
int league;
|
||||
|
||||
@@ -3,8 +3,8 @@ package de.jeyp91.tippliga;
|
||||
import de.jeyp91.ResourceProvider;
|
||||
import de.jeyp91.StatusHolder;
|
||||
import de.jeyp91.tippligaforum.TippligaConfigProvider;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.ArrayList;
|
||||
|
||||
public class TLWMatchesCreatorTipperLeague extends TLWMatchesCreatorBase {
|
||||
|
||||
private final Logger logger = LogManager.getLogger(TLWMatchesCreatorTipperLeague.class);
|
||||
private final Logger logger = LoggerFactory.getLogger(TLWMatchesCreatorTipperLeague.class);
|
||||
|
||||
int season;
|
||||
int league;
|
||||
|
||||
@@ -2,8 +2,8 @@ package de.jeyp91.tippliga;
|
||||
|
||||
import de.jeyp91.ResourceProvider;
|
||||
import de.jeyp91.tippligaforum.TippligaConfigProvider;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.ArrayList;
|
||||
|
||||
public class TLWMatchesCreatorTipperPokal extends TLWMatchesCreatorBase{
|
||||
|
||||
Logger logger = LogManager.getLogger(TLWMatchesCreatorTipperPokal.class);
|
||||
Logger logger = LoggerFactory.getLogger(TLWMatchesCreatorTipperPokal.class);
|
||||
|
||||
int season;
|
||||
int league;
|
||||
|
||||
@@ -5,8 +5,8 @@ import de.jeyp91.apifootball.APIFootballMatchesProvider;
|
||||
import de.jeyp91.teamidmatcher.TeamIDMatcher;
|
||||
import de.jeyp91.tippligaforum.TippligaSQLConnector;
|
||||
import de.jeyp91.tippligaforum.TippligaWebsiteConnector;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
|
||||
public class TLWMatchesResultsUpdater extends TLWMatchesManagerBase {
|
||||
private static final Logger logger = LogManager.getLogger(TLWMatchesResultsUpdater.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(TLWMatchesResultsUpdater.class);
|
||||
|
||||
|
||||
ArrayList<ArrayList<TLWMatch>> tlwMatchesUpdated = new ArrayList<>();
|
||||
|
||||
@@ -5,8 +5,8 @@ import de.jeyp91.teamidmatcher.TeamIDMatcher;
|
||||
import de.jeyp91.apifootball.APIFootballMatch;
|
||||
import de.jeyp91.apifootball.APIFootballMatchesProvider;
|
||||
import de.jeyp91.tippligaforum.TippligaSQLConnector;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.Iterator;
|
||||
import java.util.Objects;
|
||||
|
||||
public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase {
|
||||
private static final Logger logger = LogManager.getLogger(TLWMatchesUpdaterFootball.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(TLWMatchesUpdaterFootball.class);
|
||||
|
||||
ArrayList<TLWMatch> tlwMatchesOriginal;
|
||||
ArrayList<TLWMatch> tlwMatchesUpdated;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package de.jeyp91.tippliga;
|
||||
|
||||
import de.jeyp91.tippligaforum.TippligaSQLConnector;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
@@ -10,7 +10,7 @@ import java.util.Set;
|
||||
|
||||
public class TLWTeamsCreator {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(TLWTeamsCreator.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(TLWTeamsCreator.class);
|
||||
int season;
|
||||
int league;
|
||||
ArrayList<TLWMatch> matches;
|
||||
|
||||
@@ -2,8 +2,8 @@ package de.jeyp91.tippligaforum;
|
||||
|
||||
import de.jeyp91.App;
|
||||
import de.jeyp91.apifootball.APIFootballUpdater;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
@@ -11,7 +11,7 @@ import java.util.HashSet;
|
||||
|
||||
public class MatchesListForumUpdater {
|
||||
private HashSet<Integer> leagues;
|
||||
private static final Logger logger = LogManager.getLogger(MatchesListForumUpdater.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(MatchesListForumUpdater.class);
|
||||
|
||||
public MatchesListForumUpdater(int season) {
|
||||
this.leagues = new APIFootballUpdater().getLeagues(season);
|
||||
|
||||
@@ -6,8 +6,8 @@ import de.jeyp91.tippliga.TLWMatch;
|
||||
import de.jeyp91.tippliga.TLWMatchday;
|
||||
import de.jeyp91.tippliga.TLWTeam;
|
||||
import de.jeyp91.whatsapp.WhatsAppReminder;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
import java.security.MessageDigest;
|
||||
@@ -24,7 +24,7 @@ public class TippligaSQLConnector {
|
||||
|
||||
Connection con;
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(TippligaSQLConnector.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(TippligaSQLConnector.class);
|
||||
private static TippligaSQLConnector tlwSqlCon = null;
|
||||
|
||||
static {
|
||||
@@ -251,7 +251,7 @@ public class TippligaSQLConnector {
|
||||
stmt = con.createStatement();
|
||||
rset = stmt.executeQuery(queryString);
|
||||
} catch (SQLException e) {
|
||||
logger.error(e.getStackTrace());
|
||||
logger.error(e.getMessage());
|
||||
}
|
||||
return rset;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package de.jeyp91.tippligaforum;
|
||||
|
||||
import de.jeyp91.tippliga.TLWMatch;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.*;
|
||||
@@ -23,7 +23,7 @@ public class TippligaWebsiteConnector {
|
||||
CookieManager cm = new CookieManager(null, CookiePolicy.ACCEPT_ALL);
|
||||
|
||||
CookieStore cookieStore = cm.getCookieStore();
|
||||
private static final Logger logger = LogManager.getLogger(TippligaWebsiteConnector.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(TippligaWebsiteConnector.class);
|
||||
private final HttpClient client;
|
||||
private final String username = System.getenv("FORUM_USERNAME");
|
||||
private final String password = System.getenv("FORUM_PASSWORD");
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package de.jeyp91.whatsapp;
|
||||
|
||||
import de.jeyp91.tippligaforum.TippligaSQLConnector;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import java.net.URI;
|
||||
@@ -16,7 +16,7 @@ public class WhatsAppNotifier {
|
||||
private final String host = System.getenv("TLW_WHATSAPP_HOST");
|
||||
private final String port = System.getenv("TLW_WHATSAPP_PORT");
|
||||
private final String apiKey = System.getenv("TLW_WHATSAPP_API_KEY");
|
||||
private static final Logger logger = LogManager.getLogger(WhatsAppNotifier.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(WhatsAppNotifier.class);
|
||||
private final HttpClient client;
|
||||
private final OpenAIConnector openAIConnector = new OpenAIConnector();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user