exceptionless / Exceptionless.Net

Exceptionless clients for the .NET platform
https://exceptionless.com
Other
554 stars 142 forks source link

I can receive Error level data, but I cannot receive infomation level log data (exceptionless.Nlog used) #261

Closed ghost closed 3 years ago

ghost commented 3 years ago

image This is my Nlog configuration file

niemyjski commented 3 years ago

I think this is a result of the minimum log level is set to Warn until server side settings are retrieved. Have you tried setting a default via: https://github.com/exceptionless/Exceptionless.Net/blob/master/src/Exceptionless/Configuration/ExceptionlessConfiguration.cs#L213

ghost commented 3 years ago

image Is there any documentation related to this configuration file?

ghost commented 3 years ago

I think this is a result of the minimum log level is set to Warn until server side settings are retrieved. Have you tried setting a default via: https://github.com/exceptionless/Exceptionless.Net/blob/master/src/Exceptionless/Configuration/ExceptionlessConfiguration.cs#L213

image image image

I found the location of this configuration, but after I changed it to debug and released it, I still didn't receive info level data. . .

niemyjski commented 3 years ago

Hello,

AppSettings.yml contains settings for the self hosted application and log levels for the app itself. Can you enable client logging and paste the logs here so we can see why they might be getting discarded: https://exceptionless.com/docs/clients/dotnet/troubleshooting/#enable-client-logging

ghost commented 3 years ago

你好,

AppSettings.yml 包含自托管应用程序的设置和应用程序本身的日志级别。您能否启用客户端日志记录并将日志粘贴到此处,以便我们了解它们可能被丢弃的原因:https : //exceptionless.com/docs/clients/dotnet/troubleshooting/#enable-client-logging

I have set up the following configuration according to the document, but after I run it, there is no exceptionless.log that I expect ExceptionlessClient.Default.Configuration.UseFileLogger("C:\\exceptionless.log"); And I don’t know where is the configuration of the following line of configuration? <exceptionless apiKey="YOUR_API_KEY" enableLogging="true" logPath="C:\exceptionless.log" />

niemyjski commented 3 years ago

Please make sure you have write permission to that folder, your app may not have the permissions to write to that folder. For the xml node, you'd put that in your web.config if you are using ASP.NET (legacy)

ghost commented 3 years ago

I have elevated the project permissions to full control, but nothing seems to be written to the exceptionless.log file. And I made a simple demo and submitted log data of various levels, but only received data of Warning and above. code show as below:(Packages have been added: Exceptionless.NLog, NLog.Web.AspNetCore)

image Nlog.config: `<?xml version="1.0" encoding="utf-8" ?> <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" autoReload="true" internalLogLevel="Debug">

<targets>
    <!--上报Exceptionless-->
    <!--xsi:type:固定是Exceptionless-->
    <!--apiKey:即我们在Exceptionless中添加完项目后得到的apiKey-->
    <!--serverUrl:Exceptionless的地址-->
    <target xsi:type="Exceptionless" name="Exceptionless" apiKey="d5jRHzuqZUMtC6DKq33r3ZYk3w51WkRoLuBJmXhw"
            serverUrl="http://localhost:5010">
        <!--堆栈信息-->
        <field name="StackTrace" layout="${stacktrace}"/>
        <!--Message信息-->
        <field name="Message" layout="${message}"/>
        <field name="LogLevel" layout="${level}"/>
        <field name="CreateDate" layout="${date}"/>
        <!--物理名称-->
        <field name="MachineName" layout="${machinename}" />
        <!--线程ID-->
        <field name="ThreadId" layout="${threadid}"/>
        <!--发生源-->
        <field name="CallSite" layout="${callsite}"/>
        <field name="AppdomainVersion" layout="${assembly-version}"/>
        <field name="Appdomain" layout="${appdomain}"/> 
    </target>
    <target xsi:type="File" name="selflog"
            fileName="${basedir}\Nlogs\${level}s\${shortdate}${level}.log" encoding="utf-8"
            archiveEvery="Hour" archiveAboveSize="2097152"
            keepFileOpen="true" openFileCacheTimeout="30" openFileCacheSize="8"
            cleanupFileName =" false"
            layout="记录时间:${longdate} 日志级别:${uppercase:${level}} ${message} ${exception:format=tostring}" />
    <!--<target xsi:type="Null" name="blackhole" />-->
</targets>
<rules>
    <!--<logger name="Microsoft.*" minlevel="Trace" writeTo="blackhole" final="true" />-->
    <logger name="*" minlevel="Debug" writeTo="selflog" />
    <!--上报Exceptionless-->
    <logger name='*' minlevel="Debug" writeTo='Exceptionless'/>
</rules>

` Startrtup.cs: image image result: image

How to solve it?

Because the company's project is relatively large, almost all project logs are used nlog. I need to get the parameter information based on the info information, so it is troublesome to find an alternative. I need your help. (* ̄︶ ̄)

ghost commented 3 years ago

Please make sure you have write permission to that folder, your app may not have the permissions to write to that folder. For the xml node, you'd put that in your web.config if you are using ASP.NET (legacy)

image This is the Exceptionless.web production environment console situation

niemyjski commented 3 years ago

It looks like the API key is wrong, you are getting a bunch of 401's