Hi Guiseppe, please keep replies on the list. Regarding setting the destination file: This depends on which syslog daemon you use. I'm not sure but I think Ubuntu uses syslog-ng. There the syntax would be like this: ##### /etc/syslog-ng/syslog-ng.conf ##### # Source should already exist, check the name and update the rest source src { unix-stream("/dev/log"); internal(); }; # Define the logging chain destination locallog0 { file("/var/log/mylog"); }; filter f_locallog0 { facility(local0); }; log { source(src); filter(f_locallog0); destination(locallog0); }; # Exclude locallog0 from the normal syslog, adapt for your current # setup destination syslog { file("/var/log/syslog"); }; filter f_syslog { not facility(local0, <others>); }; log { source(src); filter(f_syslog); destination(syslog); }; ##### END ##### Don't forget to restart the daemon. Regards, Florian Philipp Am 11.06.2012 14:54, schrieb Giuseppe Penone: > I'm sorry to bother again, I'm going with syslog which works pretty good > but seems to write > to /var/log/syslog only and I cannot find a way to write to a dedicated > file. > I'm using the following code: > > // gcc giuspexample.c -o giuspexample > #include <syslog.h> > > int main() > { > setlogmask(LOG_UPTO (LOG_NOTICE)); > > openlog("atm", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL0); > > syslog(LOG_NOTICE, "Program started by User %d", getuid ()); > syslog(LOG_INFO, "A tree falls in a forest"); > > closelog(); > return 0; > } > > I followed the instructions on > http://www.codealias.info/technotes/syslog_simple_example on how to > change the destination filepath > > echo "local0.* /var/log/mylog" >> /etc/syslog.conf > > but does not write on /var/log/mylog (still on /var/log/syslog). > I'm on (L)ubuntu 12.04. > > Many thanks. > > > > On Fri, Jun 8, 2012 at 11:23 PM, Florian Philipp <lists binarywings net > <mailto:lists binarywings net>> wrote: > > Am 08.06.2012 09 <tel:08.06.2012%2009>:55, schrieb Giuseppe Penone: > > Hi, > > I need to log to file but I'm not an expert in it, I would like to > > control the number of days logged to do not fill up the disk. > > Is there an adviced way to do it in gtkmm? > > Thanks. > > > > There is a logging stream in gtkmm-utils [1]. It doesn't support > truncating the files though. Depending on your application, syslog and > logrotate might be a better approach. > > Alternatively, do some timeout logic (using [2]) to change the log file > every day and remove old ones. > > [1] http://code.google.com/p/gtkmm-utils/ > [2] > http://developer.gnome.org/glibmm/unstable/classGlib_1_1SignalTimeout.html > > Regards, > Florian Philipp > > > _______________________________________________ > gtkmm-list mailing list > gtkmm-list gnome org <mailto:gtkmm-list gnome org> > https://mail.gnome.org/mailman/listinfo/gtkmm-list > >
Attachment:
signature.asc
Description: OpenPGP digital signature