summaryrefslogtreecommitdiff
path: root/lib/util/debug.h
AgeCommit message (Collapse)AuthorFilesLines
2026-01-28lib:util:debug Logging macros for JSON outputGary Lockyer1-0/+13
Add new debug macros for outputting JSON log lines BUG: https://bugzilla.samba.org/show_bug.cgi?id=15898 Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-06-18lib:util: Disable logging to syslog for startup messagesAndreas Schneider1-0/+9
D_ERR also is sent to syslog! BUG: https://bugzilla.samba.org/show_bug.cgi?id=15869 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Wed Jun 18 12:10:03 UTC 2025 on atb-devel-224
2024-08-04lib:util: Fix code spellingJo Sutton1-1/+1
Signed-off-by: Jo Sutton <josutton@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2024-07-09ldap_server: Add a ldapsrv debug class to log LDAP queriesAndréas Leroux1-0/+1
Patch updated for recent samba versions in merge request #3295 by kvvloten Initial patch created by Jeremy Allison (https://www.spinics.net/lists/samba/msg161128.html) to log LDAP server queries/functions in a separate file Signed-off-by: Andréas Leroux <aleroux@tranquil.it> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jo Sutton <josutton@catalyst.net.nz> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Tue Jul 9 08:37:22 UTC 2024 on atb-devel-224
2023-11-24lib/util: convert DBG_STARTUP_NOTICE() to use ↵Stefan Metzmacher1-2/+6
debug_set_forced_log_priority(DBGLVL_NOTICE) Using -1 as log level is not compatible without our infrastructure. As all backends are initialized with .log_level = -1, which means they don't log the message, but now they all try to handle the startup message even if they are not configured. E.g. is means that systemd's journalctl get the message twice now, first via the syslog and also the systemd backend. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15377 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Björn Jacke <bjacke@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-24lib/util: add debug_set_forced_log_priority()Stefan Metzmacher1-0/+1
By default the priority for syslog/systemd is derived from the log level of the debug message. But for things like startup messages we want to change the priority temporary, like this: debug_set_forced_log_priority(DBGLVL_NOTICE); D_ERR("Startup...\n"); debug_set_forced_log_priority(-1); BUG: https://bugzilla.samba.org/show_bug.cgi?id=15377 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Björn Jacke <bjacke@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-20debug.h: introduce DEBUG_STARTUP_NOTICEBjörn Jacke1-0/+2
this is log level -1 and lowest syslog priority. This is used for start up messages and copyright notices, which should always be printed but which are no errors or warnings. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15377 Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-08-08lib/util: Fix code spellingJoseph Sutton1-2/+2
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-04-14lib:util: Fix code spellingAndreas Schneider1-4/+4
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2023-04-06lib/util: Add "debug syslog format = always", which logs to stdout in syslog ↵Andrew Bartlett1-1/+7
style Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2023-01-26debug: Call depth: InterfacePavel Filipenský1-0/+2
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15287 Signed-off-by: Pavel Filipenský <pfilipensky@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2022-07-15debug: Add DEBUGLF macro with explicit location and function parameters.Pavel Filipenský1-0/+19
Signed-off-by: Pavel Filipenský <pfilipen@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org>
2022-07-15debug: Fix whitespace and a typo in debug.hPavel Filipenský1-2/+2
Signed-off-by: Pavel Filipenský <pfilipen@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org>
2022-06-17debug: add DBG_DEV()Douglas Bagnall1-0/+13
This can be a useful macro when you are trying to track the behaviour of one process out of the dozens that samba starts up, and when your interest is in following it over time, not necessarily in a single stack. In DEVELOPER mode, if you call 'debug_developer_enable()' in the process you're following, then any instances of DBG_DEV() will work like DBG_ERR(), also adding ":DEV:12345:" where "12345" is the pid of th current process. Within debug.c itself, the macro always writes to stderr, because the debug.c functions are not all reentrant. When not in DEVELOPER MODE, the macro evaluates to nothing. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2022-06-16util: Add new debug setting debug_no_stderr_redirectMartin Schwenke1-0/+1
CTDB doesn't want this redirection of stderr to the log file. It expects to be able to capture stderr of subprocesses and log them with a header. This redirection stops that from happening. Unfortunately this has to be a negative option (i.e. "no" in the name) so that the default of 0/false maintains existing behaviour. Note that the default behaviour is sub-optimal because it causes raw data (i.e. debug data without a header) to appear in the log. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15090 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Volker Lendecke <vl@samba.org>
2022-05-30debug: update comments about setup_logging()Douglas Bagnall1-5/+5
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Mon May 30 11:03:47 UTC 2022 on sn-devel-184
2022-05-10debug: add debug_traceid_set/get() interfacePavel Filipenský1-0/+7
Signed-off-by: Pavel Filipenský <pfilipen@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-05-10debug: fix trailing whitespacePavel Filipenský1-1/+1
Signed-off-by: Pavel Filipenský <pfilipen@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2021-11-01debug: Add debug_syslog_format settingMartin Schwenke1-0/+2
Without debug_hires_timestamp this produces a syslog style header containing: "MON DD HH:MM:SS HOSTNAME PROGNAME[PID] " With debug_hires_timestamp this produces a syslog style header containing: "RFC5424-TIMESTAMP HOSTNAME PROGNAME[PID] " All other settings are ignored. This will be made visible via smb.conf in a subsequent commit. This commit adds some simple hostname handling. It avoids using get_myname() from util.c because using that potentially pulls in all manner of dependencies. No real error handling is done. In the worst case debug_set_hostname() sets the hostname to a truncated version of the given string. Similarly, in an even weirder world, ensure_hostname() sets the hostname to a truncation of "unknown". Both of these are unlikely in all reasonable cases. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Ralph Boehme <slow@samba.org>
2021-04-29lib:util: Add debug_get_log_type() functionAndreas Schneider1-0/+1
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-05-28lib/util: set current_msg_{level,class} also during a DEBUGADD[C]() callStefan Metzmacher1-2/+5
In some situations we use DEBUGADDC() in order to print out content without a related debug header line. This is important with the new per class logfile with: log level = 1 dsdb_json_audit:10@/var/log/samba/log.dsdb_json_audit BUG: https://bugzilla.samba.org/show_bug.cgi?id=13915 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2019-05-28lib/util: remove unused prototypes in debug.hStefan Metzmacher1-2/+0
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13915 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2019-05-28lib/util: fix call to dbghdrclass() for DEBUGC()Stefan Metzmacher1-1/+1
dbghdrclass() sets the global 'current_msg_class' and for that DEBUGC() should pass the given dbgc_class instead of the per file DBGC_CLASS. This is important with the new per class logfile with: log level = 1 dsdb_audit:10@/var/log/samba/log.dsdb_audit BUG: https://bugzilla.samba.org/show_bug.cgi?id=13915 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2018-11-08debug: Use debuglevel_(get|set) functionAndreas Schneider1-15/+15
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Thu Nov 8 11:03:11 CET 2018 on sn-devel-144
2018-05-16debug: Add group logging classesGary Lockyer1-0/+2
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Wed May 16 07:02:20 CEST 2018 on sn-devel-144
2018-05-16logging: add ldb audit classesGary Lockyer1-0/+6
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-03-22s3: smbd: SMB2: Add DBGC_SMB2_CREDITS class to specifically debug credit issues.Jeremy Allison1-0/+1
https://bugzilla.samba.org/show_bug.cgi?id=13347 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org>
2018-03-22lib: debug: Add DBGC_XXX versions of the macros to allow class-specific ↵Jeremy Allison1-0/+30
messages. https://bugzilla.samba.org/show_bug.cgi?id=13347 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org>
2018-03-22s3: debug: smb2: Create a new DBGC_SMB2 debug class and mark all ↵Jeremy Allison1-0/+1
smbd/smb2_*.c files with it. Will allow easier smb2-specific debugging. https://bugzilla.samba.org/show_bug.cgi?id=13347 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org>
2017-09-07debug: Add new debug class "drs_repl" for DRS replication processingAndrew Bartlett1-0/+1
This is used in the client and in the server Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2017-06-30debug: new debug class for kerberosAndrew Bartlett1-0/+2
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-03-29auth_log: Add JSON logging of Authorisation and AuthenticationsGary Lockyer1-1/+1
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Pair-Programmed: Andrew Bartlett <abartlet@samba.org>
2017-03-29debug: Add debug class for auth_auditAndrew Bartlett1-0/+1
This will be an audit stream of authentication and connection-level authorization Signed-off-by: Andrew Bartlett <abartlet@samba.org> Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz> Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
2017-01-20debug: add "ringbuf" backend logging to a ringbufferRalph Boehme1-0/+3
This is useful for debugging bugs that involve timing effects and are not reproducible when logging at higher debug levels with the file backend. The log can be dumped to a file with gdb: (gdb) dump binary memory samba.log debug_ringbuf debug_ringbuf+SIZE Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2016-12-05debug: Add minimalist D_* macrosMartin Schwenke1-0/+6
These don't include the function name or any other header. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Mon Dec 5 05:58:48 CET 2016 on sn-devel-144
2015-11-06Fix up some aesthetics ... ie, align things as they were intended.Richard Sharpe1-2/+2
Signed-off-by: Richard Sharpe <rsharpe@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri Nov 6 10:36:37 CET 2015 on sn-devel-104
2015-10-21debug: Prefix messages from DBG_* with function nameChristof Schmitt1-5/+13
Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2015-08-01lib/util/debug.h uses va_list, needs stdarg.hDouglas Bagnall1-1/+1
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Sat Aug 1 13:59:13 CEST 2015 on sn-devel-104
2015-07-01tevent: add and use debug class for teventRalph Boehme1-0/+1
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org> Autobuild-User(master): Günther Deschner <gd@samba.org> Autobuild-Date(master): Wed Jul 1 23:04:00 CEST 2015 on sn-devel-104
2015-07-01debug: get rid of DBGC_MAX_FIXEDRalph Boehme1-3/+0
Simplify class table by using designated array initializers and ARRAY_SIZE macro. Signed-off-by: Ralph Boehme <slow@samba.org> Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
2015-06-11debug: Add definitions and macros for log levelsChristof Schmitt1-0/+15
This provides some convenience macros to use consistent log levels for messages with different severities. Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2015-03-23debug: Remove now unused syslog variables from debug_settingsChristof Schmitt1-2/+0
Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23debug: Set backends from logging parameter in smb.confChristof Schmitt1-1/+3
Fallback to the settings of 'syslog' and 'syslog only' if logging has not been set. Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23debug: Remove some unneeded function declarationsChristof Schmitt1-3/+0
Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-01-08lib/util: Avoid collision which alread defined consumer DEBUG macro.Andreas Schneider1-3/+3
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11033 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Thu Jan 8 21:41:30 CET 2015 on sn-devel-104
2014-12-17lib/util: provide a dbgtext_va() function which takes va_listStefan Metzmacher1-0/+1
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-09-19debug: Standalone compile without includes.hMartin Schwenke1-0/+6
Compiling utilities with includes.h is confusing because includes.h could come from source3, source4 or ctdb. Utilities should be independent of such things. Add a minimal set of fined-grained includes that attempts to avoid the catch-all samba_util.h. A comment indicates what is used from samba_util.h so that future clean-ups are easier. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Volker Lendecke <vl@samba.org>
2014-07-31debug: Make Debug1 staticVolker Lendecke1-1/+0
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
2014-07-31debug: Add some readability to debug_logtypeVolker Lendecke1-1/+8
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
2014-07-31debug: Remove thread-related code from debug.cVolker Lendecke1-34/+0
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Thu Jul 31 16:20:53 CEST 2014 on sn-devel-104