Help on DEBUG variable

Hello all,
since the last topics covering debug variables are dated 10 and 20 years ago, I will risk a new thread on this.

I am developing a module inside a grass branch and am running it from vscode to exploit the debugger in the IDE. To do so I am passing via launch.json (for those who use vscode) all necessary env variables. So far my tests look good.

What I am not yet able to do though, is to get the debug messages working.
Is it enough to set the env variable

DEBUG=3

in order to make a message like:

G_debug(3, “Hello”)

appear on the terminal?
While G_message prints to terminal, I am not able to see debug messages.

Thanks, cheers,
Andrea

Andrea,

You need to set debug level with g.gisenv set=“DEBUG=3”.

See https://grasswiki.osgeo.org/wiki/GRASS_Debugging for further tips.

Best,
Nicklas

On 8 Jan 2025, at 09:12, Andrea Antonello via OSGeo Discourse noreply@discourse.osgeo.org wrote:

moovida
January 8

Hello all,
since the last topics covering debug variables are dated 10 and 20 years ago, I will risk a new thread on this.

I am developing a module inside a grass branch and am running it from vscode to exploit the debugger in the IDE. To do so I am passing via launch.json (for those who use vscode) all necessary env variables. So far my tests look good.

What I am not yet able to do though, is to get the debug messages working.
Is it enough to set the env variable

DEBUG=3

in order to make a message like:

G_debug(3, “Hello”)

appear on the terminal?
While G_message prints to terminal, I am not able to see debug messages.

Thanks, cheers,
Andrea


Visit Topic or reply to this email to respond.

To unsubscribe from these emails, click here.

Hi Nicklas,

You need to set debug level with g.gisenv set=“DEBUG=3”.

See GRASS Debugging - GRASS-Wiki for further tips.

I would like to enable debug levels by just setting the DEBUG variable, without using the shell.

But I think I now found what g.gisenv does: the variable is set in the GISRC file and not in the “standard” environment.

Cheers,
Andrea

Hi Andrea,

That’s right, so you could simply edit the “rc” file. Here mine (I have DEBUG activated):

cat $HOME/.grass8/rc

shows:

GISDBASE: /home/mneteler/grassdata
LOCATION_NAME: nc_spm_08_grass7
MAPSET: user1
GUI: text
MEMORYMB: 2000
DEBUG: 3

Cheers
Markus

1 Like