Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logs end up in different place when running 2.60 with --nodetach than with older versions. #31

Closed
realsimix opened this issue Jul 29, 2021 · 9 comments

Comments

@realsimix
Copy link

realsimix commented Jul 29, 2021

Hi Maxim,

While working on my spampd-2.60 RPMs for RHEL7 and later, I wondering how to get the logging the same way than it was with older versions up to 2.53.

On these system, systemd is starting spampd with the option --nodetach so that spampd doesn't daemonize and systemd can to the baby sitting. Unfortunately starting with 2.60, I don't get the log messages in /var/log/maillog anymore but they go to /var/log/messages instead.

The reason seems to be that with --nodetach on 2.60, messages are not going to syslog anymore but to STDERR, while with older versions, they still went to syslog.

Is this wanted or can it be changed to how it has worked before?

Thanks,
Simon

@mpaperno
Copy link
Owner

I wasn't aware that the default behavior changed (line 702), but I can look into that. Meanwhile I think the option you're looking for is --logfile, which is probably good to specify explicitly anyway. In fact there are more log destination options now...

--logfile or -o <dest>     Destination for logs (syslog|stderr|<filename>).
--logsock or -ls <sock>    Allows specifying the syslog socket type.
--logident or -li <name>   Specify syslog identity name.
--logfacility or -lf <nm>  Specify syslog facility (log name).

If you're already using --logfile then the mystery deepens.

BTW don't miss the new config file option :)

@realsimix
Copy link
Author

realsimix commented Jul 29, 2021 via email

@mpaperno
Copy link
Owner

No, it will reload the whole original command line, including config file(s), if any. The files are just for convenience really.

@mpaperno
Copy link
Owner

PS. Looks like I could have been clearer about that in the change log!

@realsimix
Copy link
Author

realsimix commented Jul 29, 2021 via email

@mpaperno
Copy link
Owner

Oh, yes, absolutely right, of course. Sorry, I missed they key word "change" in your original question.

@mpaperno
Copy link
Owner

Commenting out/removing lines 704-707 should revert back to old behavior (default logging to syslog). Could you confirm?

  # set up logging specs based on options ($logspec is only an array if --logfile option(s) existed)
  if (ref($spd_p->{logspec}) eq 'ARRAY') {
    $spd_p->{logtype} &= ~LOG_TYPE_MASK;  # reset the low byte containing LOG_<type> constant
    ($spd_p->{logtype}, $srv_p->{log_file}) = logfile2logtype($spd_p->{logspec}, $spd_p->{logtype});
  }
  # elsif (!$srv_p->{background}) {
  #   # set default logging to stderr if not daemonizing and user didn't specify.
  #   $spd_p->{logtype} = $spd_p->{logtype} & (~LOG_TYPE_MASK) | LOG_SYSLOG;
  # }

I guess I should revert it.... it was just convenient when running "interactively" from a command line, but I don't suppose many people will be doing that on a regular basis anyway.

Thanks again!
-Max

@realsimix
Copy link
Author

Hi Maxim,

Yes, that's the solution. Tested it and it reverses the behavior to how it was with older releases.

Thanks,
Simon

@mpaperno
Copy link
Owner

Thanks again Simon. I just pushed a new version with all the fixes in one place. I'll give this a day or few and if you don't find any other issues I will do a new tag/release (or I can do one sooner if you prefer).

Cheers,
-Max

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants