static public void main(String[] args) throws Exception {
// Create a SocketAppender connected to hostname:port with a
// reconnection delay of 10000 seconds.
String hostname = "localhost";
int port = 4321;
SocketAppender socketAppender = new SocketAppender();
socketAppender.setRemoteHost(hostname);
socketAppender.setPort(port);
socketAppender.setIncludeCallerData(true);
socketAppender.setReconnectionDelay(new Duration(10000));
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
socketAppender.setContext(lc);
lc.reset();
lc.getStatusManager().add(new OnConsoleStatusListener());
// SocketAppender options become active only after the execution
// of the next statement.
socketAppender.start();
Logger rootLogger = (Logger) LoggerFactory.getLogger(ROOT_LOGGER_NAME);
rootLogger.addAppender(socketAppender);
org.slf4j.Logger logger = LoggerFactory.getLogger(LOGGER_NAME);