Class TLSSyslogConnection

java.lang.Object
ch.admin.bag.covidcertificate.log.syslog.connection.TLSSyslogConnection

public class TLSSyslogConnection
extends Object
  • Constructor Details

    • TLSSyslogConnection

      public TLSSyslogConnection​(String syslogHost, int port, SSLContext sslContext, ch.qos.logback.core.net.ssl.SSLParametersConfiguration sslParameters, int timeoutMillis)
  • Method Details

    • create

      public static TLSSyslogConnection create​(String syslogHost, int port, ch.qos.logback.core.net.ssl.SSLConfiguration ssl, ch.qos.logback.core.spi.ContextAware context, int timeoutMillis) throws GeneralSecurityException
      Throws:
      GeneralSecurityException
    • transmit

      public boolean transmit​(byte[] syslogMessage)
      Writes the messge to the TCP socket's write buffer, attempting to reconnect if necessary
      Returns:
      true if the message has been successfully written to the TCP socket's write buffer, false if any error occurred
    • attemptConnection

      public void attemptConnection()
      Attempts to connect, initializes the clientSocket connected to the syslog server and sets the connection state to connected.

      If the connection attempt is unsuccessful, the error is logged once per application run to stderr, and the connection is left in disconnected state. No exception is thrown in this case to allow logging to the fallback appender or a reconnection attempt in this case.

    • disconnect

      public void disconnect()
    • getLastTransmitError

      public String getLastTransmitError()