Recent

Author Topic: To DebugLn or not to DebugLn?  (Read 1531 times)

WooBean

  • Full Member
  • ***
  • Posts: 230
To DebugLn or not to DebugLn?
« on: July 06, 2023, 03:48:59 pm »
Does anybody know how to use DebugLn to answer more detailed questions?

1. Is this somewhere documented? If yes, where  to find?

2. What a user should do in Lazarus IDE config to observe an output of DebugLn?

3. Can it be a file or "Debug Output" window docked into (or detached of) the IDE?

Some time ago I asked forum about Event Logging. Hoped  that this is a way to make debugging easier.
Not especially, I think now.


 
Platforms: Win7/64, Linux Mint Ulyssa/64

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9874
  • Debugger - SynEdit - and more
    • wiki
Re: To DebugLn or not to DebugLn?
« Reply #1 on: July 06, 2023, 04:08:26 pm »
1)
There is info on the wiki under LazLogger. (search for LazLogger should bring up the page)
That isn't IDE specific, that is general info

2)
- run from a console (on Windows, compile IDE with -WC)
- or lazarus.exe --debug-log=file
  and then as needed --debug-enable (or install ide-lazlogger package, wich can toggle those at runtime)

3) a file, see above

------------------
Quote
Event Logging.
scrap the above (Except first point)

Up till this line your question was about debugln.
debugln in the IDE has nothing todo with debugging your app. It will print out internals of the IDE, if you debug the IDE itself.

Also debugln is entirely independent of the debugger => it always (even if you run an app outside the IDE) prints to console, or to a file (which by default is specified by --debug-log= / but can be configured / see wiki )


On Windows there is a WinAPI call to write to a debugserver => and that can be displayed in the event log -- but will be mixed with all the rest.
(I need to google to find the details on calling this in the debugged app => might leave the google to you).

On Windows, you can compile your app with -WC (or disable GUI app) => and then if you debugln in your app, you have a console (that will work in the debugger or outside of it)
On Linux it goes always to the console or the debug window for the console output.


Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9874
  • Debugger - SynEdit - and more
    • wiki
Re: To DebugLn or not to DebugLn?
« Reply #2 on: July 06, 2023, 04:10:55 pm »
ok, on 2nd read I see what you mean / just misleading as debugln has so many purposes.

Just disable "gui app" in the project settings => or compile with -WC

Then you still can use forms and all, but will have a console too.

And then all your debugln goes to the console.

-------------
the wiki should have details how to set it to a logfile instead.

WooBean

  • Full Member
  • ***
  • Posts: 230
Re: To DebugLn or not to DebugLn?
« Reply #3 on: July 06, 2023, 04:30:58 pm »
Referring to 2nd post -
..
Just disable "gui app" in the project settings => or compile with -WC

Then you still can use forms and all, but will have a console too.

And then all your debugln goes to the console.

-------------
the wiki should have details how to set it to a logfile instead.

For 'normal' GUI application (on Windows) this way worked and still works (3.0RC1 I mean) but not for Lazarus IDE itself, shade.

Platforms: Win7/64, Linux Mint Ulyssa/64

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9874
  • Debugger - SynEdit - and more
    • wiki
Re: To DebugLn or not to DebugLn?
« Reply #4 on: July 06, 2023, 04:47:06 pm »
For 'normal' GUI application (on Windows) this way worked and still works (3.0RC1 I mean) but not for Lazarus IDE itself, shade.

For the IDE itself you have to put -WC into "Configure build lazarus"

WooBean

  • Full Member
  • ***
  • Posts: 230
Re: To DebugLn or not to DebugLn?
« Reply #5 on: July 06, 2023, 04:50:45 pm »
I have wanted exactly this!

Many thanks!
Platforms: Win7/64, Linux Mint Ulyssa/64

 

TinyPortal © 2005-2018