Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6619495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:58:36+00:00 2026-05-25T20:58:36+00:00

I was happily using log4net with my WPF program on an XP machine and

  • 0

I was happily using log4net with my WPF program on an XP machine and happily using a fileAppender FileAppender to write log messages to c:\log.txt. All was well. However, it does not work on a Windows 7 machine. No error or anything, just that the file isn’t created, much less logged to. A little research reveals that it’s a file permissions problem (UAC) with Windows 7, and in fact it works if I run the executable as administrator. It doesn’t work if I just click on it (even though I’m logged on as administrator) and it doesn’t work when I launch from Visual Studio.

Questions:
1. Can someone point me to an example where I ask for permission to write to one and only one file (C:\log.txt). I’ve seen some examples of where the app.config is configured to ask that the whole program is run with admin privileges. This seems like overkill but I guess it would work.
2. Is there as better way to send the information to a log file? After all, perhaps C: does not exist on user machine. I think I recall the idea of a “user partition” in Windows 7, but whatever I do has to work on XP and Vista.

Thanks a ton,
Dave

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:58:36+00:00Added an answer on May 25, 2026 at 8:58 pm

    You should not be trying to write directly to the root folder. Under windows 7, you will either have to run as administrator or disable UAC for that to work and neither are recommended.

    Instead you can write to a folder in the ‘application data’ area

    If you are using a .config file to configure log, you can use something like

    <file value="${ALLUSERSPROFILE}\CompanyName\ProductName\Log.txt" />
    

    or

    <file value="${APPDATA}\CompanyName\ProductName\Log.txt" />
    

    depending on whether you want the log files to be specific to a user or not.

    (Obviously you replace CompanyName and ProductName with your own details).

    This should work on Xp/Vista/W7.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Some WPF controls (like the Button ) seem to happily consume all the available
I've been happily using Django and MySQL in development on an existing machine running
I was happily using VB.NET, saved, and, well, there was a blackout. Probably lucky?
I have a ListBox which happily displays data using a code-behind MVVM object. However,
I am happily launching a program in a windows system from Lua using strProgram
I have a very simple table and I can happily query it using LINQ
I am currently building an ASP.Net-MVC Application using log4net for logging, but the logger
After happily using open source software for many years I've figured it's time to
So I've been happily using subversion to regularly commit files in my stack of
We have been happily using the ASPExpert Menu control at work. Recently I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.