logging: integrate consumer-app logging with campus.auth (startup config, auth-flow records, trace ids)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Domain
- backend, observability
Research direction
Start with login_manager.py, context.py, audit/tracing.py, and propagation.py; compare their logging behavior with the referenced campus/logging_config.py and the SDK’s campus_python/__init__.py. Decide how startup configuration should preserve tracing handlers and where the shared helper belongs. Done means consumer and auth-flow logs have consistent setup, trace and journey IDs, and exception details, with migration and logging guidance documented.
Written by the indexing model from the issue text.
Description
Consumer apps get no logging setup from flask_campus, and flask_campus's own
auth-flow records are emitted into whatever configuration happens to be in
the process. Nothing lines an app's logs up with campus.auth's, so a failed
sign-in has to be pieced together from stderr lines on one side and audit
traces on the other.
Worked example: nyjc-computing/nyxchange-timetable-v2#168 (verdict:
logger.exception() wherever a traceback is needed). ttv2 pins
flask-campus 0.1.21 and configures no logging of its own; the startup-config
follow-up it still owes is nyjc-computing/nyxchange-timetable-v2#93. The
facts below were checked on 2026-11-25 against main (0.2.6) and the wheels
ttv2 installs.
Today
- The only logging configuration in a consumer's process comes from the
SDK:campus_python/__init__.pycalls
logging.basicConfig(level=logging.INFO)at import, and importing
flask_campus is itself enough to trigger it (__init__imports
login_manager, which importscampus_python). That is the process's
sole handler (stderr,%(levelname)s:%(name)s:%(message)s, INFO on),
and it turns any laterbasicConfigin the app into a silent no-op,
becausebasicConfigonly acts when the root logger has no handlers.
On Railway every such line iserror, INFO narrations included. - Records are filed under two naming conventions:
login_manager.pylogs
throughflask.current_app.logger(:115, :322), so the record carries
the consumer's logger name, whilecontext.py,circles.pyand
audit/tracing.pyusecampus.flask_campus.*module loggers. Filtering
by logger name cannot separate the library's records from the app's. - Three broad
except Exceptionhandlers drop the traceback:
context.py:213and:243(session resolution degrades to signed-out,
#28) and:395(revocation failure). Each logs the exception's type and
message at WARNING and continues, so an unexpected failure in session
resolution is indistinguishable from "signed out". By the ttv2#168
verdict these wantexc_info=True. - Log records carry no ids.
propagation.request_context_headers()already
stamps the app'strace_id/journey_idon every campus.auth call, so
campus.auth's audit spans join back to the app's request. The app's
log lines do not, and neither do campus.auth's own: there is no logging
filter on either side.
Proposal: three pieces
- Startup config. A helper giving consumers what campus.auth gives
itself (campus-suite'scampus/logging_config.py: root logger to
stdout, fleet format, level from an env knob, noisy third-party
loggers quieted, idempotent). Open question: whetherinit_appapplies it
when the app has configured nothing, or only exposes it for the app to
call. - Auth-flow records. One naming convention (
campus.flask_campus.*
module loggers; library code stays offapp.logger), conventional levels,
andexc_info=Truewherever a broadexcepthandles an unknown failure.
Typed, expected errors stay message-only; the two existing
login_manager.pysites are already the model. - Ids that join logs to traces. A logging
Filterstamping each record
emitted during a request with the idspropagation.pyalready sends, so
onelogger.exceptionline can be looked up in the same journey's
campus.auth spans.
Layering note: the config helper is not auth-specific. campus-common is
its natural home, with campus.auth's logging_config collapsing onto the
same code so the service and its consumers log identically; flask_campus
owns only the auth-flow vocabulary, the filter, and calling the helper. The
SDK's import-time basicConfig has to go for any of this to hold (library
code should not configure the root logger). That change belongs in
campus-api-python and has no issue yet.
Two traps to design around
basicConfigwithoutforceis a no-op once the SDK's handler exists,
so the helper must run before the SDK is imported or replace root handlers
explicitly.init_tracingattachesRequestWarningCollectorto the root logger
(audit/tracing.py:275), andbasicConfig(force=True)removes existing
root handlers. A helper applied afterinit_tracingsilently stops
WARNING+ records riding into traces (#26). Ordering, or handler
preservation, needs specifying.
Deployment semantics: Railway assigns level by stream, not by text:
stderr lines are error, stdout lines are info, and a plain-text traceback
is one entry per line (single-line JSON keeps level and whole stack
traces). So stdout is the floor; whether the fleet moves to JSON is worth
deciding once, here.
Relation to #30: #30 is about writing into the audit trace; this is
about the process log stream. They share the root-logger touchpoint, so
they should be designed in one pass.
Migration: consumers delete hand-rolled startup config once they pin the
release (ttv2 is the first candidate, via ttv2#93); the three context.py
handlers ship in the same release. Docs: a Logging page on the MkDocs site
carrying the logger.exception vs logger.error rule.
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- Avg merge
- 9m
- Merged PRs (30d)
- 40
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nyjc-computing/flask-campus
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 58/100
nyjc-computing/flask-campus#44 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 38/100
nyjc-computing/flask-campus#43 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
nyjc-computing/flask-campus#30 ·
Maintainers usually reply within 1 day
All issues in nyjc-computing/flask-campus
Similar issues
-
triage
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
kornia/kornia-rs#1416 · 1 comment ·
Maintainers usually reply within 2 days
-
ui
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
PolicyEngine/ai-inequality#64 ·
Maintainers usually reply within 1 day
-
LinearGaussianStateSpace.dist splits states and observations wrongly when the transition varies over timePossibly taken @PabloRoque claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
pymc-devs/pymc-extras#839 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day