Page 1 of 1

Where to store debug output?

Posted: Wed Dec 21, 2011 10:36 am
by Kukulkan
Hi,

I'm currently porting a windows app to linux (must run on CentOS, RedHat and Ubuntu). At windows, I wrote some error-logs to %TEMP% path.

But what is the correct place for logfiles on Linux?

I try'd to write to /var/log/, but my app is not allowed to create a new file here (only root, but my app never runs with root permissions).

Can I use OpenFile() to write to some log that is declared for such use? For example stderr? But how can the user then see the content?

I'm new to Linux development and this is somewhat confusing.

Kukulkan

Re: Where to store debug output?

Posted: Wed Dec 21, 2011 12:52 pm
by remi_meier
If you have a normal application you should probably log to
$HOME/.yourapp/

Syslog is normally used for System-relevant logs produced by
daemons or other critical applications (e.g. webservers). Syslog
writes to /var/log and can be used through a command-line tool
"logger" or through syslog-functions. Choose whatever works
best for you.

Cheers!
remi

Re: Where to store debug output?

Posted: Wed Dec 21, 2011 1:54 pm
by Kukulkan
Hi remi,

Thanks for your input. I think I will use $HOME/.app.

Kukulkan

Re: Where to store debug output?

Posted: Wed Dec 21, 2011 5:55 pm
by Trond
/tmp is also a place where you can create temporary files.

Re: Where to store debug output?

Posted: Thu Dec 22, 2011 8:23 am
by Kukulkan
Yes, indeed a good idea. Thank you.

Re: Where to store debug output?

Posted: Thu Dec 22, 2011 2:03 pm
by Guimauve
Hello,

Code: Select all

Debug GetTemporaryDirectory()
Here on Linux Mint 12 :
Debugger Output wrote:/tmp/
I guess on windows this command return something like
C:\Windows\Temp
Best regards.
Guimauve