how to see debug messages?

Can you help improve your favourite game? Hardcore C mages, talented artists, and players with any level of experience are welcome!
Post Reply
bard
Veteran
Posts: 121
Joined: Fri Jun 14, 2013 2:00 pm

how to see debug messages?

Post by bard »

I have compiled the code from svn repository with debug enabled:
./autogen.sh --enable-debug
make

Now I can see the level 4 debug messages by launching the server this way:
./fcser --debug 4

How can I see only the specific log messages related to the file aihand.c, for example?
I tryed this, but I see no logs:
./fcser --debug 4:aihand.c

I'd like to see the log messages generated by this code inside aihand.c (or similar ones):
log_base(LOGLEVEL_TAX, "%s [res] balanced! (Sci/Lux/Tax)>=%d/%d/%d",
player_name(pplayer), rates[AI_RATE_SCI],
rates[AI_RATE_LUX], rates[AI_RATE_TAX]);
bard
Veteran
Posts: 121
Joined: Fri Jun 14, 2013 2:00 pm

Re: how to see debug messages?

Post by bard »

I still don't know the answer to the previous question, I change the debug level in the file.c as a workaround...
Another related question.

I use ./fcser to launch the game from the source folder (after make, without make install).
But savegames are created in the main freeciv folder (where fcser script is placed), and rulesets are not loaded from my home/.freeciv folder.

I have tried to change the env variables FREECIV_PATH, and FREECIV_SAVE_PATH, for example:

Code: Select all

FREECIV_PATH="~/.freeciv/dev"; export FREECIV_PATH

Code: Select all

FREECIV_SAVE_PATH="~/.freeciv/saves"; export FREECIV_SAVE_PATH
I have been able to load rulesets from my home/.freeciv/dev folder this way, but savegames keep being saved in the source folder.
Do you know how to change the save folder without installing the game? (I'm using kubuntu 13.10)
User avatar
JTN
Elite
Posts: 473
Joined: Wed Jan 30, 2013 12:15 am

Re: how to see debug messages?

Post by JTN »

bard wrote:I still don't know the answer to the previous question, I change the debug level in the file.c as a workaround...
FWIW, I don't know either, and I haven't investigated.
bard wrote:I use ./fcser to launch the game from the source folder (after make, without make install).
But savegames are created in the main freeciv folder (where fcser script is placed), and rulesets are not loaded from my home/.freeciv folder.

I have tried to change the env variables FREECIV_PATH, and FREECIV_SAVE_PATH, for example:

Code: Select all

FREECIV_PATH="~/.freeciv/dev"; export FREECIV_PATH

Code: Select all

FREECIV_SAVE_PATH="~/.freeciv/saves"; export FREECIV_SAVE_PATH
FREECIV_SAVE_PATH only affects where save files are read from. The only way to change where they are written to (apart from changing the working directory) is via the --saves option to freeciv-server. (The man page could be clearer about this, now I come to read it.)
bard
Veteran
Posts: 121
Joined: Fri Jun 14, 2013 2:00 pm

Re: how to see debug messages?

Post by bard »

Thanks, this "--saves" option is exactly what I was looking for :)

I'm starting to contribute with some minor patches or fixes, and I feel there are some things about debugging freeciv code that I still need to learn, like the way to see the log messages related to AI thinking. But maybe I chose a wrong example for my question.
I remember cazfi told me to use this option --debug 4:file.c in order to see only the log messages of certain files, but it does not work as I expected.
And I have seen this server option: debug - Turn on or off AI debugging of given entity. But it always return "invalid argument" when I try it, for example:

Code: Select all

/debug player Caesar
JTN, when you debug or test patches, how do you make to watch the log messages from the ai code?
Post Reply