0

I am writing something and I wanted to take advantage of Linux API for logging, I wanted to put the logs of my app to different files, so I added those lines to rsyslog.conf

if $programname == 'RearWindowDaemon' then /var/log/RearWindowDaemon.log 
if $programname == 'RearWindow' then /var/log/RearWindow.log

but something is not working, even with this simple code:

int main()
{
openlog("RearWindow",0,LOG_LOCAL0);
syslog(LOG_ERR,"some err");
syslog(LOG_ERR,"other err");
return;
}

I get the logs to /var/log/syslog and not to /var/log/RearWindow.

Should I do anything more? I am using XUbuntu 11.10 if it matters.

Andna
  • 6,539
  • 13
  • 71
  • 120

1 Answers1

0

Probably it's late a bit. But what I can understand, you should compile your code such that it produces the binary with name 'RearWindow'. $programname checks if logs are coming from a process with the specified name not that the log contains the string 'RearWindow'. Hopefully this helps.

tnx123456
  • 125
  • 2
  • 8