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

feat(log4j):add rollbar support #359

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ libraryDependencies ++= Seq(
"org.apache.avro" % "avro" % "1.8.2" % "provided",
"org.apache.hive" % "hive-jdbc" % "2.3.3" % "provided" excludeAll(excludeNetty, excludeNettyAll, excludeLog4j, excludeParquet),
"org.apache.hadoop" % "hadoop-aws" % "2.7.3" % "provided",
"com.amazon.deequ" % "deequ" % "1.0.4" excludeAll(excludeSpark)
"com.amazon.deequ" % "deequ" % "1.0.4" excludeAll(excludeSpark),
"com.nextdoor.rollbar" % "rollbar-log4j" % "1.0.2"
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Or try fixing with a shutdown hook?

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 the problem is they haven't implemented the close function there...

)

// Temporary fix for https://github.com/databricks/spark-redshift/issues/315#issuecomment-285294306
Expand Down
5 changes: 5 additions & 0 deletions docker/spark/log4j.rollbar.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
log4j.appender.ROLLBAR=com.nextdoor.rollbar.RollbarLog4jAppender
log4j.appender.ROLLBAR.AccessToken=${ROLLBAR_ACCESS_TOKEN}
log4j.appender.ROLLBAR.Environment=${ROLLBAR_ENV:-production}
log4j.appender.ROLLBAR.layout=org.apache.log4j.PatternLayout
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe let's start with error?

log4j.appender.ROLLBAR.Threshold=${ROLLBAR_ENV:-WARN}
Copy link
Contributor

Choose a reason for hiding this comment

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

ROLLBAR_ENV? Warn should be error

5 changes: 5 additions & 0 deletions docker/spark/scripts/init-logs-metrics.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ if [ ! -z ${JSON_LOG} ] ; then
echo "Setting Log type to JSON"
eval "echo \"$(< /spark/conf/log4j.json.properties)\"" >> /spark/conf/log4j.properties
fi

if [ ! -z ${USE_ROLLBAR} ] ; then
echo "Appending Rollbar Logger"
eval "echo \"$(< /spark/conf/log4j.rollbar.properties)\"" >> /spark/conf/log4j.properties
fi
4 changes: 2 additions & 2 deletions src/main/resources/log4j.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

# Set everything to be logged to the console
log4j.rootLogger=INFO,console
log4j.rootLogger=INFO,console,ROLLBAR
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this work if rollbar is not in this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes

log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.target=System.err
log4j.appender.console.layout=org.apache.log4j.PatternLayout
Expand All @@ -38,4 +38,4 @@ log4j.logger.org.apache.hadoop.hive.metastore.RetryingHMSHandler=FATAL
log4j.logger.org.apache.hadoop.hive.ql.exec.FunctionRegistry=ERROR

log4j.logger.com.yotpo.metorikku=INFO
log4j.logger.org.apache.hudi=INFO
log4j.logger.org.apache.hudi=INFO