Remove configruation of LogLevel
This commit is contained in:
parent
7e499348cf
commit
d22ec8c34a
@ -29,8 +29,8 @@ import fr.xephi.authme.listener.PlayerListenerHigherThan18;
|
|||||||
import fr.xephi.authme.listener.PurgeListener;
|
import fr.xephi.authme.listener.PurgeListener;
|
||||||
import fr.xephi.authme.listener.ServerListener;
|
import fr.xephi.authme.listener.ServerListener;
|
||||||
import fr.xephi.authme.logger.ConsoleLogger;
|
import fr.xephi.authme.logger.ConsoleLogger;
|
||||||
import fr.xephi.authme.mail.EmailService;
|
|
||||||
import fr.xephi.authme.logger.ConsoleLoggerFactory;
|
import fr.xephi.authme.logger.ConsoleLoggerFactory;
|
||||||
|
import fr.xephi.authme.mail.EmailService;
|
||||||
import fr.xephi.authme.security.crypts.Sha256;
|
import fr.xephi.authme.security.crypts.Sha256;
|
||||||
import fr.xephi.authme.service.BackupService;
|
import fr.xephi.authme.service.BackupService;
|
||||||
import fr.xephi.authme.service.BukkitService;
|
import fr.xephi.authme.service.BukkitService;
|
||||||
@ -267,7 +267,7 @@ public class AuthMe extends JavaPlugin {
|
|||||||
|
|
||||||
// Get settings and set up logger
|
// Get settings and set up logger
|
||||||
settings = injector.getSingleton(Settings.class);
|
settings = injector.getSingleton(Settings.class);
|
||||||
ConsoleLoggerFactory.reloadSettings(settings);
|
ConsoleLogger.initialize();
|
||||||
OnStartupTasks.setupConsoleFilter(getLogger());
|
OnStartupTasks.setupConsoleFilter(getLogger());
|
||||||
|
|
||||||
// Set all service fields on the AuthMe class
|
// Set all service fields on the AuthMe class
|
||||||
@ -393,7 +393,7 @@ public class AuthMe extends JavaPlugin {
|
|||||||
if (settings != null && settings.getProperty(EmailSettings.SHUTDOWN_MAIL)) {
|
if (settings != null && settings.getProperty(EmailSettings.SHUTDOWN_MAIL)) {
|
||||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy'.'MM'.'dd'.' HH:mm:ss");
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy'.'MM'.'dd'.' HH:mm:ss");
|
||||||
Date date = new Date(System.currentTimeMillis());
|
Date date = new Date(System.currentTimeMillis());
|
||||||
emailService.sendShutDown(settings.getProperty(EmailSettings.SHUTDOWN_MAIL_ADDRESS),dateFormat.format(date));
|
emailService.sendShutDown(settings.getProperty(EmailSettings.SHUTDOWN_MAIL_ADDRESS), dateFormat.format(date));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do backup on stop if enabled
|
// Do backup on stop if enabled
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import static ch.jalu.configme.properties.PropertyInitializer.newLowercaseString
|
|||||||
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
|
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
|
||||||
|
|
||||||
public final class PluginSettings implements SettingsHolder {
|
public final class PluginSettings implements SettingsHolder {
|
||||||
|
|
||||||
@Comment({
|
@Comment({
|
||||||
"Should we execute /help command when unregistered players press Shift+F?",
|
"Should we execute /help command when unregistered players press Shift+F?",
|
||||||
"This keeps compatibility with some menu plugins",
|
"This keeps compatibility with some menu plugins",
|
||||||
|
|||||||
@ -1,9 +1,6 @@
|
|||||||
package fr.xephi.authme.logger;
|
package fr.xephi.authme.logger;
|
||||||
|
|
||||||
import com.google.common.base.Throwables;
|
import com.google.common.base.Throwables;
|
||||||
import fr.xephi.authme.settings.Settings;
|
|
||||||
import fr.xephi.authme.settings.properties.PluginSettings;
|
|
||||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
|
||||||
import fr.xephi.authme.util.ExceptionUtils;
|
import fr.xephi.authme.util.ExceptionUtils;
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
@ -67,11 +64,8 @@ public final class ConsoleLogger {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets logging settings which are shared by all logger instances.
|
* Sets logging settings which are shared by all logger instances.
|
||||||
*
|
|
||||||
* @param settings the settings to read from
|
|
||||||
*/
|
*/
|
||||||
public static void initializeSharedSettings(Settings settings) {
|
public static void initialize(boolean useLogging) {
|
||||||
boolean useLogging = settings.getProperty(SecuritySettings.USE_LOGGING);
|
|
||||||
if (useLogging) {
|
if (useLogging) {
|
||||||
initializeFileWriter();
|
initializeFileWriter();
|
||||||
} else {
|
} else {
|
||||||
@ -79,13 +73,37 @@ public final class ConsoleLogger {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public static void initialize() {
|
||||||
* Sets logging settings which are individual to all loggers.
|
initialize(true);
|
||||||
*
|
}
|
||||||
* @param settings the settings to read from
|
|
||||||
*/
|
// Disabled
|
||||||
public void initializeSettings(Settings settings) {
|
// /**
|
||||||
this.logLevel = settings.getProperty(PluginSettings.LOG_LEVEL);
|
// * Sets logging settings which are shared by all logger instances.
|
||||||
|
// *
|
||||||
|
// * @param settings the settings to read from
|
||||||
|
// */
|
||||||
|
// public static void initializeSharedSettings(Settings settings) {
|
||||||
|
// boolean useLogging = settings.getProperty(SecuritySettings.USE_LOGGING);
|
||||||
|
// if (useLogging) {
|
||||||
|
// initializeFileWriter();
|
||||||
|
// } else {
|
||||||
|
// closeFileWriter();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Disabled
|
||||||
|
// /**
|
||||||
|
// * Sets logging settings which are individual to all loggers.
|
||||||
|
// *
|
||||||
|
// * @param settings the settings to read from
|
||||||
|
// */
|
||||||
|
// public void initializeSettings(Settings settings) {
|
||||||
|
// this.logLevel = settings.getProperty(PluginSettings.LOG_LEVEL);
|
||||||
|
// }
|
||||||
|
|
||||||
|
public void setLogLevel(LogLevel level) {
|
||||||
|
logLevel = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LogLevel getLogLevel() {
|
public LogLevel getLogLevel() {
|
||||||
@ -286,4 +304,5 @@ public final class ConsoleLogger {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,7 +1,5 @@
|
|||||||
package fr.xephi.authme.logger;
|
package fr.xephi.authme.logger;
|
||||||
|
|
||||||
import fr.xephi.authme.settings.Settings;
|
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
@ -11,7 +9,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
public final class ConsoleLoggerFactory {
|
public final class ConsoleLoggerFactory {
|
||||||
|
|
||||||
private static final Map<String, ConsoleLogger> consoleLoggers = new ConcurrentHashMap<>();
|
private static final Map<String, ConsoleLogger> consoleLoggers = new ConcurrentHashMap<>();
|
||||||
private static Settings settings;
|
|
||||||
|
|
||||||
private ConsoleLoggerFactory() {
|
private ConsoleLoggerFactory() {
|
||||||
}
|
}
|
||||||
@ -27,28 +24,12 @@ public final class ConsoleLoggerFactory {
|
|||||||
return consoleLoggers.computeIfAbsent(name, ConsoleLoggerFactory::createLogger);
|
return consoleLoggers.computeIfAbsent(name, ConsoleLoggerFactory::createLogger);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets up all loggers according to the properties returned by the settings instance.
|
|
||||||
*
|
|
||||||
* @param settings the settings instance
|
|
||||||
*/
|
|
||||||
public static void reloadSettings(Settings settings) {
|
|
||||||
ConsoleLoggerFactory.settings = settings;
|
|
||||||
ConsoleLogger.initializeSharedSettings(settings);
|
|
||||||
|
|
||||||
consoleLoggers.values()
|
|
||||||
.forEach(logger -> logger.initializeSettings(settings));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getTotalLoggers() {
|
public static int getTotalLoggers() {
|
||||||
return consoleLoggers.size();
|
return consoleLoggers.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ConsoleLogger createLogger(String name) {
|
private static ConsoleLogger createLogger(String name) {
|
||||||
ConsoleLogger logger = new ConsoleLogger(name);
|
return new ConsoleLogger(name);
|
||||||
if (settings != null) {
|
|
||||||
logger.initializeSettings(settings);
|
|
||||||
}
|
|
||||||
return logger;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,5 +1,4 @@
|
|||||||
dependencies {
|
dependencies {
|
||||||
compileOnly(project(":project:module-common"))
|
|
||||||
compileOnly(project(":project:module-logger"))
|
compileOnly(project(":project:module-logger"))
|
||||||
compileOnly(project(":project:module-util"))
|
compileOnly(project(":project:module-util"))
|
||||||
compileOnly(libs.configme)
|
compileOnly(libs.configme)
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
dependencies {
|
dependencies {
|
||||||
compileOnly(project(":project:module-util"))
|
compileOnly(project(":project:module-util"))
|
||||||
compileOnly(libs.guava)
|
compileOnly(libs.guava)
|
||||||
|
compileOnly(libs.configme)
|
||||||
compileOnly(libs.jalu.injector)
|
compileOnly(libs.jalu.injector)
|
||||||
// PBKDF2 implementation
|
// PBKDF2 implementation
|
||||||
implementation("de.rtner:PBKDF2:1.1.4")
|
implementation("de.rtner:PBKDF2:1.1.4")
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
dependencies {
|
dependencies {
|
||||||
compileOnly(project(":project:module-logger"))
|
compileOnly(project(":project:module-logger"))
|
||||||
compileOnly(project(":project:module-common"))
|
|
||||||
compileOnly(libs.guava)
|
compileOnly(libs.guava)
|
||||||
// String comparison library. Used for dynamic help system.
|
// String comparison library. Used for dynamic help system.
|
||||||
implementation("net.ricecode:string-similarity:1.0.0")
|
implementation("net.ricecode:string-similarity:1.0.0")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user