mirror of
https://github.com/zulip/zulip.git
synced 2025-11-17 20:41:46 +00:00
middleware: Log <user.id>@subdomain instead of subdomain/<user.id>.
It was decided that the new format is preferable.
This commit is contained in:
committed by
Tim Abbott
parent
a1daf0cf83
commit
eb0216c5a8
@@ -380,11 +380,11 @@ When you navigate to Zulip in your browser, check your terminal and you
|
|||||||
should see something like:
|
should see something like:
|
||||||
|
|
||||||
```
|
```
|
||||||
2016-05-04 18:21:57,547 INFO 127.0.0.1 GET 302 582ms (+start: 417ms) / (zulip/unauth via ?)
|
2016-05-04 18:21:57,547 INFO 127.0.0.1 GET 302 582ms (+start: 417ms) / (unauth@zulip via ?)
|
||||||
[04/May/2016 18:21:57]"GET / HTTP/1.0" 302 0
|
[04/May/2016 18:21:57]"GET / HTTP/1.0" 302 0
|
||||||
2016-05-04 18:21:57,568 INFO 127.0.0.1 GET 301 4ms /login (zulip/unauth via ?)
|
2016-05-04 18:21:57,568 INFO 127.0.0.1 GET 301 4ms /login (unauth@zulip via ?)
|
||||||
[04/May/2016 18:21:57]"GET /login HTTP/1.0" 301 0
|
[04/May/2016 18:21:57]"GET /login HTTP/1.0" 301 0
|
||||||
2016-05-04 18:21:57,819 INFO 127.0.0.1 GET 200 209ms (db: 7ms/2q) /login/ (zulip/unauth via ?)
|
2016-05-04 18:21:57,819 INFO 127.0.0.1 GET 200 209ms (db: 7ms/2q) /login/ (unauth@zulip via ?)
|
||||||
```
|
```
|
||||||
|
|
||||||
Now you're ready for [Step 4: Developing.](#step-4-developing)
|
Now you're ready for [Step 4: Developing.](#step-4-developing)
|
||||||
@@ -479,7 +479,7 @@ can halt vagrant from another Terminal/Git BASH window.
|
|||||||
From the window where run-dev.py is running:
|
From the window where run-dev.py is running:
|
||||||
|
|
||||||
```
|
```
|
||||||
2016-05-04 18:33:13,330 INFO 127.0.0.1 GET 200 92ms /register/ (zulip/unauth via ?)
|
2016-05-04 18:33:13,330 INFO 127.0.0.1 GET 200 92ms /register/ (unauth@zulip via ?)
|
||||||
^C
|
^C
|
||||||
KeyboardInterrupt
|
KeyboardInterrupt
|
||||||
(zulip-py3-venv) vagrant@ubuntu-bionic:/srv/zulip$ exit
|
(zulip-py3-venv) vagrant@ubuntu-bionic:/srv/zulip$ exit
|
||||||
|
|||||||
@@ -68,14 +68,14 @@ since the main server log can be very verbose, but the main server log
|
|||||||
can be extremely valuable for investigating performance problems.
|
can be extremely valuable for investigating performance problems.
|
||||||
|
|
||||||
```
|
```
|
||||||
2016-05-20 14:50:22.056 INFO [zr] 127.0.0.1 GET 302 528ms (db: 1ms/1q) (+start: 123ms) / (zulip/unauth via ?)
|
2016-05-20 14:50:22.056 INFO [zr] 127.0.0.1 GET 302 528ms (db: 1ms/1q) (+start: 123ms) / (unauth@zulip via ?)
|
||||||
[20/May/2016 14:50:22]"GET / HTTP/1.0" 302 0
|
[20/May/2016 14:50:22]"GET / HTTP/1.0" 302 0
|
||||||
2016-05-20 14:50:22.272 INFO [zr] 127.0.0.1 GET 200 124ms (db: 3ms/2q) /login/ (zulip/unauth via ?)
|
2016-05-20 14:50:22.272 INFO [zr] 127.0.0.1 GET 200 124ms (db: 3ms/2q) /login/ (unauth@zulip via ?)
|
||||||
2016-05-20 14:50:26.333 INFO [zr] 127.0.0.1 POST 302 37ms (db: 6ms/7q) /accounts/login/local/ (zulip/nauth via ?)
|
2016-05-20 14:50:26.333 INFO [zr] 127.0.0.1 POST 302 37ms (db: 6ms/7q) /accounts/login/local/ (unauth@zulip via ?)
|
||||||
[20/May/2016 14:50:26]"POST /accounts/login/local/ HTTP/1.0" 302 0
|
[20/May/2016 14:50:26]"POST /accounts/login/local/ HTTP/1.0" 302 0
|
||||||
2016-05-20 14:50:26.538 INFO [zr] 127.0.0.1 POST 200 12ms (db: 1ms/2q) (+start: 53ms) /api/v1/events/internal [1463769771:0/0] (zulip/8 via internal)
|
2016-05-20 14:50:26.538 INFO [zr] 127.0.0.1 POST 200 12ms (db: 1ms/2q) (+start: 53ms) /api/v1/events/internal [1463769771:0/0] (8@zulip via internal)
|
||||||
2016-05-20 14:50:26.657 INFO [zr] 127.0.0.1 POST 200 10ms (+start: 8ms) /api/v1/events/internal [1463769771:0/0] (zulip/8 via internal)
|
2016-05-20 14:50:26.657 INFO [zr] 127.0.0.1 POST 200 10ms (+start: 8ms) /api/v1/events/internal [1463769771:0/0] (8@zulip via internal)
|
||||||
2016-05-20 14:50:26.959 INFO [zr] 127.0.0.1 GET 200 588ms (db: 26ms/21q) / [1463769771:0] (zulip/8 via website)
|
2016-05-20 14:50:26.959 INFO [zr] 127.0.0.1 GET 200 588ms (db: 26ms/21q) / [1463769771:0] (8@zulip via website)
|
||||||
```
|
```
|
||||||
|
|
||||||
The format of this output is:
|
The format of this output is:
|
||||||
|
|||||||
@@ -292,7 +292,7 @@ class LogRequests(MiddlewareMixin):
|
|||||||
if hasattr(request, 'user') and hasattr(request.user, 'format_requestor_for_logs'):
|
if hasattr(request, 'user') and hasattr(request.user, 'format_requestor_for_logs'):
|
||||||
requestor_for_logs = request.user.format_requestor_for_logs()
|
requestor_for_logs = request.user.format_requestor_for_logs()
|
||||||
else:
|
else:
|
||||||
requestor_for_logs = "%s/unauth" % (get_subdomain(request) or 'root',)
|
requestor_for_logs = "unauth@%s" % (get_subdomain(request) or 'root',)
|
||||||
try:
|
try:
|
||||||
client = request.client.name
|
client = request.client.name
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
@@ -1177,7 +1177,7 @@ class UserProfile(AbstractBaseUser, PermissionsMixin):
|
|||||||
return -1
|
return -1
|
||||||
|
|
||||||
def format_requestor_for_logs(self) -> str:
|
def format_requestor_for_logs(self) -> str:
|
||||||
return "{}/{}".format(self.realm.string_id or 'root', self.id)
|
return "{}@{}".format(self.id, self.realm.string_id or 'root')
|
||||||
|
|
||||||
def set_password(self, password: Optional[str]) -> None:
|
def set_password(self, password: Optional[str]) -> None:
|
||||||
if password is None:
|
if password is None:
|
||||||
|
|||||||
Reference in New Issue
Block a user