samba3 have built-in (without any patches) ability to run in foreground (smbd - F) and to write log to stdout (smbd -FS). But realisation of logging to stdout is broken: only few first strings of log appears in stdout, all other strings of log are disappear. You can simply check this: run "smbd -FS", connect clients, do some operations and watch log output to console. Then run smbd as usually (logging in syslog or log files), connect clients, do the same operations. Then compare stdout log and usual log. Stdout log is limited by few strings, when usual log is complete. I investigated this problem since samba v2.2.8. In this version ability to run in foreground and logging to stdout was added by patches from Michael Handler (www.grendel.net). By the way, these patches was applied for samba3 source tree, so in samba3-release abilities to run in foreground and log to stdout are built-in. For samba3 problem in file smbd/server.c, in call of procedure close_low_fds (False) - it closing stdout and log disappears. By the way, "False" in calling of this procedure means not to close stderr (see lib/util.c). I noticed that in smbd/server.c procedure close_low_fds called 2 times, and both times with "False" argument. So, if we not closing stderr, maybe direct log to stderr will be more reasonable? I do this by editing lib/debug.c. In fragment: if (interactive) { stdout_logging = True; dbf = x_stdout; x_setbuf( x_stdout, NULL ); } i replaced x_stdout to x_stderr. Then i run smbd daemon: exec 2>&1 exec /usr/local/samba/bin/smbd -FS logging to stdout works great!
database cleanup
*** This bug has been marked as a duplicate of 1847 ***