[logback-user] logback does not print exception's cause

陌路人 h5ru at qq.com
Wed Jun 10 04:52:14 CEST 2020


Hi,
Firstly thank you for your time.
Sometimes, logback 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, 183.200.25.192:24172, type=websocket, uri=/ws/user/bind, ts=‪1591692869‬} /10.0.0.70:34948 10



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



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 


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20200610/353a78b9/attachment.html>


More information about the logback-user mailing list