-
Notifications
You must be signed in to change notification settings - Fork 28.7k
[SPARK-26235][Core] Change log level for ClassNotFoundException/NoClassDefFoundError in SparkSubmit to Error #23189
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
Conversation
cc @vanzin This is really trivial, but can be helpful to user in certain case. |
Actually the problem is here:
That particular
Probably should instead use the same
Which should then always print the error regardless of your log4j configuration. |
@vanzin The
My basic point is, the exception/error message should be in the category of |
Test build #99514 has finished for PR 23189 at commit
|
It is. I even copied & pasted the code. I made the change locally and this is what happens:
With your change, if you are using a file appender instead of a console appender, you'll still not see the error on the terminal. For If you want to also write the full exception to the logs, that's fine, but the change I suggested is more correct here considering the use. |
@vanzin Ah, I see. Thanks for pointing it out! But I am now thinking overriding |
Sounds ok. |
@@ -813,14 +813,14 @@ private[spark] class SparkSubmit extends Logging { | |||
mainClass = Utils.classForName(childMainClass) | |||
} catch { | |||
case e: ClassNotFoundException => | |||
logWarning(s"Failed to load $childMainClass.", e) | |||
logError(s"Failed to load class $childMainClass.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I tried append e.getMessage
to the output, but it seems the error message equals the class name childMainClass
. e.g.
Error: Failed to load class foo: foo.
So I think we can output without the exception message.
Test build #99525 has finished for PR 23189 at commit
|
retest this please. |
Test build #99545 has finished for PR 23189 at commit
|
Merged to master |
…ssDefFoundError in SparkSubmit to Error ## What changes were proposed in this pull request? In my local setup, I set log4j root category as ERROR (https://stackoverflow.com/questions/27781187/how-to-stop-info-messages-displaying-on-spark-console , first item show up if we google search "set spark log level".) When I run such command ``` spark-submit --class foo bar.jar ``` Nothing shows up, and the script exits. After quick investigation, I think the log level for ClassNotFoundException/NoClassDefFoundError in SparkSubmit should be ERROR instead of WARN. Since the whole process exit because of the exception/error. Before apache#20925, the message is not controlled by `log4j.rootCategory`. ## How was this patch tested? Manual check. Closes apache#23189 from gengliangwang/changeLogLevel. Authored-by: Gengliang Wang <gengliang.wang@databricks.com> Signed-off-by: Sean Owen <sean.owen@databricks.com>
What changes were proposed in this pull request?
In my local setup, I set log4j root category as ERROR (https://stackoverflow.com/questions/27781187/how-to-stop-info-messages-displaying-on-spark-console , first item show up if we google search "set spark log level".) When I run such command
Nothing shows up, and the script exits.
After quick investigation, I think the log level for ClassNotFoundException/NoClassDefFoundError in SparkSubmit should be ERROR instead of WARN. Since the whole process exit because of the exception/error.
Before #20925, the message is not controlled by
log4j.rootCategory
.How was this patch tested?
Manual check.