This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Logging all console activity to a text file


Hi Brian,

Thanks for your very detailed post.  I'm no Unix guru so I'll be honest and
say some of that wasn't entirely clear to me.  It seems that, as what I'm
doing with cygwin is really pretty basic (compressing/decompressing,
subversion operations, ssh operations, etc), trying a different shell like
xterm as you mentioned may be the best and simplest bet.  I doubt at this
stage of learning I'd even notice the difference.

Are there other shels that have a logging engine built in?  I use bash at
the moment, but that's only because it's the first thing that comes up and I
really didn't have any knowledge or reason to use a different one.

Thanks again,

H.

> Subject: Re: Logging all console activity to a text file
> 
> Hussein Patwa wrote:
> 
> > I'd like to log all console activity, both input and output 
> to a text 
> > file for later review.  Uses for this could be, for example, 
> > demonstrating an operation to someone unfamiliar with 
> cygwin, or say, 
> > keeping a record of console output for future reference.
> 
> You should try the 'script' command from the util-linux 
> package.  It will capture all input and output from a 
> terminal.  Note that the file it produces really is an exact 
> replica, containing all the terminal escape sequences as well 
> as all keypresses (i.e. typos+backspaces
> included.)  Because of that if you try to view it with 'less' 
> or edit it with a text editor sometimes it will look like 
> garbage.  The only real reliable way of viewing it is to cat 
> it to the terminal, or strip out the terminal escape 
> sequences.  There is also the 'replayscript' command but that 
> is more oriented towards playing back the session with timing info.
> 
> Another thing to be aware of when using 'script' is that it 
> runs the commands attached to a pty (pseudoterminal), which 
> is how it intercepts all I/O.  This is normally not an issue, 
> but it can be a problem if you're running non-Cygwin 
> commands.  The reason is that native apps don't understand 
> ptys, they think their stdin and stdout are pipes and 
> therefore sometimes interactive input doesn't work or output 
> is buffered.  If you are already using rxvt/xterm or have 
> CYGWIN=tty then you're already using ptys so it will be no change.
> 
> Some terminals also have a logging capability.  For example 
> xterm has the -l option.  This only logs the output, altough 
> that may not be an issue since every character you type is 
> also echoed to stdout by the shell -- that's how you see what 
> you've typed.  I think putty has a similar option.
> 
> > Can this be done either globally (logging start each time a cygwin 
> > session starts), or individually (I can start and stop logging as I 
> > choose) and if so how?
> 
> If you wanted 'script' to log everything for every session by 
> default, you could add it as the last command in the user's 
> profile or the system profile -- or you could just change the 
> command that starts the Cygwin session (normally cygwin.bat) 
> to run script explicitly.  You may have to use some logic to 
> pick a unquely named filename each time, e.g. using the date command.
> 
> If you want to start and stop logging, it works just like 
> invoking a subshell, i.e. type "script filename", enter some 
> commands, type exit, logging stops.
> 
> Brian
> 
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Problem reports:       http://cygwin.com/problems.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
> 
> 


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]