Use apm agent for java springboot noerrordata

hello
I have a problem
no error data
Hope to help me thank you!!!

this apm-agent-config
nohup /usr/local/jdk1.8.0_161/bin/java -jar -javaagent:/home/ydbs/socialbureau/elastic-apm-agent-1.3.0.jar
-Delastic.apm.service_name=socialBureau
-Delastic.apm.server_url=http://172.18.108.109:8200
-Delastic.apm.capture_body=all
-Delastic.apm.log_level=TRACE
-Delastic.apm.transaction_sample_rate=1
-Delastic.apm.enable_log_correlation=true
-Delastic.apm.unnest_exceptions=*
-Delastic.apm.log_file=/home/ydbs/socialbureau/elastic-apm.log
-Delastic.apm.application_packages=com.socialBureau.site.socialBureau
-jar /home/ydbs/socialbureau/socialBureau-2.0.0-PRO.jar >> /home/ydbs/socialbureau/logs/log.log 2>&1 &

############################################

cat /home/ydbs/socialbureau/logs/log.log

2019-01-21 09:50:22.910 [http-nio-9014-exec-6] INFO  com.socialBureau.common.filter.UserInfoFilter -===========userValue===============>null
java.lang.NullPointerException
	at com.socialBureau.site.socialBureau.personnel.controller.CertificateController.findFile(CertificateController.java:33)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess


#######################################################
cat /home/ydbs/socialbureau/elastic-apm.log

2019-01-21 09:50:22.908 [http-nio-9014-exec-6] DEBUG co.elastic.apm.agent.impl.ElasticApmTracer - Activating '' 00-ccbdfb750157b9dcf3f4a64183d9b8f8-6978f04a5c35bce7-01 on thread 41
2019-01-21 09:50:22.914 [http-nio-9014-exec-6] DEBUG co.elastic.apm.agent.impl.ElasticApmTracer - Deactivating 'CertificateController#findFile' 00-ccbdfb750157b9dcf3f4a64183d9b8f8-6978f041
2019-01-21 09:50:22.914 [http-nio-9014-exec-6] DEBUG co.elastic.apm.agent.impl.ElasticApmTracer - } endTransaction 'CertificateController#findFile' 00-ccbdfb750157b9dcf3f4a64183d9b8f8-6971
2019-01-21 09:50:22.914 [http-nio-9014-exec-6] TRACE co.elastic.apm.agent.impl.ElasticApmTracer - ending transaction at
java.lang.RuntimeException: this exception is just used to record where the transaction has been ended from
	at co.elastic.apm.agent.impl.ElasticApmTracer.endTransaction(ElasticApmTracer.java:272)
	at co.elastic.apm.agent.impl.transaction.Transaction.doEnd(Transaction.java:146)
	at co.elastic.apm.agent.impl.transaction.AbstractSpan.end(AbstractSpan.java:210)
	at co.elastic.apm.agent.impl.transaction.AbstractSpan.end(AbstractSpan.java:197)
	at co.elastic.apm.agent.servlet.ServletTransactionHelper.onAfter(ServletTransactionHelper.java:155)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:168)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)

Hi and thanks for trying out our APM solution!

Looks like com.socialBureau.common.filter.UserInfoFilter is catching the NPE and prints an INFO message. Is that a ServletFilter?
The Java agent reports errors for Transactions/Spans that end with an Exception. A ServletFilter is invoked within a FilterChain, which we instrument to capture transactions so if the Exception is caught without being rethrown within the chain, we don't have visibility to it.

I hope this makes sense.
Eyal.

hello,Thank you very much for your answer
I don't quite follow you
Can you give me a case

The Java agent is instrumenting methods in order to trace them. One of things we instrument in order to trace transactions is javax.servlet.FilterChain#doFilter. This method runs all registered servlet Filters as a chain, then runs the actual servlet (eg Spring's FrameworkServlet or DispatherServlet), which delegates execution to the relevant controller. If the controller is throwing an Exception and this Exception is caught quietly before the FilterChain#doFilter method execution finishes, we don't report this as error.
The rationale is that only unhandled Exceptions are reported, but maybe we need to rethink this. What would you expect to get? All errors in controllers being reported?

Exceptions handled by try are not considered false?
%E5%9B%BE%E7%89%87

We can't see handled Exceptions. For something like that, we may decide to add instrumentation to APIs such as the R.error from the above. However, you don't need to wait for something like that, you can capture such errors programatically using our public API :slight_smile: .
I hope this helps.
Eyal.

I want to get all the error information. Is it ok

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.