private List<LogMessage> attemptToSend(List<LogMessage> batch)
{
if (batch.isEmpty())
return batch;
PutLogEventsRequest request = new PutLogEventsRequest()
.withLogGroupName(groupName)
.withLogStreamName(streamName)
.withLogEvents(constructLogEvents(batch));
// sending is all-or-nothing with CloudWatch; we'll return the entire batch
// if there's an exception
try
{
LogStream stream = findLogStream();
request.setSequenceToken(stream.getUploadSequenceToken());
client.putLogEvents(request);
return Collections.emptyList();
}
catch (Exception ex)
{
LogLog.error("failed to send batch", ex);
return batch;
}
}
CloudWatchLogWriter.java 文件源码
java
阅读 25
收藏 0
点赞 0
评论 0
项目:log4j-aws-appenders
作者:
评论列表
文章目录