473,398 Members | 2,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

The right place to save log files to

Hi,

my application writes some log files. It runs on notebooks and PCs. Several
different users may log on to the machines.

Which is the right place to store the log files? Should I create some sub
folder below %ALLUSERSPROFILE% ? The problem here: By default a standard
windows user does not have write permission below %ALLUSERSPROFILE%. Which is
the recommended place for saving this kind of data?

Thanks for any ideas,
Guido
Apr 27 '07 #1
3 5857
Hello Guido,

Why not to save to the application folder?

---
WBR, Michael Nemtsev [.NET/C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

GKmy application writes some log files. It runs on notebooks and PCs.
GKSeveral different users may log on to the machines.
GK>
GKWhich is the right place to store the log files? Should I create
GKsome sub folder below %ALLUSERSPROFILE% ? The problem here: By
GKdefault a standard windows user does not have write permission below
GK%ALLUSERSPROFILE%. Which is the recommended place for saving this
GKkind of data?
GK>
GKThanks for any ideas,
GK>
GKGuido
GK>
Apr 27 '07 #2
JR
If by "application folder" you mean the application folder in "program
files", it normally required administrator privileges and thus is not a good
idea.

If you mean Environment.SpecialFolder.ApplicationData, you get a separate
log for each user. If you need a common log, you could use
Environment.SpecialFolder.CommonApplicationData.

These locations are normally hidden. If this is a problem, use
Environment.SpecialFolder.MyDocuments.

JR

"Michael Nemtsev" <ne*****@msn.comëúá
áäåãòä:a2***************************@msnews.micros oft.com...
Hello Guido,

Why not to save to the application folder?

---
WBR, Michael Nemtsev [.NET/C# MVP]. My blog:
http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

GKmy application writes some log files. It runs on notebooks and PCs.
GKSeveral different users may log on to the machines.
GKGKWhich is the right place to store the log files? Should I create
GKsome sub folder below %ALLUSERSPROFILE% ? The problem here: By
GKdefault a standard windows user does not have write permission below
GK%ALLUSERSPROFILE%. Which is the recommended place for saving this
GKkind of data?
GKGKThanks for any ideas,
GKGKGuido
GK>

Apr 27 '07 #3
Hi Guido,

Yes, just as JR pointed out, you should save the log files to the per-user
directory under C:\Documents and Settings. The normal user will have full
control over his own per-user directory. You may use
Environment.GetFolderPath to obtain the path programmatically, like this:
Environment.GetFolderPath(Environment.SpecialFolde r.ApplicationData);

However, I need correct one points:
Environment.SpecialFolder.CommonApplicationData points to the "Application
Data" under %ALLUSERSPROFILE% directory, and normal users do not have write
permission to it just as you have discovered. So you should not use
"Environment.SpecialFolder.CommonApplicationDa ta" constant.

Hope it helps.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Apr 30 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Viviana Vc | last post by:
How can I programatically do the equivalent of the following: cacls "C:\Program Files\test" /T /G Everyone:f ? Thanks, Viv
7
by: user | last post by:
Hello I tried: pictureBox1.Image.Save("file.sav"); compiled, but when i run i receive errors: Additional information: Object reference not set to an instance of an object. Why ?
10
by: GJP | last post by:
Hello. Ive been asked to make my own notepade for college assignment. All ig going well, but i cant get the save to work. I can get Save a (shows dialog box), i can get it to just save too,...
4
by: Marco | last post by:
Hi to All, I'm developing an application in VB .NET. I have a question: what is the best place to save personal settings of my users? I mean, when a user uses my application, it can create a...
2
by: Scott M. Lyon | last post by:
I'm working on a WinForm application, and recently was informed that I need to create an "Export" function for the data (stored in SQL Server), in a specific (TXT, tab delimited) format. I'd...
3
by: K.Kishore | last post by:
Hi all, When iam clicking 'X' option it is asking a popup to save or No. I am selecting "No" (Since I dont want to save) But i want it not tosave without prompting. For this the following code i...
4
by: Ed | last post by:
Recently I got a new laptop and placed my Visual Studio 2003 project on it. But when I place my aspx files in design mode the aspx files don't design right. I used grid layout (not flow) and...
0
by: hatcat | last post by:
Hi everyone. I'm looking for the right tool for a job. Hope someone can help. The deal is this: We have a large amount of data which is maintained by non-programmers. This is validated and...
4
by: kev | last post by:
Hi folks, I have created a database to store information on equipments. During the first level of registration, there is a form that i need the user to fill up details on the equipment testing....
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.