On Tue, Feb 16, 2010 at 3:50 PM, <[email protected]> wrote: > Author: poirier > Date: Tue Feb 16 20:50:10 2010 > New Revision: 910684 > > URL: http://svn.apache.org/viewvc?rev=910684&view=rev > Log: > Log command line on startup, so there's a record of command line > arguments like -f. Suggested by Shaya Potter. [Dan Poirier] > PR: 48752 > > Modified: > httpd/httpd/trunk/CHANGES > httpd/httpd/trunk/include/ap_mmn.h > httpd/httpd/trunk/include/http_log.h > httpd/httpd/trunk/server/log.c > httpd/httpd/trunk/server/mpm/event/event.c > httpd/httpd/trunk/server/mpm/netware/mpm_netware.c > httpd/httpd/trunk/server/mpm/prefork/prefork.c > httpd/httpd/trunk/server/mpm/winnt/mpm_winnt.c > httpd/httpd/trunk/server/mpm/worker/worker.c > > Modified: httpd/httpd/trunk/CHANGES > URL: > http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=910684&r1=910683&r2=910684&view=diff > ============================================================================== > --- httpd/httpd/trunk/CHANGES [utf-8] (original) > +++ httpd/httpd/trunk/CHANGES [utf-8] Tue Feb 16 20:50:10 2010 > @@ -2,6 +2,10 @@ > > Changes with Apache 2.3.7 > > + *) Log command line on startup, so there's a record of command line > + arguments like -f. > + PR 48752. [Dan Poirier] > + > *) Introduce mod_reflector, a handler capable of reflecting POSTed > request bodies back within the response through the output filter > stack. Can be used to turn an output filter into a web service. > > Modified: httpd/httpd/trunk/include/ap_mmn.h > URL: > http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mmn.h?rev=910684&r1=910683&r2=910684&view=diff > ============================================================================== > --- httpd/httpd/trunk/include/ap_mmn.h (original) > +++ httpd/httpd/trunk/include/ap_mmn.h Tue Feb 16 20:50:10 2010 > @@ -216,6 +216,7 @@ > * 20091230.4 (2.3.6-dev) export ap_process_request_after_handler() for > mod_serf > * 20100208.0 (2.3.6-dev) ap_socache_provider_t API changes to store and > iterate > * 20100208.1 (2.3.6-dev) Added forward member to proxy_conn_rec > + * 20100215.0 (2.3.7-dev) Added ap_log_command_line().
A new API is a minor bump (no module recompile necessary), so the new number would be "20100208.2". Also, you forgot to change the number except in the comment (which is what I usually do). > * > */ > > > Modified: httpd/httpd/trunk/include/http_log.h > URL: > http://svn.apache.org/viewvc/httpd/httpd/trunk/include/http_log.h?rev=910684&r1=910683&r2=910684&view=diff > ============================================================================== > --- httpd/httpd/trunk/include/http_log.h (original) > +++ httpd/httpd/trunk/include/http_log.h Tue Feb 16 20:50:10 2010 > @@ -250,6 +250,14 @@ > AP_DECLARE(void) ap_error_log2stderr(server_rec *s); > > /** > + * Log the command line used to start the server. > + * @param p The pool to use for logging > + * @param s The server_rec whose process's command line we want to log. > + * The command line is logged to that server's error log. > + */ > +AP_DECLARE(void) ap_log_command_line(apr_pool_t *p, server_rec *s); I think an API to return a string form of the command-line would be more generally useful (e.g., mod_info could use that to display the command-line). > + > +/** > * Log the current pid of the parent process > * @param p The pool to use for logging > * @param fname The name of the file to log to > > Modified: httpd/httpd/trunk/server/log.c > URL: > http://svn.apache.org/viewvc/httpd/httpd/trunk/server/log.c?rev=910684&r1=910683&r2=910684&view=diff > ============================================================================== > --- httpd/httpd/trunk/server/log.c (original) > +++ httpd/httpd/trunk/server/log.c Tue Feb 16 20:50:10 2010 > @@ -784,6 +784,33 @@ > va_end(args); > } > > +AP_DECLARE(void) ap_log_command_line(apr_pool_t *plog, server_rec *s) > +{ > + int i; > + process_rec *process = s->process; > + char *result; > + int len_needed = 0; > + > + /* Piece together the command line from the pieces > + * in process->argv, with spaces in between. > + */ > + for (i = 0; i < process->argc; i++) { > + len_needed += strlen(process->argv[i]) + 1; > + } FWLIW, sooner or later somebody will want quoting around args with embedded blanks (surprisingly there doesn't seem to be an existing function to do this work)
