Commit graph

45 commits

Author SHA1 Message Date
Jennifer Richards 48e0aa23f5
refactor: clean up logging (#7419)
* fix: log to stdout/stderr in json format

* chore: remove UTILS_LOGGER_LEVELS

This is not used (there _is_ a setting for the
django.security logger in settings_local.py on
production, but it is redundant with the
settings.LOGGING configuration and is not doing
anything).

* chore: revert to debug_console django logging

* chore: log.log to syslog via datatracker logger

* chore: remove unused imports

---------

Co-authored-by: Robert Sparks <rjsparks@nostrum.com>
2024-05-14 18:47:40 -05:00
Henrik Levkowetz 51806b1964 Updated log.assertion() to provide an exception object (under Py3, it seems that logging.Logger instances ignore the traceback if there isn't also an exception object). Added a check for unset draft-iesg state to Document.set_state().
- Legacy-Id: 18503
2020-09-18 14:15:02 +00:00
Henrik Levkowetz e86bf0194b Added an assertion to catch an unexpected document state (no IESG state set). Updated the log.assertion() function to accept a "note" argument, for more informative assertion messages.
- Legacy-Id: 18479
2020-09-09 14:09:43 +00:00
Henrik Levkowetz 595dcb75e9 Fixed a silly bug in [18040]. 'settings' isn't a dictionary.
- Legacy-Id: 18043
Note: SVN reference [18040] has been migrated to Git commit e1ed51b0b6
2020-06-23 21:16:02 +00:00
Henrik Levkowetz e1ed51b0b6 Fixed a logging issue when running the test crawler.
- Legacy-Id: 18040
2020-06-23 20:38:33 +00:00
Henrik Levkowetz bf230a738b Added a test suite switch to optionally show logging output. Normally this is suppressed while running tests. In production, it goes to syslog's user facility. With --show-logging, it will go to the console when running tests.
- Legacy-Id: 18010
2020-06-17 15:05:57 +00:00
Henrik Levkowetz 3589ea2cd9 Fixed two mypy issues with utils.log code to set loggin handlers.
- Legacy-Id: 17987
2020-06-14 18:32:45 +00:00
Henrik Levkowetz 0a7648b7de Improved the handling of logger enabling entries in UTILS_LOGGER_LEVELS to set a handler if none exists for a given logger.
- Legacy-Id: 17981
2020-06-13 21:31:31 +00:00
Henrik Levkowetz c5f6883624 Fixed a couple of mypy errors.
- Legacy-Id: 17977
2020-06-12 22:05:03 +00:00
Henrik Levkowetz 682036321d Reorganized the python logging setup slightly, and added a possibility to configure logging levels for individual loggers in settings_local.py
- Legacy-Id: 17973
2020-06-12 14:41:41 +00:00
Henrik Levkowetz 0ca29a80c2 Tweaked log.unreachable() and log.assertion() for Py3 compatibility.
- Legacy-Id: 17915
2020-06-06 20:17:04 +00:00
Henrik Levkowetz f10ddadc0e Merged in changes from trunk up to r17584.
- Legacy-Id: 17593
2020-04-07 16:02:52 +00:00
Russ Housley 333abcab6d Improve performance of log.assertion() and log.unreachable()
- Legacy-Id: 17521
2020-03-23 22:02:58 +00:00
Henrik Levkowetz 726fcbf27d Removed all __future__ imports.
- Legacy-Id: 17391
2020-03-05 23:53:42 +00:00
Henrik Levkowetz ab173cb2eb Removed further six usage: six.string_types, six.integer_types, six.moves.urllib instances.
- Legacy-Id: 17390
2020-03-05 20:46:58 +00:00
Henrik Levkowetz 03bd9c0594 Fixed log.log() to hand on the right type (str) to underlying functions.
- Legacy-Id: 17343
2020-02-26 17:16:35 +00:00
Henrik Levkowetz 45465f1174 Merged in [16818] from rjsparks@nostrum.com:
Make hybrid pdfs when converting ppt materials to pdf. Fixes #2769.
 - Legacy-Id: 16880
Note: SVN reference [16818] has been migrated to Git commit 84270a71d0e7373c5e05ddc834e91c445a1296ed
2019-10-21 13:17:33 +00:00
Henrik Levkowetz 33e8733b91 Fixed up mypy issues or added type:ignore comments as needed for a clean mypy run.
- Legacy-Id: 16772
2019-09-30 15:42:18 +00:00
Henrik Levkowetz 8c6eb3a30a Python2/3 compatibility: Changed the use of open() and StringIO to io.open() etc.
- Legacy-Id: 16458
2019-07-15 19:14:04 +00:00
Henrik Levkowetz d7f5c84182 Initial 2to3 patch with added copyright statement updates.
- Legacy-Id: 16309
2019-06-27 14:40:54 +00:00
Henrik Levkowetz 4fba531e9e Merged in the latest GDPR changes. This refines the handling of the consent checkbox on the account page; refines the Consent Needed warning given on login if consent is needed; tweaks several models to set the on_deletion fields for FK to User and Person appropriately; adds a Person.needs_consent() method to capture the logic of which fields require consent; refines the Person.plain_name() method and the user.log.log() function; and adds 2 management commands to send out consent requests and delete non-consent information, respectively.
- Legacy-Id: 15464
2018-09-16 23:12:43 +00:00
Henrik Levkowetz a389e24fb6 Refined utils.log.log() to flush stdout before logging if we're writing log messages to stderr.
- Legacy-Id: 15463
2018-09-16 14:14:26 +00:00
Henrik Levkowetz b2bfc7858a Generalized the log.assertion() function a bit to be able to provide more information on assertion failure.
- Legacy-Id: 15426
2018-08-10 15:31:12 +00:00
Henrik Levkowetz fb88596c59 Fixed an issue with the scope of the logfunc variable in production.
- Legacy-Id: 13761
2017-07-03 14:03:53 +00:00
Henrik Levkowetz 2070bbfed6 Merged in [13722] and [13712] from rcross@amsl.com:
Remove all use of request.session from secretariat apps.  Add tests for affected views.  Fixes #1455.
 - Legacy-Id: 13724
Note: SVN reference [13712] has been migrated to Git commit 915b445bcffcd4687fb1677230b98282d22dd9a0

Note: SVN reference [13722] has been migrated to Git commit 3a2cb9d3d846168f75d9796b4e5383bdf10b1f60
2017-06-28 14:55:10 +00:00
Henrik Levkowetz 7385a8be51 Changed name and signature for a log helper.
- Legacy-Id: 13571
2017-06-09 19:38:48 +00:00
Henrik Levkowetz fb93a8c293 Added dates to unreachable() calls, to make it easier to decide when to remove marked code.
- Legacy-Id: 13538
2017-06-06 07:27:07 +00:00
Henrik Levkowetz b2da91de1b Added a middleware exception handler for the case of people submitting unicode outside the Basic Multilingual Plane, which cannot currently be saved to the database.
- Legacy-Id: 13508
2017-06-03 21:47:51 +00:00
Henrik Levkowetz 7b3ce6e795 Improved the log.assertion() and unreachable() functions to send a deeper traceback when reporting by email, rather than just the last stack frame.
- Legacy-Id: 12999
2017-03-13 05:37:02 +00:00
Henrik Levkowetz ff31644ccf Tweaked assertion() and unreachable() to raise an exception instead of sending email (to the test mailbox ...) when running the test suite.
- Legacy-Id: 12977
2017-03-06 14:31:45 +00:00
Henrik Levkowetz 0bcb4ae30c Fixed a problem with assertion() and unreachable(), which could break if certain names (like 'args') were set in the calling frame.
- Legacy-Id: 12975
2017-03-06 13:51:08 +00:00
Henrik Levkowetz 5bb5ca727b Created a special function log.unreachable() to mark code unreachable, and changed a function name from log.affirm() to log.assertion().
- Legacy-Id: 12933
2017-02-28 20:16:52 +00:00
Henrik Levkowetz 4f12513b1f Tweaked the affirm() failure message.
- Legacy-Id: 12925
2017-02-27 16:42:23 +00:00
Henrik Levkowetz 49af9b4e1a Added an affirm(statement_string) function, which acts like an assert, and lets us trigger an email message with traceback when the statement to affirm is False. Use instead of assert if we still want the server to produce a response, even if something is seriously wrong.
- Legacy-Id: 12901
2017-02-23 11:48:55 +00:00
Henrik Levkowetz 0d160b9672 Guard get array value against array==None in log.getcaller()
- Legacy-Id: 11641
2016-07-13 12:56:02 +00:00
Henrik Levkowetz 2191ec3cbd Removed logging through ietf.utils.log.log when running tests -- should shave another 15% off the test suite run time.
- Legacy-Id: 10454
2015-11-08 14:26:41 +00:00
Henrik Levkowetz 9ea9ba1d66 Merged in [7138] from rjsparks@nostrum.com:
Reworked SMTP Exception handling, adding sending a ticket to the secretariat when there are errors handing messages off for delivery.
Added SMTP exception handling to send-scheduled-mail.
This is related to ticket #1208
 - Legacy-Id: 7256
Note: SVN reference [7138] has been migrated to Git commit 64727c1c33
2014-02-17 18:55:37 +00:00
Henrik Levkowetz 0e67b2c758 Tweaked the handling of the syslog module not being available on windows.
- Legacy-Id: 5058
2012-11-07 21:41:02 +00:00
Henrik Levkowetz cfcce2f03e Merged [5000] from rjsparks@nostrum.com:
Made it more obvious when an intended status or shepherding AD is not set
Removed an unused template
Show reset approval text immediately.

Fixes bug #900
 - Legacy-Id: 5015
Note: SVN reference [5000] has been migrated to Git commit 2470ad77dd
2012-11-07 13:01:34 +00:00
Henrik Levkowetz cfe466eb37 Merged [4991] from adam@nostrum.com:
Fixing time column wrapping problem that exhibits in (at least) Safari.
 - Legacy-Id: 5008
Note: SVN reference [4991] has been migrated to Git commit 5e384591fd
2012-11-06 15:23:17 +00:00
Henrik Levkowetz 8aa4922978 Remove dependency on syslog module -- it won't be available under Python 2.7 under Windows.
- Legacy-Id: 4974
2012-10-30 22:17:24 +00:00
Henrik Levkowetz 266b7820d0 Merged from log:branch/2.00@2363: Current release branch head to trunk.
- Legacy-Id: 2365
2010-07-21 12:48:05 +00:00
Henrik Levkowetz cd030d3b43 Adding copyright notices to all python files
- Legacy-Id: 716
2007-06-27 21:16:34 +00:00
Bill Fenner 78186c7406 Use the "standard" django way to get at the settings.
- Legacy-Id: 162
2007-05-24 17:36:25 +00:00
Henrik Levkowetz cf20093762 * Moved utility functions into utils/ directory, and started breaking out
utilities into separate files.
 * Added a log() function in ietf/utils.  It uses syslog, but adds some
   information about where it was called from.
 - Legacy-Id: 130
2007-05-11 15:48:45 +00:00