How do I log terminal output to file automatically?

Answers

What the terminal do you mean? I believe there are plenty of terminal apps with this feature, e.g. this one.

Or do you want to log only Caché terminal sessions? And store it on the server?

I want to log Caché terminal.

My use case: developer machine on windows.

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:127.0.0.1[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>

closelog

 

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