[PATCHES v2] Logging to multiple debug backends
Jeremy Allison
jra at samba.org
Thu Mar 19 13:02:50 MDT 2015
On Wed, Mar 18, 2015 at 04:24:55PM -0700, Christof Schmitt wrote:
> Here is the updated patchset for the debug backends. The main change is
> that an option field is reserved for the entries in the logging
> parameter. It is unused at this point, but it will get used when logging
> code from ctdb is also moved in a backend.
>
> For completeness, the logging config with this patch applied looks like:
> log level = 3 passdb:5 auth:10 winbind:2 (unchanged by this patchset)
> logging = file at 5 syslog at 1 lttng at 10 (new parameter for the backends)
>
> I also reworded the manpage entry for the new logging parameter.
In :
+static void debug_backends_log(const char *msg, int msg_level)
+{
+ char msg_no_nl[FORMAT_BUFR_SIZE];
+ int len = strlen(msg);
+ int i;
+
+ /*
+ * Some backends already add an extra newline, so also provide
+ * a buffer without the newline character.
+ */
+ if (msg[len - 1] == '\n') {
+ len--;
+ }
+
+ memcpy(msg_no_nl, msg, len);
+ msg_no_nl[len] = '\0';
the memcpy length needs to be clamped to the
max of FORMAT_BUFR_SIZE-1, Otherwise if the
lenth of *msg > FORMAT_BUFR_SIZE we're in
trouble :-).
Other than that it looks very nice work !
Can you fix that up and resubmit and I
promise I'll re-review.
Cheers,
Jeremy.
More information about the samba-technical
mailing list