PayPal 的特定 log4net 日志文件

Specific log4net-logfile for PayPal

是否可以在 App.config 中指定日志文件?

我在 .NET 中找到了这些参数: https://github.com/paypal/sdk-core-dotnet/wiki/SDK-Configuration-Parameters

在 PHP 中似乎是可能的(记录): https://github.com/paypal/sdk-core-php/wiki/Configuring-the-SDK

现在,信息将保存在多个指定日志文件中的第一个。

是的,可以在您的配置中指定日志文件。 PayPal .NET SDK wiki 显示您需要添加到配置文件的信息:

<configuration>
  <configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
  </configSections>

  <!-- log4net settings -->
  <log4net>
    <appender name="FileAppender" type="log4net.Appender.FileAppender">
      <file value="my_app.log"/>
      <appendToFile value="true"/>
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] %message%newline"/>
      </layout>
    </appender>
    <root>
      <level value="DEBUG"/>
      <appender-ref ref="FileAppender"/>
    </root>
  </log4net>

  <!-- 
  App-specific settings. Here we specify which PayPal logging classes are enabled.
    PayPal.Log.Log4netLogger: Provides base log4net logging functionality
    PayPal.Log.DiagnosticsLogger: Provides more thorough logging of system diagnostic information and tracing code execution
  -->
  <appSettings>
    <!-- Diagnostics logging is only available in a Full Trust environment. -->
    <!-- <add key="PayPalLogger" value="PayPal.Log.DiagnosticsLogger, PayPal.Log.Log4netLogger"/> -->
    <add key="PayPalLogger" value="PayPal.Log.Log4netLogger"/>
  </appSettings>
</configuration>

my_app.log 替换为您自己的日志文件名。