Don't log SocketExceptions. Fixes #9
This commit is contained in:
parent
2ef5146868
commit
8a6482c523
|
@ -16,6 +16,7 @@ import org.apache.logging.log4j.core.appender.AbstractAppender;
|
|||
|
||||
public class TelnetLogAppender extends AbstractAppender
|
||||
{
|
||||
private static final long serialVersionUID = 234234L;
|
||||
|
||||
private final Set<ClientSession> sessions;
|
||||
private final SimpleDateFormat dateFormat;
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.io.IOException;
|
|||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
@ -77,7 +78,14 @@ public final class ClientSession extends Thread
|
|||
syncTerminateSession();
|
||||
}
|
||||
|
||||
writeLine("Logged in as " + username + ".");
|
||||
TelnetLogger.info(clientAddress + " logged in as \"" + username + "\".");
|
||||
|
||||
// Start feeding data to the client.
|
||||
telnet.getPlugin().appender.addSession(this);
|
||||
|
||||
mainLoop();
|
||||
|
||||
syncTerminateSession();
|
||||
}
|
||||
|
||||
|
@ -356,12 +364,6 @@ public final class ClientSession extends Thread
|
|||
return;
|
||||
}
|
||||
|
||||
writeLine("Logged in as " + username + ".");
|
||||
TelnetLogger.info(clientAddress + " logged in as \"" + username + "\".");
|
||||
|
||||
// Start feeding data to the client.
|
||||
telnet.getPlugin().appender.addSession(this);
|
||||
|
||||
// Process commands
|
||||
while (syncIsConnected())
|
||||
{
|
||||
|
@ -371,6 +373,10 @@ public final class ClientSession extends Thread
|
|||
{
|
||||
command = reader.readLine();
|
||||
}
|
||||
catch (SocketException ex)
|
||||
{
|
||||
break;
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
TelnetLogger.severe(ex);
|
||||
|
|
Loading…
Reference in New Issue