Minor logging tweaks.

This commit is contained in:
default 2024-08-05 05:35:10 +02:00
parent 78d34e4fb4
commit e9b108a6e0

15
httpd.c
View File

@ -763,6 +763,7 @@ void httpd(void)
{ {
const char *address; const char *address;
const char *port; const char *port;
xs *full_address = NULL;
int rs; int rs;
pthread_t threads[MAX_THREADS] = {0}; pthread_t threads[MAX_THREADS] = {0};
int n; int n;
@ -773,8 +774,10 @@ void httpd(void)
address = xs_dict_get(srv_config, "address"); address = xs_dict_get(srv_config, "address");
port = xs_number_str(xs_dict_get(srv_config, "port")); port = xs_number_str(xs_dict_get(srv_config, "port"));
full_address = xs_fmt("%s:%s", address, port);
if ((rs = xs_socket_server(address, port)) == -1) { if ((rs = xs_socket_server(address, port)) == -1) {
srv_log(xs_fmt("cannot bind socket to %s:%s", address, port)); srv_log(xs_fmt("cannot bind socket to %s", full_address));
return; return;
} }
@ -791,13 +794,13 @@ void httpd(void)
signal(SIGTERM, term_handler); signal(SIGTERM, term_handler);
signal(SIGINT, term_handler); signal(SIGINT, term_handler);
srv_log(xs_fmt("httpd%s start %s:%s %s", p_state->use_fcgi ? " (FastCGI)" : "", srv_log(xs_fmt("httpd%s start %s %s", p_state->use_fcgi ? " (FastCGI)" : "",
address, port, USER_AGENT)); full_address, USER_AGENT));
/* show the number of usable file descriptors */ /* show the number of usable file descriptors */
struct rlimit r; struct rlimit r;
getrlimit(RLIMIT_NOFILE, &r); getrlimit(RLIMIT_NOFILE, &r);
srv_debug(0, xs_fmt("available (rlimit) fds: %d (cur) / %d (max)", srv_debug(1, xs_fmt("available (rlimit) fds: %d (cur) / %d (max)",
(int) r.rlim_cur, (int) r.rlim_max)); (int) r.rlim_cur, (int) r.rlim_max));
/* initialize the job control engine */ /* initialize the job control engine */
@ -876,7 +879,7 @@ void httpd(void)
xs *uptime = xs_str_time_diff(time(NULL) - p_state->srv_start_time); xs *uptime = xs_str_time_diff(time(NULL) - p_state->srv_start_time);
srv_log(xs_fmt("httpd%s stop %s:%s (run time: %s)", srv_log(xs_fmt("httpd%s stop %s (run time: %s)",
p_state->use_fcgi ? " (FastCGI)" : "", p_state->use_fcgi ? " (FastCGI)" : "",
address, port, uptime)); full_address, uptime));
} }