1

The question is specific to WebJobs. I've been thru the steps to configure logging to my Azure WebSite (sry...Azure AppService WebSite - sheese with the name changes already) and am now trying to iron everything out for WebJobs running beneath the same.

I'm logging to both a RollingFile and to the Ado.net appender - for sake of brevity pasting config only for the File - neither of the 2 work so gotta be a problem common at the core.

The sub-directory specified in the config exists but files are not being created within. The same configs are working for the host WebSite but WJs fail to log. Anywhere I can look for error messages or otherwise troubleshoot this?

<?xml version="1.0" encoding="utf-8" ?>
<log4net>
  <appender name="FileAppender" type="log4net.Appender.RollingFileAppender">
    <file type="log4net.Util.PatternString" value="D:/home/site/wwwroot/App_Data/Logs/AccountMaintenance/log4net_%date{yyyyMMdd}.log" />
    <appendToFile value="true" />
    <rollingStyle value="Date" />
    <datePattern value="yyyyMMdd" />
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%date [%thread] %-5level %logger %property – %message%newline" />
    </layout>
  </appender>

Shortly after posting this question I found a typo / syntax error in web.config file and my expected functionality returned.

Just for the record - here's a screenshot showing that files are being written in a folder beneath root:

justSteve
  • 5,444
  • 19
  • 72
  • 137
  • The issue you're having is that you can only write to the root folder of an azure website (WebApp). So make sure you modify the path in the config file to be able to do so. http://stackoverflow.com/questions/12964129/can-i-write-to-file-system-on-azure-web-site – lopezbertoni Jul 02 '15 at 17:18
  • Thanks for the reply l. I've seen other places the reference to 'only in root folder' but am actually finding myself able to target folders beneath the root as per that above schema. Posting some screen shots to the OP... – justSteve Jul 14 '15 at 18:14
  • I know this was a few years ago now @justSteve but are you still able to write your logs to the D:/home/site/wwwroot/App_Data/ directory? I can't get it to work. I have it configured in web.config and calling `XmlConfigurator.Configure();` in `Program.Main()`. Another appender is working fine but the file appender just won't create the file. I'm wondering if some file permissions have changed with regards to WebJobs since 2015? – lee_mcmullen Jul 06 '18 at 10:58

0 Answers0