How can I write to a log file?


I would like to either write on the webserver log file or create my own file on the disk. How can I do that?


You can access the file directly using .NET or PHP file commands to create/modify/delete files within your CloudSite file system. Assuming you are using .NET you would use the System.IO classes.


You do it exactly like you would write to your PC’s disk, you only need to use MapPath function

Example (in VB):

let’s say your log file is in a folder named “logs”

FileOpen(1,filename, …

If you want to access MapPath from a class, then you need to use System.Web.HttpContext.Current.Server.MapPath