Цели не настроены для ведения журнала. Linux + МОНО - PullRequest
0 голосов
/ 20 апреля 2020

Я использую NLOG с Linux + MONO ASP. NET WebService, и я не могу зарегистрировать два разных файла. Файл ASMX имеет два разных метода, и я хотел бы войти в отдельный файл журнала

Это Nlog.config

...
  <targets async="true">
    <target name="sendMail"  xsi:type="File" fileName="${logDirectory}/${shortdate}_sendMail_${level}.log"
            layout="${time} ${uppercase:${level}} ${message}" />  

    <target name="checkMail"  xsi:type="File" fileName="${logDirectory}/${shortdate}_checkMail_${level}.log"
            layout="${time} ${uppercase:${level}} ${message}" />   
</targets>

  <rules>
    <logger name="sendMail" minlevel="Debug" writeTo="sendMail" />
    <logger name="checkMail" minlevel="Debug" writeTo="checkMail" />   
 </rules> 
</nlog>

Это файл журнала:

2020-04-20 01:42:39.6781 Debug LogFactory Flush with timeout=15 secs
2020-04-20 01:42:39.6907 Debug FileTarget(Name=sendMail_wrapped): Process file '/var/log/wsMail/2020-04-20_sendMail_Info.log' on startup
2020-04-20 01:42:39.6907 Debug FileTarget(Name=checkMail_wrapped): Process file '/var/log/wsMail/2020-04-20_checkMail_Info.log' on startup
2020-04-20 01:42:39.7058 Debug Creating file appender: /var/log/wsMail/2020-04-20_checkMail_Info.log
2020-04-20 01:42:39.7058 Debug Creating file appender: /var/log/wsMail/2020-04-20_sendMail_Info.log
2020-04-20 01:42:39.7442 Debug Flush completed
2020-04-20 01:42:39.7442 Info Shutdown() called. Logger closing...
2020-04-20 01:42:39.7442 Info Closing old configuration.
2020-04-20 01:42:39.7442 Debug LogFactory Flush with timeout=15 secs
2020-04-20 01:42:39.7442 Debug Flush completed
2020-04-20 01:42:39.7442 Debug Closing logging configuration...
2020-04-20 01:42:39.7490 Debug Closing target 'AsyncWrapper Target[sendMail](File Target[sendMail_wrapped])'.
2020-04-20 01:42:39.7533 Debug Closed target 'AsyncWrapper Target[sendMail](File Target[sendMail_wrapped])'.
2020-04-20 01:42:39.7533 Debug Closing target 'File Target[sendMail_wrapped]'.
2020-04-20 01:42:39.7585 Debug FileAppender Closing Invalidate - /var/log/wsMail/2020-04-20_sendMail_Info.log
2020-04-20 01:42:39.7620 Debug Closed target 'File Target[sendMail_wrapped]'.
2020-04-20 01:42:39.7620 Debug Closing target 'AsyncWrapper Target[checkMail](File Target[checkMail_wrapped])'.
2020-04-20 01:42:39.7620 Debug Closed target 'AsyncWrapper Target[checkMail](File Target[checkMail_wrapped])'.
2020-04-20 01:42:39.7639 Debug Closing target 'File Target[checkMail_wrapped]'.
2020-04-20 01:42:39.7639 Debug FileAppender Closing Invalidate - /var/log/wsMail/2020-04-20_checkMail_Info.log
2020-04-20 01:42:39.7639 Debug Closed target 'File Target[checkMail_wrapped]'.
2020-04-20 01:42:39.7639 Debug Finished closing logging configuration.
2020-04-20 01:42:39.7639 Debug Stopping file watching for path '/var/www/wsMail' filter 'NLog.config'
2020-04-20 01:42:39.7775 Debug Targets not configured for logger: sendMail
2020-04-20 01:42:39.7775 Debug Targets not configured for logger: checkMail
2020-04-20 01:42:39.7775 Info Logger has been closed down.

Это код VS2019


<pre><code><System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)>
<ToolboxItem(False)>
Public Class wsMail
    Inherits System.Web.Services.WebService
    Public Credentials As AuthHeader
    Public smLog As NLog.Logger = LogManager.GetLogger("sendMail")
    Public cmLog As NLog.Logger = LogManager.GetLogger("checkMail")
    Public messageID As String = Nothing
    Public retMsg As String = Nothing
    Public retRemoteMsg As String = Nothing
......
    cmLog.Error("|" & idCustomer & "|" & remoteIP & "|wrong Password|")
    smLog.Debug("- v1.0.1 |" & idCustomer & "|" & remoteIP & "|" & ex.Message & ex.StackTrace & "|")
</code>

Любая помощь приветствуется, большое спасибо

...