Search in sources :

Example 1 with AbstractSocketManager

use of org.apache.logging.log4j.core.net.AbstractSocketManager in project logging-log4j2 by apache.

the class SyslogAppenderConfigurationTest method checkProtocol.

private void checkProtocol(final Protocol expected, final Configuration configuration) {
    final Map<String, Appender> appenders = configuration.getAppenders();
    assertNotNull(appenders);
    final String appenderName = "syslog";
    final Appender appender = appenders.get(appenderName);
    assertNotNull(appender, "Missing appender " + appenderName);
    final SocketAppender socketAppender = (SocketAppender) appender;
    @SuppressWarnings("resource") final AbstractSocketManager manager = socketAppender.getManager();
    final String prefix = expected + ":";
    assertTrue(manager.getName().startsWith(prefix), () -> String.format("'%s' does not start with '%s'", manager.getName(), prefix));
}
Also used : SocketAppender(org.apache.logging.log4j.core.appender.SocketAppender) Appender(org.apache.logging.log4j.core.Appender) AbstractSocketManager(org.apache.logging.log4j.core.net.AbstractSocketManager) SocketAppender(org.apache.logging.log4j.core.appender.SocketAppender)

Aggregations

Appender (org.apache.logging.log4j.core.Appender)1 SocketAppender (org.apache.logging.log4j.core.appender.SocketAppender)1 AbstractSocketManager (org.apache.logging.log4j.core.net.AbstractSocketManager)1