0

I had Log4Net working on my Local machine. It logged to a DB with one FileAppender, Nothing logged to a file. When I moved my code to my shared Hoting provider (GoDaddy) I got an exception about FileIOPermission required. Does anyone have any ideas of what might have been happening?

I removed the configuration and am at the moment using ELMAH to log everything, (although I would like to use Log4Net) so I don't have any of the examples or stack traces anymore.

Any thoughts would be appreciated.

EJC
  • 2,062
  • 5
  • 21
  • 33
  • When you say: "It logged to a DB with one FileAppender, Nothing logged to a file." ... Doesn't FileAppender append to a file? It strikes me that it would be particularly badly named if that weren't the case. – Jon Skeet Sep 10 '10 at 16:26
  • Sorry, I meant I was using ADONetAppender... I'm just fishing for reasons of why log4net wanted FileIOPermission when I wasn't writing to a file. I was logging to a SQL DB. – EJC Sep 10 '10 at 16:50

1 Answers1

0

This is not much info to work with, but here are a few things you can do:

  1. You can always debug the actual log4net code.
  2. When it doesn't write to a file, it's usually a problem of permissions. If it's a web project, look at what user the application pool is running under (usually LOCAL SYSTEM), and that user needs write access to the file (and the directory where you want to put the file). The fact that the exception is actually FileIOPermission required definitely points to this direction.
  3. Similarly, it might be that there is a temp file that log4net is trying to use when you're logging to a db. In that case, you might going to have to change your temp folder.

Furthermore, look at this post: Log4Net works on Dev machine, fails when deployed to shared host (using same db/connstring)

Community
  • 1
  • 1
Gyuri
  • 4,548
  • 4
  • 34
  • 44
  • I left the internal debugging writing to a file from when I was trying to debug on my dev machine... lame :) thanks for the temp file check it made me think of what might have been going wrong. – EJC Sep 16 '10 at 16:17