Diverting all console messages from a process

I'm running a transmission-daemon with error logging enabled. This gives a lot of records diverted to my console such as

Code:
Dec 28 18:59:53 yyy transmission-daemon[36329]: zzzzz No data found! Ensure your drives are connected or use "Set Location".
 To re-download, remove the torrent and re-add it. (torrent.c:487)
How can I divert all this messages to a file? I have tried setting up the following record in syslog.conf:

Code:
!transmission-daemon
*.*                                             /var/log/transmission-remote.log
with no success
 
Set message-level to 1 or 0 in transmission's settings.json.
 
Well that would have been fine if I didn't want to receive them at all. Anyway I have found that since 1.91 transmission daemon supports logging to a file. The only question left where to put the directives in rc.d script to start the transmission with the following flags?

Code:
-e --logfile <filename> Dump the log messages to this filename

Here is rc.d script attached

Code:
. /etc/rc.subr

name="transmission"
rcvar=${name}_enable

command=/usr/local/bin/transmission-daemon

load_rc_config ${name}

: ${transmission_enable:="NO"}
: ${transmission_user:="transmission"}
: ${transmission_conf_dir="/usr/local/etc/transmission/home"}
: ${transmission_download_dir="/usr/local/etc/transmission/home/Downloads"}
transmission_flags=" \
        ${transmission_watch_dir:+-c ${transmission_watch_dir}} \
        ${transmission_conf_dir:+-g ${transmission_conf_dir}} \
        ${transmission_download_dir:+-w ${transmission_download_dir}} \
        ${transmission_flags}"

run_rc_command "$1"
 
Don't modify the rc script, set the flags in /etc/rc.conf:
Code:
transmission_flags="-e --logfile /var/log/transmission.log"
Untested.
 
I guess they're getting caught by the first line of a default /etc/syslog.conf. I suggest you add this to /etc/rc.conf:

Code:
syslogd_flags="-vv"

And then restart. You'll now see the facility and log level of each message syslog generates, which will help you to modify /etc/syslog.conf appropriately.

If my guess is right, you can try add this to the top of your /etc/syslog.conf:

Code:
!-transmission-daemon
 
rc.conf correction

wblock@ said:
Don't modify the rc script, set the flags in /etc/rc.conf:
Code:
transmission_flags="-e --logfile /var/log/transmission.log"
Untested.

Either:
Code:
transmission_flags="-e /var/log/transmission.log"

OR:
Code:
transmission_flags="--logfile /var/log/transmission.log"

Then...
Code:
# touch /var/log/transmission.log
# chown transmission /var/log/transmission.log
# service transmission restart

This prevents transmission from writing to the console, unless it runs into big trouble, such as not being able to open the log file or save settings.json.
 
Back
Top