Messages that you see in the debugger console, or
- information provided by the debugger itself (e.g. breakpoint)
- custom breakpoint related messages
When you add a breakpoint to a line of code, the default behavior of a breakpoint is to pause the thread that executed the line of code and print the text "Breakpoint hit at line {lineNumber} in class {className} by thread {threadName}." .
You can set a breakpoint to print custom text. This text will be displayed in the debugger console when it reaches a breakpoint. To do this, right-click the breakpoint, open the propoerties window, and enter text in the Print text box.
A useful trick is to set a breakpoint so that it does not block ( suspend : no thread ), and enter the text. The effect is the same as adding println lines to your code, but the advantage is that you do not need to recompile the code, and it is easier to activate / deactivate these debugger logs (and, obviously, it does not remain on the production code).
Note that in the breakpoint text you can use one of the special values {lineNumber} , {methodName} , {className} or {threadName} , and you can also evaluate some code with the syntax {=xxx} . Just replace xxx with the name variable or method call or something else.
source share