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

Allow multiple consoleAppender to be used in peon logging #14521

Merged
merged 2 commits into from
Jul 18, 2023

Conversation

maytasm
Copy link
Contributor

@maytasm maytasm commented Jul 4, 2023

Fixes ConsoleLoggingEnforcementConfigurationFactory would still enforce an additional ConsoleAppender if there are multiple ConsoleAppender defined

Description

The PR #14094 allow for multiple/existing log4j appenders to be kept when there is a ConsoleAppender configured for a Logger. However, this doesn't work as expected when there are multiple ConsoleAppender defined. The function ConsoleLoggingEnforcementConfigurationFactory#findConsoleAppender currently only considered the first ConsoleAppender it finds and verify that this ConsoleAppender is set in the Loggers. However, this fails to consider that multiple ConsoleAppenders could be defined. When we ensure there is a console logger defined for each Logger (in the function ConsoleLoggingEnforcementConfigurationFactory#applyConsoleAppender), we should make it such that ANY of the defined ConsoleAppender is sufficient (not just the first ConsoleAppender in the list)

This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

Copy link
Contributor

@abhishekrb19 abhishekrb19 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. One minor comment

}
}

@Nullable
private Appender findConsoleAppender()
@NotNull
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be @Nonnull rather than @NotNull as there's no validation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Thanks

@maytasm maytasm requested a review from suneet-s July 4, 2023 02:48
@maytasm
Copy link
Contributor Author

maytasm commented Jul 4, 2023

CC: @suneet-s @TSFenwick

@maytasm maytasm force-pushed the multiple-console-app-peon-log branch from 288f141 to b180154 Compare July 17, 2023 18:50
@suneet-s
Copy link
Contributor

When testing this change without specifying a Console appender, I see this in the task logs.

19:25:12.045 [main] WARN  org.apache.druid.indexing.common.tasklogs.ConsoleLoggingEnforcementConfigurationFactory - Clearing all configured appenders for logger root. Using _Injected_Console_Appender_ instead.
19:25:12.047 [main] WARN  org.apache.druid.indexing.common.tasklogs.ConsoleLoggingEnforcementConfigurationFactory - Clearing all configured appenders for logger root. Using _Injected_Console_Appender_ instead.
19:25:12.047 [main] WARN  org.apache.druid.indexing.common.tasklogs.ConsoleLoggingEnforcementConfigurationFactory - Clearing all configured appenders for logger org.apache.druid.initialization. Using _Injected_Console_Appender_ instead.
19:25:12.047 [main] WARN  org.apache.druid.indexing.common.tasklogs.ConsoleLoggingEnforcementConfigurationFactory - Clearing all configured appenders for logger org.skife.config. Using _Injected_Console_Appender_ instead.
19:25:12.047 [main] WARN  org.apache.druid.indexing.common.tasklogs.ConsoleLoggingEnforcementConfigurationFactory - Clearing all configured appenders for logger org.apache.druid.segment. Using _Injected_Console_Appender_ instead.
19:25:12.047 [main] WARN  org.apache.druid.indexing.common.tasklogs.ConsoleLoggingEnforcementConfigurationFactory - Clearing all configured appenders for logger org.apache.kafka.clients.consumer.internals. Using _Injected_Console_Appender_ instead.
19:25:12.047 [main] WARN  org.apache.druid.indexing.common.tasklogs.ConsoleLoggingEnforcementConfigurationFactory - Clearing all configured appenders for logger org.apache.druid.server.QueryResource. Using _Injected_Console_Appender_ instead.
19:25:12.047 [main] WARN  org.apache.druid.indexing.common.tasklogs.ConsoleLoggingEnforcementConfigurationFactory - Clearing all configured appenders for logger org.apache.druid.server.coordinator. Using _Injected_Console_Appender_ instead.
19:25:12.047 [main] WARN  org.apache.druid.indexing.common.tasklogs.ConsoleLoggingEnforcementConfigurationFactory - Clearing all configured appenders for logger com.sun.jersey.guice. Using _Injected_Console_Appender_ instead.
19:25:12.048 [main] WARN  org.apache.druid.indexing.common.tasklogs.ConsoleLoggingEnforcementConfigurationFactory - Clearing all configured appenders for logger org.apache.druid.server.QueryLifecycle. Using _Injected_Console_Appender_ instead.
2023-07-17 19:25:12,218 main ERROR Attempted to append to non-started appender _Injected_Console_Appender_

I know this is not part of this change, as I have seen this error before this patch. Since you are changing the code, could you look into why the injected console appender is not started

Copy link
Contributor

@suneet-s suneet-s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 on the approach, thank you!

@maytasm
Copy link
Contributor Author

maytasm commented Jul 18, 2023

When testing this change without specifying a Console appender, I see this in the task logs.

19:25:12.045 [main] WARN  org.apache.druid.indexing.common.tasklogs.ConsoleLoggingEnforcementConfigurationFactory - Clearing all configured appenders for logger root. Using _Injected_Console_Appender_ instead.
19:25:12.047 [main] WARN  org.apache.druid.indexing.common.tasklogs.ConsoleLoggingEnforcementConfigurationFactory - Clearing all configured appenders for logger root. Using _Injected_Console_Appender_ instead.
19:25:12.047 [main] WARN  org.apache.druid.indexing.common.tasklogs.ConsoleLoggingEnforcementConfigurationFactory - Clearing all configured appenders for logger org.apache.druid.initialization. Using _Injected_Console_Appender_ instead.
19:25:12.047 [main] WARN  org.apache.druid.indexing.common.tasklogs.ConsoleLoggingEnforcementConfigurationFactory - Clearing all configured appenders for logger org.skife.config. Using _Injected_Console_Appender_ instead.
19:25:12.047 [main] WARN  org.apache.druid.indexing.common.tasklogs.ConsoleLoggingEnforcementConfigurationFactory - Clearing all configured appenders for logger org.apache.druid.segment. Using _Injected_Console_Appender_ instead.
19:25:12.047 [main] WARN  org.apache.druid.indexing.common.tasklogs.ConsoleLoggingEnforcementConfigurationFactory - Clearing all configured appenders for logger org.apache.kafka.clients.consumer.internals. Using _Injected_Console_Appender_ instead.
19:25:12.047 [main] WARN  org.apache.druid.indexing.common.tasklogs.ConsoleLoggingEnforcementConfigurationFactory - Clearing all configured appenders for logger org.apache.druid.server.QueryResource. Using _Injected_Console_Appender_ instead.
19:25:12.047 [main] WARN  org.apache.druid.indexing.common.tasklogs.ConsoleLoggingEnforcementConfigurationFactory - Clearing all configured appenders for logger org.apache.druid.server.coordinator. Using _Injected_Console_Appender_ instead.
19:25:12.047 [main] WARN  org.apache.druid.indexing.common.tasklogs.ConsoleLoggingEnforcementConfigurationFactory - Clearing all configured appenders for logger com.sun.jersey.guice. Using _Injected_Console_Appender_ instead.
19:25:12.048 [main] WARN  org.apache.druid.indexing.common.tasklogs.ConsoleLoggingEnforcementConfigurationFactory - Clearing all configured appenders for logger org.apache.druid.server.QueryLifecycle. Using _Injected_Console_Appender_ instead.
2023-07-17 19:25:12,218 main ERROR Attempted to append to non-started appender _Injected_Console_Appender_

I know this is not part of this change, as I have seen this error before this patch. Since you are changing the code, could you look into why the injected console appender is not started

This error is not introduced by my change. The error is due to the created _Injected_Console_Appender_ not being started. I went and fix this and include it in this PR.

@maytasm maytasm merged commit aef221f into apache:master Jul 18, 2023
@maytasm maytasm deleted the multiple-console-app-peon-log branch July 18, 2023 04:29
sergioferragut pushed a commit to sergioferragut/druid that referenced this pull request Jul 21, 2023
* Allow multiple consoleAppender to be used in peon logging

* Fix Attempted to append to non-started appender error
@LakshSingla LakshSingla added this to the 28.0 milestone Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants