New version for our AWS details logger

A while ago we presented a library that helps logging in a text calls a few details about a call you did to AWS. We are more than happy to say that feedback received was very positive and also many improvement ideas have come from you.

Accordingly, we want to announce a new version for this library that includes a few new things:

  • More info about a AWS call are fetched
  • Output can be published in JSON format. This format could be very useful if you want to process the output, like with AWS Athena.

How to do that?

First step is to add our library as a dependency. For a Maven project, just add the following section in your pom.xml. For others, please check this link.

dependency>
 <groupId>cloud.cirrusup</groupId>
 <artifactId>aws-latency-request-log-handler</artifactId>
 <version>1.1.0</version>
</dependency>

Then create a request handler and add it to the AWS client:

AwsLatencyRequestLogHandler handler = new AwsLatencyRequestLogHandler(new JSONPublisher());
dynamoDB.addRequestHandler(handler);   

And the final step is to create a log appender named aws-latency-log.

<appender name="AWS-APPENDER-LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>/var/log/awsLatency.log</file>
    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
     <!-- hourly rollover -->
     <fileNamePattern>/var/log/awsLatency/awsLatency.%d{yyyy-MM-dd-HH}.log</fileNamePattern>
     <!-- keep 2 days' worth of history capped at 500MB total size -->
     <maxHistory>2</maxHistory>
     <totalSizeCap>100MB</totalSizeCap>
    </rollingPolicy>
    <encoder>
     <pattern>[%thread] %-5level - %d{yyyy-MM-dd HH:mm:ss} - %logger{36} - %msg%n</pattern>
    </encoder>
 </appender>

And you are done 🙂 As a conclusion, we can that the library name became a little bit misleading, since it does more than the name suggests. But this is how a project evolve thanks to feedback received from you!

If you want to contribute, let us know. Sources are available on github.

Looking forward to hear your opinion!