mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Add log4j config (this might work :p)
This commit is contained in:
parent
c6962ef4d2
commit
e84d82315c
@ -37,7 +37,10 @@ dependencies {
|
|||||||
implementation("net.alpenblock:BungeePerms:4.0-dev-106")
|
implementation("net.alpenblock:BungeePerms:4.0-dev-106")
|
||||||
compile("se.hyperver.hyperverse:Core:0.6.0-SNAPSHOT"){ transitive = false }
|
compile("se.hyperver.hyperverse:Core:0.6.0-SNAPSHOT"){ transitive = false }
|
||||||
compile('com.sk89q:squirrelid:1.0.0-SNAPSHOT'){ transitive = false }
|
compile('com.sk89q:squirrelid:1.0.0-SNAPSHOT'){ transitive = false }
|
||||||
compile("org.slf4j:slf4j-jdk14:2.0.0-alpha1")
|
// logging
|
||||||
|
implementation('org.apache.logging.log4j:log4j-slf4j-impl:2.13.3')
|
||||||
|
implementation('org.apache.logging.log4j:log4j-core:2.13.3')
|
||||||
|
implementation('org.apache.logging.log4j:log4j-api:2.13.3')
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
@ -97,12 +100,16 @@ shadowJar {
|
|||||||
include(dependency("org.khelekore:prtree:1.7.0-SNAPSHOT"))
|
include(dependency("org.khelekore:prtree:1.7.0-SNAPSHOT"))
|
||||||
include(dependency("com.sk89q:squirrelid:1.0.0-SNAPSHOT"))
|
include(dependency("com.sk89q:squirrelid:1.0.0-SNAPSHOT"))
|
||||||
include(dependency("org.slf4j:slf4j-jdk14:2.0.0-alpha1"))
|
include(dependency("org.slf4j:slf4j-jdk14:2.0.0-alpha1"))
|
||||||
|
include(dependency('org.apache.logging.log4j:log4j-slf4j-impl:2.13.3'))
|
||||||
|
include(dependency('org.apache.logging.log4j:log4j-core:2.13.3'))
|
||||||
|
include(dependency('org.apache.logging.log4j:log4j-api:2.13.3'))
|
||||||
}
|
}
|
||||||
relocate('net.kyori.text', 'com.plotsquared.formatting.text')
|
relocate('net.kyori.text', 'com.plotsquared.formatting.text')
|
||||||
relocate("io.papermc.lib", "com.plotsquared.bukkit.paperlib")
|
relocate("io.papermc.lib", "com.plotsquared.bukkit.paperlib")
|
||||||
relocate("org.bstats", "com.plotsquared.metrics")
|
relocate("org.bstats", "com.plotsquared.metrics")
|
||||||
relocate('com.sk89q.squirrelid', 'com.plotsquared.squirrelid')
|
relocate('com.sk89q.squirrelid', 'com.plotsquared.squirrelid')
|
||||||
relocate('org.khelekore.prtree', 'com.plotsquared.prtree')
|
relocate('org.khelekore.prtree', 'com.plotsquared.prtree')
|
||||||
|
relocate('org.apache.logging.log4j', 'com.plotsquared.logging')
|
||||||
archiveFileName = "${project.name}-${parent.version}.jar"
|
archiveFileName = "${project.name}-${parent.version}.jar"
|
||||||
destinationDirectory = file "../target"
|
destinationDirectory = file "../target"
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,10 @@ dependencies {
|
|||||||
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.72")
|
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.72")
|
||||||
implementation("org.jetbrains:annotations:19.0.0")
|
implementation("org.jetbrains:annotations:19.0.0")
|
||||||
implementation("org.khelekore:prtree:1.7.0-SNAPSHOT")
|
implementation("org.khelekore:prtree:1.7.0-SNAPSHOT")
|
||||||
implementation("org.slf4j:slf4j-api:2.0.0-alpha1")
|
// logging
|
||||||
|
implementation('org.apache.logging.log4j:log4j-slf4j-impl:2.13.3')
|
||||||
|
implementation('org.apache.logging.log4j:log4j-core:2.13.3')
|
||||||
|
implementation('org.apache.logging.log4j:log4j-api:2.13.3')
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
|
@ -99,8 +99,8 @@ public class Config {
|
|||||||
field.set(instance, value);
|
field.set(instance, value);
|
||||||
return;
|
return;
|
||||||
} catch (final Throwable e) {
|
} catch (final Throwable e) {
|
||||||
logger.atDebug().addArgument(key).addArgument(value).addArgument(root.getSimpleName())
|
logger.debug("Invalid configuration value '{}: {}' in {}", key, value, root.getSimpleName());
|
||||||
.setCause(e).log("Invalid configuration value '{}: {}' in {}");
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -289,9 +289,10 @@ public class Config {
|
|||||||
Field field = instance.getClass().getField(toFieldName(split[split.length - 1]));
|
Field field = instance.getClass().getField(toFieldName(split[split.length - 1]));
|
||||||
setAccessible(field);
|
setAccessible(field);
|
||||||
return field;
|
return field;
|
||||||
} catch (Throwable e) {
|
} catch (final Throwable e) {
|
||||||
logger.atDebug().addArgument(StringMan.join(split, ".")).setCause(e)
|
logger.debug("Invalid config field: {} for {}",
|
||||||
.addArgument(toNodeName(instance.getClass().getSimpleName())).log("Invalid config field: {} for {}");
|
StringMan.join(split, "."), toNodeName(instance.getClass().getSimpleName()));
|
||||||
|
e.printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1735,8 +1735,8 @@ public class Plot {
|
|||||||
|
|
||||||
public boolean claim(@NotNull final PlotPlayer player, boolean teleport, String schematic) {
|
public boolean claim(@NotNull final PlotPlayer player, boolean teleport, String schematic) {
|
||||||
if (!canClaim(player)) {
|
if (!canClaim(player)) {
|
||||||
logger.atDebug().addArgument(player.getName()).addArgument(this.getId().toCommaSeparatedString())
|
logger.debug("Player {} attempted to claim plot {}, but was not allowed",
|
||||||
.log("Player {} attempted to claim plot {}, but was not allowed");
|
player.getName(), this.getId().toCommaSeparatedString());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return claim(player, teleport, schematic, true);
|
return claim(player, teleport, schematic, true);
|
||||||
@ -1835,8 +1835,8 @@ public class Plot {
|
|||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
logger.atInfo().addArgument(this.getId().toCommaSeparatedString())
|
logger.info("Failed to add plot {} to plot area {}",
|
||||||
.addArgument(this.area.toString()).log("Failed to add plot {} to plot area {}");
|
this.getId().toCommaSeparatedString(), this.area.toString());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1934,12 +1934,12 @@ public class Plot {
|
|||||||
*/
|
*/
|
||||||
public boolean moveData(Plot plot, Runnable whenDone) {
|
public boolean moveData(Plot plot, Runnable whenDone) {
|
||||||
if (!this.hasOwner()) {
|
if (!this.hasOwner()) {
|
||||||
logger.atDebug().addArgument(plot).log("{} is unowned (single)");
|
logger.debug("{} is unowned (single)", plot);
|
||||||
TaskManager.runTask(whenDone);
|
TaskManager.runTask(whenDone);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (plot.hasOwner()) {
|
if (plot.hasOwner()) {
|
||||||
logger.atDebug().addArgument(plot).log("{} is unowned (multi)");
|
logger.debug("{} is unowned (multi)", plot);
|
||||||
TaskManager.runTask(whenDone);
|
TaskManager.runTask(whenDone);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -2647,7 +2647,7 @@ public class Plot {
|
|||||||
tmp = this.area.getPlotAbs(this.id.getRelative(Direction.NORTH));
|
tmp = this.area.getPlotAbs(this.id.getRelative(Direction.NORTH));
|
||||||
if (!tmp.getMerged(Direction.SOUTH)) {
|
if (!tmp.getMerged(Direction.SOUTH)) {
|
||||||
// invalid merge
|
// invalid merge
|
||||||
logger.atDebug().addArgument(this).log("Fixing invalid merge: {}");
|
logger.debug("Fixing invalid merge: {}", this);
|
||||||
if (tmp.isOwnerAbs(this.getOwnerAbs())) {
|
if (tmp.isOwnerAbs(this.getOwnerAbs())) {
|
||||||
tmp.getSettings().setMerged(Direction.SOUTH, true);
|
tmp.getSettings().setMerged(Direction.SOUTH, true);
|
||||||
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
||||||
@ -2664,7 +2664,7 @@ public class Plot {
|
|||||||
assert tmp != null;
|
assert tmp != null;
|
||||||
if (!tmp.getMerged(Direction.WEST)) {
|
if (!tmp.getMerged(Direction.WEST)) {
|
||||||
// invalid merge
|
// invalid merge
|
||||||
logger.atDebug().addArgument(this).log("Fixing invalid merge: {}");
|
logger.debug("Fixing invalid merge: {}", this);
|
||||||
if (tmp.isOwnerAbs(this.getOwnerAbs())) {
|
if (tmp.isOwnerAbs(this.getOwnerAbs())) {
|
||||||
tmp.getSettings().setMerged(Direction.WEST, true);
|
tmp.getSettings().setMerged(Direction.WEST, true);
|
||||||
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
||||||
@ -2681,7 +2681,7 @@ public class Plot {
|
|||||||
assert tmp != null;
|
assert tmp != null;
|
||||||
if (!tmp.getMerged(Direction.NORTH)) {
|
if (!tmp.getMerged(Direction.NORTH)) {
|
||||||
// invalid merge
|
// invalid merge
|
||||||
logger.atDebug().addArgument(this).log("Fixing invalid merge: {}");
|
logger.debug("Fixing invalid merge: {}", this);
|
||||||
if (tmp.isOwnerAbs(this.getOwnerAbs())) {
|
if (tmp.isOwnerAbs(this.getOwnerAbs())) {
|
||||||
tmp.getSettings().setMerged(Direction.NORTH, true);
|
tmp.getSettings().setMerged(Direction.NORTH, true);
|
||||||
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
||||||
@ -2697,7 +2697,7 @@ public class Plot {
|
|||||||
tmp = this.area.getPlotAbs(this.id.getRelative(Direction.WEST));
|
tmp = this.area.getPlotAbs(this.id.getRelative(Direction.WEST));
|
||||||
if (!tmp.getMerged(Direction.EAST)) {
|
if (!tmp.getMerged(Direction.EAST)) {
|
||||||
// invalid merge
|
// invalid merge
|
||||||
logger.atDebug().addArgument(this).log("Fixing invalid merge: {}");
|
logger.debug("Fixing invalid merge: {}", this);
|
||||||
if (tmp.isOwnerAbs(this.getOwnerAbs())) {
|
if (tmp.isOwnerAbs(this.getOwnerAbs())) {
|
||||||
tmp.getSettings().setMerged(Direction.EAST, true);
|
tmp.getSettings().setMerged(Direction.EAST, true);
|
||||||
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
||||||
@ -2712,10 +2712,7 @@ public class Plot {
|
|||||||
Plot current;
|
Plot current;
|
||||||
while ((current = frontier.poll()) != null) {
|
while ((current = frontier.poll()) != null) {
|
||||||
if (!current.hasOwner() || current.settings == null) {
|
if (!current.hasOwner() || current.settings == null) {
|
||||||
// Invalid plot
|
logger.debug("Ignoring invalid merged plot: {} | {}", current, current.getOwnerAbs());
|
||||||
// merged onto unclaimed plot
|
|
||||||
logger.atDebug().addArgument(current).addArgument(current.getOwnerAbs())
|
|
||||||
.log("Ignoring invalid merged plot: {} | {}");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
tmpSet.add(current);
|
tmpSet.add(current);
|
||||||
|
@ -1063,13 +1063,12 @@ public abstract class PlotArea {
|
|||||||
try {
|
try {
|
||||||
flags.add(flagInstance.parse(split[1]));
|
flags.add(flagInstance.parse(split[1]));
|
||||||
} catch (final FlagParseException e) {
|
} catch (final FlagParseException e) {
|
||||||
logger.atWarn()
|
logger.warn("Failed to parse default flag with key '{}' and value '{}'. "
|
||||||
.addArgument(e.getFlag().getName())
|
+ "Reason: {}. This flag will not be added as a default flag.",
|
||||||
.addArgument(e.getValue())
|
e.getFlag().getName(),
|
||||||
.addArgument(e.getErrorMessage())
|
e.getValue(),
|
||||||
.setCause(e)
|
e.getErrorMessage());
|
||||||
.log("Failed to parse default flag with key '{}' and value '{}'. "
|
e.printStackTrace();
|
||||||
+ "Reason: {}. This flag will not be added as a default flag.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
13
Core/src/main/resources/log4j.xml
Normal file
13
Core/src/main/resources/log4j.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Configuration status="WARN" packages="com.plotsquared">
|
||||||
|
<Appenders>
|
||||||
|
<Console name="SysOut" target="SYSTEM_OUT">
|
||||||
|
<PatternLayout pattern="%highlight{[P2: %c{1.}][%d{HH:mm:ss}] [%t/%level]: %msg%n%throwable{full}}" />
|
||||||
|
</Console>
|
||||||
|
</Appenders>
|
||||||
|
<Loggers>
|
||||||
|
<Root level="info">
|
||||||
|
<AppenderRef ref="SysOut"/>
|
||||||
|
</Root>
|
||||||
|
</Loggers>
|
||||||
|
</Configuration>
|
Loading…
Reference in New Issue
Block a user