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

[STORM-3198] Topology submitters should be able to supply log4j2 conf #2806

Merged
merged 1 commit into from
Sep 10, 2018

Conversation

jacobtolar
Copy link
Contributor

This adds a new config setting, topology.logging.config, that allows a topology submitter to specify an additional log4j2 config to be used via composite configuration.

When the worker starts the -Dlog4j.configurationFile option is modified to include the additional file if requested.

To test, I submitted a topology (FastWordCountTopology):

bin/storm jar -c topology.logging.config=classpath:resources/topology_log4j2.xml ../../../../../examples/storm-starter/target/storm-starter-*.jar org.apache.storm.starter.FastWordCountTopology fwc

topology_log4j2.xml:

<configuration monitorInterval="60" shutdownHook="disable">
<loggers>
    <root>
       <RegexFilter regex=".*Preparing.*" onMatch="DENY" onMismatch="ACCEPT" />
    </root>
    <Logger name="org.apache.storm.metric.LoggingMetricsConsumer">
       <RegexFilter regex=".*Preparing.*" onMatch="DENY" onMismatch="ACCEPT" />
    </Logger>
    <Logger name="STDERR">
       <RegexFilter regex=".*Preparing.*" onMatch="DENY" onMismatch="ACCEPT" />
    </Logger>
    <Logger name="STDOUT">
       <RegexFilter regex=".*Preparing.*" onMatch="DENY" onMismatch="ACCEPT" />
    </Logger>
</loggers>
</configuration>

With this child configuration added, the messages about preparing bolts no longer appear in the worker log.

I also tested changing simply changing the log level in the child log4j2 config and that also works as expected.

pom.xml Outdated
@@ -278,7 +278,7 @@
<netty.version>4.1.25.Final</netty.version>
<sysout-over-slf4j.version>1.0.2</sysout-over-slf4j.version>
<log4j-over-slf4j.version>1.6.6</log4j-over-slf4j.version>
<log4j.version>2.8.2</log4j.version>
<log4j.version>2.11.0</log4j.version>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: The update to log4j2-2.11.0 is not strictly necessary. 2.8.2 supports composite configuration. However, there was a bug in merging filters from child configurations that I got fixed in 2.11.0. If a child configuration added filters and there were none in the parent, the child filter would be ignored.

I would like to add some filters in my topology, so, bumping the version to the one with the fix.

Copy link
Contributor

Choose a reason for hiding this comment

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

Unless we know of a reason not to, we could just bump to the latest version IMO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not aware of any such reason; done

pom.xml Outdated
@@ -278,7 +278,7 @@
<netty.version>4.1.25.Final</netty.version>
<sysout-over-slf4j.version>1.0.2</sysout-over-slf4j.version>
<log4j-over-slf4j.version>1.6.6</log4j-over-slf4j.version>
<log4j.version>2.8.2</log4j.version>
<log4j.version>2.11.0</log4j.version>
Copy link
Contributor

Choose a reason for hiding this comment

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

Unless we know of a reason not to, we could just bump to the latest version IMO.

@jacobtolar
Copy link
Contributor Author

Looks like there are a couple unit tests I need to fix. Probably won't get to that till next week.

Copy link

@danny0405 danny0405 left a comment

Choose a reason for hiding this comment

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

+1, LGTM

Copy link
Contributor

@revans2 revans2 left a comment

Choose a reason for hiding this comment

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

I love the change +1 for that, but @jacobtolar there are unit tests that verify exactly what is coming out on the command line, and they are failing because you changed the order of the commands on the command line.

Please take a look at org.apache.storm.daemon.supervisor.BasicContainerTest

@jacobtolar
Copy link
Contributor Author

Yeah, sorry it took me a while to get to fixing it. Hopefully that does it.

Copy link
Contributor

@kishorvpatil kishorvpatil left a comment

Choose a reason for hiding this comment

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

👍

@srdo
Copy link
Contributor

srdo commented Sep 9, 2018

+1. Please squash to one commit @jacobtolar.

Copy link
Contributor

@revans2 revans2 left a comment

Choose a reason for hiding this comment

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

+1

@jacobtolar
Copy link
Contributor Author

rebased to latest master and squashed into one commit

@asfgit asfgit merged commit 620ccf9 into apache:master Sep 10, 2018
asfgit pushed a commit that referenced this pull request Sep 10, 2018
… STORM-3198

STORM-3198: Topology submitters should be able to supply log4j2 conf

This closes #2806
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.

7 participants