mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-28 15:42:30 +00:00
MINOR: trace: define simple -dt argument
Add '-dt' haproxy process argument. This will automatically activate all trace sources on stderr with the error level. This could be useful to troubleshoot issues such as protocol violations.
This commit is contained in:
parent
eabe477ad2
commit
cef29d3708
@ -402,6 +402,10 @@ list of options is :
|
||||
the libc fails to resolve an address, the startup sequence is not
|
||||
interrupted.
|
||||
|
||||
-dt : activate traces on stderr. This enables all trace sources on error
|
||||
level. This can notably be useful to detect protocol violations from
|
||||
clients or servers.
|
||||
|
||||
-m <limit> : limit the total allocatable memory to <limit> megabytes across
|
||||
all processes. This may cause some connection refusals or some slowdowns
|
||||
depending on the amount of memory needed for normal operations. This is
|
||||
|
@ -190,6 +190,8 @@ void trace_no_cb(enum trace_level level, uint64_t mask, const struct trace_sourc
|
||||
|
||||
void trace_register_source(struct trace_source *source);
|
||||
|
||||
int trace_parse_cmd();
|
||||
|
||||
/* return a single char to describe a trace state */
|
||||
static inline char trace_state_char(enum trace_state st)
|
||||
{
|
||||
|
@ -124,6 +124,7 @@
|
||||
#include <haproxy/thread.h>
|
||||
#include <haproxy/time.h>
|
||||
#include <haproxy/tools.h>
|
||||
#include <haproxy/trace.h>
|
||||
#include <haproxy/uri_auth-t.h>
|
||||
#include <haproxy/vars.h>
|
||||
#include <haproxy/version.h>
|
||||
@ -588,6 +589,7 @@ static void usage(char *name)
|
||||
" -v displays version ; -vv shows known build options.\n"
|
||||
" -d enters debug mode ; -db only disables background mode.\n"
|
||||
" -dM[<byte>,help,...] debug memory (default: poison with <byte>/0x50)\n"
|
||||
" -dt activate traces on stderr\n"
|
||||
" -V enters verbose mode (disables quiet mode)\n"
|
||||
" -D goes daemon ; -C changes to <dir> before loading files.\n"
|
||||
" -W master-worker mode.\n"
|
||||
@ -1705,6 +1707,9 @@ static void init_args(int argc, char **argv)
|
||||
arg_mode |= MODE_DUMP_KWD;
|
||||
kwd_dump = flag + 2;
|
||||
}
|
||||
else if (*flag == 'd' && flag[1] == 't') {
|
||||
trace_parse_cmd();
|
||||
}
|
||||
else if (*flag == 'd')
|
||||
arg_mode |= MODE_DEBUG;
|
||||
else if (*flag == 'c' && flag[1] == 'c') {
|
||||
|
18
src/trace.c
18
src/trace.c
@ -731,6 +731,24 @@ static int trace_parse_statement(char **args, char **msg)
|
||||
|
||||
}
|
||||
|
||||
/* Parse a process argument specified via "-dt".
|
||||
*
|
||||
* Returns 0 on success else non-zero.
|
||||
*/
|
||||
int trace_parse_cmd()
|
||||
{
|
||||
struct trace_source *src;
|
||||
|
||||
list_for_each_entry(src, &trace_sources, source_link) {
|
||||
src->sink = sink_find("stderr");
|
||||
src->level = TRACE_LEVEL_ERROR;
|
||||
src->verbosity = 1;
|
||||
src->state = TRACE_STATE_RUNNING;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* parse a "trace" statement in the "global" section, returns 1 if a message is returned, otherwise zero */
|
||||
static int cfg_parse_trace(char **args, int section_type, struct proxy *curpx,
|
||||
const struct proxy *defpx, const char *file, int line,
|
||||
|
Loading…
Reference in New Issue
Block a user