Opened 7 months ago

Closed 3 months ago

#28973 closed Cleanup/optimization (fixed)

Move the output of every file that collectstatic processes to verbosity level 2

Reported by: Tanguy Nodet Owned by: nobody
Component: contrib.staticfiles Version: master
Severity: Normal Keywords: collecstatic verbosity log logging management command
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I have a suggestion concerning the logging of the collectstatic command.
Presently, with the default verbosity level (1), individual information on each copied or linked file are printed to sdtout, resulting in a log looking like this:

Copying  '/path/to/the/file'
# or
Linking '/path/to/the/file'
# [...dozens if not hundreds of other lines...]
187 static files copied to '/var/www/my_site/static'.

Now providing the command is launched at every startup of the server (and that you restart your server often, for example in development), this can result in pretty heavy and "polluted" server logs.
If you use verbosity level 0, no output whatsoever is printed (obviously).

Plus, in several cases, the output for verbosity levels 1 and 2 are the same.
Looking at the collectstatic source code, only skipped operations (for post-processing, linking, copy, deletion with --clear) and deletion (of previously copied files that got modified) are logged with a verbosity level of 2.

In my opinion, it would be nice to shift the lines concerning individual files to a verbosity level of 2, and keep the summary at a verbosity level of 1.
I think it would also bring consistency with other commands, such as loaddata, which only displays its summary (at a verbosity level of 1):

Installed 42 object(s) from 7 fixture(s)

Cheers!

Change History (5)

comment:1 Changed 7 months ago by Tim Graham

Component: Core (Management commands)contrib.staticfiles

I don't know. Generally if you want to revisit a design decision like that, it's better to post on the DevelopersMailingList because it reaches a wider audience.

comment:2 in reply to:  1 Changed 7 months ago by Tanguy Nodet

Replying to Tim Graham:

I don't know. Generally if you want to revisit a design decision like that, it's better to post on the DevelopersMailingList because it reaches a wider audience.

Okay, will do. Thank you for your advice.

comment:3 Changed 6 months ago by Tim Graham

Summary: Change verbosity level of collectstatic command's outputsMove the output of every file that collectstatic processes to verbosity level 2
Triage Stage: UnreviewedAccepted

Tentatively accepting as per django-developers discussion.

comment:4 Changed 3 months ago by Claude Paroz

Has patch: set

comment:5 Changed 3 months ago by Tim Graham <timograham@…>

Resolution: fixed
Status: newclosed

In 3aae43d:

Fixed #28973 -- Silenced copying/linking messages in collectstatic's default verbosity.

Note: See TracTickets for help on using tickets.
Back to Top