本文整理了Java中software.amazon.awssdk.utils.Logger
类的一些代码示例,展示了Logger
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger
类的具体详情如下:
包路径:software.amazon.awssdk.utils.Logger
类名称:Logger
暂无
代码示例来源:origin: aws/aws-sdk-java-v2
public void buffer(byte read) {
pos = -1;
if (byteBuffered >= maxBufferSize) {
log.debug(() -> "Buffer size " + maxBufferSize
+ " has been exceeded and the input stream "
+ "will not be repeatable. Freeing buffer memory");
bufferSizeOverflow = true;
} else {
bufferArray[byteBuffered++] = read;
}
}
代码示例来源:origin: aws/aws-sdk-java-v2
@Override
public void connect(SocketAddress endpoint) throws IOException {
log.trace(() -> "connecting to: " + endpoint);
sock.connect(endpoint);
log.debug(() -> "connected to: " + endpoint);
}
代码示例来源:origin: aws/aws-sdk-java-v2
public final void run(String[] args) {
Options options = new Options();
Stream.of(optionsToAdd).forEach(options::addOption);
CommandLineParser parser = new DefaultParser();
HelpFormatter help = new HelpFormatter();
try {
CommandLine commandLine = parser.parse(options, args);
run(commandLine);
} catch (ParseException e) {
log.error(() -> "Invalid input: " + e.getMessage());
help.printHelp(getClass().getSimpleName(), options);
throw new Error();
} catch (Exception e) {
log.error(() -> "Script execution failed.", e);
throw new Error();
}
}
代码示例来源:origin: aws/aws-sdk-java-v2
private void closeStream(SdkHttpFullResponse response) {
response.content().ifPresent(i -> {
try {
i.close();
} catch (IOException e) {
log.warn(() -> "Error closing HTTP content.", e);
}
});
}
代码示例来源:origin: aws/aws-sdk-java-v2
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
boolean channelInUse = getAttribute(ctx, ChannelAttributeKey.IN_USE).orElse(false);
if (channelInUse) {
ctx.fireExceptionCaught(cause);
} else {
ctx.close();
Optional<CompletableFuture<Void>> executeFuture = getAttribute(ctx, ChannelAttributeKey.EXECUTE_FUTURE_KEY);
if (executeFuture.isPresent() && !executeFuture.get().isDone()) {
log.error(() -> "An exception occurred on an channel (" + ctx.channel().id() + ") that was not in use, " +
"but was associated with a future that wasn't completed. This indicates a bug in the " +
"Java SDK, where a future was not completed while the channel was in use. The channel has " +
"been closed, and the future will be completed to prevent any ongoing issues.", cause);
executeFuture.get().completeExceptionally(cause);
} else if (cause instanceof IOException) {
log.debug(() -> "An I/O exception (" + cause.getMessage() + ") occurred on a channel (" + ctx.channel().id() +
") that was not in use. The channel has been closed. This is usually normal.");
} else {
log.warn(() -> "A non-I/O exception occurred on a channel (" + ctx.channel().id() + ") that was not in use. " +
"The channel has been closed to prevent any ongoing issues.", cause);
}
}
}
代码示例来源:origin: aws/aws-sdk-java-v2
@Override
public Socket connectSocket(
final int connectTimeout,
final Socket socket,
final HttpHost host,
final InetSocketAddress remoteAddress,
final InetSocketAddress localAddress,
final HttpContext context) throws IOException {
log.trace(() -> String.format("Connecting to %s:%s", remoteAddress.getAddress(), remoteAddress.getPort()));
Socket connectedSocket = super.connectSocket(connectTimeout, socket, host, remoteAddress, localAddress, context);
if (connectedSocket instanceof SSLSocket) {
return new SdkSslSocket((SSLSocket) connectedSocket);
}
return new SdkSocket(connectedSocket);
}
代码示例来源:origin: software.amazon.awssdk/sdk-core
Files.deleteIfExists(path);
} catch (IOException deletionException) {
Logger.loggerFor(ResponseTransformer.class)
.error(() -> "Failed to delete destination file '" + path +
"' after reading the service response " +
"failed.", deletionException);
代码示例来源:origin: aws/aws-sdk-java-v2
public abstract class Cli {
private final Logger log = Logger.loggerFor(Cli.class);
private final Option[] optionsToAdd;
代码示例来源:origin: aws/aws-sdk-java-v2
private void copyFile(Path source, Path destination) throws IOException {
if (source != null && Files.isRegularFile(source)) {
log.info(() -> "Copying " + source + " to " + destination);
FileUtils.copyFile(source.toFile(), destination.toFile());
}
}
}
代码示例来源:origin: software.amazon.awssdk/aws-xml-protocol
private void closeStream(SdkHttpFullResponse response) {
response.content().ifPresent(i -> {
try {
i.close();
} catch (IOException e) {
log.warn(() -> "Error closing HTTP content.", e);
}
});
}
代码示例来源:origin: software.amazon.awssdk/netty-nio-client
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
boolean channelInUse = getAttribute(ctx, ChannelAttributeKey.IN_USE).orElse(false);
if (channelInUse) {
ctx.fireExceptionCaught(cause);
} else {
ctx.close();
Optional<CompletableFuture<Void>> executeFuture = getAttribute(ctx, ChannelAttributeKey.EXECUTE_FUTURE_KEY);
if (executeFuture.isPresent() && !executeFuture.get().isDone()) {
log.error(() -> "An exception occurred on an channel (" + ctx.channel().id() + ") that was not in use, " +
"but was associated with a future that wasn't completed. This indicates a bug in the " +
"Java SDK, where a future was not completed while the channel was in use. The channel has " +
"been closed, and the future will be completed to prevent any ongoing issues.", cause);
executeFuture.get().completeExceptionally(cause);
} else if (cause instanceof IOException) {
log.debug(() -> "An I/O exception (" + cause.getMessage() + ") occurred on a channel (" + ctx.channel().id() +
") that was not in use. The channel has been closed. This is usually normal.");
} else {
log.warn(() -> "A non-I/O exception occurred on a channel (" + ctx.channel().id() + ") that was not in use. " +
"The channel has been closed to prevent any ongoing issues.", cause);
}
}
}
代码示例来源:origin: aws/aws-sdk-java-v2
@SuppressWarnings("unchecked")
private T unmarshallResponse(SdkHttpFullResponse response) throws Exception {
SdkStandardLogger.REQUEST_LOGGER.trace(() -> "Parsing service response XML.");
T result = unmarshaller.unmarshall(pojoSupplier.apply(response), response);
SdkStandardLogger.REQUEST_LOGGER.trace(() -> "Done parsing service response.");
AwsResponseMetadata responseMetadata = generateResponseMetadata(response);
return (T) result.toBuilder().responseMetadata(responseMetadata).build();
}
代码示例来源:origin: aws/aws-sdk-java-v2
log.info(() -> "Got expected response: " + result);
return result;
} else if (whenToFail.test(result)) {
log.info(() -> "Attempt " + unsuccessfulAttempt + " failed predicate.");
} catch (RuntimeException e) {
Throwable t = e instanceof CompletionException ? e.getCause() : e;
log.info(() -> "Got expected exception: " + t.getClass().getSimpleName());
return null;
log.info(() -> "Attempt " + unsuccessfulAttempt +
" failed with an expected exception (" + t.getClass() + ")");
} else {
代码示例来源:origin: software.amazon.awssdk/auth
public void buffer(byte read) {
pos = -1;
if (byteBuffered >= maxBufferSize) {
log.debug(() -> "Buffer size " + maxBufferSize
+ " has been exceeded and the input stream "
+ "will not be repeatable. Freeing buffer memory");
bufferSizeOverflow = true;
} else {
bufferArray[byteBuffered++] = read;
}
}
代码示例来源:origin: aws/aws-sdk-java-v2
@Override
public void connect(SocketAddress endpoint, int timeout) throws IOException {
log.trace(() -> "connecting to: " + endpoint);
sock.connect(endpoint, timeout);
log.debug(() -> "connected to: " + endpoint);
}
代码示例来源:origin: aws/aws-sdk-java-v2
@Override
public String getEnumValueName(String enumValue) {
String result = enumValue;
// Special cases
result = result.replaceAll("textORcsv", "TEXT_OR_CSV");
// Split into words
result = String.join("_", splitOnWordBoundaries(result));
// Enums should be upper-case
result = StringUtils.upperCase(result);
if (!result.matches("^[A-Z][A-Z0-9_]*$")) {
String attempt = result;
log.warn(() -> "Invalid enum member generated for input '" + enumValue + "'. Best attempt: '" + attempt + "' If this "
+ "enum is not customized out, the build will fail.");
}
return result;
}
代码示例来源:origin: software.amazon.awssdk/aws-xml-protocol
@SuppressWarnings("unchecked")
private T unmarshallResponse(SdkHttpFullResponse response) throws Exception {
SdkStandardLogger.REQUEST_LOGGER.trace(() -> "Parsing service response XML.");
T result = unmarshaller.unmarshall(pojoSupplier.apply(response), response);
SdkStandardLogger.REQUEST_LOGGER.trace(() -> "Done parsing service response.");
AwsResponseMetadata responseMetadata = generateResponseMetadata(response);
return (T) result.toBuilder().responseMetadata(responseMetadata).build();
}
代码示例来源:origin: software.amazon.awssdk/test-utils
log.info(() -> "Got expected response: " + result);
return result;
} else if (whenToFail.test(result)) {
log.info(() -> "Attempt " + unsuccessfulAttempt + " failed predicate.");
} catch (RuntimeException e) {
Throwable t = e instanceof CompletionException ? e.getCause() : e;
log.info(() -> "Got expected exception: " + t.getClass().getSimpleName());
return null;
log.info(() -> "Attempt " + unsuccessfulAttempt +
" failed with an expected exception (" + t.getClass() + ")");
} else {
代码示例来源:origin: aws/aws-sdk-java-v2
public void buffer(byte[] src, int srcPos, int length) {
pos = -1;
if (byteBuffered + length > maxBufferSize) {
log.debug(() -> "Buffer size " + maxBufferSize
+ " has been exceeded and the input stream "
+ "will not be repeatable. Freeing buffer memory");
bufferSizeOverflow = true;
} else {
System.arraycopy(src, srcPos, bufferArray, byteBuffered, length);
byteBuffered += length;
}
}
代码示例来源:origin: aws/aws-sdk-java-v2
@Override
public void connect(SocketAddress endpoint) throws IOException {
log.trace(() -> "connecting to: " + endpoint);
sock.connect(endpoint);
log.debug(() -> "connected to: " + endpoint);
}
内容来源于网络,如有侵权,请联系作者删除!