Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove LogstashTcpSocketAppender.remoteHost/port #545

Merged
merged 1 commit into from
Jun 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,6 @@ public abstract class AbstractLogstashTcpSocketAppender<Event extends DeferredPr
SHUTDOWN_IN_PROGRESS_EXCEPTION.setStackTrace(new StackTraceElement[] {new StackTraceElement(AbstractLogstashTcpSocketAppender.TcpSendingEventHandler.class.getName(), "onEvent(..)", null, -1)});
}

/**
* The host to which to connect and send events
*/
private String remoteHost;

/**
* The TCP port on the host to which to connect and send events
*/
private int port = DEFAULT_PORT;

/**
* Destinations to which to attempt to send logs, in order of preference.
* <p>
Expand Down Expand Up @@ -908,27 +898,6 @@ public synchronized void start() {
addError("No encoder was configured. Use <encoder> to specify the fully qualified class name of the encoder to use");
}

/*
* Destinations can be configured via <remoteHost>/<port> OR <destination> but not both!
*/
if (!destinations.isEmpty() && remoteHost != null) {
errorCount++;
addError("Use '<remoteHost>/<port>' or '<destination>' but not both");
}

/*
* Handle destination specified using <remoteHost>/<port>
*/
if (remoteHost != null) {
addWarn("<remoteHost>/<port> are DEPRECATED, use <destination> instead");
try {
addDestinations(InetSocketAddress.createUnresolved(remoteHost, port));
} catch (IllegalArgumentException e) {
errorCount++;
addError(e.getMessage());
}
}

/*
* Make sure at least one destination has been specified
*/
Expand Down Expand Up @@ -1059,45 +1028,14 @@ public void setSocketFactory(SocketFactory socketFactory) {
this.socketFactory = socketFactory;
}

/**
* The host to which to connect and send events
*
* @deprecated use {@link #addDestination(String)} instead
*/
@Deprecated
public void setRemoteHost(String host) {
remoteHost = host;
}

@Deprecated
public String getRemoteHost() {
return remoteHost;
}

/**
* The TCP port on the host to which to connect and send events
*
* @deprecated use {@link #addDestination(String)} instead
*/
@Deprecated
public void setPort(int port) {
this.port = port;
}

@Deprecated
public int getPort() {
return port;
}

/**
* Adds the given destination (or destinations) to the list of potential destinations
* to which to send logs.
* <p>
*
* The string is a comma separated list of destinations in the form of hostName[:portNumber].
* <p>
* If portNumber is not provided, then the configured {@link #port} will be used,
* which defaults to {@value #DEFAULT_PORT}
* If portNumber is not provided, then the default ({@value #DEFAULT_PORT}) will be used
* <p>
*
* For example, "host1.domain.com,host2.domain.com:5560"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -575,22 +575,6 @@ public void testDestination_None() {
Assertions.assertFalse(appender.isStarted());
}


/**
* Specify destinations using both <remoteHost>/<port> and <destination>.
* Only one scheme can be used - make sure the appender refuses to start.
*/
@Test
@SuppressWarnings("deprecation")
public void testDestination_MixedType() {
appender.setRemoteHost("localhost");
appender.setPort(10000);
appender.addDestination("localhost:10001");

appender.start();
Assertions.assertFalse(appender.isStarted());
}

@Test
public void testRoundRobin() throws Exception {
appender.addDestination("localhost:10000");
Expand Down