printf question

Christian Stimming stimming at tuhh.de
Mon Mar 21 15:29:35 EDT 2011


Am Montag, 21. März 2011 schrieb Geert Janssens:
> > >> -- ---------- Where does the output of the printf statement go?
> > > 
> > > If the start-up of gnucash still opens a separate console, it should 
> > > go there. If we've switched off that separate console, it goes
> > > nowhere.
> > 
> > How do I switch off that separate console?
> > How do I switch on that separate console?
> 
> I hope Christian can give more details about this.

I forgot how we enabled or disabled this in the Makefile.am, but after 
compiling has finished, we have the "exetype.exe" executable that is used 
several times throughout the install-impl.sh functions to switch applications 
without console into ones with console or vice versa. Just call "exetype 
my_prog_name.exe console" and this should turn on the console - I think.

In Cmake, there was a special keyword when specifying the to-be-compiled 
executable, so in Makefile.am there must have been something similar, but I 
forgot where.

> > > My workaround for similar debugging steps is to use g_warning("Some
> > > number %d", some_number) instead of printf(), i.e. the function
> > > arguments of g_warning are the same as the ones of printf. Once the
> > > logging filename was set up correctly, your g_warning statements will
> > > at least show up there.
> > 
> > How do I set up the logging filename correctly?
> 
> You can use the --logto command line option to gnucash. For example if you
> run gnucash-launcher.cmd --logto c:\logfile
> your debug messages will be stored in a file called
> c:\logfile.ABCDEF.log
> with ABCDEF some random digits.
> If you don't pass the --logto option, the logfile will default to
> %TEMP%\gnucash.trace.ABCDEF.log
> %TEMP% is usually c:\Documents and Settings\<username>\Local Data\Temp
> (WinXP) or c:\Users\<username>\Local Data\Temp

And also the g_warning() output will work correctly only after in main(), the 
function gnc_log_init() was called (line 849). It won't work before that, but 
it will after that.

Regards,

Christian


More information about the gnucash-devel mailing list