473,378 Members | 1,394 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,378 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 5854
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....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.