When to log a stacktrace for a caught exception

后端 未结 5 1122
萌比男神i
萌比男神i 2020-12-02 00:51

I recently asked whether to report the getMessage() text of a caught exception. Rather surprisingly, most answers misunderstood my question and thought I was asking whether

5条回答
  •  旧时难觅i
    2020-12-02 01:38

    You - the developer - will need the stack trace if you are in an error situation. Hence you need some way of getting it out of the JVM and on to you.

    If you do not log it to a file then what will you do? Files are the most reliable thing available in a JVM so you should at least put it there before sending it on the network.

提交回复
热议问题