I am trying to permanently redirect stdout to a file but all of the examples I can find about doing this involve doing so inside a let or inside a with-open-file using the standard-output global. Is there a way can do an application wide redirect?
EDIT: Here is how I've tried to do the redirect with standard output:
(Setf *log* (open "/Users/Mike/Desktop/some.txt" :direction :output :if-exists :append))
(Setf *standard-output* *log*)
(print "Test")
This stops output to the REPL but nothing shows up in the file (which does exists and is seen by probe-file
) from the print call.
EDIT: I've tried using the Dribble function:
(Dribble "/Users/Mike/Desktop/some.txt")
(format t "hello")
But I get the following error:
Error: There is no applicable method for the generic function: #STANDARD-GENERIC-FUNCTION CCL::STREAM-SET-COLUMN #x30200006557F when called with arguments: (# 0) While executing: #, in process Listener(11). Type cmd-/ to continue, cmd-. to abort, cmd-\ for a list of available restarts. If continued: Try calling it again Type :? for other options.
(setf *standard-output* ...)
not work? – Joshua Taylor