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.
Dump Kinesis Client Library (KCL) logs to file
1.7k Views Asked by Sunil Gulabani At
2
There are 2 best solutions below
1
Niketh Sudhakaran
On
You could also use logback.xml
./bin/kcl-bootstrap --java /usr/local/openjdk-8/bin/java --log-configuration ./properties/logback.xml -p ./properties/kcl.properties
Create logback.xml file with following contents
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<appender name="DEBUG" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d [%thread] %-5level %logger{36} [%mdc{ShardId:-NONE}] - %msg %n</pattern>
</encoder>
</appender>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>smlogs.log</file>
<append>true</append>
<!-- set immediateFlush to false for much higher logging throughput -->
<immediateFlush>true</immediateFlush>
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>
</encoder>
</appender>
<root level="DEBUG">
<appender-ref ref="DEBUG" />
<appender-ref ref="FILE" />
</root>
Related Questions in JAVA
- I need the BIRT.war that is compatible with Java 17 and Tomcat 10
- Creating global Class holder
- No method found for class java.lang.String in Kafka
- Issue edit a jtable with a pictures
- getting error when trying to launch kotlin jar file that use supabase "java.lang.NoClassDefFoundError"
- Does the && (logical AND) operator have a higher precedence than || (logical OR) operator in Java?
- Mixed color rendering in a JTable
- HTTPS configuration in Spring Boot, server returning timeout
- How to use Layout to create textfields which dont increase in size?
- Function for making the code wait in javafx
- How to create beans of the same class for multiple template parameters in Spring
- How could you print a specific String from an array with the values of an array from a double array on the same line, using iteration to print all?
- org.telegram.telegrambots.meta.exceptions.TelegramApiException: Bot token and username can't be empty
- Accessing Secret Variables in Classic Pipelines through Java app in Azure DevOps
- Postgres && statement Error in Mybatis Mapper?
Related Questions in JAKARTA-EE
- How can I calculate the number of matches of a jakarta.ejb.ScheduleExpression within a time interval in Java?
- How to connect to cloud sql when using app engine instance in java 21 runtime?
- Glassfish 7.0.12 adds question mark to URL when running JAVA EE Application
- Weblogic: The Message Driven Beans in the war file are not reflecting in Weblogic 14.1.1
- Jakarta EE 10 serializing person entities results in recursion checker exception (from org.eclipse.yasson.internal.serializer.RecursionChecker)
- EJB transactions behaving differently on Wildfly 8 between Windows and Linux deployments
- Is EntityManager injected with @PersistenceContext to a @RequestScoped CDI bean thread-safe?
- Redirect user based on his Role in Jakarta EE web app
- CXF web service deployed with docker compose won't work
- Messages won't reach the JMS backend in Weblogic JMS (BEA Server)
- Using XML as config-property value
- JEE-Transaction- vs. JPA Entity Management
- Jakarta CDI force bean construction/register legacy event listeners
- WildFly localhost 'forbidden' access
- WSSTUBE0025: Error in Verifying Security in the Inbound Message (Security Requirements not met - No Security header in message)
Related Questions in AMAZON-WEB-SERVICES
- S3 integration testing
- How to get content of BLOCK types LAYOUT_TITLE, LAYOUT_SECTION_HEADER and LAYOUT_xx in Textract
- Error **net::ERR_CONNECTION_RESET** error while uploading files to AWS S3 using multipart upload and Pre-Signed URL
- Failed to connect to your instance after deploying mern app on aws ec2 instance when i try to access frontend
- AWS - Tab Schema Conversion don't show up after creating a Migration Project
- Unable to run Bash Script using AWS Custom Lambda Runtime
- Using Amazon managed Prometheus to get EC2 metrics data in Grafana
- AWS Dns record A not navigate to elb
- Connection timed out error with smtp.gmail.com
- AWS Cognito Multi-tenant Integration | Ok to use Client’s Idp?
- Elasticbeanstalk FastAPI application is intermittently not responding to https requests
- Call an External API from AWS Lambda
- Why my mail service api spring isnt working?
- export 'AWSIoTProvider' (imported as 'AWSIoTProvider') was not found in '@aws-amplify/pubsub'
- How to take first x seconds of Audio from a wav file read from AWS S3 as binary stream using Python?
Related Questions in AMAZON-KINESIS
- Lambda retries kinesis event properly processed
- Checkpointing and Locking in Amazon Kinesis using PostgreSQL
- How to do transformations on a json string in a streaming dataframe?
- Incompatible Checkpoint and application versions with AWS Managed Flink
- Can we use PostgreSQL instead of default dynamo db for checkpointing and locking in case of consuming data from Kinesis Using Binder approach
- Cloudwatch Subscription Filter does not ingest logs in Kinesis Data Stream
- Amazon Kinesis Stream name is not taken as per provided application.yml file
- AWS process large batch of small files daily
- IP Camera Integration error with AWS Kinesis Video Streaming
- TimeAt and Latest function not working on Kinesis data viewer
- Spring Cloud Stream Kinesis Binder consumer High Availability using dynamoDB
- Does the Kinesis Input Plugin of LogStash Support Enhanced Fan-Out (EFO)?
- What does the StartingPosition flag of a kinesis event source mapping do?
- Kinesis group video chat (Like zoom) Javascript
- How does lambda function know when new records are pushed to Kinesis?
Related Questions in AMAZON-KCL
- Spring Cloud Stream Kinesis Binder consumer High Availability using dynamoDB
- KCL2 -Multi stream consumer - Configured streams can be in same account and cross account
- Configuring AWS X-Ray with Kinesis KCL 2.0
- Uneven distribution of shards over the consumer application workers in amazon-kinesis-client-python
- How to perfectly use KPL/KCL with spring-cloud-stream-binder-aws-kinesis lib?
- Lease table is not updated when new shards are added causing stale workers in KCL
- AccessDeniedException coming for ListShard Action of Kinesis when trying to setup IAM role policy for spring based application deployed in eks cluster
- KCL 2.x is polling Kinesis stream at slower rate than configured
- Spring Cloud Stream Kinesis Binder 4.0 doesn't support Multi Stream with KCL 2 Enabled
- Kinesis KCL not pulling records from all shards
- Working With KCL 2.x is causing issue while "Syncing Kinesis shard info"
- How to shutdown processRecord method of KCL in case of any error?
- How to configure KCL worker properties for Amazon KCL client
- KCL doesn't PUT or GET and items from DynamoDB checkpoint or locks tables
- Reprocessing messages AWS kinesis data stream message using KCL consumer
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
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.Loginterface in Amazon classes.