Click here to Skip to main content
Rate this: bad
good
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
good
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.
  Permalink  
Comments
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)

  Print Answers RSS
0 OriginalGriff 371
1 Sergey Alexandrovich Kryukov 269
2 CB Sharma 79
3 RyanDev 75
4 PhilLenoir 70
0 Sergey Alexandrovich Kryukov 6,676
1 OriginalGriff 6,056
2 CPallini 2,473
3 Richard MacCutchan 1,697
4 Abhinav S 1,560


Advertise | Privacy | Mobile
Web01 | 2.8.140821.2 | 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