0

I use xboard as a GUI for Crafty, being Crafty a state of the art chess engine I don't want to use anything else, but it floods my home directory with game.nnn and log.nnn files. I would like to change the settings and have Crafty to save this files to a "Folder1" instead of my home directory.

1

2 Answers 2

1

You can start crafty with the parameter log off. Parameters can be put into the crafty.rc file, or used as start-up parameters from the terminal. The files you see created are created by the parameter log. This is by default set to on. There is an alphabetical list of all the options here. It does not look like you can not put those log files somewhere else.

The most important parameter for these log.{nnn} files is:

log off|on|{n}

This command is used to disable logging. The default is log on, which causes Crafty to produce a new log.nnn file for each game played. If you are running Crafty on a server, you might use log off, which disables creating these files as well as the game.nnn files used to restart a game after you exit Crafty and come back later. If you use the form log n Crafty will simply display the last n lines of the log on the screen. If you use log n file Crafty will copy the last n lines of the log to file which could be your hard drive, or a floppy.

Note that if you run with log off, you will be unable to find out what Crafty was thinking about since there is no other record of the game. You will always see a game.001 because as Crafty plays a game, this contains all the real moves played so far so that you can back up if needed. you will also see a log.001 file, but it will be empty.


Alternative: create a script that moves all the log files to your directory before starting crafty or when crafty stops. That way you have then in your folder in bulk and you can keep logging on.

1
  • Thankyou Rinzwind, seems that you know how to do this, I don't really know how to create such a script (the one to move those files to another directory) could you please help me with that, or point me to where i might find out how?... and yes i have joined Chess Beta at stack exchange thanks for that too.
    – Helio
    Commented Nov 20, 2012 at 22:51
1

From "man crafty":

   Logging
       When  a game is played, Crafty normally writes "logpath/game.<nnn>" and
       "logpath/log.<nnn>". Details of what is written are modifiable  by  the
       `log'  command. Because $CRAFTY_LOG_DIR defaults to "./" (the directory
       in which Crafty is launched), trouble  can  occur  if  the  program  is
       launched  in a directory to which it is unable to write.  Note that the
       "log.<nnn>" file normally contains all output that would be visible  if
       Crafty  were run from the command line but is usually hidden when it is
       run from a GUI.

So, you may define CRAFTY_LOG_DIR in your ~/.bashrc. I'd put the crafty logs in $HOME/var/log/crafty, and set it up by adding the following to ~/.bashrc:

[[ -d $HOME/var ]] || mkdir -m 0700 $HOME/var
[[ -d $HOME/var/log ]] || mkdir -m 0700 $HOME/var/log
[[ -d $HOME/var/log/crafty ]] || mkdir -m 0700 $HOME/var/log/crafty
export CRAFTY_LOG_DIR="$HOME/var/log/crafty/"

To avoid filling $HOME/var/log/crafty/ with log files, set up "Log Rotation". Read man logrotate and man logrotate.conf.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .