Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-17 05:20:14 +01:00
Adapt System.(out|err) to log4j.
Dieser Commit ist enthalten in:
Ursprung
1113266823
Commit
68fde1e795
@ -38,6 +38,7 @@ dependencies {
|
||||
compile "org.apache.logging.log4j:log4j-api:${log4jVersion}"
|
||||
compile "org.apache.logging.log4j:log4j-core:${log4jVersion}"
|
||||
compile "org.apache.logging.log4j:log4j-slf4j-impl:${log4jVersion}"
|
||||
compile "org.apache.logging.log4j:log4j-iostreams:${log4jVersion}"
|
||||
|
||||
compile 'net.sf.jopt-simple:jopt-simple:5.0.4' // command-line options
|
||||
compile 'net.minecrell:terminalconsoleappender:1.1.1'
|
||||
@ -63,11 +64,14 @@ shadowJar {
|
||||
exclude 'it/unimi/dsi/fastutil/ints/IntAVL*'
|
||||
exclude 'it/unimi/dsi/fastutil/ints/IntArray*'
|
||||
exclude 'it/unimi/dsi/fastutil/ints/IntBi*'
|
||||
exclude 'it/unimi/dsi/fastutil/ints/IntLinked*'
|
||||
exclude 'it/unimi/dsi/fastutil/ints/IntList*'
|
||||
exclude 'it/unimi/dsi/fastutil/ints/IntOpen*'
|
||||
exclude 'it/unimi/dsi/fastutil/ints/IntRB*'
|
||||
exclude 'it/unimi/dsi/fastutil/ints/IntSet*'
|
||||
exclude 'it/unimi/dsi/fastutil/ints/IntSorted*'
|
||||
exclude 'it/unimi/dsi/fastutil/ints/*Priority*'
|
||||
exclude 'it/unimi/dsi/fastutil/ints/*BigList*'
|
||||
exclude 'it/unimi/dsi/fastutil/io/**'
|
||||
exclude 'it/unimi/dsi/fastutil/longs/**'
|
||||
exclude 'it/unimi/dsi/fastutil/objects/*ObjectArray*'
|
||||
|
@ -146,6 +146,7 @@ public class VelocityServer implements ProxyServer {
|
||||
"console", "cm", "configuration"})
|
||||
void start() {
|
||||
logger.info("Booting up {} {}...", getVersion().getName(), getVersion().getVersion());
|
||||
console.setupStreams();
|
||||
|
||||
serverKeyPair = EncryptionUtils.createRsaKeyPair(1024);
|
||||
|
||||
|
@ -5,14 +5,17 @@ import com.velocitypowered.api.permission.PermissionFunction;
|
||||
import com.velocitypowered.api.permission.Tristate;
|
||||
import com.velocitypowered.api.proxy.ConsoleCommandSource;
|
||||
import com.velocitypowered.proxy.VelocityServer;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.List;
|
||||
import net.kyori.text.Component;
|
||||
import net.kyori.text.TextComponent;
|
||||
import net.kyori.text.format.TextColor;
|
||||
import net.kyori.text.serializer.ComponentSerializers;
|
||||
import net.minecrell.terminalconsole.SimpleTerminalConsole;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.io.IoBuilder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jline.reader.Candidate;
|
||||
import org.jline.reader.LineReader;
|
||||
@ -39,6 +42,15 @@ public final class VelocityConsole extends SimpleTerminalConsole implements Cons
|
||||
return this.permissionFunction.getPermissionValue(permission);
|
||||
}
|
||||
|
||||
public void setupStreams() {
|
||||
System.setOut(IoBuilder.forLogger(logger)
|
||||
.setLevel(Level.INFO)
|
||||
.buildPrintStream());
|
||||
System.setErr(IoBuilder.forLogger(logger)
|
||||
.setLevel(Level.ERROR)
|
||||
.buildPrintStream());
|
||||
}
|
||||
|
||||
public void setupPermissions() {
|
||||
PermissionsSetupEvent event = new PermissionsSetupEvent(this,
|
||||
s -> PermissionFunction.ALWAYS_TRUE);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren