Log4Net to Azure WebJob

六眼飞鱼酱① 提交于 2019-12-08 03:28:26

问题


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

来源:https://stackoverflow.com/questions/31169011/log4net-to-azure-webjob

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!