Where to store debug output?

Linux specific forum
User avatar
Kukulkan
Addict
Addict
Posts: 1396
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Where to store debug output?

Post 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
remi_meier
Enthusiast
Enthusiast
Posts: 468
Joined: Sat Dec 20, 2003 6:19 pm
Location: Switzerland

Re: Where to store debug output?

Post 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
Athlon64 3700+, 1024MB Ram, Radeon X1600
User avatar
Kukulkan
Addict
Addict
Posts: 1396
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: Where to store debug output?

Post by Kukulkan »

Hi remi,

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

Kukulkan
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: Where to store debug output?

Post by Trond »

/tmp is also a place where you can create temporary files.
User avatar
Kukulkan
Addict
Addict
Posts: 1396
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: Where to store debug output?

Post by Kukulkan »

Yes, indeed a good idea. Thank you.
User avatar
Guimauve
Enthusiast
Enthusiast
Posts: 742
Joined: Wed Oct 22, 2003 2:51 am
Location: Canada

Re: Where to store debug output?

Post 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
Post Reply