• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java CreateLogGroupRequest类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中com.amazonaws.services.logs.model.CreateLogGroupRequest的典型用法代码示例。如果您正苦于以下问题:Java CreateLogGroupRequest类的具体用法?Java CreateLogGroupRequest怎么用?Java CreateLogGroupRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

CreateLogGroupRequest类属于com.amazonaws.services.logs.model包,在下文中一共展示了CreateLogGroupRequest类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createLogGroupAndLogStreamIfNeeded

点赞 2

import com.amazonaws.services.logs.model.CreateLogGroupRequest; //导入依赖的package包/类
private String createLogGroupAndLogStreamIfNeeded() {
    LOGGER.debug("Attempting to locate the log group [{}]", logGroupName);
    final DescribeLogGroupsResult describeLogGroupsResult =
            awsLogsClient.describeLogGroups(new DescribeLogGroupsRequest().withLogGroupNamePrefix(logGroupName));
    boolean createLogGroup = true;
    if (describeLogGroupsResult != null && describeLogGroupsResult.getLogGroups() != null && !describeLogGroupsResult.getLogGroups().isEmpty()) {
        createLogGroup = !describeLogGroupsResult.getLogGroups().stream().anyMatch(g -> g.getLogGroupName().equals(logGroupName));
    }
    if (createLogGroup) {
        LOGGER.debug("Creating log group [{}]", logGroupName);
        final CreateLogGroupRequest createLogGroupRequest = new CreateLogGroupRequest(logGroupName);
        awsLogsClient.createLogGroup(createLogGroupRequest);
    }
    String logSequenceToken = null;
    boolean createLogStream = true;
    LOGGER.debug("Attempting to locate the log stream [{}] for group [{}]", logStreamName, logGroupName);
    final DescribeLogStreamsRequest describeLogStreamsRequest = new DescribeLogStreamsRequest(logGroupName).withLogStreamNamePrefix(logStreamName);
    final DescribeLogStreamsResult describeLogStreamsResult = awsLogsClient.describeLogStreams(describeLogStreamsRequest);
    if (describeLogStreamsResult != null && describeLogStreamsResult.getLogStreams() != null && !describeLogStreamsResult.getLogStreams().isEmpty()) {
        for (final LogStream ls : describeLogStreamsResult.getLogStreams()) {
            if (logStreamName.equals(ls.getLogStreamName())) {
                createLogStream = false;
                logSequenceToken = ls.getUploadSequenceToken();
                LOGGER.debug("Found log stream [{}] with sequence token [{}]", logStreamName, logSequenceToken);
                break;
            }
        }
    }

    if (createLogStream) {
        LOGGER.debug("Creating log stream [{}] for group [{}]", logStreamName, logGroupName);
        final CreateLogStreamRequest createLogStreamRequest = new CreateLogStreamRequest(logGroupName, logStreamName);
        awsLogsClient.createLogStream(createLogStreamRequest);
    }
    return logSequenceToken;
}
 

开发者ID:mrluo735,
项目名称:cas-5.1.0,
代码行数:37,
代码来源:CloudWatchAppender.java

示例2: verifyLogGroupExists

点赞 2

import com.amazonaws.services.logs.model.CreateLogGroupRequest; //导入依赖的package包/类
private void verifyLogGroupExists() {
	DescribeLogGroupsRequest request = new DescribeLogGroupsRequest().withLogGroupNamePrefix(logGroup);
	DescribeLogGroupsResult result = awsLogsClient.describeLogGroups(request);
	for (LogGroup group : result.getLogGroups()) {
		if (logGroup.equals(group.getLogGroupName())) {
			return;
		}
	}
	if (createLogDests) {
		callLogClientMethod("createLogGroup", new CreateLogGroupRequest(logGroup));
	} else {
		logWarn("Log-group '" + logGroup + "' doesn't exist and not created", null);
	}
}
 

开发者ID:j256,
项目名称:cloudwatch-logback-appender,
代码行数:15,
代码来源:CloudWatchAppender.java

示例3: createLogGroup

点赞 2

import com.amazonaws.services.logs.model.CreateLogGroupRequest; //导入依赖的package包/类
private void createLogGroup() {
    try {
        awsLogs.createLogGroup(new CreateLogGroupRequest().withLogGroupName(logGroupName));
    } catch (final ResourceAlreadyExistsException e) {
        addStatus(new InfoStatus(e.getMessage(), this));
    }
}
 

开发者ID:minijax,
项目名称:minijax,
代码行数:8,
代码来源:CloudWatchAppender.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)