I have discovered that I must change option log_file
after printing, because it seems that AMPL doesn't close the file, even if I use close
.
Then, the following works:
print "Hello, "; # Printed to the console
option log_file "test.txt";
print "World"; # Printed to the console and file
option log_file "";
close;