Merge pull request #79 from prymitive/log_format_fixes

few log format fixes
This commit is contained in:
unbit
2012-12-07 02:16:18 -08:00
16 changed files with 27 additions and 24 deletions
+1 -1
View File
@@ -153,7 +153,7 @@ cycle:
uci = &uwsgi.cache_items[slot];
rounds++;
if (rounds > uwsgi.cache_max_items) {
uwsgi_log("ALARM !!! cache-loop (and potential deadlock) detected slot = %llu prev = %llu next = %llu\n", uci->next, slot, uci->prev, uci->next);
uwsgi_log("ALARM !!! cache-loop (and potential deadlock) detected slot = %lu prev = %lu next = %lu\n", slot, uci->prev, uci->next);
// terrible case: the whole uWSGI stack can deadlock, leaving only the master alive
// if the master is avalable, trigger a brutal reload
if (uwsgi.master_process) {
+2 -2
View File
@@ -325,7 +325,7 @@ static void emperor_stats() {
while (c_ui) {
uwsgi_log("vassal instance %s (last modified %d) status %d loyal %d zerg %d\n", c_ui->name, c_ui->last_mod, c_ui->status, c_ui->loyal, c_ui->zerg);
uwsgi_log("vassal instance %s (last modified %lld) status %d loyal %d zerg %d\n", c_ui->name, (long long) c_ui->last_mod, c_ui->status, c_ui->loyal, c_ui->zerg);
c_ui = c_ui->ui_next;
}
@@ -465,7 +465,7 @@ void emperor_add(struct uwsgi_emperor_scanner *ues, char *name, time_t born, cha
#endif
if (strlen(name) > (0xff - 1)) {
uwsgi_log("[emperor] invalid vassal name\n", name);
uwsgi_log("[emperor] invalid vassal name: %s\n", name);
return;
}
+1 -1
View File
@@ -265,7 +265,7 @@ void uwsgi_setup_workers() {
}
total_memory *= (uwsgi.numproc + uwsgi.master_process);
uwsgi_log("mapped %llu bytes (%llu KB) for %d cores\n", total_memory, total_memory / 1024, uwsgi.cores * uwsgi.numproc);
uwsgi_log("mapped %lu bytes (%lu KB) for %d cores\n", total_memory, total_memory / 1024, uwsgi.cores * uwsgi.numproc);
}
+1
View File
@@ -255,6 +255,7 @@ static void *legion_loop(void *foobar) {
int uwsgi_legion_action_call(char *phase, struct uwsgi_legion *ul, struct uwsgi_string_list *usl) {
struct uwsgi_legion_action *ula = uwsgi_legion_action_get(usl->custom_ptr);
if (!ula) {
//FIXME core/legion.c:258: error: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘void *’
uwsgi_log("[uwsgi-legion] ERROR unable to find legion_action \"%s\"\n", usl->custom_ptr);
return -1;
}
+2 -1
View File
@@ -85,6 +85,7 @@ void uwsgi_master_manage_udp(int udp_fd) {
// else a simple udp logger
if (!udp_managed) {
//FIXME error: field precision should have type ‘int’, but argument 4 has type ‘ssize_t’
uwsgi_log("[udp:%s:%d] %.*s", udp_client_addr, ntohs(udp_client.sin_port), rlen, uwsgi.wsgi_req->buffer);
}
}
@@ -1578,7 +1579,7 @@ next:
}
// manage_next_request is zero, but killed by signal...
else if (WIFSIGNALED(waitpid_status)) {
uwsgi_log("DAMN ! worker %d (pid: %d) MISTERIOUSLY killed by signal :( trying respawn ...\n", uwsgi.mywid, (int) diedpid, (int) WTERMSIG(waitpid_status));
uwsgi_log("DAMN ! worker %d (pid: %d) MISTERIOUSLY killed by signal %d :( trying respawn ...\n", uwsgi.mywid, (int) diedpid, (int) WTERMSIG(waitpid_status));
}
if (uwsgi.workers[uwsgi.mywid].cheaped == 1) {
+1 -1
View File
@@ -198,7 +198,7 @@ void uwsgi_mule_handler() {
}
}
if (!found)
uwsgi_log("*** mule %d received a %d bytes message ***\n", uwsgi.muleid, len);
uwsgi_log("*** mule %d received a %zd bytes message ***\n", uwsgi.muleid, len);
}
}
}
+2 -2
View File
@@ -1376,7 +1376,7 @@ int uwsgi_hooked_parse_dict_dgram(int fd, char *buffer, size_t len, uint8_t modi
#ifdef UWSGI_DEBUG
uwsgi_log("RLEN: %d\n", rlen);
uwsgi_log("RLEN: %zd\n", rlen);
#endif
// check for valid dict 4(header) 2(non-zero key)+1 2(value)
@@ -1415,7 +1415,7 @@ int uwsgi_hooked_parse_dict_dgram(int fd, char *buffer, size_t len, uint8_t modi
#ifdef UWSGI_DEBUG
uwsgi_log("%p %p %d\n", ptrbuf, bufferend, bufferend - ptrbuf);
uwsgi_log("%p %p %ld\n", ptrbuf, bufferend, bufferend - ptrbuf);
#endif
uwsgi_hooked_parse(ptrbuf, bufferend - ptrbuf, hook, data);
+1 -1
View File
@@ -65,7 +65,7 @@ void uwsgi_init_queue() {
uwsgi.queue_lock = uwsgi_rwlock_init("queue");
uwsgi_log("*** Queue subsystem initialized: %dMB preallocated ***\n", (uwsgi.queue_blocksize * uwsgi.queue_size) / (1024 * 1024));
uwsgi_log("*** Queue subsystem initialized: %luMB preallocated ***\n", (uwsgi.queue_blocksize * uwsgi.queue_size) / (1024 * 1024));
}
char *uwsgi_queue_get(uint64_t index, uint64_t * size) {
+1 -1
View File
@@ -644,7 +644,7 @@ int bind_to_tcp(char *socket_name, int listen_queue, char *tcp_port) {
#ifdef __linux__
long somaxconn = uwsgi_num_from_file("/proc/sys/net/core/somaxconn");
if (somaxconn > 0 && uwsgi.listen_queue > somaxconn) {
uwsgi_log("Listen queue size is greater than the system max net.core.somaxconn (%i).\n", somaxconn);
uwsgi_log("Listen queue size is greater than the system max net.core.somaxconn (%li).\n", somaxconn);
uwsgi_nuclear_blast();
}
#endif
+2 -2
View File
@@ -245,7 +245,7 @@ int spool_request(struct uwsgi_spooler *uspool, char *filename, int rn, int core
close(fd);
if (!uwsgi.spooler_quiet)
uwsgi_log("[spooler] written %d bytes to file %s\n", size + body_len + 4, filename);
uwsgi_log("[spooler] written %zd bytes to file %s\n", size + body_len + 4, filename);
// and here waiting threads can continue
uwsgi_unlock(uspool->lock);
@@ -538,7 +538,7 @@ void spooler_manage_task(struct uwsgi_spooler *uspool, char *dir, char *task) {
uspool->tasks++;
if (ret == -2) {
if (!uwsgi.spooler_quiet)
uwsgi_log("[spooler %s pid: %d] done with task %s after %d seconds\n", uspool->dir, (int) uwsgi.mypid, task, uwsgi_now() - now);
uwsgi_log("[spooler %s pid: %d] done with task %s after %lld seconds\n", uspool->dir, (int) uwsgi.mypid, task, (long long) uwsgi_now() - now);
destroy_spool(dir, task);
}
// re-spool it
+2 -2
View File
@@ -229,7 +229,7 @@ char *uwsgi_get_cwd() {
if (getcwd(cwd, newsize) == NULL && errno == ERANGE) {
newsize += 256;
uwsgi_log("need a bigger buffer (%d bytes) for getcwd(). doing reallocation.\n", newsize);
uwsgi_log("need a bigger buffer (%zd bytes) for getcwd(). doing reallocation.\n", newsize);
free(cwd);
cwd = uwsgi_malloc(newsize);
if (getcwd(cwd, newsize) == NULL) {
@@ -4182,7 +4182,7 @@ void uwsgi_setup_post_buffering() {
if (uwsgi.post_buffering_bufsize < uwsgi.post_buffering) {
uwsgi.post_buffering_bufsize = uwsgi.post_buffering;
uwsgi_log("setting request body buffering size to %d bytes\n", uwsgi.post_buffering_bufsize);
uwsgi_log("setting request body buffering size to %zd bytes\n", uwsgi.post_buffering_bufsize);
}
}
+6 -6
View File
@@ -1183,24 +1183,24 @@ void stats(int signum) {
if (uwsgi.mywid == 0) {
show_config();
uwsgi_log("\tworkers total requests: %llu\n", uwsgi.workers[0].requests);
uwsgi_log("\tworkers total requests: %lu\n", uwsgi.workers[0].requests);
uwsgi_log("-----------------\n");
for (j = 1; j <= uwsgi.numproc; j++) {
for (i = 0; i < uwsgi.workers[j].apps_cnt; i++) {
ua = &uwsgi.workers[j].apps[i];
if (ua) {
uwsgi_log("\tworker %d app %d [%.*s] requests: %d exceptions: %d\n", j, i, ua->mountpoint_len, ua->mountpoint, ua->requests, ua->exceptions);
uwsgi_log("\tworker %d app %d [%.*s] requests: %lu exceptions: %lu\n", j, i, ua->mountpoint_len, ua->mountpoint, ua->requests, ua->exceptions);
}
}
uwsgi_log("-----------------\n");
}
}
else {
uwsgi_log("worker %d total requests: %llu\n", uwsgi.mywid, uwsgi.workers[0].requests);
uwsgi_log("worker %d total requests: %lu\n", uwsgi.mywid, uwsgi.workers[0].requests);
for (i = 0; i < uwsgi.workers[uwsgi.mywid].apps_cnt; i++) {
ua = &uwsgi.workers[uwsgi.mywid].apps[i];
if (ua) {
uwsgi_log("\tapp %d [%.*s] requests: %d exceptions: %d\n", i, ua->mountpoint_len, ua->mountpoint, ua->requests, ua->exceptions);
uwsgi_log("\tapp %d [%.*s] requests: %lu exceptions: %lu\n", i, ua->mountpoint_len, ua->mountpoint, ua->requests, ua->exceptions);
}
}
uwsgi_log("-----------------\n");
@@ -2348,7 +2348,7 @@ int uwsgi_start(void *v_argv) {
(void) pthread_attr_init(&uwsgi.threads_attr);
if (uwsgi.threads_stacksize) {
if (pthread_attr_setstacksize(&uwsgi.threads_attr, uwsgi.threads_stacksize * 1024) == 0) {
uwsgi_log("threads stack size set to %dk\n", uwsgi.threads_stacksize);
uwsgi_log("threads stack size set to %zdk\n", uwsgi.threads_stacksize);
}
else {
uwsgi_log("!!! unable to set requested threads stacksize !!!\n");
@@ -3907,7 +3907,7 @@ void uwsgi_opt_add_custom_option(char *opt, char *value, void *none) {
char *copy = uwsgi_str(value);
char *equal = strchr(copy, '=');
if (!equal) {
uwsgi_log("invalid %s syntax, must be newoption=template\n");
uwsgi_log("invalid %s syntax, must be newoption=template\n", value);
exit(1);
}
*equal = 0;
+1 -1
View File
@@ -137,7 +137,7 @@ void carbon_push_stats(int retry_cycle) {
u_carbon.need_retry = 1;
u_carbon.next_retry = uwsgi_now() + u_carbon.retry_delay;
} else {
uwsgi_log("[carbon] Maximum number of retries for %s (1)\n",
uwsgi_log("[carbon] Maximum number of retries for %s (%d)\n",
usl->value, u_carbon.max_retries);
usl->healthy = 0;
usl->errors = 0;
+2 -2
View File
@@ -323,7 +323,7 @@ static int uwsgi_lua_input(lua_State *L) {
sum = lua_tonumber(L, 2);
if (n > 1) {
uwsgi_log("requested %d bytes\n", sum);
uwsgi_log("requested %zd bytes\n", sum);
}
buf = uwsgi_malloc(sum);
@@ -666,7 +666,7 @@ uint16_t uwsgi_lua_rpc(void * func, uint8_t argc, char **argv, uint16_t argvs[],
sv = lua_tolstring(L, -1, &sl);
uwsgi_log("sv = %s sl = %d\n", sv, sl);
uwsgi_log("sv = %s sl = %zd\n", sv, sl);
if (sl <= 0xffff) {
memcpy(buffer, sv, sl);
return sl;
+1
View File
@@ -197,6 +197,7 @@ XS(XS_error_print) {
if (items > 1) {
body = SvPV(ST(1), blen);
//FIXME error: field precision should have type ‘int’, but argument 2 has type ‘STRLEN’
uwsgi_log("%.*s", blen, body);
}
+1 -1
View File
@@ -869,7 +869,7 @@ int uwsgi_rack_request(struct wsgi_request *wsgi_req) {
if (TYPE(ret) == T_ARRAY) {
if (RARRAY_LEN(ret) != 3) {
uwsgi_log("Invalid RACK response size: %d\n", RARRAY_LEN(ret));
uwsgi_log("Invalid RACK response size: %ld\n", RARRAY_LEN(ret));
return -1;
}