Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dump Kinesis Client Library (KCL) logs to file

Am using Kinesis Client Library (KCL) to subscribe to kinesis stream. All the KCL logs are printed on console. I need to dump all the logs to file. I tried adding log4j.properties and common-logging.properties files in src folder, but not able to sort out.

like image 810
Sunil Gulabani Avatar asked Oct 31 '22 08:10

Sunil Gulabani


1 Answers

KCL uses Apache Commons Logging (common-logging) in the background.

Try using slf4j with jcl-over-slf4j dependency included (or logback).

That way, your general log collector (slf4j) will handle both your application logs and the logs generated by org.apache.commons.logging.Log interface in Amazon classes.

  • Sample class in KCL: https://github.com/awslabs/amazon-kinesis-client/blob/c6e393c13ec348f77b8b08082ba56823776ee48a/src/main/java/com/amazonaws/services/kinesis/metrics/impl/CWPublisherRunnable.java
  • SLF4J Bridging: http://www.slf4j.org/legacy.html
like image 160
az3 Avatar answered Nov 08 '22 06:11

az3