Skip to content

Commit

Permalink
Another attempt to fix o.o.transport.netty4.OpenSearchLoggingHandlerI…
Browse files Browse the repository at this point in the history
…T fails w/ stack overflow (#2051) (#2055)

Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
(cherry picked from commit 1e5d983)

Co-authored-by: Andriy Redko <andriy.redko@aiven.io>
  • Loading branch information
github-actions[bot] and reta authored Feb 7, 2022
1 parent bd55f0f commit 02ca00f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public class OpenSearchLoggingHandlerIT extends OpenSearchNetty4IntegTestCase {
public void setUp() throws Exception {
super.setUp();
appender = MockLogAppender.createForLoggers(
"^[^\n]+$", /* Only consider single line log statements */
LogManager.getLogger(OpenSearchLoggingHandler.class),
LogManager.getLogger(TransportLogger.class),
LogManager.getLogger(TcpTransport.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,12 @@ public class MockLogAppender extends AbstractAppender implements AutoCloseable {
* write to a closed MockLogAppender instance.
*/
public static MockLogAppender createForLoggers(Logger... loggers) throws IllegalAccessException {
return createForLoggers(".*(\n.*)*", loggers);
}

public static MockLogAppender createForLoggers(String filter, Logger... loggers) throws IllegalAccessException {
final MockLogAppender appender = new MockLogAppender(
RegexFilter.createFilter(".*(\n.*)*", new String[0], false, null, null),
RegexFilter.createFilter(filter, new String[0], false, null, null),
Collections.unmodifiableList(Arrays.asList(loggers))
);
appender.start();
Expand Down

0 comments on commit 02ca00f

Please sign in to comment.