How to capture all console output from a TCMD session?

May 9, 2013
40
0
#1
the LOG command is close to useless IMO. It only captures what I already know: the commands issued (which are already in the BTM file - so no actual information whatsoever captured).

What I need to know is... what happened?

And that's the part LOG can't manage to do whatsoever.

So... might there be a way to get LOG to be useful? Or what is the recommended "capture" technique?
 

rps

Jul 6, 2008
378
4
#2
How about using the TEE command with a pipe to the file of your choice, which could be your log file?

Output from a simple test:
Code:
Tue  Nov 24, 2015 12:09:40 [6072]
C:\JPSoft\TCMD17x64>*dir /a /k /m *.ini | tee test9.txt
11/06/2015  18:42  5,678  tcmd.ini
11/22/2015  13:21  5,342  tcmdOneTccTab.ini
11/30/2014  1:22  5,602  tcmdV17.ini
11/23/2015  10:02  396  updater.ini

Tue  Nov 24, 2015 12:09:54 [6072]
C:\JPSoft\TCMD17x64>type test9.txt
11/06/2015  18:42  5,678  tcmd.ini
11/22/2015  13:21  5,342  tcmdOneTccTab.ini
11/30/2014  1:22  5,602  tcmdV17.ini
11/23/2015  10:02  396  updater.ini
So if I want the command and the results in my LOG file, defined by %logfile, I could use:
Code:
Tue  Nov 24, 2015 12:09:54 [6072]
C:\JPSoft\TCMD17x64>*dir /a /k /m *.ini | tee /d /t %logfile
2015/11/24 12:17:52.587 11/06/2015  18:42  5,678  tcmd.ini
2015/11/24 12:17:52.587 11/22/2015  13:21  5,342  tcmdOneTccTab.ini
2015/11/24 12:17:52.587 11/30/2014  1:22  5,602  tcmdV17.ini
2015/11/24 12:17:52.587 11/23/2015  10:02  396  updater.ini
which will display the results of the dir command with date and time stamps to my monitor and also add it to my log file which would record the command, if logging is on, and the result.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,725
47
Albuquerque, NM
prospero.unm.edu
#3
You can also save the contents of the console buffer to a text file with the Save button, under the "Home" menu item. Note that the console buffer has a finite length; you'll want to save it before it completely fills up and stuff starts scrolling off the top.
 
May 9, 2013
40
0
#4
I went with redirecting each external to append a log file.

I can't use the save buffer due to this running automated & headless from a service.

I just think it's silly to have a logging function that can't log anything really. Not much of a logging function.

But thanks for the kind responses & ideas.
 

rconn

Administrator
Staff member
May 14, 2008
10,773
97
#5
There are several ways to log output. But if you want to log output of external apps, the only way to do that (other than redirection, which only gets the output if the app writes to STDOUT & STDERR) is to inject a dll into every process that TCC starts and to intercept the console I/O functions.

I actually did a test version a while back that did this, but there are some drawbacks:

1) TCMD / TCC output is much, much slower (like 5x slower).
2) Many (most?) antivirus & antimalware apps will flag TCC as a virus, and kill it.
3) Once we start injecting code into other apps, we get blamed for every bug in every app.