/** * Creates a new audit endpoint that logs to syslog server. */ SyslogAuditEndpoint(Builder builder) throws IOException { SyslogHandler.Protocol protocol = builder.ssl ? Protocol.SSL_TCP : builder.tcp ? Protocol.TCP : Protocol.UDP; syslogHandler = new SyslogHandler(checkNotNullParam("serverAddress", builder.serverAddress), builder.port, Facility.SECURITY, null, protocol, checkNotNullParam("hostName", builder.hostName)); if (builder.tcp && builder.socketFactory != null) { syslogHandler.setOutputStream(new TcpOutputStream(builder.socketFactory, builder.serverAddress, builder.port) { // anonymous class to access protected constructor }); } }
/** * Sets the output stream for the syslog handler to write to. * <p/> * Setting the output stream closes any already established connections or open output streams and will not open * any new connections until the output stream is set to {@code null}. The {@link * #setProtocol(org.jboss.logmanager.handlers.SyslogHandler.Protocol) protocol}, {@link * #setServerAddress(java.net.InetAddress), server address}, {@link #setServerHostname(String) server hostname} or * {@link #setPort(int) port} have no effect when the output stream is set. * * @param out the output stream to write to */ public void setOutputStream(final OutputStream out) { checkAccess(this); setOutputStream(out, true); }
private void init() { if (initializeConnection && !outputStreamSet) { if (serverAddress == null || port < 0 || protocol == null) { throw new IllegalStateException("Invalid connection parameters. The port, server address and protocol must be set."); } initializeConnection = false; final OutputStream out; // Check the sockets try { final ClientSocketFactory clientSocketFactory = getClientSocketFactory(); if (protocol == Protocol.UDP) { out = new UdpOutputStream(clientSocketFactory); } else { out = new TcpOutputStream(clientSocketFactory, blockOnReconnect); } setOutputStream(out, false); } catch (IOException e) { throw new IllegalStateException("Could not set " + protocol + " output stream.", e); } } }
/** * Creates a new audit endpoint that logs to syslog server. */ SyslogAuditEndpoint(Builder builder) throws IOException { SyslogHandler.Protocol protocol = builder.ssl ? Protocol.SSL_TCP : builder.tcp ? Protocol.TCP : Protocol.UDP; syslogHandler = new SyslogHandler(checkNotNullParam("serverAddress", builder.serverAddress), builder.port, Facility.SECURITY, null, protocol, checkNotNullParam("hostName", builder.hostName)); if (builder.tcp && builder.socketFactory != null) { syslogHandler.setOutputStream(new TcpOutputStream(builder.socketFactory, builder.serverAddress, builder.port) { // anonymous class to access protected constructor }); } }
/** * Creates a new audit endpoint that logs to syslog server. */ SyslogAuditEndpoint(Builder builder) throws IOException { SyslogHandler.Protocol protocol = builder.ssl ? Protocol.SSL_TCP : builder.tcp ? Protocol.TCP : Protocol.UDP; syslogHandler = new SyslogHandler(checkNotNullParam("serverAddress", builder.serverAddress), builder.port, Facility.SECURITY, null, protocol, checkNotNullParam("hostName", builder.hostName)); if (builder.tcp && builder.socketFactory != null) { syslogHandler.setOutputStream(new TcpOutputStream(builder.socketFactory, builder.serverAddress, builder.port) { // anonymous class to access protected constructor }); } }
/** * Creates a new audit endpoint that logs to syslog server. */ SyslogAuditEndpoint(Builder builder) throws IOException { SyslogHandler.Protocol protocol = builder.ssl ? Protocol.SSL_TCP : builder.tcp ? Protocol.TCP : Protocol.UDP; syslogHandler = new SyslogHandler(checkNotNullParam("serverAddress", builder.serverAddress), builder.port, Facility.SECURITY, null, protocol, checkNotNullParam("hostName", builder.hostName)); if (builder.tcp && builder.socketFactory != null) { syslogHandler.setOutputStream(new TcpOutputStream(builder.socketFactory, builder.serverAddress, builder.port) { // anonymous class to access protected constructor }); } }
handler.setOutputStream(new SSLContextOutputStream(context, syslogServerAddress, port)); } else { handler.setProtocol(transport == Transport.TCP ? Protocol.TCP : Protocol.SSL_TCP);
handler.setOutputStream(new SSLContextOutputStream(context, syslogServerAddress, port)); } else { handler.setOutputStream(new AuditLogTcpOutputStream(syslogServerAddress, port)); handler.setProtocol(transport == Transport.TCP ? Protocol.TCP : Protocol.SSL_TCP);
handler.setOutputStream(new SSLContextOutputStream(context, syslogServerAddress, port)); } else { handler.setOutputStream(new AuditLogTcpOutputStream(syslogServerAddress, port)); handler.setProtocol(transport == Transport.TCP ? Protocol.TCP : Protocol.SSL_TCP);