-
Notifications
You must be signed in to change notification settings - Fork 7
/
example_log.json
481 lines (481 loc) · 23.8 KB
/
example_log.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
{
"thread": 459014,
"level_name": "Information",
"message": "Started server process [459014]",
"source_log": "uvicorn.error",
"@timestamp": "2022-03-16T09:50:58+03:00",
"app_name": "FastAPI example application",
"app_version": "0.0.1",
"app_env": "dev",
"duration": 320
}
{
"thread": 459014,
"level_name": "Information",
"message": "Waiting for application startup.",
"source_log": "uvicorn.error",
"@timestamp": "2022-03-16T09:50:58+03:00",
"app_name": "FastAPI example application",
"app_version": "0.0.1",
"app_env": "dev",
"duration": 320
}
{
"thread": 459014,
"level_name": "Information",
"message": "Application startup complete.",
"source_log": "uvicorn.error",
"@timestamp": "2022-03-16T09:50:58+03:00",
"app_name": "FastAPI example application",
"app_version": "0.0.1",
"app_env": "dev",
"duration": 321
}
{
"thread": 459014,
"level_name": "Information",
"message": "Got /",
"source_log": "main",
"@timestamp": "2022-03-16T09:51:03+03:00",
"app_name": "FastAPI example application",
"app_version": "0.0.1",
"app_env": "dev",
"duration": 649
}
{
"thread": 459014,
"level_name": "Information",
"message": "Answer code: 200 request url: GET \"http://127.0.0.1:8888/\" duration: 2 ms ",
"source_log": "main",
"@timestamp": "2022-03-16T09:51:03+03:00",
"app_name": "FastAPI example application",
"app_version": "0.0.1",
"app_env": "dev",
"duration": 2,
"request_uri": "http://127.0.0.1:8888/",
"request_referer": "http://127.0.0.1:8888/docs",
"request_method": "GET",
"request_path": "/",
"request_host": "127.0.0.1:8888",
"request_size": 0,
"request_content_type": "",
"request_headers": {
"host": "127.0.0.1:8888",
"connection": "keep-alive",
"sec-ch-ua": "\"Chromium\";v=\"98\", \" Not A;Brand\";v=\"99\"",
"accept": "application/json",
"sec-ch-ua-mobile": "?0",
"user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.121 Safari/537.36",
"sec-ch-ua-platform": "\"Linux\"",
"sec-fetch-site": "same-origin",
"sec-fetch-mode": "cors",
"sec-fetch-dest": "empty",
"referer": "http://127.0.0.1:8888/docs",
"accept-encoding": "gzip, deflate, br",
"accept-language": "ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7",
"cookie": "_pk_id.1.dc78=4ec40eae396f1c32.1645453915.; GUID_20B40965CCF8B7300FCB1E3B5CB9925FB27970B0_8888=NcjlKqKxMJq9RgiYXEf3; io=fSKn7g-dE_J63nxDAAAA"
},
"request_body": "",
"request_direction": "in",
"response_status_code": 200,
"response_size": 22,
"response_headers": {
"content-length": "22",
"content-type": "application/json"
},
"response_body": "{\"answer\":\"I am Root\"}"
}
{
"thread": 459014,
"level_name": "Information",
"message": "Got /error, one=1, two=0",
"source_log": "main",
"@timestamp": "2022-03-16T09:51:07+03:00",
"app_name": "FastAPI example application",
"app_version": "0.0.1",
"app_env": "dev",
"duration": 173
}
{
"thread": 459014,
"level_name": "Information",
"message": "Error code: 500 request url: GET \"http://127.0.0.1:8888/error?one=1&two=0\" duration: 2 ms ",
"source_log": "main",
"@timestamp": "2022-03-16T09:51:07+03:00",
"app_name": "FastAPI example application",
"app_version": "0.0.1",
"app_env": "dev",
"duration": 2,
"exceptions": [
"File \"/home/mostepan/dev/allgit/fastapi-json-log/venv/lib/python3.8/site-packages/starlette/middleware/base.py\", line 41, in call_next",
" message = await recv_stream.receive()",
"File \"/home/mostepan/dev/allgit/fastapi-json-log/venv/lib/python3.8/site-packages/anyio/streams/memory.py\", line 81, in receive",
" 78 async def receive(self) -> T_Item:",
" 79 await checkpoint()",
" 80 try:",
"--> 81 return self.receive_nowait()",
" 82 except WouldBlock:",
" ..................................................",
" self = MemoryObjectReceiveStream(_state=MemoryObjectStreamState(max",
" _buffer_size=0, buffer=deque([]), open_send_channels=0, open",
" _receive_channels=1, waiting_receivers=OrderedDict(), waitin",
" g_senders=OrderedDict()), _closed=False)",
" T_Item = ~T_Item",
" self.receive_nowait = <method 'MemoryObjectReceiveStream.receive_nowait' of Memory",
" ObjectReceiveStream(_state=MemoryObjectStreamState(max_buffe",
" r_size=0, buffer=deque([]), open_send_channels=0, open_recei",
" ve_channels=1, waiting_receivers=OrderedDict(), waiting_send",
" ers=OrderedDict()), _closed=False) memory.py:50>",
" WouldBlock = <class 'anyio.WouldBlock'>",
" ..................................................",
"",
"File \"/home/mostepan/dev/allgit/fastapi-json-log/venv/lib/python3.8/site-packages/anyio/streams/memory.py\", line 74, in receive_nowait",
" 50 def receive_nowait(self) -> T_Item:",
" (...)",
" 70 ",
" 71 if self._state.buffer:",
" 72 return self._state.buffer.popleft()",
" 73 elif not self._state.open_send_channels:",
"--> 74 raise EndOfStream",
" 75 ",
" ..................................................",
" self = MemoryObjectReceiveStream(_state=MemoryObjectStreamState(max",
" _buffer_size=0, buffer=deque([]), open_send_channels=0, open",
" _receive_channels=1, waiting_receivers=OrderedDict(), waitin",
" g_senders=OrderedDict()), _closed=False)",
" T_Item = ~T_Item",
" self._state.buffer = deque([])",
" self._state.open_send_channels = 0",
" EndOfStream = <class 'anyio.EndOfStream'>",
" ..................................................",
"",
"EndOfStream",
"",
"While handling the above exception, another exception occurred:",
"",
"File \"/home/mostepan/dev/allgit/fastapi-json-log/./app/core/middleware.py\", line 87, in __call__",
" 71 async def __call__(",
" 72 self,",
" 73 request: Request,",
" 74 call_next: RequestResponseEndpoint,",
" 75 *args,",
" 76 **kwargs",
" 77 ):",
" (...)",
" 83 request_headers: dict = dict(request.headers.items())",
" 84 ",
" 85 # Response Side",
" 86 try:",
"--> 87 response = await call_next(request)",
" 88 except Exception as ex:",
" ..................................................",
" self = <app.core.middleware.LoggingMiddleware object at 0x7fbeb2d80",
" e20>",
" request = <starlette.requests.Request object at 0x7fbeb2d331c0>",
" Request = <class 'starlette.requests.Request'>",
" RequestResponseEndpoint = typing.Callable[[starlette.requests.Request], typing.Awaitab",
" le[starlette.responses.Response]]",
" args = ()",
" kwargs = {}",
" request_headers = {'host': '127.0.0.1:8888',",
" 'connection': 'keep-alive',",
" 'sec-ch-ua': '\"Chromium\";v=\"98\", \" Not A;Brand\";v=\"99\"',",
" 'accept': 'application/json',",
" 'sec-ch-ua-mobile': '?0',",
" 'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/",
" 537.36 (KHTML, like Gecko) Chrome/98.0.4758.121 Safari/537.3",
" 6',",
" 'sec-ch-ua-platform': '\"Linux\"',",
" 'sec-fetch-site': 'same-origin',",
" 'sec-fetch-mode': 'cors',",
" 'sec-fetch-dest': 'empty',",
" 'referer': 'http://127.0.0.1:8888/docs',",
" 'accept-encoding': 'gzip, deflate, br'...",
" response = <starlette.responses.Response object at 0x7fbeb2cfb400>",
" ..................................................",
"",
"File \"/home/mostepan/dev/allgit/fastapi-json-log/venv/lib/python3.8/site-packages/starlette/middleware/base.py\", line 44, in call_next",
" 25 async def call_next(request: Request) -> Response:",
" (...)",
"--> 44 raise app_exc",
" ..................................................",
" request = <starlette.requests.Request object at 0x7fbeb2d331c0>",
" Request = <class 'starlette.requests.Request'>",
" Response = <class 'starlette.responses.Response'>",
" app_exc = ZeroDivisionError('division by zero')",
" ..................................................",
"",
"File \"/home/mostepan/dev/allgit/fastapi-json-log/venv/lib/python3.8/site-packages/starlette/middleware/base.py\", line 34, in coro",
" await self.app(scope, request.receive, send_stream.send)",
"File \"/home/mostepan/dev/allgit/fastapi-json-log/venv/lib/python3.8/site-packages/starlette/middleware/cors.py\", line 84, in __call__",
" await self.app(scope, receive, send)",
"File \"/home/mostepan/dev/allgit/fastapi-json-log/venv/lib/python3.8/site-packages/starlette/exceptions.py\", line 82, in __call__",
" raise exc",
"File \"/home/mostepan/dev/allgit/fastapi-json-log/venv/lib/python3.8/site-packages/starlette/exceptions.py\", line 71, in __call__",
" await self.app(scope, receive, sender)",
"File \"/home/mostepan/dev/allgit/fastapi-json-log/venv/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py\", line 21, in __call__",
" 12 async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:",
" (...)",
" 17 try:",
" 18 await self.app(scope, receive, send)",
" 19 except Exception as e:",
" 20 dependency_exception = e",
"--> 21 raise e",
" 22 if dependency_exception:",
" ..................................................",
" self = <fastapi.middleware.asyncexitstack.AsyncExitStackMiddleware ",
" object at 0x7fbeb2d181c0>",
" scope = {'type': 'http',",
" 'asgi': {'version': '3.0',",
" 'spec_version': '2.3'},",
" 'http_version': '1.1',",
" 'server': ('127.0.0.1', 8888, ),",
" 'client': ('127.0.0.1', 48234, ),",
" 'scheme': 'http',",
" 'method': 'GET',",
" 'root_path': '',",
" 'path': '/error',",
" 'raw_path': b'/error',",
" 'query_string': b'one=1&two=0',",
" 'headers': [(...), (...), (...), (...), (...), (...), (...)",
" , (...), (...), (...), (...), (...), (...), (...), ],",
" 'app': <fastapi.applications.FastAPI object at 0x7fbeb389fd",
" c0>,",
" 'fastapi_astack':...",
" Scope = typing.MutableMapping[str, typing.Any]",
" receive = ReceiveProxy(receive=<function MessageLoggerMiddleware.__cal",
" l__.<locals>.inner_receive at 0x7fbeb2cce430>, cached_body=b",
" '')",
" Receive = typing.Callable[[], typing.Awaitable[typing.MutableMapping[s",
" tr, typing.Any]]]",
" Send = typing.Callable[[typing.MutableMapping[str, typing.Any]], ty",
" ping.Awaitable[NoneType]]",
" self.app = <fastapi.routing.APIRouter object at 0x7fbeb389fe50>",
" dependency_exception = ZeroDivisionError('division by zero')",
" ..................................................",
"",
"File \"/home/mostepan/dev/allgit/fastapi-json-log/venv/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py\", line 18, in __call__",
" 12 async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:",
" (...)",
" 14 dependency_exception: Optional[Exception] = None",
" 15 async with AsyncExitStack() as stack:",
" 16 scope[self.context_name] = stack",
" 17 try:",
"--> 18 await self.app(scope, receive, send)",
" 19 except Exception as e:",
" ..................................................",
" self = <fastapi.middleware.asyncexitstack.AsyncExitStackMiddleware ",
" object at 0x7fbeb2d181c0>",
" scope = {'type': 'http',",
" 'asgi': {'version': '3.0',",
" 'spec_version': '2.3'},",
" 'http_version': '1.1',",
" 'server': ('127.0.0.1', 8888, ),",
" 'client': ('127.0.0.1', 48234, ),",
" 'scheme': 'http',",
" 'method': 'GET',",
" 'root_path': '',",
" 'path': '/error',",
" 'raw_path': b'/error',",
" 'query_string': b'one=1&two=0',",
" 'headers': [(...), (...), (...), (...), (...), (...), (...)",
" , (...), (...), (...), (...), (...), (...), (...), ],",
" 'app': <fastapi.applications.FastAPI object at 0x7fbeb389fd",
" c0>,",
" 'fastapi_astack':...",
" Scope = typing.MutableMapping[str, typing.Any]",
" receive = ReceiveProxy(receive=<function MessageLoggerMiddleware.__cal",
" l__.<locals>.inner_receive at 0x7fbeb2cce430>, cached_body=b",
" '')",
" Receive = typing.Callable[[], typing.Awaitable[typing.MutableMapping[s",
" tr, typing.Any]]]",
" Send = typing.Callable[[typing.MutableMapping[str, typing.Any]], ty",
" ping.Awaitable[NoneType]]",
" dependency_exception = ZeroDivisionError('division by zero')",
" Optional = typing.Optional",
" AsyncExitStack = <class 'contextlib.AsyncExitStack'>",
" stack = <contextlib.AsyncExitStack object at 0x7fbeb2d33580>",
" self.context_name = 'fastapi_astack'",
" self.app = <fastapi.routing.APIRouter object at 0x7fbeb389fe50>",
" ..................................................",
"",
"File \"/home/mostepan/dev/allgit/fastapi-json-log/venv/lib/python3.8/site-packages/starlette/routing.py\", line 656, in __call__",
" 635 async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:",
" (...)",
"--> 656 await route.handle(scope, receive, send)",
" ..................................................",
" self = <fastapi.routing.APIRouter object at 0x7fbeb389fe50>",
" scope = {'type': 'http',",
" 'asgi': {'version': '3.0',",
" 'spec_version': '2.3'},",
" 'http_version': '1.1',",
" 'server': ('127.0.0.1', 8888, ),",
" 'client': ('127.0.0.1', 48234, ),",
" 'scheme': 'http',",
" 'method': 'GET',",
" 'root_path': '',",
" 'path': '/error',",
" 'raw_path': b'/error',",
" 'query_string': b'one=1&two=0',",
" 'headers': [(...), (...), (...), (...), (...), (...), (...)",
" , (...), (...), (...), (...), (...), (...), (...), ],",
" 'app': <fastapi.applications.FastAPI object at 0x7fbeb389fd",
" c0>,",
" 'fastapi_astack':...",
" Scope = typing.MutableMapping[str, typing.Any]",
" receive = ReceiveProxy(receive=<function MessageLoggerMiddleware.__cal",
" l__.<locals>.inner_receive at 0x7fbeb2cce430>, cached_body=b",
" '')",
" Receive = typing.Callable[[], typing.Awaitable[typing.MutableMapping[s",
" tr, typing.Any]]]",
" Send = typing.Callable[[typing.MutableMapping[str, typing.Any]], ty",
" ping.Awaitable[NoneType]]",
" ..................................................",
"",
"File \"/home/mostepan/dev/allgit/fastapi-json-log/venv/lib/python3.8/site-packages/starlette/routing.py\", line 259, in handle",
" await self.app(scope, receive, send)",
"File \"/home/mostepan/dev/allgit/fastapi-json-log/venv/lib/python3.8/site-packages/starlette/routing.py\", line 61, in app",
" response = await func(request)",
"File \"/home/mostepan/dev/allgit/fastapi-json-log/venv/lib/python3.8/site-packages/fastapi/routing.py\", line 227, in app",
" 187 async def app(request: Request) -> Response:",
" (...)",
" 223 values, errors, background_tasks, sub_response, _ = solved_result",
" 224 if errors:",
" 225 raise RequestValidationError(errors, body=body)",
" 226 else:",
"--> 227 raw_response = await run_endpoint_function(",
" 228 dependant=dependant, values=values, is_coroutine=is_coroutine",
" ..................................................",
" request = <starlette.requests.Request object at 0x7fbeb2d33070>",
" Request = <class 'starlette.requests.Request'>",
" Response = <class 'starlette.responses.Response'>",
" values = {'one': 1,",
" 'two': 0}",
" errors = []",
" background_tasks = None",
" sub_response = <starlette.responses.Response object at 0x7fbeb2d33610>",
" _ = {}",
" solved_result = (",
" {'one': 1,",
" 'two': 0}, ",
" [], None, <starlette.responses.Response object at 0x7fbeb2d3",
" 3610>, {}, )",
" RequestValidationError = <class 'fastapi.exceptions.RequestValidationError'>",
" body = None",
" dependant = <fastapi.dependencies.models.Dependant object at 0x7fbeb2d18",
" ac0>",
" is_coroutine = True",
" ..................................................",
"",
"File \"/home/mostepan/dev/allgit/fastapi-json-log/venv/lib/python3.8/site-packages/fastapi/routing.py\", line 160, in run_endpoint_function",
" 152 async def run_endpoint_function(",
" 153 *, dependant: Dependant, values: Dict[str, Any], is_coroutine: bool",
" 154 ) -> Any:",
" (...)",
" 156 # facilitate profiling endpoints, since inner functions are harder to profile.",
" 157 assert dependant.call is not None, \"dependant.call must be a function\"",
" 158 ",
" 159 if is_coroutine:",
"--> 160 return await dependant.call(**values)",
" 161 else:",
" ..................................................",
" dependant = <fastapi.dependencies.models.Dependant object at 0x7fbeb2d18",
" ac0>",
" Dependant = <class 'fastapi.dependencies.models.Dependant'>",
" values = {'one': 1,",
" 'two': 0}",
" Dict = typing.Dict",
" Any = typing.Any",
" is_coroutine = True",
" dependant.call = <function 'error' main.py:39>",
" ..................................................",
"",
"File \"/home/mostepan/dev/allgit/fastapi-json-log/./app/main.py\", line 44, in error",
" 40 async def error(one: int, two: int):",
" 41 \"\"\" Example with traceback",
" 42 \"\"\"",
" 43 logger.info(f\"Got /error, {one=}, {two=}\")",
"--> 44 return one / two",
" ..................................................",
" one = 1",
" two = 0",
" logger.info = <method 'Logger.info' of <Logger main (DEBUG)> __init__.py:1",
" 436>",
" ..................................................",
"",
"ZeroDivisionError: division by zero"
],
"request_uri": "http://127.0.0.1:8888/error?one=1&two=0",
"request_referer": "http://127.0.0.1:8888/docs",
"request_method": "GET",
"request_path": "/error",
"request_host": "127.0.0.1:8888",
"request_size": 0,
"request_content_type": "",
"request_headers": {
"host": "127.0.0.1:8888",
"connection": "keep-alive",
"sec-ch-ua": "\"Chromium\";v=\"98\", \" Not A;Brand\";v=\"99\"",
"accept": "application/json",
"sec-ch-ua-mobile": "?0",
"user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.121 Safari/537.36",
"sec-ch-ua-platform": "\"Linux\"",
"sec-fetch-site": "same-origin",
"sec-fetch-mode": "cors",
"sec-fetch-dest": "empty",
"referer": "http://127.0.0.1:8888/docs",
"accept-encoding": "gzip, deflate, br",
"accept-language": "ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7",
"cookie": "_pk_id.1.dc78=4ec40eae396f1c32.1645453915.; GUID_20B40965CCF8B7300FCB1E3B5CB9925FB27970B0_8888=NcjlKqKxMJq9RgiYXEf3; io=fSKn7g-dE_J63nxDAAAA"
},
"request_body": "",
"request_direction": "in",
"response_status_code": 500,
"response_size": 0,
"response_headers": {},
"response_body": "Internal Server Error"
}
{
"thread": 459014,
"level_name": "Information",
"message": "Shutting down",
"source_log": "uvicorn.error",
"@timestamp": "2022-03-16T09:51:13+03:00",
"app_name": "FastAPI example application",
"app_version": "0.0.1",
"app_env": "dev",
"duration": 599
}
{
"thread": 459014,
"level_name": "Information",
"message": "Waiting for application shutdown.",
"source_log": "uvicorn.error",
"@timestamp": "2022-03-16T09:51:13+03:00",
"app_name": "FastAPI example application",
"app_version": "0.0.1",
"app_env": "dev",
"duration": 701
}
{
"thread": 459014,
"level_name": "Information",
"message": "Application shutdown complete.",
"source_log": "uvicorn.error",
"@timestamp": "2022-03-16T09:51:13+03:00",
"app_name": "FastAPI example application",
"app_version": "0.0.1",
"app_env": "dev",
"duration": 702
}
{
"thread": 459014,
"level_name": "Information",
"message": "Finished server process [459014]",
"source_log": "uvicorn.error",
"@timestamp": "2022-03-16T09:51:13+03:00",
"app_name": "FastAPI example application",
"app_version": "0.0.1",
"app_env": "dev",
"duration": 703
}