Write log messages with lower levels to the log file.

This commit is contained in:
Minecrell 2014-06-24 20:04:46 +02:00 committed by md_5
parent 4cc009a9c0
commit a668da76d0
2 changed files with 7 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package net.md_5.bungee.log;
import java.io.IOException;
import java.util.logging.FileHandler;
import java.util.logging.Formatter;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import net.md_5.bungee.BungeeCord;
@ -16,6 +17,7 @@ public class BungeeLogger extends Logger
public BungeeLogger(BungeeCord bungee)
{
super( "BungeeCord", null );
setLevel( Level.ALL );
try
{
@ -24,6 +26,7 @@ public class BungeeLogger extends Logger
addHandler( fileHandler );
ColouredWriter consoleHandler = new ColouredWriter( bungee.getConsoleReader() );
consoleHandler.setLevel( Level.INFO );
consoleHandler.setFormatter( formatter );
addHandler( consoleHandler );
} catch ( IOException ex )

View File

@ -63,7 +63,10 @@ public class ColouredWriter extends Handler
@Override
public void publish(LogRecord record)
{
print( getFormatter().format( record ) );
if ( isLoggable( record ) )
{
print( getFormatter().format( record ) );
}
}
@Override