File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 196196# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
197197
198198DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
199+
200+ # Customise the default logging config, since by default full Django logs are only emitted when
201+ # `DEBUG=True` (which otherwise makes diagnosing errors much harder in production):
202+ # https://docs.djangoproject.com/en/5.1/ref/logging/#default-logging-configuration
203+ # For more advanced logging you may want to try: https://django-structlog.readthedocs.io
204+ LOGGING = {
205+ "version" : 1 ,
206+ "disable_existing_loggers" : False ,
207+ "formatters" : {
208+ "simple" : {
209+ "format" : "[{levelname}] {message}" ,
210+ "style" : "{" ,
211+ },
212+ },
213+ "handlers" : {
214+ "console" : {
215+ "class" : "logging.StreamHandler" ,
216+ "formatter" : "simple" ,
217+ },
218+ },
219+ # Fallback for anything not configured via `loggers`.
220+ "root" : {
221+ "handlers" : ["console" ],
222+ "level" : "INFO" ,
223+ },
224+ "loggers" : {
225+ "django" : {
226+ "handlers" : ["console" ],
227+ "level" : "INFO" ,
228+ # Prevent double logging due to the root logger.
229+ "propagate" : False ,
230+ },
231+ "django.request" : {
232+ # Suppress the WARNINGS from any HTTP 4xx responses (in particular for 404s caused by
233+ # web crawlers), but still show any ERRORs from HTTP 5xx responses/exceptions.
234+ "level" : "ERROR" ,
235+ },
236+ },
237+ }
You can’t perform that action at this time.
0 commit comments