Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#20640 closed enhancement (fixed)

sage-logger: show log(s) each line is going to on stdout

Reported by: embray Owned by:
Priority: minor Milestone: sage-7.3
Component: build Keywords:
Cc: Merged in:
Authors: Erik Bray Reviewers: Volker Braun
Report Upstream: N/A Work issues:
Branch: bc0f3da (Commits, GitHub, GitLab) Commit:
Dependencies: Stopgaps:

Status badges

Description

A minor enhancement to sage-logger that I've found incredibly helpful. Every line output to stdout is prefixed with the name(s) of the log file(s) they are being logged to.

In particular this helps sort out stdout when there are large number of make processes running in parallel. It helps to reason about what lines of output are associated with which packages. I know each package build is logged individually as well, but this still helps understand what's going on at a glance. It also helps quickly determine which log file to look at if I see something scroll past that I want to investigate further.

Change History (13)

comment:1 Changed 5 years ago by embray

  • Authors set to Erik Bray
  • Status changed from new to needs_review

comment:2 Changed 5 years ago by git

  • Commit changed from 632a6b36f66e5c1250467bbeffc0c40733bd4af0 to c9d0d7cf129b3ad5e66abde2e43273f410584072

Branch pushed to git repo; I updated commit sha1. New commits:

c9d0d7cecho'd string should be quoted

comment:3 Changed 5 years ago by vbraun

  • Reviewers set to Volker Braun
  • Status changed from needs_review to positive_review

comment:4 Changed 5 years ago by vbraun

  • Status changed from positive_review to needs_work
sage -t --long src/sage/tests/cmdline.py
**********************************************************************
File "src/sage/tests/cmdline.py", line 219, in sage.tests.cmdline.test_executable
Failed example:
    print(out)
Expected:
    Found local metadata for sqlite-...
    = SQLite =
    ...
    SQLite is a software library that implements a self-contained,
    serverless, zero-configuration, transactional SQL database engine.
    ...
Got:
    [sqlite] Found local metadata for sqlite-autoconf-3130000
    [sqlite] = SQLite =
    [sqlite] 
    [sqlite] == Description ==
    [sqlite] 
    [sqlite] SQLite is a software library that implements a self-contained,
    [sqlite] serverless, zero-configuration, transactional SQL database engine.
    [sqlite] 
    [sqlite] == License ==
    [sqlite] 
    [sqlite] Public Domain
    [sqlite] 
    [sqlite] == Upstream contact ==
    [sqlite] 
    [sqlite] * http://www.sqlite.org
    [sqlite] 
    [sqlite] == Dependencies ==
    [sqlite] 
    [sqlite] * readline
    [sqlite] 
    [sqlite] == Special Update/Build Instructions ==
    [sqlite] 
    [sqlite] * Use the autoconf version of sqlite.
    <BLANKLINE>
**********************************************************************
1 item had failures:
   1 of 235 in sage.tests.cmdline.test_executable
    [234 tests, 1 failure, 70.24 s]

comment:5 Changed 5 years ago by embray

Was that the only test that changed as a result? Should be easy enough to update.

comment:6 Changed 5 years ago by embray

Since it seems that sage-logger is used in a few places besides just building, maybe this behavior should be enabled only via a switch.

comment:7 Changed 5 years ago by git

  • Commit changed from c9d0d7cf129b3ad5e66abde2e43273f410584072 to bc0f3daa7ca41f310ee5b21c0bc31e53b3fd3bf9

Branch pushed to git repo; I updated commit sha1. New commits:

bc0f3daOnly prefix log messages if -p is given to sage-logger, but use this throughout the build system.

comment:8 Changed 5 years ago by embray

I added an optional -p flag for applying the line prefix. This way the previous default behavior is preserved, but the -p flag is used throughout the build system where it's most useful.

comment:9 Changed 5 years ago by embray

  • Status changed from needs_work to needs_review

comment:10 Changed 5 years ago by vbraun

  • Status changed from needs_review to positive_review

comment:11 Changed 5 years ago by vbraun

  • Branch changed from u/embray/sage-logger to bc0f3daa7ca41f310ee5b21c0bc31e53b3fd3bf9
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:12 Changed 5 years ago by jdemeyer

  • Commit bc0f3daa7ca41f310ee5b21c0bc31e53b3fd3bf9 deleted

This causes every single line in the output of make to have [install] prepended. Surely, that's not useful and we shouldn't use the -p flag for the top-level sage-logger.

comment:13 Changed 5 years ago by jdemeyer

Also: this causes leading whitespace to be dropped from the logfile, which messes up ASCII-art-style error messages from GCC for example. See #20708.

Note: See TracTickets for help on using tickets.