# The Commandlog

The commandlog is a file where all communication with clients having user or manager privilege is logged. This log allows to retrace each step of an experiment. This log is normally configured in the startup file or can be configured by the instrument manager. There exists a special command, commandlog, which allows to control this log file.

commandlog new filename
  starts a new commandlog writing to filename. Any prior files will be closed. The log file can be found in the directory specified by the ServerOption LogFileDir. Usually this is the log directory.
commandlog
  displays the status of the commandlog.
commandlog close
  closes the commandlog file.
commandlog auto
  Switches automatic log file creation on. This is normally switched on. Log files are written to the log directory of the instrument account. There are time stamps any hour in that file and there is a new file any 24 hours.
commandlog tail [n]
  prints the last n entries made into the command log. n is optional and defaults to 20. Up to 1000 lines are held in an internal buffer for this command.
commandlog intervall
  Queries and configures the intervall in minutes at which time stamps are written to the commandlog.

It is now possible to have a script executed whenever a new log file is started. In order to make this work a ServerOption with the name logstartfile must exist in the instrument configuration file. The value of this option must be the full path name of the file to execute.

Note: with the command <it>config listen 1</it> you can have the output to the command log printed into your client, too. With <it>config listen 0</it> you can switch this off again. This is useful for listening into a running instrument.