无法使用 Google Cloud 的 Log4net 集成写入日志条目

Can't write log entry with Google Cloud's Log4net integration

我正在尝试让 Log4Net 集成在将部署到 AppEngine Flexible 环境的 .NET Core 应用程序中运行。我的起点是 documentation 中的示例代码。我的代码看起来是这样的:

using log4net; // resolve Log4net
using log4net.Config; // resolve XmlConfigurator
using System.IO; // resolve FileInfo
using System.Reflection; // resolve Assembly

namespace Test
{
    public class PlayWithStackdriverLog4net
    {
        public void Write()
        {
            log4net.Util.LogLog.InternalDebugging = true; // enable Log4net debugging
            var xmlConfiguration = XmlConfigurator.Configure(LogManager.GetRepository(typeof(PlayWithStackdriverLog4net).Assembly), new FileInfo("log4net.xml"));
            ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            log.Info("An exciting log entry!");
        }
    }
}

不幸的是,最终结果是我在 Google 云控制台的日志记录窗格中没有看到 令人兴奋的日志条目!。我做错了什么?

一些备注:

1) log4net.xml 文件与 documentation 中的文件几乎相同,只是我用自己的 ID 替换了 PROJECT-ID。

2) Log4net 调试输出表明它已成功读取 log4net.xml:

log4net: log4net assembly [log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a]. (.NET Framework [.NET Core 4.6.26020.03] on Microsoft Windows 6.1.7601 S)
log4net: defaultRepositoryType [log4net.Repository.Hierarchy.Hierarchy]
log4net: Creating repository for assembly [Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]
log4net: Assembly [Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null] Loaded From [Not supported on .NET Core]
log4net: Assembly [Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null] does not have a RepositoryAttribute specified.
log4net: Assembly [Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null] using repository [log4net-default-repository] and repository type [log4net.Repository.Hierarchy.Hierarchy]
log4net: Creating repository [log4net-default-repository] using type [log4net.Repository.Hierarchy.Hierarchy]
log4net: configuring repository [log4net-default-repository] using file [log4net.xml]
log4net: configuring repository [log4net-default-repository] using stream
log4net: loading XML configuration
log4net: Configuring Repository [log4net-default-repository]
log4net: Configuration update mode [Merge].
log4net: Logger [root] Level string is [ALL].
log4net: Logger [root] level set to [name="ALL",value=-2147483648].
log4net: Loading Appender [CloudLogger] type: [Google.Cloud.Logging.Log4Net.GoogleStackdriverAppender,Google.Cloud.Logging.Log4Net]
log4net: Converter [message] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [newline] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Setting Property [ConversionPattern] to String value [%-4timestamp [%thread] %-5level %logger %ndc - %message]
log4net: Converter [timestamp] Option [] Format [min=4,max=2147483647,leftAlign=True]
log4net: Converter [literal] Option [ [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [thread] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [literal] Option [] ] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [level] Option [] Format [min=5,max=2147483647,leftAlign=True]
log4net: Converter [literal] Option [ ] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [logger] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [literal] Option [ ] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [ndc] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [literal] Option [ - ] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [message] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Setting Property [Layout] to object [log4net.Layout.PatternLayout]
log4net: Setting Property [ProjectId] to String value [my-project-id-goes-here]
log4net: Setting Property [LogId] to String value [mySampleLog]
log4net: Created Appender [CloudLogger]
log4net: Adding appender named [CloudLogger] to logger [root].
log4net: Hierarchy Threshold []

3) 如果我按照使用 Google.Cloud.Logging.V2 的 Stackdriver Logging Client Libraries 示例进行操作,那么我可以按预期在全局资源类型中找到我的 'hello world' 文本。

根据 dsesto I am closing this question as it has been confirmed as a bug, see 的要求。