mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 04:56:50 +01:00
Handle JUL logger formatting
This commit is contained in:
parent
c098854591
commit
d48bcbe642
1 changed files with 3 additions and 3 deletions
|
@ -5,11 +5,11 @@ import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.logging.Handler;
|
import java.util.logging.ConsoleHandler;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.LogRecord;
|
import java.util.logging.LogRecord;
|
||||||
|
|
||||||
public class ForwardLogHandler extends Handler {
|
public class ForwardLogHandler extends ConsoleHandler {
|
||||||
private Map<String, Logger> cachedLoggers = new ConcurrentHashMap<String, Logger>();
|
private Map<String, Logger> cachedLoggers = new ConcurrentHashMap<String, Logger>();
|
||||||
|
|
||||||
private Logger getLogger(String name) {
|
private Logger getLogger(String name) {
|
||||||
|
@ -25,9 +25,9 @@ public class ForwardLogHandler extends Handler {
|
||||||
@Override
|
@Override
|
||||||
public void publish(LogRecord record) {
|
public void publish(LogRecord record) {
|
||||||
Logger logger = getLogger(record.getLoggerName());
|
Logger logger = getLogger(record.getLoggerName());
|
||||||
String message = record.getMessage();
|
|
||||||
Throwable exception = record.getThrown();
|
Throwable exception = record.getThrown();
|
||||||
Level level = record.getLevel();
|
Level level = record.getLevel();
|
||||||
|
String message = getFormatter().formatMessage(record);
|
||||||
|
|
||||||
if (level == Level.SEVERE) {
|
if (level == Level.SEVERE) {
|
||||||
logger.error(message, exception);
|
logger.error(message, exception);
|
||||||
|
|
Loading…
Reference in a new issue