Log issues when using the Quarkus Java framework
einarjohnson opened this issue · comments
Hello all,
I am building a Java AWS lambda using the Quarkus framework and I am running into an issue with JSON formatted logs as described here: quarkusio/quarkus#26816
In short, whenever my lambda throws an exception(RuntimeException for instance) the exception trace is outputted by the lambda runtime environment to stdout on a non-json format and that makes my logs pretty useless when using tools like ElasticSearch/Coralogix which expect the logformat to be a structured JSON document.
I am wondering if this could be related to the LambdaRuntime
class and the fact that it uses System.out
to output log messages? See: https://github.com/aws/aws-lambda-java-libs/blob/main/aws-lambda-java-core/src/main/java/com/amazonaws/services/lambda/runtime/LambdaRuntime.java
The reason I point at this particular class is because of the discussion here: https://frank-afriat.medium.com/solving-the-java-aws-lambda-logging-problem
I have tried including the log4j2
dependencies in my project as described here: https://docs.aws.amazon.com/lambda/latest/dg/java-logging.html#java-logging-log4j2
without any luck and I am wondering if there is anything else I need to? Note that Quarkus uses the JBoss logging framework internally so maybe using log4j2 isn't going to work?
Hi, can you try consuming aws-lambda-java-runtime-interface-client from the main branch directly? I believe this PR should fix your problem, but it hasn't been released to maven yet
Thanks for getting back to me on this one @smirnoal, I appreciate your help here.
I am currently using maven/pom.xml to pull in the needed dependencies, which package repository should I use to fetch the main branch aws-lambda-java-runtime-interface-client
dependency?
@smirnoal , any ETA on when this fix will be deployed to Maven?
sorry for delay @einarjohnson. I'm staging new version now, created a PR for it: #398
btw, if you have a chance to consume a locally built artifact to validate the assumption, that would be helpful
apologies for the very late responses here @smirnoal . I did try to locally build the project but ran into all kinds of walls. probably because I am on a Windows environment. Do you have a .jar somewhere available I could try to plug in?
hi, no worries, it's been published to maven. Please try this one: https://mvnrepository.com/artifact/com.amazonaws/aws-lambda-java-runtime-interface-client/2.2.0