开发者

Log4Net on Godaddy Shared Host

开发者 https://www.devze.com 2023-01-15 09:46 出处:网络
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 FileI

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.


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)

0

精彩评论

暂无评论...
验证码 换一张
取 消