Skip to content
This repository has been archived by the owner on Apr 3, 2018. It is now read-only.

Updating log configuration from command line #30

Open
naoman opened this issue Feb 25, 2017 · 13 comments
Open

Updating log configuration from command line #30

naoman opened this issue Feb 25, 2017 · 13 comments

Comments

@naoman
Copy link
Collaborator

naoman commented Feb 25, 2017

To enable debug logs, we have to update logback.xml and rebuilding the code. We should be able to configure log levels through command line parameters.

@codefromthecrypt
Copy link

It was very hard to get to the bottom of this. I just solved this in zipkin-dependencies (spark, but not streaming).

https://github.com/openzipkin/zipkin-dependencies/pull/62/files#diff-ddb160535eab74c2106377fdbd2b5c40

The bottom line is that spark really wants you to use log4j :) I will make something similar to this here, if interested.

codefromthecrypt pushed a commit that referenced this issue Mar 7, 2017
Before, we could only control logging by rebuilding. This special-cases
the "zipkin" category such that it can be controlled without
distributing files to the cluster or changing dependencies.

Note: this only special-cases the zipkin log category. Third party code
that logs outside the zipkin category will need to do something more
involved, possibly creating and distributing a log4j.properties file and
enabling it on the executors.

This is a port of work done in openzipkin/zipkin-dependencies#62

Fixes #30
@naoman
Copy link
Collaborator Author

naoman commented Mar 10, 2017

@adriancole Thanks for the fix. It looks good. Do you think this can be extended to spring framework logs as well? I'm interesting in logs like below, to get some insight into the spring magic.

14:16:50.189 [main] DEBUG o.s.b.f.annotation.InjectionMetadata - Registered injected element on class [zipkin.sparkstreaming.job.ZipkinSparkStreamingConfiguration$$EnhancerBySpringCGLIB$$af3c3acd]: AutowiredFieldElement for java.util.List zipkin.sparkstreaming.job.ZipkinSparkStreamingConfiguration.adjusters
14:16:50.190 [main] DEBUG o.s.b.f.annotation.InjectionMetadata - Processing injected element of bean 'zipkinSparkStreamingConfiguration': AutowiredFieldElement for java.util.List zipkin.sparkstreaming.job.ZipkinSparkStreamingConfiguration.adjusters

@naoman naoman reopened this Mar 10, 2017
@codefromthecrypt
Copy link

codefromthecrypt commented Mar 11, 2017 via email

@codefromthecrypt
Copy link

one alternative to whack-a-mole would be to assign the root log level. then when you are debugging something, you set everything to DEBUG (which would work regardless of debugging kafka, zookeeper or spring). That would be more volume than necessary, but would not require in whack-a-mole (ex cherry-picking categories and adding tech debt for each one)

@naoman
Copy link
Collaborator Author

naoman commented Mar 13, 2017

Since we are using Spring framework to build our spark job and its plugins, we should support insights into the framework as first class citizen.

Exposing the root log level can be a good compromise.

@codefromthecrypt
Copy link

codefromthecrypt commented Mar 14, 2017 via email

@codefromthecrypt
Copy link

NEXT STEP:

look into resetting the root logger (possibly via SparkConf if we are lucky enough for that to work). We are probably getting to a point where we'll need to backfill and add integration tests so that if this doesn't work the next one who touches the code isn't in for a hard time.

@naoman
Copy link
Collaborator Author

naoman commented Mar 15, 2017

For example, there's zero
reason we can't ask people to simply distribute log configuration like
normal spark does.

Can you share sample command for this? I tried passing the log config file using the parameters below, but it didn't work. The same parameters work for non-spring spark jobs.

--zipkin.sparkstreaming.conf.spark.executor.extraJavaOptions="-Dlog4j.configuration=file:/tmp/log4j.properties" \
--zipkin.sparkstreaming.conf.spark.driver.extraJavaOptions="-Dlog4j.configuration=file:/tmp/log4j.properties"

@codefromthecrypt
Copy link

codefromthecrypt commented Mar 15, 2017 via email

@naoman
Copy link
Collaborator Author

naoman commented Mar 15, 2017

Each task in spark is me learning how to do something then helping make the
change.

Welcome to my life :) (just switch spark with Spring)

BTW really appreciate your help! Didn't want to burden you with more work. Your earlier messages gave the impression that you have done this already thats why I asked.

@codefromthecrypt
Copy link

codefromthecrypt commented Mar 15, 2017 via email

@naoman
Copy link
Collaborator Author

naoman commented Mar 15, 2017

I'm able to get the log config working in local mode (non-cluster). I'll debug more and try to get it working for the cluster mode as well.

java -Dlog4j.configuration=file:/temp/log4j.properties -jar zipkin-sparkstreaming-job-0.3.1-SNAPSHOT.jar ....

@codefromthecrypt
Copy link

codefromthecrypt commented Mar 15, 2017 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants