Hi Jörn,
Thank you a lot a lot :) :) I will try it:)

BR,
Mike(Yu, Chong-Chao)


 




------------------ 原始邮件 ------------------
发件人:&nbsp;"Jörn Huxhorn"<[email protected]&gt;;
发送时间:&nbsp;2020年6月14日(星期天) 晚上10:42
收件人:&nbsp;"logback users list"<[email protected]&gt;;

主题:&nbsp;Re: [logback-user] logback does not print exception's cause



 Hi Mike,


sorry for the late answer. I hope this still helps you.


This stackoverflow answer solves your problem:
https://stackoverflow.com/questions/2411487/nullpointerexception-in-java-with-no-stacktrace#3010106


TL;DR:
You are running into a hotspot optimisation and need to 
add&nbsp;-XX:-OmitStackTraceInFastThrow to your JVM options to “enable” those 
stacktraces.
 

Cheers,Jörn.
 
 

On 10. June 2020 at 04:52:38, 陌路人 ([email protected]) wrote:
 
Hi,
Firstly thank you for your time.
Sometimes, logback&nbsp;does not print exception's cause, I can't use the log 
to fix bug, as followings:


2020-06-09 16:54:32,393 ERROR [task-executor-27] [SimpleDispatcher.java:203] 
Exception occurred during dispatch web socket frame for 
uri[/ws/partydungeon/move] by uid[‪6493203‬].
java.lang.reflect.InvocationTargetException: null
        at sun.reflect.GeneratedMethodAccessor100.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
com.mitu.game.dispatcher.SimpleDispatcher$EventRunnable.doWebSocketMessage(SimpleDispatcher.java:187)
        at 
com.mitu.game.dispatcher.SimpleDispatcher$EventRunnable.run(SimpleDispatcher.java:106)
        at 
com.mitu.game.wrapper.ThreadPoolTaskExecutorEx$SafeRunnable.run(ThreadPoolTaskExecutorEx.java:74)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException: null
2020-06-09 16:54:32,405 INFO [nioEventLoopGroup-3-4] 
[SimpleLoggingHandler.java:35] IN {uid=‪5589867‬, 
forward=183.200.25.192,&nbsp;183.200.25.192:24172, type=websocket, 
uri=/ws/user/bind, ts=‪1591692869‬} /10.0.0.70:34948&nbsp;10



And the code is like:
&nbsp; &nbsp; private void doWebSocketMessage(Event event) {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String uri = "some uri";
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String uid = "some id";
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Object ret = 
action.method.invoke(action.instance, event.getData(), new Object[]{event});
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } catch (Exception ex) {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
logger.error(String.format("Exception occurred during dispatch web socket frame 
for uri[%s] by uid[%s].", uri, uid), ex);
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; }



I tried to look for answers by google and bing, but failed, and I tried to 
reproduce this problem, failed too, the cause can be printed, and it likes:
java.lang.reflect.InvocationTargetException: null
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.mitu.game.Application.main(Application.java:54)
Caused by: java.lang.NullPointerException: null
        at com.mitu.game.Application$T.f(Application.java:42)
        ... 5 common frames omitted&nbsp;


the difference is NativeMethodAccessorImpl vs GeneratedMethodAccessor100, is it 
matter? I steped into the logback code, maybe the target of the exception is 
null, but I do not know the reason:(




Thank you again, for your patient, and sorry for my poor english:(

BR,Mike Yu

_______________________________________________
logback-user mailing list
[email protected]
http://mailman.qos.ch/mailman/listinfo/logback-user
_______________________________________________
logback-user mailing list
[email protected]
http://mailman.qos.ch/mailman/listinfo/logback-user

Reply via email to