Java – What is “~[task/:na]” or “~[na:na]” in the Java stack trace?

What is “~[task/:na]” or “~[na:na]” in the Java stack trace?… here is a solution to the problem.

What is “~[task/:na]” or “~[na:na]” in the Java stack trace?

Java stack traces in AWS Lambda now include something extraneous at the end of each line:

at com.cth.rets.indexer.App.lambda$0(App.java:53) [task/:na]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:792) ~[task/:na]
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:776) ~[task/:na]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[task/:na]
at com.cth.rets.indexer.App.lambdaHandler(App.java:47) [task/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_181]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_181]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_181]
at lambdainternal. EventHandlerLoader$StreamMethodRequestHandler.handleRequest(EventHandlerLoader.java:350) ~[na:na]
at lambdainternal. EventHandlerLoader$2.call(EventHandlerLoader.java:888) ~[na:na]
at lambdainternal. AWSLambda.startRuntime(AWSLambda.java:293) ~[na:na]
at lambdainternal. AWSLambda.<clinit>(AWSLambda.java:64) ~[na:na]
at java.lang.Class.forName0(Native Method) ~[na:1.8.0_181]
at java.lang.Class.forName(Class.java:348) ~[na:1.8.0_181]
at lambdainternal. LambdaRTEntry.main(LambdaRTEntry.java:104) ~[LambdaJavaRTEntry-1.0.jar:na]

What does all this extra little stuff ~[...] mean?

Solution

What do all the little extra ~[...] things mean?

The logging framework uses a tilde to indicate that the class packaging information it displays may or may not be correct.

For example, here is an excerpt from the logback documentation:

when it is unable to guarantee the absolute correctness of the
information, then it will prefix the data with a tilde, i.e. the ‘~’
character.

The left side of : indicates that the jar or resource from which the method is called is unknown, and the NA to the right of : indicates that the version of the resource is unknown.

Related Problems and Solutions