software.amazon.awssdk.utils.Logger类的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(9.6k)|赞(0)|评价(0)|浏览(340)

本文整理了Java中software.amazon.awssdk.utils.Logger类的一些代码示例,展示了Logger类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger类的具体详情如下:
包路径:software.amazon.awssdk.utils.Logger
类名称:Logger

Logger介绍

暂无

代码示例

代码示例来源:origin: aws/aws-sdk-java-v2

  1. public void buffer(byte read) {
  2. pos = -1;
  3. if (byteBuffered >= maxBufferSize) {
  4. log.debug(() -> "Buffer size " + maxBufferSize
  5. + " has been exceeded and the input stream "
  6. + "will not be repeatable. Freeing buffer memory");
  7. bufferSizeOverflow = true;
  8. } else {
  9. bufferArray[byteBuffered++] = read;
  10. }
  11. }

代码示例来源:origin: aws/aws-sdk-java-v2

  1. @Override
  2. public void connect(SocketAddress endpoint) throws IOException {
  3. log.trace(() -> "connecting to: " + endpoint);
  4. sock.connect(endpoint);
  5. log.debug(() -> "connected to: " + endpoint);
  6. }

代码示例来源:origin: aws/aws-sdk-java-v2

  1. public final void run(String[] args) {
  2. Options options = new Options();
  3. Stream.of(optionsToAdd).forEach(options::addOption);
  4. CommandLineParser parser = new DefaultParser();
  5. HelpFormatter help = new HelpFormatter();
  6. try {
  7. CommandLine commandLine = parser.parse(options, args);
  8. run(commandLine);
  9. } catch (ParseException e) {
  10. log.error(() -> "Invalid input: " + e.getMessage());
  11. help.printHelp(getClass().getSimpleName(), options);
  12. throw new Error();
  13. } catch (Exception e) {
  14. log.error(() -> "Script execution failed.", e);
  15. throw new Error();
  16. }
  17. }

代码示例来源:origin: aws/aws-sdk-java-v2

  1. private void closeStream(SdkHttpFullResponse response) {
  2. response.content().ifPresent(i -> {
  3. try {
  4. i.close();
  5. } catch (IOException e) {
  6. log.warn(() -> "Error closing HTTP content.", e);
  7. }
  8. });
  9. }

代码示例来源:origin: aws/aws-sdk-java-v2

  1. @Override
  2. public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
  3. boolean channelInUse = getAttribute(ctx, ChannelAttributeKey.IN_USE).orElse(false);
  4. if (channelInUse) {
  5. ctx.fireExceptionCaught(cause);
  6. } else {
  7. ctx.close();
  8. Optional<CompletableFuture<Void>> executeFuture = getAttribute(ctx, ChannelAttributeKey.EXECUTE_FUTURE_KEY);
  9. if (executeFuture.isPresent() && !executeFuture.get().isDone()) {
  10. log.error(() -> "An exception occurred on an channel (" + ctx.channel().id() + ") that was not in use, " +
  11. "but was associated with a future that wasn't completed. This indicates a bug in the " +
  12. "Java SDK, where a future was not completed while the channel was in use. The channel has " +
  13. "been closed, and the future will be completed to prevent any ongoing issues.", cause);
  14. executeFuture.get().completeExceptionally(cause);
  15. } else if (cause instanceof IOException) {
  16. log.debug(() -> "An I/O exception (" + cause.getMessage() + ") occurred on a channel (" + ctx.channel().id() +
  17. ") that was not in use. The channel has been closed. This is usually normal.");
  18. } else {
  19. log.warn(() -> "A non-I/O exception occurred on a channel (" + ctx.channel().id() + ") that was not in use. " +
  20. "The channel has been closed to prevent any ongoing issues.", cause);
  21. }
  22. }
  23. }

代码示例来源:origin: aws/aws-sdk-java-v2

  1. @Override
  2. public Socket connectSocket(
  3. final int connectTimeout,
  4. final Socket socket,
  5. final HttpHost host,
  6. final InetSocketAddress remoteAddress,
  7. final InetSocketAddress localAddress,
  8. final HttpContext context) throws IOException {
  9. log.trace(() -> String.format("Connecting to %s:%s", remoteAddress.getAddress(), remoteAddress.getPort()));
  10. Socket connectedSocket = super.connectSocket(connectTimeout, socket, host, remoteAddress, localAddress, context);
  11. if (connectedSocket instanceof SSLSocket) {
  12. return new SdkSslSocket((SSLSocket) connectedSocket);
  13. }
  14. return new SdkSocket(connectedSocket);
  15. }

代码示例来源:origin: software.amazon.awssdk/sdk-core

  1. Files.deleteIfExists(path);
  2. } catch (IOException deletionException) {
  3. Logger.loggerFor(ResponseTransformer.class)
  4. .error(() -> "Failed to delete destination file '" + path +
  5. "' after reading the service response " +
  6. "failed.", deletionException);

代码示例来源:origin: aws/aws-sdk-java-v2

  1. public abstract class Cli {
  2. private final Logger log = Logger.loggerFor(Cli.class);
  3. private final Option[] optionsToAdd;

代码示例来源:origin: aws/aws-sdk-java-v2

  1. private void copyFile(Path source, Path destination) throws IOException {
  2. if (source != null && Files.isRegularFile(source)) {
  3. log.info(() -> "Copying " + source + " to " + destination);
  4. FileUtils.copyFile(source.toFile(), destination.toFile());
  5. }
  6. }
  7. }

代码示例来源:origin: software.amazon.awssdk/aws-xml-protocol

  1. private void closeStream(SdkHttpFullResponse response) {
  2. response.content().ifPresent(i -> {
  3. try {
  4. i.close();
  5. } catch (IOException e) {
  6. log.warn(() -> "Error closing HTTP content.", e);
  7. }
  8. });
  9. }

代码示例来源:origin: software.amazon.awssdk/netty-nio-client

  1. @Override
  2. public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
  3. boolean channelInUse = getAttribute(ctx, ChannelAttributeKey.IN_USE).orElse(false);
  4. if (channelInUse) {
  5. ctx.fireExceptionCaught(cause);
  6. } else {
  7. ctx.close();
  8. Optional<CompletableFuture<Void>> executeFuture = getAttribute(ctx, ChannelAttributeKey.EXECUTE_FUTURE_KEY);
  9. if (executeFuture.isPresent() && !executeFuture.get().isDone()) {
  10. log.error(() -> "An exception occurred on an channel (" + ctx.channel().id() + ") that was not in use, " +
  11. "but was associated with a future that wasn't completed. This indicates a bug in the " +
  12. "Java SDK, where a future was not completed while the channel was in use. The channel has " +
  13. "been closed, and the future will be completed to prevent any ongoing issues.", cause);
  14. executeFuture.get().completeExceptionally(cause);
  15. } else if (cause instanceof IOException) {
  16. log.debug(() -> "An I/O exception (" + cause.getMessage() + ") occurred on a channel (" + ctx.channel().id() +
  17. ") that was not in use. The channel has been closed. This is usually normal.");
  18. } else {
  19. log.warn(() -> "A non-I/O exception occurred on a channel (" + ctx.channel().id() + ") that was not in use. " +
  20. "The channel has been closed to prevent any ongoing issues.", cause);
  21. }
  22. }
  23. }

代码示例来源:origin: aws/aws-sdk-java-v2

  1. @SuppressWarnings("unchecked")
  2. private T unmarshallResponse(SdkHttpFullResponse response) throws Exception {
  3. SdkStandardLogger.REQUEST_LOGGER.trace(() -> "Parsing service response XML.");
  4. T result = unmarshaller.unmarshall(pojoSupplier.apply(response), response);
  5. SdkStandardLogger.REQUEST_LOGGER.trace(() -> "Done parsing service response.");
  6. AwsResponseMetadata responseMetadata = generateResponseMetadata(response);
  7. return (T) result.toBuilder().responseMetadata(responseMetadata).build();
  8. }

代码示例来源:origin: aws/aws-sdk-java-v2

  1. log.info(() -> "Got expected response: " + result);
  2. return result;
  3. } else if (whenToFail.test(result)) {
  4. log.info(() -> "Attempt " + unsuccessfulAttempt + " failed predicate.");
  5. } catch (RuntimeException e) {
  6. Throwable t = e instanceof CompletionException ? e.getCause() : e;
  7. log.info(() -> "Got expected exception: " + t.getClass().getSimpleName());
  8. return null;
  9. log.info(() -> "Attempt " + unsuccessfulAttempt +
  10. " failed with an expected exception (" + t.getClass() + ")");
  11. } else {

代码示例来源:origin: software.amazon.awssdk/auth

  1. public void buffer(byte read) {
  2. pos = -1;
  3. if (byteBuffered >= maxBufferSize) {
  4. log.debug(() -> "Buffer size " + maxBufferSize
  5. + " has been exceeded and the input stream "
  6. + "will not be repeatable. Freeing buffer memory");
  7. bufferSizeOverflow = true;
  8. } else {
  9. bufferArray[byteBuffered++] = read;
  10. }
  11. }

代码示例来源:origin: aws/aws-sdk-java-v2

  1. @Override
  2. public void connect(SocketAddress endpoint, int timeout) throws IOException {
  3. log.trace(() -> "connecting to: " + endpoint);
  4. sock.connect(endpoint, timeout);
  5. log.debug(() -> "connected to: " + endpoint);
  6. }

代码示例来源:origin: aws/aws-sdk-java-v2

  1. @Override
  2. public String getEnumValueName(String enumValue) {
  3. String result = enumValue;
  4. // Special cases
  5. result = result.replaceAll("textORcsv", "TEXT_OR_CSV");
  6. // Split into words
  7. result = String.join("_", splitOnWordBoundaries(result));
  8. // Enums should be upper-case
  9. result = StringUtils.upperCase(result);
  10. if (!result.matches("^[A-Z][A-Z0-9_]*$")) {
  11. String attempt = result;
  12. log.warn(() -> "Invalid enum member generated for input '" + enumValue + "'. Best attempt: '" + attempt + "' If this "
  13. + "enum is not customized out, the build will fail.");
  14. }
  15. return result;
  16. }

代码示例来源:origin: software.amazon.awssdk/aws-xml-protocol

  1. @SuppressWarnings("unchecked")
  2. private T unmarshallResponse(SdkHttpFullResponse response) throws Exception {
  3. SdkStandardLogger.REQUEST_LOGGER.trace(() -> "Parsing service response XML.");
  4. T result = unmarshaller.unmarshall(pojoSupplier.apply(response), response);
  5. SdkStandardLogger.REQUEST_LOGGER.trace(() -> "Done parsing service response.");
  6. AwsResponseMetadata responseMetadata = generateResponseMetadata(response);
  7. return (T) result.toBuilder().responseMetadata(responseMetadata).build();
  8. }

代码示例来源:origin: software.amazon.awssdk/test-utils

  1. log.info(() -> "Got expected response: " + result);
  2. return result;
  3. } else if (whenToFail.test(result)) {
  4. log.info(() -> "Attempt " + unsuccessfulAttempt + " failed predicate.");
  5. } catch (RuntimeException e) {
  6. Throwable t = e instanceof CompletionException ? e.getCause() : e;
  7. log.info(() -> "Got expected exception: " + t.getClass().getSimpleName());
  8. return null;
  9. log.info(() -> "Attempt " + unsuccessfulAttempt +
  10. " failed with an expected exception (" + t.getClass() + ")");
  11. } else {

代码示例来源:origin: aws/aws-sdk-java-v2

  1. public void buffer(byte[] src, int srcPos, int length) {
  2. pos = -1;
  3. if (byteBuffered + length > maxBufferSize) {
  4. log.debug(() -> "Buffer size " + maxBufferSize
  5. + " has been exceeded and the input stream "
  6. + "will not be repeatable. Freeing buffer memory");
  7. bufferSizeOverflow = true;
  8. } else {
  9. System.arraycopy(src, srcPos, bufferArray, byteBuffered, length);
  10. byteBuffered += length;
  11. }
  12. }

代码示例来源:origin: aws/aws-sdk-java-v2

  1. @Override
  2. public void connect(SocketAddress endpoint) throws IOException {
  3. log.trace(() -> "connecting to: " + endpoint);
  4. sock.connect(endpoint);
  5. log.debug(() -> "connected to: " + endpoint);
  6. }

相关文章