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

Another attempt to fix o.o.transport.netty4.OpenSearchLoggingHandlerIT fails w/ stack overflow #2051

Merged
merged 1 commit into from
Feb 4, 2022
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 @@ -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