Logging

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
jsgroby
Posts: 83
Joined: Mon Mar 24, 2014 12:26 am
Location: Glen Carbon, IL USA

Logging

Post by jsgroby »

Anyone have any recommendations on a low overhead way to log all of the output of an engine to a file each time you run the engine? My engine is in ANSI C, so would be interested in source code or suggestions related to that language.

Is there a engine anyone knows of written in C that logs to a file? I will be glad to take a look at the source and figure it out.

Thanks for any information.

Jeff
ZirconiumX
Posts: 1334
Joined: Sun Jul 17, 2011 11:14 am

Re: Logging

Post by ZirconiumX »

jsgroby wrote:Anyone have any recommendations on a low overhead way to log all of the output of an engine to a file each time you run the engine? My engine is in ANSI C, so would be interested in source code or suggestions related to that language.

Is there a engine anyone knows of written in C that logs to a file? I will be glad to take a look at the source and figure it out.

Thanks for any information.

Jeff
You could use xboard -debug if your engine is xboard protocol, and I believe polyglot has a logging function, too.

Matthew:out
Some believe in the almighty dollar.

I believe in the almighty printf statement.
User avatar
hgm
Posts: 27789
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Logging

Post by hgm »

Usually one lets the GUI take care of this.
Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Re: Logging

Post by Henk »

hgm wrote:Usually one lets the GUI take care of this.
By the way do you know how to play ultra short games using winboard. Then I don't need to see the GUI but only the result of the match.
User avatar
hgm
Posts: 27789
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Logging

Post by hgm »

The easiest way to not see the GUI is to minimize the window. :wink:

There is a command-line option -noGUI, which suppresses the board and icon update during the game. When you use that the round-trip delay for engine-GUI traffic should reduce to around 1 msec, which should be low enough to play very fast games. (Keep in mind that when you use standard functions to let the engine read the time, the accuracty is only 16 msec.) If you don't need extremely fast play (i.e. down to 10 sec/game), allowing the GUI update is usually not a problem, however, as long as you don't forget to switch move animation off.
User avatar
jsgroby
Posts: 83
Joined: Mon Mar 24, 2014 12:26 am
Location: Glen Carbon, IL USA

Re: Logging

Post by jsgroby »

hgm wrote:Usually one lets the GUI take care of this.
Thanks. I had not really thought out what I was wanting before I posted. With the GUIs (engine is both uci and xboard compatible) I was getting the logs, but I was more concerned about running debug tests and perft and getting that output. Turns out that I can just redirect the output to a file since I am on unix. That way I don't have to put any additional code in that might have an effect on performance.

Thanks for the answers everyone.

Jeff
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Logging

Post by bob »

jsgroby wrote:Anyone have any recommendations on a low overhead way to log all of the output of an engine to a file each time you run the engine? My engine is in ANSI C, so would be interested in source code or suggestions related to that language.

Is there a engine anyone knows of written in C that logs to a file? I will be glad to take a look at the source and figure it out.

Thanks for any information.

Jeff
Crafty has done this forever. For things I want logged, I use a "Print()" procedure that is in Crafty utility.c. It displays output to the display exactly like printf (it uses printf internally) but also directs a copy to a file.. I don't notice enough overhead to even measure, but I have the ability to turn it off should I ever have to write to a device slow enough to cause problems...
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Logging

Post by bob »

hgm wrote:Usually one lets the GUI take care of this.
I think he is wanting to log more than what he sends to xboard. For example all my end of search statistics, time used, sometimes debugging output on how many reductions were done by ply and such, etc.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Logging

Post by bob »

jsgroby wrote:
hgm wrote:Usually one lets the GUI take care of this.
Thanks. I had not really thought out what I was wanting before I posted. With the GUIs (engine is both uci and xboard compatible) I was getting the logs, but I was more concerned about running debug tests and perft and getting that output. Turns out that I can just redirect the output to a file since I am on unix. That way I don't have to put any additional code in that might have an effect on performance.

Thanks for the answers everyone.

Jeff
If that is all you want, try this:


program | tee filename

now output goes to filename AND the display although it can get sort of "chunky" in the way it gets displayed in chunks rather than always being real smooth.
User avatar
jsgroby
Posts: 83
Joined: Mon Mar 24, 2014 12:26 am
Location: Glen Carbon, IL USA

Re: Logging

Post by jsgroby »

bob wrote:
jsgroby wrote:
hgm wrote:Usually one lets the GUI take care of this.
Thanks. I had not really thought out what I was wanting before I posted. With the GUIs (engine is both uci and xboard compatible) I was getting the logs, but I was more concerned about running debug tests and perft and getting that output. Turns out that I can just redirect the output to a file since I am on unix. That way I don't have to put any additional code in that might have an effect on performance.

Thanks for the answers everyone.

Jeff
If that is all you want, try this:


program | tee filename

now output goes to filename AND the display although it can get sort of "chunky" in the way it gets displayed in chunks rather than always being real smooth.
Perfect. Exactly what I needed. Thank you sir.

Jeff