Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 5962

VS Code terminal - log everything into txt file?

$
0
0

I log to file everything from my Bash console. I do it with the following code added to my .bashrc:

start_terminal_logging(){    if [ -z "$SCRIPT_LOG_FILE_ACTIVE" ]; then        # Log each session to a separate file:        logdir=~/.terminal_logs        logfile=$logdir/session_log_$(date +%Y%m%d_%H%M%S)_$$.txt        # If no folder exist make one:        if [ ! -d $logdir ]; then            mkdir -p $logdir        fi        export SCRIPT_LOG_FILE_ACTIVE=$logfile        # Start logging, a=append, q=quiet:        script -aq $logfile        exit    fi}# Start the logging(script above):start_terminal_logging

This creates a file session_log_$datetime.txt for each terminal session, and saves everything into it.

However, when I launch the terminal from within VS Code, it doesn't work. How can I log VS Code terminal outputs into file too?


Viewing all articles
Browse latest Browse all 5962

Trending Articles