mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-06 05:31:44 +00:00
merge
This commit is contained in:
@@ -113,7 +113,7 @@ void uwsgi_check_logrotate(void) {
|
||||
void log_request(struct wsgi_request *wsgi_req) {
|
||||
|
||||
// optimize this (please)
|
||||
char *time_request;
|
||||
char time_request[26];
|
||||
time_t microseconds, microseconds2;
|
||||
int rlen;
|
||||
int app_req = -1;
|
||||
@@ -160,7 +160,7 @@ void log_request(struct wsgi_request *wsgi_req) {
|
||||
via = msg3;
|
||||
}
|
||||
|
||||
time_request = ctime((const time_t *) &wsgi_req->start_of_request.tv_sec);
|
||||
ctime_r((const time_t *) &wsgi_req->start_of_request.tv_sec, time_request);
|
||||
microseconds = wsgi_req->end_of_request.tv_sec * 1000000 + wsgi_req->end_of_request.tv_usec;
|
||||
microseconds2 = wsgi_req->start_of_request.tv_sec * 1000000 + wsgi_req->start_of_request.tv_usec;
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ extern struct uwsgi_server uwsgi;
|
||||
ssize_t uwsgi_rsyslog_logger(struct uwsgi_logger *ul, char *message, size_t len) {
|
||||
|
||||
char buf[MAX_SYSLOG_PKT];
|
||||
char ctime_storage[26];
|
||||
time_t current_time;
|
||||
int portn = 514;
|
||||
int rlen;
|
||||
@@ -55,8 +56,8 @@ ssize_t uwsgi_rsyslog_logger(struct uwsgi_logger *ul, char *message, size_t len)
|
||||
|
||||
// drop newline
|
||||
if (message[len-1] == '\n') len--;
|
||||
|
||||
rlen = snprintf(buf, MAX_SYSLOG_PKT, "<29>%.*s %s: %.*s", 15, ctime(¤t_time)+4, (char *) ul->data, (int) len, message);
|
||||
ctime_r(¤t_time, ctime_storage);
|
||||
rlen = snprintf(buf, MAX_SYSLOG_PKT, "<29>%.*s %s: %.*s", 15, ctime_storage+4, (char *) ul->data, (int) len, message);
|
||||
if (rlen > 0) {
|
||||
return sendto(ul->fd, buf, rlen, 0, (const struct sockaddr *) &ul->addr, ul->addr_len);
|
||||
}
|
||||
|
||||
@@ -1189,6 +1189,7 @@ void uwsgi_log(const char *fmt, ...) {
|
||||
|
||||
struct timeval tv;
|
||||
char sftime[64];
|
||||
char ctime_storage[26];
|
||||
time_t now;
|
||||
|
||||
if (uwsgi.logdate) {
|
||||
@@ -1201,8 +1202,8 @@ void uwsgi_log(const char *fmt, ...) {
|
||||
}
|
||||
else {
|
||||
gettimeofday(&tv, NULL);
|
||||
|
||||
memcpy(logpkt, ctime((const time_t *) &tv.tv_sec), 24);
|
||||
ctime_r((const time_t *) &tv.tv_sec, ctime_storage);
|
||||
memcpy(logpkt, ctime_storage, 24);
|
||||
memcpy(logpkt + 24, " - ", 3);
|
||||
|
||||
rlen = 24 + 3;
|
||||
@@ -1238,6 +1239,7 @@ void uwsgi_log_verbose(const char *fmt, ...) {
|
||||
struct timeval tv;
|
||||
char sftime[64];
|
||||
time_t now;
|
||||
char ctime_storage[26];
|
||||
|
||||
if (uwsgi.log_strftime) {
|
||||
now = time(NULL);
|
||||
@@ -1248,8 +1250,8 @@ void uwsgi_log_verbose(const char *fmt, ...) {
|
||||
}
|
||||
else {
|
||||
gettimeofday(&tv, NULL);
|
||||
|
||||
memcpy(logpkt, ctime((const time_t *) &tv.tv_sec), 24);
|
||||
ctime_r((const time_t *) &tv.tv_sec, ctime_storage);
|
||||
memcpy(logpkt, ctime_storage, 24);
|
||||
memcpy(logpkt + 24, " - ", 3);
|
||||
|
||||
rlen = 24 + 3;
|
||||
|
||||
@@ -871,6 +871,7 @@ void what_i_am_doing() {
|
||||
|
||||
struct wsgi_request *wsgi_req;
|
||||
int i;
|
||||
char ctime_storage[26];
|
||||
|
||||
uwsgi_backtrace(uwsgi.backtrace_depth);
|
||||
|
||||
@@ -878,11 +879,12 @@ void what_i_am_doing() {
|
||||
for (i = 0; i < uwsgi.cores; i++) {
|
||||
wsgi_req = uwsgi.wsgi_requests[i];
|
||||
if (wsgi_req->uri_len > 0) {
|
||||
ctime_r((const time_t *) &wsgi_req->start_of_request.tv_sec, ctime_storage);
|
||||
if (uwsgi.shared->options[UWSGI_OPTION_HARAKIRI] > 0 && uwsgi.workers[uwsgi.mywid].harakiri < time(NULL)) {
|
||||
uwsgi_log("HARAKIRI: --- uWSGI worker %d core %d (pid: %d) WAS managing request %.*s since %.*s ---\n", (int) uwsgi.mywid, i, (int) uwsgi.mypid, wsgi_req->uri_len, wsgi_req->uri, 24, ctime((const time_t *) &wsgi_req->start_of_request.tv_sec));
|
||||
uwsgi_log("HARAKIRI: --- uWSGI worker %d core %d (pid: %d) WAS managing request %.*s since %.*s ---\n", (int) uwsgi.mywid, i, (int) uwsgi.mypid, wsgi_req->uri_len, wsgi_req->uri, 24, ctime_storage);
|
||||
}
|
||||
else {
|
||||
uwsgi_log("SIGUSR2: --- uWSGI worker %d core %d (pid: %d) is managing request %.*s since %.*s ---\n", (int) uwsgi.mywid, i, (int) uwsgi.mypid, wsgi_req->uri_len, wsgi_req->uri, 24, ctime((const time_t *) &wsgi_req->start_of_request.tv_sec));
|
||||
uwsgi_log("SIGUSR2: --- uWSGI worker %d core %d (pid: %d) is managing request %.*s since %.*s ---\n", (int) uwsgi.mywid, i, (int) uwsgi.mypid, wsgi_req->uri_len, wsgi_req->uri, 24, ctime_storage);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -890,11 +892,12 @@ void what_i_am_doing() {
|
||||
else {
|
||||
wsgi_req = uwsgi.wsgi_requests[0];
|
||||
if (wsgi_req->uri_len > 0) {
|
||||
ctime_r((const time_t *) &wsgi_req->start_of_request.tv_sec, ctime_storage);
|
||||
if (uwsgi.shared->options[UWSGI_OPTION_HARAKIRI] > 0 && uwsgi.workers[uwsgi.mywid].harakiri < time(NULL)) {
|
||||
uwsgi_log("HARAKIRI: --- uWSGI worker %d (pid: %d) WAS managing request %.*s since %.*s ---\n", (int) uwsgi.mywid, (int) uwsgi.mypid, wsgi_req->uri_len, wsgi_req->uri, 24, ctime((const time_t *) &wsgi_req->start_of_request.tv_sec));
|
||||
uwsgi_log("HARAKIRI: --- uWSGI worker %d (pid: %d) WAS managing request %.*s since %.*s ---\n", (int) uwsgi.mywid, (int) uwsgi.mypid, wsgi_req->uri_len, wsgi_req->uri, 24, ctime_storage);
|
||||
}
|
||||
else {
|
||||
uwsgi_log("SIGUSR2: --- uWSGI worker %d (pid: %d) is managing request %.*s since %.*s ---\n", (int) uwsgi.mywid, (int) uwsgi.mypid, wsgi_req->uri_len, wsgi_req->uri, 24, ctime((const time_t *) &wsgi_req->start_of_request.tv_sec));
|
||||
uwsgi_log("SIGUSR2: --- uWSGI worker %d (pid: %d) is managing request %.*s since %.*s ---\n", (int) uwsgi.mywid, (int) uwsgi.mypid, wsgi_req->uri_len, wsgi_req->uri, 24, ctime_storage);
|
||||
}
|
||||
}
|
||||
else if (uwsgi.shared->options[UWSGI_OPTION_HARAKIRI] > 0 && uwsgi.workers[uwsgi.mywid].harakiri < time(NULL) && uwsgi.workers[uwsgi.mywid].sig) {
|
||||
|
||||
Reference in New Issue
Block a user