mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
GH-2641: Lazy-load syslog to avoid creating bro.log on Windows
This commit is contained in:
parent
991652f479
commit
a1e8af7745
2 changed files with 8 additions and 1 deletions
|
@ -59,7 +59,7 @@ Reporter::Reporter(bool arg_abort_on_scripting_errors)
|
||||||
weird_sampling_duration = 0;
|
weird_sampling_duration = 0;
|
||||||
weird_sampling_threshold = 0;
|
weird_sampling_threshold = 0;
|
||||||
|
|
||||||
openlog("bro", 0, LOG_LOCAL5);
|
syslog_open = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Reporter::~Reporter()
|
Reporter::~Reporter()
|
||||||
|
@ -265,6 +265,12 @@ void Reporter::Syslog(const char* fmt, ...)
|
||||||
if ( run_state::reading_traces )
|
if ( run_state::reading_traces )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if ( ! syslog_open )
|
||||||
|
{
|
||||||
|
openlog("bro", 0, LOG_LOCAL5);
|
||||||
|
syslog_open = true;
|
||||||
|
}
|
||||||
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
vsyslog(LOG_NOTICE, fmt, ap);
|
vsyslog(LOG_NOTICE, fmt, ap);
|
||||||
|
|
|
@ -325,6 +325,7 @@ private:
|
||||||
|
|
||||||
int errors;
|
int errors;
|
||||||
bool via_events;
|
bool via_events;
|
||||||
|
bool syslog_open;
|
||||||
int in_error_handler;
|
int in_error_handler;
|
||||||
bool info_to_stderr;
|
bool info_to_stderr;
|
||||||
bool warnings_to_stderr;
|
bool warnings_to_stderr;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue