<p>I have a ASP.NET application that we've written our own logging module for.</p>

<p>My question is, where is the standard place to write a log file to? I.e. the website will be running as the anonymous user identity (e.g. IUSR on IIS7) and I need a place where I know it'll have permission to write to.</p>

<p>Cheers,</p>

[{'answer_id': 6534, 'author': 'EndangeredMassa', 'author_id': 106, 'author_profile': 'https://Stackoverflow.com/users/106', 'pm_score': 4, 'selected': True, 'text': "<p>App_Data folder on the root of the project. It isn't served to web requests; so other people can't snoop for it.</p>\n"}, {'answer_id': 6702, 'author': 'GateKiller', 'author_id': 383, 'author_profile': 'https://Stackoverflow.com/users/383', 'pm_score': 1, 'selected': False, 'text': '<p>I would suggest putting the log file onto a seperate disk, though should give you a little performance gain so that your not trying to both read and write to the same disk as the website. If you cannot put the log file on a seperate disk, then I would simply choose a folder of your choice.</p>\n\n<p>In any case, you will have to give the "Network Service" account "Modify" permissions to the desired folder.</p>\n\n<p>If on the other hand, you have access to a databse, then log the information there. It will be much quicker than accessing the hard drive and won\'t be publically available. You\'ll also be able to report from the data quite easily.</p>\n'}, {'answer_id': 7343, 'author': 'Ray', 'author_id': 233, 'author_profile': 'https://Stackoverflow.com/users/233', 'pm_score': 0, 'selected': False, 'text': "<p>I'm not in a position to modify the permissions on folders (especially outside of the virtual directory home folder), and don't already have an App_Data folder, so am a bit hesitant to go with that. </p>\n\n<p>So for the moment I'm going with the CommonApplicationData Folder. </p>\n\n<ul>\n<li>On Vista/Server 2008 this is C:\\ProgramData\\</li>\n<li>On XP/Server 2003 this is C:\\Documents and Settings\\All Users\\Application Data\\</li>\n</ul>\n"}, {'answer_id': 7345, 'author': 'Derek Park', 'author_id': 872, 'author_profile': 'https://Stackoverflow.com/users/872', 'pm_score': 0, 'selected': False, 'text': "<blockquote>\n  <p>I'm not in a position to modify the permissions on folders (especially outside of the virtual directory home folder), and don't already have an App_Data folder, so am a bit hesitant to go with that.</p>\n</blockquote>\n\n<p>If you have a website, you clearly have a folder somewhere.  Can you not add a (non-web-facing) subfolder?  It seems like that would be a more appropriate place to put your logs than dumping them into a global, shared folder.</p>\n"}, {'answer_id': 7478, 'author': 'Chris Miller', 'author_id': 206, 'author_profile': 'https://Stackoverflow.com/users/206', 'pm_score': 0, 'selected': False, 'text': '<p>You could also log to the Windows Event log or to a table in a database.  How often are people looking at the event log?  If it\'s being examined on a regualr basis, writing to a table amkes the reporting back much easier as it\'s trivial to reverse the order and only show the last X events for the current time period.  The Windows Event log you can also query the Windows Event Log through <a href="http://en.wikipedia.org/wiki/Powershell" rel="nofollow noreferrer">PowerShell</a> or with <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07&amp;displaylang=en" rel="nofollow noreferrer">LogParser</a>.</p>\n'}, {'answer_id': 14847416, 'author': 'anIBMer', 'author_id': 1465054, 'author_profile': 'https://Stackoverflow.com/users/1465054', 'pm_score': 0, 'selected': False, 'text': '<p>Push the app_data is the best idea, just bear in mind, when the publishing the projects, if the option "Delete all existing files before publishing" is ticked, then the current data in the folder will be gone. The workaround is to skip the deletion of app_data folder. </p>\n\n<p>Another option to do logging is to use some existing framework such as Log4net. </p>\n'}]
['https://Stackoverflow.com/questions/6530', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/233/']