How to make logs?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
Luis Babboni
Posts: 464
Joined: Sat Feb 28, 2015 4:37 pm
Location: Argentina

How to make logs?

Post by Luis Babboni »

Some engines made logs during play.
I tried to do the same, mostly for debug, and have problems with it.
In fact I need to disable this option to not have crashes.
Wich is the correct way to do it? (I think no matter the language you coding the options could not be so differents)
Open file, write in file, close file each time you want to save something or
open file, write in file, engine play, write in file, engine play... till game ends and just then close file?
User avatar
hgm
Posts: 27795
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: How to make logs?

Post by hgm »

Doesn't matter much. But why would you want the engine to make logs? That just seems a waste of time. I always print all debug info to the standard output, prefixed with #. Then it appears in the GUI log.
User avatar
Luis Babboni
Posts: 464
Joined: Sat Feb 28, 2015 4:37 pm
Location: Argentina

Re: How to make logs?

Post by Luis Babboni »

hgm wrote:Doesn't matter much.
It not takes too much time if you use
open-write-close using the HD?
hgm wrote: But why would you want the engine to make logs? That just seems a waste of time.
Gaviota ones for example are very nice to understand how it works!
Mine is, as i said, mostly for debug showing data that I need to check if it is correct.
hgm wrote: I always print all debug info to the standard output, prefixed with #. Then it appears in the GUI log.
I did not think in this option!!
Daniel Anulliero
Posts: 759
Joined: Fri Jan 04, 2013 4:55 pm
Location: Nice

Re: How to make logs?

Post by Daniel Anulliero »

When you run winboard , type /debug command and it'll write all the infos during the game
Of course you must have some code to display the search incos in your code
Henk
Posts: 7218
Joined: Mon May 27, 2013 10:31 am

Re: How to make logs?

Post by Henk »

For fools only: Log files can become very large. So it might give a problem when you perform an over simplified back up by copying whole map.
JVMerlino
Posts: 1357
Joined: Wed Mar 08, 2006 10:15 pm
Location: San Francisco, California

Re: How to make logs?

Post by JVMerlino »

Luis Babboni wrote:Some engines made logs during play.
I tried to do the same, mostly for debug, and have problems with it.
In fact I need to disable this option to not have crashes.
Wich is the correct way to do it? (I think no matter the language you coding the options could not be so differents)
Open file, write in file, close file each time you want to save something or
open file, write in file, engine play, write in file, engine play... till game ends and just then close file?
In Myrddin, I open the file at the start of the program, write to it whenever I need to, then close it at the end of the program. Even if it plays multiple games during the session, it all goes into one logfile. If I'm using multiple cores, each core gets its own logfile.

If you want to see what I write (at minimum) you just need to edit myrddin.ini to enable the logfiles. Of course, when I'm deep in debugging I can enable a lot more output. But in release versions I keep it minimal so people can send me logfiles if Myrddin is misbehaving for some reason.
User avatar
Luis Babboni
Posts: 464
Joined: Sat Feb 28, 2015 4:37 pm
Location: Argentina

Re: How to make logs?

Post by Luis Babboni »

Thanks guys!! :D
Robert Pope
Posts: 558
Joined: Sat Mar 25, 2006 8:27 pm

Re: How to make logs?

Post by Robert Pope »

hgm wrote:Doesn't matter much. But why would you want the engine to make logs? That just seems a waste of time. I always print all debug info to the standard output, prefixed with #. Then it appears in the GUI log.
Two reasons I do it:
1. I don't always run through a GUI, especially when I am testing something specific or debugging a problem. So no GUI to capture what I want to refer back to.

2. GUI logs will have both engines' outputs, which can make reading through more difficult, particularly if the same engine was playing both sides. Also, if one engine is outputting pondering data at the same time as the other engine is thinking, I expect they will be interleaved a lot.
User avatar
hgm
Posts: 27795
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: How to make logs?

Post by hgm »

Well, what the engine prints to the GUI log would appear on the screen when I run from the command line. (Which I also do a lot.) If I ratherhave in on file (e.g. because I want to dumpa big tree), I just redirect the output to a file.

I am used to working in a Unix-like environment, be it on Windows+Cygwin or Linux. So I always have the indispensible 'grep' command available, and if I want to see the communication of one engine only, I just do "grep first winboard.debug" or "grep second winboard.debug".