logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stuart.Good...@ubs.com
Subject RE: Permission problem with RollingFileAppender
Date Tue, 17 Jul 2007 12:41:23 GMT
Ignore me, it just started working !  Guess it just took time for the
permissions to propagate.


-----Original Message-----
From: Goodwin, Stuart 
Sent: Tuesday, July 17, 2007 2:08 PM
To: log4net-user@logging.apache.org
Subject: Permission problem with RollingFileAppender 
Importance: High

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


- <log4net>
- <appender name="GridFileAppender"
  <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" /> 
- <appender name="AspNetTraceAppender"
- <layout type="log4net.Layout.PatternLayout">
  <conversionPattern value="%date [%thread] %-5level %logger
(%file:%line) - %message%newline" /> 
  <level value="ALL" /> 
  <appender-ref ref="AspNetTraceAppender" /> 
- <logger name="GridUsage">
  <level value="ALL" /> 
  <appender-ref ref="GridFileAppender" /> 
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
  at log4net.Appender.RollingFileAppender.OpenFile(String fileName,
Boolean append) 
  at log4net.Appender.FileAppender.SafeOpenFile(String fileName, Boolean
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...




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.

View raw message