Hi all,
I have an ASP.NET 2.0 application programmed in VB using log4net. It produces logs on the ASP Trace, and also on a RollingFile Appender. The file appender works fine logging to a network drive from my development machine using Visual Studio development server, and also to my C drive using local IIS server, but not when running on the UAT remote server machine to the same network drive, even though I have the service name for the remote machine set up with the permissions it needs. (local IIS to network drive doesn't work either, but I figure the service name for that really doesn't have permissions. I presume Visual Studio dev server is running with my own login name, which has perms ?). ASP Trace logger works everywhere, and I have internal logging on log4net logging to the Trace too (but I want to turn the Trace off !). My logger config looks like this (pathnames changed to protect the innocent): <configuration> - <log4net> - <appender name="GridFileAppender" type="log4net.Appender.RollingFileAppender"> <file type="log4net.Util.PatternString" value="\\\\fish\\chips\\Mushy Peas\\Grid Usage.log" /> <appendToFile value="true" /> <countDirection value="1" /> <lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> <rollingStyle value="Size" /> <maximumFileSize value="2MB" /> <maxSizeRollBackups value="100" /> - <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%date - %message%newline" /> </layout> </appender> - <appender name="AspNetTraceAppender" type="log4net.Appender.AspNetTraceAppender"> - <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%date [%thread] %-5level %logger (%file:%line) - %message%newline" /> </layout> </appender> <root> <level value="ALL" /> <appender-ref ref="AspNetTraceAppender" /> </root> - <logger name="GridUsage"> <level value="ALL" /> <appender-ref ref="GridFileAppender" /> </logger> </log4net> </configuration> The error that log4net throws is as follows: log4net: FileAppender: Opening file for writing [\\fish\chips\Mushy Peas\Grid Usage.log] append [True] log4net:ERROR [RollingFileAppender] Unable to acquire lock on file \\fish\chips\Mushy Peas\Grid Usage.log. Access to the path '\\fish\chips\Mushy Peas\Grid Usage.log' is denied. log4net:ERROR [RollingFileAppender] OpenFile(\\fish\chips\Mushy Peas\Grid Usage.log,True) call failed. log4net.Appender.FileAppender+LockingStream+LockStateException: The file is not currently locked at log4net.Appender.FileAppender.LockingStream.get_CanWrite() at System.IO.StreamWriter..ctor(Stream stream, Encoding encoding, Int32 bufferSize) at System.IO.StreamWriter..ctor(Stream stream, Encoding encoding) at log4net.Appender.FileAppender.OpenFile(String fileName, Boolean append) at log4net.Appender.RollingFileAppender.OpenFile(String fileName, Boolean append) at log4net.Appender.FileAppender.SafeOpenFile(String fileName, Boolean append) log4net:ERROR [RollingFileAppender] No output stream or file set for the appender named [GridFileAppender]. Looks like a simple permissions problem, but I'm sure the service account has the right permissions for that drive - properties/security/advanced/effective permissions for that drive with my service account name shows all ticked apart from delete subfolders, change perms and take ownership. Is there anything else it could be ? Would the spaces in the path name cause a problem, for example ? Please help - this is the last thing I need to sort before I take the application into production, I want the logging, but obviously want to turn the trace off... Thanks, Stu This communication is issued by UBS AG and/or affiliates to institutional investors; it is not for private persons. This is a product of a sales or trading desk and not the Research Dept. Opinions expressed may differ from those of other divisions of UBS, including Research. UBS may trade as principal in instruments identified herein and may accumulate/have accumulated a long or short position in instruments or derivatives thereof. UBS has policies designed to negate conflicts of interest. This e-mail is not an official confirmation of terms and unless stated, is not a recommendation, offer or solicitation to buy or sell. Any prices or quotations contained herein are indicative only. Communications may be monitored. © 2006 UBS. All rights reserved. Intended for recipient only and not for further distribution without the consent of UBS. UBS Limited is a company registered in England & Wales under company number 2035362, whose registered office is at 1 Finsbury Avenue, London, EC2M 2PP, United Kingdom. UBS AG (London Branch) is registered as a branch of a foreign company under number BR004507, whose registered office is at 1 Finsbury Avenue, London, EC2M 2PP, United Kingdom. UBS Clearing and Execution Services Limited is a company registered in England & Wales under company number 03123037, whose registered office is at 1 Finsbury Avenue, London, EC2M 2PP, United Kingdom.
