I've got a .NET Windows application that's deployed via ClickOnce to a Web server. There are approximately 100 users at any given time, all centrally located. I'm using log4net to log within the application, but I'm having trouble arriving at the best place to put the log.
I've tried having them write to a shared network location, but some users have experienced poor I/O with that approach. I've tried logging to the user's temp folder, but that makes it harder to retrieve the logs. I haven't tried the event log because I will probably have to jump through some hoops to get that working, and I'm not sure if it's worth it. I've never tried database logging, but I've always assumed that it would be relatively slow.
Does anybody have experience with logging in a Windows application deployed in a corporate environment? Any suggestions on where I can put the log so that it will be (1) quick, (2) reliable, and (3) accessible?
You could use a combination of local logging, and you could sync the logs to a centeral database at successful log off.
It depends on what kind of logging you want to do and how your application is running. If the application doing the logging is a client side application, then if you write to the event logs it may not be helpful.
If you do want to write to the event logs, it's fairly straight forward:
http://support.microsoft.com/kb/307024
One more thing, if you are looking for a location that you know the user has access to for sure, you can use isolated storage, but the fact that you were trying to write to a shared folder makes me thing that you want one central location for your logs, in which case a DB is probably your best bet, and my top suggestion may be best for you.
You could try somewhere under the CommonAppData folder - i.e., CommonAppData\YourAppName\Logs - provided that you ensure size limits and/or periodic cleanups. People are used to periodically clean up the temp folders but are wary of starting ot dig around CommonAppData, AppData or LocalAppData.
Writing anywhere else but here or into Temp will sooner or later get you in trouble on Vista and higher.
If the logs are not vital, i.e. if irreplaceable data won't get lost if someone deletes the log, I would definitely go for a subfolder in Temp and have a separate task scheduler job upload them. It's the least painful place.