Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where should I put my log file for an asp.net application?

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

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.

Cheers,

like image 722
Ray Avatar asked Aug 09 '08 02:08

Ray


People also ask

Where should log files be stored?

Logs are stored as a file on the Log Server. A separate folder is created for the logged events each hour. The log files are stored by default in the <installation directory>/data/ storage/ directory on the Log Server.

Where do I put application logs?

On a Windows computer: Inside the Control Panel, find System & Security. From there, go to Administrative Tools and then the Event Viewer. Open Windows Logs and choose Application. This will show you all the application logs saved on your computer.

Where are .NET logs stored?

Most . NET programs write logs to a database or Windows Event Log if running in Windows and to the /var/log folder if running in Linux. There are security issues with flat files, but their use is also common. You'll need extra storage space for logging, regardless of the method used.


2 Answers

App_Data folder on the root of the project. It isn't served to web requests; so other people can't snoop for it.

like image 137
EndangeredMassa Avatar answered Sep 27 '22 21:09

EndangeredMassa


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.

In any case, you will have to give the "Network Service" account "Modify" permissions to the desired folder.

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.

like image 22
GateKiller Avatar answered Sep 27 '22 22:09

GateKiller