Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 07-13-2011, 02:40 AM   #1
LQ Newbie
Registered: Jul 2011
Posts: 3

Rep: Reputation: Disabled
logging messages from my program doesn't reach /var/log/messages


I have a syslog-ng running and kernel build of

I use a syslog API in my program with facility LOG_LOCAL5 and and levels debug err and crit and info.

when I ran on the older syslog facility I had everything logged fine as I intended. now I have written these rules into the syslog-ng.conf:

options {
flush_lines (0);
time_reopen (10);
log_fifo_size (1000);
long_hostnames (off);
use_dns (no);
use_fqdn (no);
create_dirs (no);
keep_hostname (yes);

source s_sys {
file ("/proc/kmsg" program_override("kernel: "));
unix-stream ("/dev/log");
# udp(ip( port(514));

destination d_cons { file("/dev/console"); };
destination d_mesg { file("/var/log/messages"); };
destination d_auth { file("/var/log/secure"); };
destination d_mail { file("/var/log/maillog" flush_lines(10)); };
destination d_spol { file("/var/log/spooler"); };
destination d_boot { file("/var/log/boot.log"); };
destination d_cron { file("/var/log/cron"); };
destination d_mlal { usertty("*"); };

#filter f_filter1 { facility(kern); };
filter f_filter2 { level(info..emerg) and
not facility(mail,authpriv,cron); };
filter f_filter3 { facility(authpriv); };
filter f_filter4 { facility(mail); };
filter f_filter5 { level(emerg); };
filter f_filter6 { facility(uucp) or
(facility(news) and level(crit..emerg)); };
filter f_filter7 { facility(local7); };
filter f_filter8 { facility(cron); };
filter f_gnssapp { facility(local5) or level(info..emerg); };
filter f_gnssdbg { facility(local5) or level(debug); };
#log { source(s_sys); filter(f_filter1); destination(d_cons); };
#log { source(s_sys); filter(f_filter2); destination(d_mesg); };
log { source(s_sys); filter(f_filter3); destination(d_auth); };
log { source(s_sys); filter(f_filter4); destination(d_mail); };
log { source(s_sys); filter(f_filter5); destination(d_mlal); };
log { source(s_sys); filter(f_filter6); destination(d_spol); };
log { source(s_sys); filter(f_filter7); destination(d_boot); };
log { source(s_sys); filter(f_filter8); destination(d_cron); };
log { source(s_sys); filter(f_gnssapp) ; destination(d_mesg); };
log { source(s_sys); filter(f_gnssdbg) ; destination(d_mesg); };

the last two rules show my program gnssapp.

the result is all debug levels or crit or err levels I don't see any of them !

any help is much appreciated
Old 07-13-2011, 09:00 AM   #2
Senior Member
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Have you checked dmesg for the output?
Kevin Barry
Old 07-13-2011, 09:09 AM   #3
LQ Newbie
Registered: Jul 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
Yes, I don't have anything of tons of log messages I should have written with debug level in neither the /var/log/messages or in dmesg
Old 07-13-2011, 04:16 PM   #4
Senior Member
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Can you reproduce the problem with a small program you can post here?
Kevin Barry
Old 09-18-2011, 01:38 AM   #5
LQ Newbie
Registered: Jul 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
Sorry for the delayed answer.

I appreciate your help. but my mistake was that I had two syslog-ng.conf files in my system one of which that I updated was not in the right directory.

kind of an amateur's mistake...

Thanks again...


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Logging SSH in a separate file other than the regular /var/log/messages satya123 Linux - Newbie 7 04-13-2011 08:43 AM
Logging a to /var/log/messages using python heeman Linux - Newbie 1 03-25-2011 02:10 PM
segfaults are not logging into /var/log/messages ravikumarv Linux - General 1 12-10-2010 09:20 AM
Logging to /var/log/messages paddyjoy Programming 5 12-19-2005 07:01 AM
Redirecting the kernel messages to file other than /var/log/messages jyotika_b83 Linux - General 3 04-28-2005 07:39 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:09 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration