Wget logs are easier to review after the fact than terminal scrollback, especially for cron jobs, background downloads, or remote sessions that disconnect before the transfer finishes. Writing the command output to a file keeps progress and status messages together with the exact URL and final result for later inspection.

The --output-file option sends Wget messages to a log file instead of standard error, while --append-output preserves older entries and adds new runs to the same file. The payload still goes to the normal destination file, so logging and downloaded content stay separate by design.

Transfer logs can expose URLs, query strings, and diagnostic details that do not belong in world-readable directories. Create a private log path first, choose a verbosity level that matches the job, and rotate or prune old logs before they grow into a blind spot.

Steps to log wget output to a file:

  1. Create a dedicated log directory with restricted permissions.
    $ mkdir -p ~/logs/wget
    $ chmod 700 ~/logs/wget

    A private log directory keeps transfer telemetry separate from downloaded payloads and reduces accidental disclosure.

  2. Write one transfer to a fresh log file with --output-file.
    $ LOGFILE=~/logs/wget/wget-download.log
    $ wget --output-file="$LOGFILE" --no-verbose https://httpbin.org/bytes/128 -O sample-a.bin

    --output-file replaces the previous file contents, which is useful for one-off diagnostics or clean single-run audits.

  3. Append a later transfer to the same log file with --append-output.
    $ LOGFILE=~/logs/wget/wget-download.log
    $ wget --append-output="$LOGFILE" --no-verbose https://httpbin.org/bytes/64 -O sample-b.bin

    Append mode is the better choice for cron jobs and repeated scheduled pulls that need one continuous audit trail.

  4. Review the last log entries and confirm the payload files were written separately.
    $ tail -n 10 ~/logs/wget/wget-download.log
    2026-03-27 06:55:30 URL:https://httpbin.org/bytes/128 [128/128] -> "sample-a.bin" [1]
    2026-03-27 06:55:31 URL:https://httpbin.org/bytes/64 [64/64] -> "sample-b.bin" [1]
    
    $ ls -lh sample-a.bin sample-b.bin
    -rw-r--r--  1 user  user   128B Mar 27 06:55 sample-a.bin
    -rw-r--r--  1 user  user    64B Mar 27 06:55 sample-b.bin

    The log records transfer events only; the actual payload still lands in the output files named on the command line.

  5. Increase detail by combining --debug with a file log when normal output is not enough.
    $ wget --debug --output-file=~/logs/wget/wget-debug.log --spider https://httpbin.org/status/403

    Debug logs are much more verbose and may include sensitive request details, so they should be rotated or removed after the troubleshooting pass.

  6. Keep recurring logs under control with dated filenames or periodic cleanup.
    $ date +'%F'
    2026-03-27
    $ du -h ~/logs/wget/wget-download.log
    4.0K	/home/user/logs/wget/wget-download.log

    A naming pattern such as wget-$(date +%F).log keeps long-running download hosts easier to audit and rotate.