snowplow / stream-collector

Collector for cloud-native web, mobile and event analytics, running on AWS and GCP
http://snowplowanalytics.com
Other
27 stars 32 forks source link

Bug - AKKA Loglevel setting doesn't work #317

Closed wiktor2200 closed 1 year ago

wiktor2200 commented 1 year ago

Hello! I have an issue with logging from stream collector. I'm running it on Kubernetes cluster using official:

image:
  tag: 2.9.0
  repository: snowplow/scala-stream-collector-pubsub

Logs are emitted on INFO level no matter what. Default log level is set to WARNING here: https://github.com/snowplow/stream-collector/blob/master/pubsub/src/main/resources/application.conf#L32

My config.hocon (for logging part) looks like this:

akka {
  loglevel = WARNING # 'OFF' for no logging, 'DEBUG' for all logging.
  loglevel = ${?AKKA_LOGLEVEL}
  loggers = ["akka.event.slf4j.Slf4jLogger"]
  loggers = [${?AKKA_LOGGERS}]

And akka.loglevel seems not to work properly when it's set to different level (e.g. DEBUG), pods that I'm running got CrashLoopBackOff and containers fails, when I use env AKKA_LOGLEVEL it's the same.

When left unchanged logs are always INFO.

I think it may be a bug, so I'm reporting that. If you have ever faced that issue or know the solution for that, please let me know. :)

benjben commented 1 year ago

Hi @wiktor2200 ,

The log level that you mention is for Akka framework logging.

The logs of the collector (outside Akka) should be configured through JAVA_OPTS : docker run -e JAVA_OPTS="-Dorg.slf4j.simpleLogger.defaultLogLevel=warn" ...

wiktor2200 commented 1 year ago

Hi @benjben! I've tried both AKKA setting and simpleLogger with the same parameters as you mentioned before creating this issue. Have you tested that?

My logs after setting:

akka {
  loglevel = WARNING

Looks like this:

[scala-stream-collector-akka.actor.default-dispatcher-8] INFO com.snowplowanalytics.snowplow.collectors.scalastream.sinks.GooglePubSubSink - Writing 1 records to PubSub topic snowplow-input

So it definitely comes from AKKA dispatcher. You can try it even locally with docker. akka.loglevel setting doesn't work it shows INFO no matter you set.

benjben commented 1 year ago

Hi @wiktor2200 ,

I tested that -Dorg.slf4j.simpleLogger.log.com.snowplowanalytics.snowplow.collectors.scalastream.sinks.GooglePubSubSink=warn removes the line you mentioned.

Also, please see https://github.com/snowplow/stream-collector/issues/321.

We're preparing a patch release that will log this line as DEBUG instead of INFO.

It will be announced on https://discourse.snowplow.io/.

wiktor2200 commented 1 year ago

Hi @benjben! Thanks a lot for you advice. Setting above parameter works. What is more thanks for fixing in 2.9.1, where it's not needed anymore.