Java – how to find the mysterious information being printed?

OK, so I have a very large java project. I have worked for many years (games, if you have to know)

Unfortunately, a mysterious message has begun to be printed No matter how long I search, I can't determine the location of the message

I know you can override the println method. I'm curious if it's possible to attach some debugging information to the printed message? Like a line or file printed from it? I tried to Google this, but it was just too detailed a question for me to find an answer

To make matters worse, the news is very vague It's just "- 1"

At least I now know to use the appropriate logger instead of a simple println ()

Solution

In this case, you can use conditional breakpoints in the IDE This is a very useful feature of the IDE and is not always well known

You set a breakpoint and you want it to pause the application only under certain conditions. In this case, the parameter of the println method is your 'mysterious ufindable string'

In the case of intelllij idea, this would be:

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>