Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9023897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:52:28+00:00 2026-06-16T05:52:28+00:00

Note: I will post an answer, actually, but any other suggestion is welcome! This

  • 0

Note: I will post an answer, actually, but any other suggestion is welcome!

This question needs a bit of context, to prevent comments questioning my goal… 🙂

Where I work, we use lot of debug, mostly done with Eclipse.
I know some people question the practice of debugging, asserting that good design and analysis and appropriate unit tests makes easy to dissect a bug.

Well, I work on a large code base (Java / Swing) of a legacy application designed when Java 1.2 (or even 1.1) was the latest version, and the code has lot of cruft, and even after years of working on it, I can’t pretend to know more than 10 % of it!
And the JUnit tests we have covers perhaps 1 % of the code, at best (it is a recent practice here…).

So using a good debugger is important to examine classes, the data inside them, the behavior of the software with the kind of data we provide, etc.

Yet, step-by-step has its limits: it can be slow, we can miss stuff out, and it is impractical in some cases, like looking at a paint() method or with multithreaded parts.

So I took the habit, in these difficult cases, to sprinkle some System.out.println() statements here and there, to see what methods are called, with what parameters, in what order, etc.
I could use logs, but it is somehow simpler this way, and I remove these lines after the problem has been solved.

One problem with that practice is that we have to scrutenize the diffs to eliminate these lines before committing.
Another problem is that we use Perforce as VCS, which is fine, but requires to check out explicitly a file (changing its state from read-only to writable) to add such trace. It is slow (with the Eclipse P4 plug-in) and cumbersome .

So, my question is: is it possible to add contextual trace to some points of code, without altering the source code itself?
Something that can log “I was here and I saw that” each time a line is ran.

I initially searched an Eclipse plugin, found only a proposal for the C debugger, and found out (in comment in SO, I think, but I lost the reference, alas) a solution which I will post below, in the hope it can be useful to somebody else.
As said above, any alternative is good to take.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T05:52:29+00:00Added an answer on June 16, 2026 at 5:52 am

    No need for a plugin in Eclipse: add a breakpoint to the line where you want a trace, make it conditional (eg. Ctrl+double click on the breakpoint icon in the margin; alternatively by right-clicking on the BP line in the BP list and selecting Breakpoint Properties) by selecting the Conditional check box and keeping the Suspend when 'true' option.

    Then paste something like:

    System.out.println("ClassName.methodName: " + parameter);
    return false;
    

    Contextual auto-completion works (reminder: sysout followed by Ctrl+space expands to System.out.println()), you can print out the current thread name, and other useful information.

    The return false; line tells Eclipse not to stop on this breakpoint, actually. So the “conditional” code is run, and Eclipse continues to run the code.

    I was fearing it would slow down the code, but with a modern computer, it isn’t perceptible at human level.

    Note: for some reason, when I type the semi-colon after false, the Perforce plugin wants to check out the current file. You can cancel this, of course. And if you paste the line, it doesn’t react…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There may actually not be an answer to this question, but I wanted to
I will post my code below as a quick note I define both of
Please note this application will never be running on a server system. I am
Screenshot Important Note : This application does not support Internet Explorer. I will be
i have this page . login: fer password: m Note: after login you will
Note, this is not a duplicate of .prop() vs .attr() ; that question refers
(Note: This is not a question about what is the best way with code
This is quite an 'out there' question but i've been thinking about some simplification
Here's Eric Lippert's comment from this post : Now that you know the answer,
I just read this SE Post where it explains the question asked is similar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.