#define APLOG_WIN32ERROR ((APLOG_LEVELMASK+1) * 2)
#endif
+/* normal but significant condition on startup, usually printed to stderr */
+#define APLOG_STARTUP ((APLOG_LEVELMASK + 1) * 4)
+
#ifndef DEFAULT_LOGLEVEL
#define DEFAULT_LOGLEVEL APLOG_WARNING
#endif
arg = ap_os_canonical_filename(cmd->pool, arg);
if (/* TODO: ap_configtestonly && ap_docrootcheck && */ !ap_is_directory(arg)) {
if (cmd->server->is_virtual) {
- fprintf(stderr, "Warning: DocumentRoot [%s] does not exist\n",
- arg);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "Warning: DocumentRoot [%s] does not exist",
+ arg);
}
else {
return "DocumentRoot must be a directory";
*/
if (m->version != MODULE_MAGIC_NUMBER_MAJOR) {
- fprintf(stderr, "%s: module \"%s\" is not compatible with this "
- "version of Apache.\n", ap_server_argv0, m->name);
- fprintf(stderr, "Please contact the vendor for the correct version.\n");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "%s: module \"%s\" is not compatible with this "
+ "version of Apache.", ap_server_argv0, m->name);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Please contact the vendor for the correct version.");
exit(1);
}
dynamic_modules++;
if (dynamic_modules > DYNAMIC_MODULE_LIMIT) {
- fprintf(stderr, "%s: module \"%s\" could not be loaded, because"
- " the dynamic\n", ap_server_argv0, m->name);
- fprintf(stderr, "module limit was reached. Please increase "
- "DYNAMIC_MODULE_LIMIT and recompile.\n");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "%s: module \"%s\" could not be loaded, because"
+ " the dynamic", ap_server_argv0, m->name);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "module limit was reached. Please increase "
+ "DYNAMIC_MODULE_LIMIT and recompile.");
exit(1);
}
}
ap_loaded_modules = (module **)ap_palloc(process->pool,
sizeof(module *)*(total_modules+DYNAMIC_MODULE_LIMIT+1));
if (ap_loaded_modules == NULL) {
- fprintf(stderr, "Ouch! Out of memory in ap_setup_prelinked_modules()!\n");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "Ouch! Out of memory in ap_setup_prelinked_modules()!");
}
for (m = ap_preloaded_modules, m2 = ap_loaded_modules; *m != NULL; )
*m2++ = *m++;
errmsg = ap_srm_command_loop(&parms, s->lookup_defaults);
if (errmsg) {
- fprintf(stderr, "Syntax error in -C/-c directive:\n%s\n", errmsg);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "Syntax error in -C/-c directive:\n%s", errmsg);
exit(1);
}
parms.override = (RSRC_CONF | OR_ALL) & ~(OR_AUTHCFG | OR_LIMIT);
if (ap_pcfg_openfile(&parms.config_file, p, fname) != APR_SUCCESS) {
- fprintf(stderr, "%s: could not open document config file %s\n",
- ap_server_argv0, fname);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "%s: could not open document config file %s",
+ ap_server_argv0, fname);
exit(1);
}
errmsg = ap_srm_command_loop(&parms, s->lookup_defaults);
if (errmsg) {
- fprintf(stderr, "Syntax error on line %d of %s:\n",
- parms.config_file->line_number, parms.config_file->name);
- fprintf(stderr, "%s\n", errmsg);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "Syntax error on line %d of %s:",
+ parms.config_file->line_number, parms.config_file->name);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "%s", errmsg);
exit(1);
}
limits.rlim_cur += 2;
if (setrlimit(RLIMIT_NOFILE, &limits) < 0) {
perror("setrlimit(RLIMIT_NOFILE)");
- fprintf(stderr, "Cannot exceed hard limit for open files");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "Cannot exceed hard limit for open files");
}
}
#endif
rc = log_child (p, s->error_fname+1, NULL, &dummy, NULL);
if (rc != APR_SUCCESS) {
perror("ap_spawn_child");
- fprintf(stderr, "Couldn't fork child for ErrorLog process\n");
- exit(1);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "Couldn't fork child for ErrorLog process");
+ exit(1);
}
s->error_log = dummy;
if (ap_open(&s->error_log, fname, APR_APPEND |
APR_READ | APR_WRITE | APR_CREATE, APR_OS_DEFAULT, p) != APR_SUCCESS) {
perror("fopen");
- fprintf(stderr, "%s: could not open error log file %s.\n",
- ap_server_argv0, fname);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "%s: could not open error log file %s.",
+ ap_server_argv0, fname);
exit(1);
}
}
if (((level & APLOG_LEVELMASK) != APLOG_NOTICE) &&
((level & APLOG_LEVELMASK) > DEFAULT_LOGLEVEL))
return;
+#ifdef WIN32
+ /* This is where the different ap_put_os_file's belong */
+#else
ap_put_os_file(&logf, &errfileno, NULL);
+#endif
}
else if (s->error_log) {
/*
* If we are doing normal logging, don't log messages that are
* above the server log level unless it is a startup/shutdown notice
*/
- if (((level & APLOG_LEVELMASK) != APLOG_NOTICE) &&
+ if (((level & APLOG_LEVELMASK) != APLOG_NOTICE) &&
((level & APLOG_LEVELMASK) > s->loglevel))
return;
logf = s->error_log;
logf = NULL;
}
- if (logf) {
+ if (logf && ((level & APLOG_STARTUP) != APLOG_STARTUP)) {
len = ap_snprintf(errstr, MAX_STRING_LEN, "[%s] ", ap_get_time());
} else {
len = 0;
}
- len += ap_snprintf(errstr + len, MAX_STRING_LEN - len,
- "[%s] ", priorities[level & APLOG_LEVELMASK].t_name);
-
+ if ((level & APLOG_STARTUP) != APLOG_STARTUP) {
+ len += ap_snprintf(errstr + len, MAX_STRING_LEN - len,
+ "[%s] ", priorities[level & APLOG_LEVELMASK].t_name);
+ }
#ifndef TPF
if (file && (level & APLOG_LEVELMASK) == APLOG_DEBUG) {
#ifdef _OSD_POSIX
if(ap_open(&pid_file, fname, APR_WRITE | APR_CREATE, APR_OS_DEFAULT, p) != APR_SUCCESS) {
perror("fopen");
- fprintf(stderr, "%s: could not log pid to file %s\n",
- ap_server_argv0, fname);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "%s: could not log pid to file %s",
+ ap_server_argv0, fname);
exit(1);
}
ap_fprintf(pid_file, "%ld\n", (long)mypid);
API_EXPORT(void) ap_log_assert(const char *szExp, const char *szFile, int nLine)
{
- /* Use AP funcs to output message and abort program. */
- fprintf(stderr, "[%s] file %s, line %d, assertion \"%s\" failed\n",
- ap_get_time(), szFile, nLine, szExp);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "[%s] file %s, line %d, assertion \"%s\" failed",
+ ap_get_time(), szFile, nLine, szExp);
#ifndef WIN32
/* unix assert does an abort leading to a core dump */
abort();
(ap_setprocattr_dir(procattr, pl->program) != APR_SUCCESS) ||
(ap_set_childin(procattr, pl->fds[0], pl->fds[1]) != APR_SUCCESS)) {
/* Something bad happened, give up and go away. */
- fprintf(stderr,
- "piped_log_spawn: unable to exec %s -c '%s': %s\n",
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "piped_log_spawn: unable to exec %s -c '%s': %s",
SHELL_PATH, pl->program, strerror (errno));
rc = -1;
}
if (piped_log_spawn(pl) != APR_SUCCESS) {
/* what can we do? This could be the error log we're having
* problems opening up... */
- fprintf(stderr,
- "piped_log_maintenance: unable to respawn '%s': %s\n",
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "piped_log_maintenance: unable to respawn '%s': %s",
pl->program, strerror(errno));
}
break;
rc = log_child(p, program, NULL, &dummy, NULL);
if (rc != APR_SUCCESS) {
perror("ap_spawn_child");
- fprintf(stderr, "Couldn't fork child for piped log process\n");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "Couldn't fork child for piped log process");
exit (1);
}
#define CORE_PRIVATE
#include "httpd.h"
#include "http_main.h"
+#include "http_log.h"
#include "http_config.h"
#include "util_uri.h"
#include "ap_mpm.h"
pad[i] = ' ';
pad[i] = '\0';
#ifdef SHARED_CORE
- fprintf(stderr, "Usage: %s [-R directory] [-D name] [-d directory] [-f file]\n", bin);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0,NULL , "Usage: %s [-R directory] [-D name] [-d directory] [-f file]", bin);
#else
- fprintf(stderr, "Usage: %s [-D name] [-d directory] [-f file]\n", bin);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Usage: %s [-D name] [-d directory] [-f file]", bin);
#endif
- fprintf(stderr, " %s [-C \"directive\"] [-c \"directive\"]\n", pad);
- fprintf(stderr, " %s [-v] [-V] [-h] [-l] [-L] [-S] [-t] [-T]\n", pad);
- fprintf(stderr, "Options:\n");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " %s [-C \"directive\"] [-c \"directive\"]", pad);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " %s [-v] [-V] [-h] [-l] [-L] [-S] [-t] [-T]", pad);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Options:");
#ifdef SHARED_CORE
- fprintf(stderr, " -R directory : specify an alternate location for shared object files\n");
-#endif
- fprintf(stderr, " -D name : define a name for use in <IfDefine name> directives\n");
- fprintf(stderr, " -d directory : specify an alternate initial ServerRoot\n");
- fprintf(stderr, " -f file : specify an alternate ServerConfigFile\n");
- fprintf(stderr, " -C \"directive\" : process directive before reading config files\n");
- fprintf(stderr, " -c \"directive\" : process directive after reading config files\n");
- fprintf(stderr, " -v : show version number\n");
- fprintf(stderr, " -V : show compile settings\n");
- fprintf(stderr, " -h : list available command line options (this page)\n");
- fprintf(stderr, " -l : list compiled in modules\n");
- fprintf(stderr, " -L : list available configuration directives\n");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -R directory : specify an alternate location for shared object files");
+#endif
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -D name : define a name for use in <IfDefine name> directives");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -d directory : specify an alternate initial ServerRoot");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -f file : specify an alternate ServerConfigFile");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -C \"directive\" : process directive before reading config files");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -c \"directive\" : process directive after reading config files");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -v : show version number");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -V : show compile settings");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -h : list available command line options (this page)");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -l : list compiled in modules");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -L : list available configuration directives");
/* TODOC: -S has been replaced by '-t -D DUMP_VHOSTS' */
- /* fprintf(stderr, " -S : show parsed settings (currently only vhost settings)\n"); */
- fprintf(stderr, " -t : run syntax check for config files (with docroot check)\n");
- fprintf(stderr, " -T : run syntax check for config files (without docroot check)\n");
+ /* ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -S : show parsed settings (currently only vhost settings)"); */
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -t : run syntax check for config files (with docroot check)");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -T : run syntax check for config files (without docroot check)");
/* TODOC: -X goes away, expect MPMs to use -D options */
destroy_and_exit_process(process, 1);
}
ap_run_pre_config(pconf, plog, ptemp);
server_conf = ap_read_config(process, ptemp, confname);
if (configtestonly) {
- fprintf(stderr, "Syntax OK\n");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Syntax OK\n");
destroy_and_exit_process(process, 0);
}
ap_clear_pool(plog);
num_daemons = atoi(arg);
if (num_daemons > HARD_SERVER_LIMIT) {
- fprintf(stderr, "WARNING: NumServers of %d exceeds compile time limit "
- "of %d servers,\n", num_daemons, HARD_SERVER_LIMIT);
- fprintf(stderr, " lowering NumServers to %d. To increase, please "
- "see the\n", HARD_SERVER_LIMIT);
- fprintf(stderr, " HARD_SERVER_LIMIT define in src/include/httpd.h.\n");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "WARNING: NumServers of %d exceeds compile time limit "
+ "of %d servers,", num_daemons, HARD_SERVER_LIMIT);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ " lowering NumServers to %d. To increase, please "
+ "see the", HARD_SERVER_LIMIT);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ " HARD_SERVER_LIMIT define in src/include/httpd.h.");
num_daemons = HARD_SERVER_LIMIT;
}
else if (num_daemons < 1) {
- fprintf(stderr, "WARNING: Require NumServers > 0, setting to 1\n");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "WARNING: Require NumServers > 0, setting to 1");
num_daemons = 1;
}
return NULL;
threads_to_start = atoi(arg);
if (threads_to_start > HARD_THREAD_LIMIT) {
- fprintf(stderr, "WARNING: StartThreads of %d exceeds compile time"
- "limit of %d threads,\n", threads_to_start,
- HARD_THREAD_LIMIT);
- fprintf(stderr, " lowering StartThreads to %d. To increase, please"
- "see the\n", HARD_THREAD_LIMIT);
- fprintf(stderr, " HARD_THREAD_LIMIT define in src/include/httpd.h.\n");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "WARNING: StartThreads of %d exceeds compile time"
+ "limit of %d threads,", threads_to_start,
+ HARD_THREAD_LIMIT);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "lowering StartThreads to %d. To increase, please"
+ "see the", HARD_THREAD_LIMIT);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "HARD_THREAD_LIMIT define in src/include/httpd.h.");
}
else if (threads_to_start < 1) {
- fprintf(stderr, "WARNING: Require StartThreads > 0, setting to 1\n");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "WARNING: Require StartThreads > 0, setting to 1");
threads_to_start = 1;
}
return NULL;
min_spare_threads = atoi(arg);
if (min_spare_threads <= 0) {
- fprintf(stderr, "WARNING: detected MinSpareThreads set to non-positive.\n");
- fprintf(stderr, "Resetting to 1 to avoid almost certain Apache failure.\n");
- fprintf(stderr, "Please read the documentation.\n");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "WARNING: detected MinSpareThreads set to non-positive.");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "Resetting to 1 to avoid almost certain Apache failure.");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "Please read the documentation.");
min_spare_threads = 1;
}
max_spare_threads = atoi(arg);
if (max_spare_threads >= HARD_THREAD_LIMIT) {
- fprintf(stderr, "WARNING: detected MinSpareThreads set higher than\n");
- fprintf(stderr, "HARD_THREAD_LIMIT. Resetting to %d\n", HARD_THREAD_LIMIT);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "WARNING: detected MinSpareThreads set higher than");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "HARD_THREAD_LIMIT. Resetting to %d", HARD_THREAD_LIMIT);
max_spare_threads = HARD_THREAD_LIMIT;
}
return NULL;
max_threads = atoi(arg);
if (max_threads > HARD_THREAD_LIMIT) {
- fprintf(stderr, "WARNING: detected MaxThreadsPerChild set higher than\n");
- fprintf(stderr, "HARD_THREAD_LIMIT. Resetting to %d\n", HARD_THREAD_LIMIT);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "WARNING: detected MaxThreadsPerChild set higher than");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "HARD_THREAD_LIMIT. Resetting to %d", HARD_THREAD_LIMIT);
max_threads = HARD_THREAD_LIMIT;
}
return NULL;
m = (caddr_t) create_shared_heap("\\SHAREMEM\\SCOREBOARD", SCOREBOARD_SIZE);
if (m == 0) {
- fprintf(stderr, "%s: Could not create OS/2 Shared memory pool.\n",
- ap_server_argv0);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "%s: Could not create OS/2 Shared memory pool.",
+ ap_server_argv0);
exit(APEXIT_INIT);
}
rc = _uopen((Heap_t) m);
if (rc != 0) {
- fprintf(stderr,
- "%s: Could not uopen() newly created OS/2 Shared memory pool.\n",
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "%s: Could not uopen() newly created OS/2 Shared memory pool.",
ap_server_argv0);
}
ap_scoreboard_image = (scoreboard *) m;
m = (caddr_t) get_shared_heap("\\SHAREMEM\\SCOREBOARD");
if (m == 0) {
- fprintf(stderr, "%s: Could not find existing OS/2 Shared memory pool.\n",
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "%s: Could not find existing OS/2 Shared memory pool.",
ap_server_argv0);
exit(APEXIT_INIT);
}
int fd = mkstemp(mfile);
if (fd == -1) {
perror("open");
- fprintf(stderr, "%s: Could not open %s\n", ap_server_argv0, mfile);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "%s: Could not open %s", ap_server_argv0, mfile);
exit(APEXIT_INIT);
}
m = mmap((caddr_t) 0, SCOREBOARD_SIZE,
PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (m == (caddr_t) - 1) {
perror("mmap");
- fprintf(stderr, "%s: Could not mmap %s\n", ap_server_argv0, mfile);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "%s: Could not mmap %s", ap_server_argv0, mfile);
exit(APEXIT_INIT);
}
close(fd);
#endif
if (m == (caddr_t) - 1) {
perror("mmap");
- fprintf(stderr, "%s: Could not mmap memory\n", ap_server_argv0);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "%s: Could not mmap memory", ap_server_argv0);
exit(APEXIT_INIT);
}
#else
fd = open("/dev/zero", O_RDWR);
if (fd == -1) {
perror("open");
- fprintf(stderr, "%s: Could not open /dev/zero\n", ap_server_argv0);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "%s: Could not open /dev/zero", ap_server_argv0);
exit(APEXIT_INIT);
}
m = mmap((caddr_t) 0, SCOREBOARD_SIZE,
PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (m == (caddr_t) - 1) {
perror("mmap");
- fprintf(stderr, "%s: Could not mmap /dev/zero\n", ap_server_argv0);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "%s: Could not mmap /dev/zero", ap_server_argv0);
exit(APEXIT_INIT);
}
close(fd);
char *sdup;
if (!(sdup = (char *) malloc(strlen(str) + 1))) {
- fprintf(stderr, "Ouch! Out of memory in our strdup()!\n");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Ouch! Out of memory in our strdup()!");
return NULL;
}
sdup = strcpy(sdup, str);
return (atoi(&name[1]));
if (!(ent = getpwnam(name))) {
- fprintf(stderr, "%s: bad user name %s\n", ap_server_argv0, name);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "%s: bad user name %s", ap_server_argv0, name);
exit(1);
}
return (ent->pw_uid);
return (atoi(&name[1]));
if (!(ent = getgrnam(name))) {
- fprintf(stderr, "%s: bad group name %s\n", ap_server_argv0, name);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "%s: bad group name %s", ap_server_argv0, name);
exit(1);
}
return (ent->gr_gid);
hep = gethostbyname(w);
if ((!hep) || (hep->h_addrtype != AF_INET || !hep->h_addr_list[0])) {
- fprintf(stderr, "Cannot resolve host name %s --- exiting!\n", w);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Cannot resolve host name %s --- exiting!", w);
exit(1);
}
if (hep->h_addr_list[1]) {
- fprintf(stderr, "Host %s has multiple addresses ---\n", w);
- fprintf(stderr, "you must choose one explicitly for use as\n");
- fprintf(stderr, "a virtual host. Exiting!!!\n");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Host %s has multiple addresses ---", w);
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "you must choose one explicitly for use as");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "a virtual host. Exiting!!!");
exit(1);
}
}
str[MAXHOSTNAMELEN] = '\0';
if ((!(p = gethostbyname(str))) || (!(server_hostname = find_fqdn(a, p)))) {
- fprintf(stderr, "%s: cannot determine local host name.\n",
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "%s: cannot determine local host name.",
ap_server_argv0);
- fprintf(stderr, "Use the ServerName directive to set it manually.\n");
+ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+ "Use the ServerName directive to set it manually.");
exit(1);
}