· Nov 22, 2016

How do I log terminal output to file automatically?

As stated in title, I want to log everything I type/get in the terminal to a log file, is there a setting like this somewhere?

Preferably I'd like to enable it once and that's it.

Discussion (5)0
Log in or sign up to continue

Hi Eduard,

To put all together:
the documentation Alexander pointed you to is quite complete and should allow the creation of quite powerful scripts.

I wanted to get you started with something that I created a while back for a similar request:

a Windows command that would A) start our Telnet client to B) connect to a specific server and C) execute a script where we can then enable logging and perform multiple actions as needed..

My script example is nothing else as logging into a default namespace (without username/password, so the typical minimal security setting where you would end up in the USER namespace), enable logging, execute a %SS displa for the list of running processes, pause a few seconds, and exit..

The command line would look as follow:

C:\Temp\>C:\InterSystems\E20162\Bin\CTerm.exe /CONSOLE=CN_IPTCP:[23] C:\Temp\testlog.scr

And the content of the testlog.scr script:

;Script to test logfiles

logfile: C:\temp\TestLog.log

wait for: USER>
send: d ALL^%SS<CR>
wait for: >

send: H 10<CR>

send: HALT<CR>


Hopefully this will work for you too and act a useful starting point for your actual needs.