Following the fix for bug 14897, an smb.conf line like log level = 1 dsdb_group_json_audit:5@somewhere.log no longer works properly; the '5' for dsdb_group_json_audit is effective, turning on the logging, but the '@somewhere.log' does nothing and the JSON logs end up in the main log file. I am able to get 4.15.6 working by running setup_logging() again after the lpcfg_load(): --- a/lib/cmdline/cmdline_s4.c +++ b/lib/cmdline/cmdline_s4.c @@ -58,20 +58,33 @@ static bool _samba_cmdline_load_config_s4(void) default: break; } config_file = get_dyn_CONFIGFILE(); ok = lpcfg_load(lp_ctx, config_file); if (!ok) { fprintf(stderr, "Can't load %s - run testparm to debug it\n", config_file); if (_require_smbconf) { return false; } } + switch (_config_type) { + case SAMBA_CMDLINE_CONFIG_SERVER: { + /* + * We need to setup_logging *again* to ensure multi-file + * logging is set up as specified in smb.conf. + */ + setup_logging(getprogname(), DEBUG_FILE); + break; + } + default: + break; + } return true; } but I am not sure whether it also still needs to be there *before* the lpcfg_load(). Ralph, Andreas, was there a specific reason for that order?
You want to write to the log file as early as possible to not miss anything. I think you're right that we need to call setup_logging() after loading the config again. Shouldn't we disable logging to files in interactive mode?
(In reply to Andreas Schneider from comment #1) > Shouldn't we disable logging to files in interactive mode? Yes. The patch I actually used had DEBUG_DEFAULT_STDERR there, which I think *maybe* we want to do in all cases, but until I resolve that maybe, there is: https://gitlab.com/samba-team/samba/-/merge_requests/2548
This bug was referenced in samba master: 9537ac723cfdc43e718fdd08dc28883e7057a372
Created attachment 17350 [details] Patch for 4.15 and 4.16
Please apply for 4.15.next and 4.16.next
Pushed to autobuild-v4-{16,15}-test.
This bug was referenced in samba v4-15-test: a1bb535cfb37f7e0534a0bcdd0ea2bf918a0ac42
This bug was referenced in samba v4-16-test: edd5a851273cdbece6aba3d22241e469e58bed9a
Closing out bug report. Thanks!
This bug was referenced in samba v4-15-stable (Release samba-4.15.8): a1bb535cfb37f7e0534a0bcdd0ea2bf918a0ac42
This bug was referenced in samba v4-16-stable (Release samba-4.16.3): edd5a851273cdbece6aba3d22241e469e58bed9a