views:

140

answers:

4

I need a path I could specify in log4net file appender so that the log files would go there. However, aspnet or whatever account does not have write privileges to %APPDATA% folder. Is there any place I can write to without asking customer admins to give extra access privileges? Path.GetTempFile() is probably not a good idea. I need some defined place I could tell users to look in, and where web application could also read from. Any other thoughts on how to achieve what I need?

I would like to emphasize: the whole point is NOT TO ASK CUSTOMERS ANYTHING!

A: 

As far as I know, there is no place that the ASPNET user has rights to write to by default. It comes out of the box as a very limited account, by design. I think there will have to be some admin changes, though there are ways to automate them so your customers don't have to manually do them. For example, they can be placed in a script you deliver or of course built into an installer. I'm sure you still would want to make sure the changes were OK with your customers, depending on how security-conscious or IT-conscious they are. I wish I could think of a way for you to do what you want, but nothing else is coming to mind.

Charlie Flowers
+1  A: 

Hey, I did think of something. Duh ... I feel kind of silly for not mentioning this earlier. If your app is talking to a database, you can create a table or tables in it for the logs. There are log4net appenders that write to databases. I'm sure if you're using a DB then permission issues have already been worked out. And log entries in a database have some advantages (some disadvantages too).

Charlie Flowers
+1  A: 

In my current application the installer (.msi built with Windows Installer XML) creates a writable folder for log output (along with a tool to ZIP all log files and send them back to me in case of a problem).

froh42
+1  A: 

What about system event log using EventLogAppender? Is that an option for you?

Vijesh VP