Skip to content

Commit

Permalink
Merge pull request #21 from agido-malter/staging
Browse files Browse the repository at this point in the history
fix bug of dead loop when get http 4xx error from Elasticsearch
  • Loading branch information
agido-malter authored Nov 13, 2023
2 parents 6cec924 + 5b163d6 commit 0a5bf69
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v.3.0.9
* fix bug of dead loop when get http 4xx error from Elasticsearch

v.3.0.8
* added enum values for update & delete

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.agido</groupId>
<artifactId>logback-elasticsearch-appender</artifactId>
<version>3.0.8</version>
<version>3.0.9</version>
<packaging>jar</packaging>

<name>Logback Elasticsearch Appender</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ public void sendData() throws IOException {
int rc = urlConnection.getResponseCode();
if (rc != 200) {
String data = slurpErrors(urlConnection);
if(rc >= 400 && rc < 500){
// no chance to recover form these errors and has to drop the log messages in order to avoid dead loop.
errorReporter.logInfo("Send queue cleared - drop log messages due to http 4xx error.");
sendBuffer.setLength(0);
bufferExceeded = false;
}
throw new IOException("Got response code [" + rc + "] from server with data " + data);
}
} finally {
Expand Down

0 comments on commit 0a5bf69

Please sign in to comment.