Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C++ Linux logging
please help me!!
i want to log some data of my program using syslog().
but i don't know the procedure,
i googled and i understood i should modify rsyslog.conf but i dont have permission to modify it!!
please help!!
Posted 25-Jul-12 22:46pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You should be able to use the syslog(3)[^] calls without the need to change any system configuration.
Bathooman at 26-Jul-12 5:19am
but my question is how can i use my own logfile?
and a new question is where the log is stored?
Richard MacCutchan at 26-Jul-12 5:33am
Read the man pages, all the information you need is in there.
Jochen Arndt at 26-Jul-12 6:27am
If you don't want to use syslog, just open a file in append mode and write your log data to it.
It's your decision where to store it. /var/log or a subdirectory are common places but your program requires write access to the directory.
For non-system programs you can create your program specific directory and write the log to that directory (or better a sub directory); e.g. /usr/local/myprogram/var/log. Or just use a subdirectory of your home dir if the program is only executed by you.
Richard MacCutchan at 26-Jul-12 6:33am
OP did specifically ask about using syslog().
Jochen Arndt at 26-Jul-12 6:42am
Ups. I missed that. Thank you for pointing to it.
Richard MacCutchan at 26-Jul-12 7:23am
However, your suggestion is still valid.
Bathooman at 26-Jul-12 5:33am
i did but i'm still confused
Richard MacCutchan at 26-Jul-12 5:57am
Confused about what, I cannot guess which parts you do not understand?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Advertise | Privacy | Mobile
Web01 | 2.8.140926.1 | Last Updated 26 Jul 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100