Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. My log4net is not working on releases (but works on asp.net debug mode)

My log4net is not working on releases (but works on asp.net debug mode)

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netvisual-studiowindows-admindebugging
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rafferty Uy
    wrote on last edited by
    #1

    Hi, I'm having problems getting logs to work. Here are some configuration snippets. // -- IN MY LOG4NET.XML ------------------------------------------ // -- IN MY WEB.CONFIG ------------------------------------------- // -- IN MY GLOBAL.ASAX.CS --------------------------------------- protected void Application_Start(object sender, EventArgs e) { var config = new FileInfo(configPath); log4net.Config.XmlConfigurator.ConfigureAndWatch(config); } What could be wrong? For some reason when I enter debug mode through visual studio (by pressing F5), it correctly creates the data sub directory as well as the ErrorTrace.txt. However, it does not work when I copy the release files to my IIS virtual directory. *Additional note: the virtual directory is configured to have write access. Can anyone help? Rafferty

    P 1 Reply Last reply
    0
    • R Rafferty Uy

      Hi, I'm having problems getting logs to work. Here are some configuration snippets. // -- IN MY LOG4NET.XML ------------------------------------------ // -- IN MY WEB.CONFIG ------------------------------------------- // -- IN MY GLOBAL.ASAX.CS --------------------------------------- protected void Application_Start(object sender, EventArgs e) { var config = new FileInfo(configPath); log4net.Config.XmlConfigurator.ConfigureAndWatch(config); } What could be wrong? For some reason when I enter debug mode through visual studio (by pressing F5), it correctly creates the data sub directory as well as the ErrorTrace.txt. However, it does not work when I copy the release files to my IIS virtual directory. *Additional note: the virtual directory is configured to have write access. Can anyone help? Rafferty

      P Offline
      P Offline
      Paddy Boyd
      wrote on last edited by
      #2

      Are you 100% sure that your directory has been configured for write/create access for the correct user? Are you working in integrated mode in debug and then anonymous in your release site?

      R 1 Reply Last reply
      0
      • P Paddy Boyd

        Are you 100% sure that your directory has been configured for write/create access for the correct user? Are you working in integrated mode in debug and then anonymous in your release site?

        R Offline
        R Offline
        Rafferty Uy
        wrote on last edited by
        #3

        Hi Paddy, Thanks for the reply. I wrote some code to test the creation of a dummy text file and it did NOT work. You're right, looks like I only thought I had set the write access. Can you instruct me on how to do this? I thought it's a matter of checking the "Write" checkbox in the IIS Web Site Properties? I'm not sure what you mean by integrated and anonymous modes. How can I check? Thanks!

        Rafferty

        P 1 Reply Last reply
        0
        • R Rafferty Uy

          Hi Paddy, Thanks for the reply. I wrote some code to test the creation of a dummy text file and it did NOT work. You're right, looks like I only thought I had set the write access. Can you instruct me on how to do this? I thought it's a matter of checking the "Write" checkbox in the IIS Web Site Properties? I'm not sure what you mean by integrated and anonymous modes. How can I check? Thanks!

          Rafferty

          P Offline
          P Offline
          Paddy Boyd
          wrote on last edited by
          #4

          You need to actually set the security rights on the physical folder in the file system (right click > Properties > Security). If you don't know what integrated security is, then you're probably not using it, so you'll need to set rights for the ASP.net account and for whatever account your website runs under anonymously (check this in IIS Manager > Virtual directory > Right click > Properties > Directory Security > Edit (you should see a user name beside the anonymous checkbox).

          R 1 Reply Last reply
          0
          • P Paddy Boyd

            You need to actually set the security rights on the physical folder in the file system (right click > Properties > Security). If you don't know what integrated security is, then you're probably not using it, so you'll need to set rights for the ASP.net account and for whatever account your website runs under anonymously (check this in IIS Manager > Virtual directory > Right click > Properties > Directory Security > Edit (you should see a user name beside the anonymous checkbox).

            R Offline
            R Offline
            Rafferty Uy
            wrote on last edited by
            #5

            Okay thanks! Since my local is not in an AD, I'm not seeing the Security tab in Properties. But since it's confirmed that it's an IIS setting problem than log4net config/coding problem... at least I have some direction. What I don't understand is that the logging of this web application used to work, when we were still doing the following:

            Trace.Listeners.Add(new TextWriterTraceListener("data/ErrorTrace.txt"));
            Trace.AutoFlush = true;

            So I'm also inclined to think that it's not a permissions problem. Would you know why it worked using trace listeners and stopped working when I switched to log4net?

            Rafferty

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups