0

I have a web service (IIS) that has a config file with the following:

<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
     <file value="\\serverName\c$\logs\log.log"/>
     <appendToFile value="true"/>
... 
<\appender>

For some reason it doesn't log. Only if I a give a path that starts with "c:\" it logs. Is there any way to log to a file that is located on a different server?

Lilach F
  • 65
  • 2
  • 5
  • You can map \\serverName\c$\logs to a drive, like L: – Ricardo Pontual Aug 31 '15 at 12:53
  • I don't want to do that because the application has multiple clients and I can't map the drive for everyone – Lilach F Aug 31 '15 at 12:54
  • Log4net can log on unc mapped files. Check that the IIS impersonated user has write permission to that folder. – deramko Aug 31 '15 at 12:56
  • I tried with localhost(and my computer name too) to see if it was a permission problem and it still didn't work. (while running the web service locally) – Lilach F Aug 31 '15 at 12:57
  • Taken from a similar thread: http://stackoverflow.com/questions/571876/best-way-to-dynamically-set-an-appender-file-path/571979#571979 – Ryan Peters Aug 31 '15 at 12:58
  • I don't understand how to use that thread in order to log to a different server. – Lilach F Aug 31 '15 at 13:04
  • 3
    \\servername\C$ is a default file share with ACL settings only administrators can access by default. You will have to create a file share with ACL that allows the logging threads' accounts to write. For testing you can set it to everyone. – Lex Li Aug 31 '15 at 15:03

0 Answers0