speedwing / log4j-cloudwatch-appender

MIT License
24 stars 15 forks source link

com.amazonaws.services.logs.model.InvalidSequenceTokenException: The given sequenceToken is invalid. #8

Closed tdhulster closed 4 years ago

tdhulster commented 6 years ago

Hi,

I'm using JDK 6 and Log4j 1.2.16 and configured my log4j xml as following :

<appender name="CLOUDWATCH" class="com.github.speedwing.log4j.cloudwatch.appender.CloudwatchAppender"> <param name="logGroupName" value="BackorderLogGroup"/> <param name="logStreamName" value="BackorderLogStream"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d %5p %20c{1}:%-4L [%t] - %m%n"/> </layout> </appender> but I get following error when trying to log

com.amazonaws.services.logs.model.InvalidSequenceTokenException: The given sequenceToken is invalid. The next expected sequenceToken is: 49577995201047669753620135554220966790451069419220327442 (Service: AWSLogs; Status Code: 400; Error Code: InvalidSequenceTokenException; Request ID: fcd6f72f-e76c-11e7-9ba4-33c0d99defc0) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1639) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1304) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1056) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:743) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:717) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:699) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:667) at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:649) at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:513) at com.amazonaws.services.logs.AWSLogsClient.doInvoke(AWSLogsClient.java:2414) at com.amazonaws.services.logs.AWSLogsClient.invoke(AWSLogsClient.java:2390) at com.amazonaws.services.logs.AWSLogsClient.executePutLogEvents(AWSLogsClient.java:1925) at com.amazonaws.services.logs.AWSLogsClient.putLogEvents(AWSLogsClient.java:1901) at com.github.speedwing.log4j.cloudwatch.appender.CloudwatchAppender.sendMessages(CloudwatchAppender.java:148) at com.github.speedwing.log4j.cloudwatch.appender.CloudwatchAppender.lambda$initCloudwatchDaemon$1(CloudwatchAppender.java:241) at java.lang.Thread.run(Thread.java:745)

Any idea on how to fix this?