-
Notifications
You must be signed in to change notification settings - Fork 90
Provide working maven example #726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I've seen some of these errors as well. Looks like that In the end was able to get both a maven and a gradle lambda working by following the docs. |
Thanks @orozcoadrian that was my original first point of call. Following the install steps then adding the example log4j2.xml into resources, resulted in me getting this error in the Cloudwatch logs:
Since getting the above error, I had a sniff around for examples and came here... It's not entirely clear to me from the docs what other additional dependencies need to be included for this to work re: log4j2. |
Hi @GuyJackson Which version of powertools are you using ? |
I would also recommend using quick start template documented here https://awslabs.github.io/aws-lambda-powertools-java/ to get a sample maven or gradle app. Note, Support for |
Also as @orozcoadrian pointed, please avoid referring |
@pankajagrawal16 thanks for the reply, I'm using
Will see what that produces. |
Cool, Let us know how it goes. :) |
running:
I get errors on windows and linux (on different machines). Windows (11) errors:
WSL2 Linux (Ubuntu) error:
|
Hmm , this seems odd. I cannot seem to replicate this issue on mac atleast. Do you have any more logs to share? |
@pankajagrawal16 My colleague who has a Mac also confirmed it to be working (like you) and shared the generated project with me. I have a suspicion it's perhaps just a windows / linux issue but will share logs when I have looked at it a bit further. Using the generated project shared by my colleague, one thing I did notice was the same issue with this line in
If you leave as is you get this CW error:
Everything else appears to work well. |
Ok great that you got it working. Regarding error on initializing logger, its totally fine to provide class explicitly if log4j is not able to figure it out itself. I suspect this issue https://stackoverflow.com/questions/52953483/logmanager-getlogger-is-unable-to-determine-class-name-on-java-11 might be related with your project. Feel free to close the issue if all is good. |
Thanks @pankajagrawal16 👍🏻 |
I'm trying to trial Powertools in my demo project (specifically around logging).
I've copied this pom in your example repo and get a series of issues in my demo project - when I package (
mvn clean package
) and upload the produced jar to aws.1. Cloudwatch error - Exception when using
private final static Logger log = LogManager.getLogger();
in App class.Resolved by putting in
private final static Logger log = LogManager.getLogger(**App.class**);
2. Cloudwatch error - Exception related to maven shade plugin:
Seems to relate to this stackoverflow post.
Resolved by adding this config to the shade plugin:
3. Cloudwatch warning:
Not entirely sure on the resolution for this but doesn't break things as it stands.
4. Cloudwatch Error related to log4j2.xml which is copied from your repo here.
I don't know how to progress past this.
Many Thanks,
The text was updated successfully, but these errors were encountered: