NLog: IIS appliction running medium trust outputs ProcessName as Unknown
NLog version: 4.7.5
Platform: .Net 4.8
Current NLog config (xml or C#, if relevant)
<?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"
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
autoReload="true"
throwExceptions="true"
internalLogLevel="Warn" internalLogFile="c:\temp\nlog-internal.log" >
<!--
This configuration file is generated if it does not exist and will not be updated
The documentation for the NLog configuration can be found at https://github.com/nlog/NLog/wiki/Configuration-file
-->
<!-- optional, add some variabeles
https://github.com/nlog/NLog/wiki/Configuration-file#variables
-->
<variable name="loglocation" value="c:\netadmin\logs\"/>
<!--
These are the default targets defined by netadmin. Additional targets can be added:
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
-->
<targets>
<!-- Keeps a log file for each process and day-->
<target xsi:type="File"
name="ProcessLog"
fileName="${var:loglocation}${processname}.log"
layout="${longdate} ${uppercase:${level}} ${message} ${exception:format=tostring}"
keepFileOpen="true"
concurrentWrites="true"
archiveFileName="${var:loglocation}\archive\${processname}-{#}.log"
archiveEvery="Day"
archiveNumbering="DateAndSequence"
archiveDateFormat="yyyyMMddHHmmss"
maxArchiveFiles="90"
/>
<!-- Keeps a log file for each class and day and archive for 30 days -->
<target xsi:type="File"
name="ClassLog"
fileName="${var:loglocation}${logger}.log"
layout="${longdate} - ${callsite}${newline}${level}: ${message}${newline}${exception:format=ToString}"
keepFileOpen="true"
concurrentWrites="true"
archiveFileName="${var:loglocation}\archive\${logger}-{#}.log"
archiveEvery="Day"
archiveNumbering="Date"
archiveDateFormat="yyyyMMddHHmmss"
maxArchiveFiles="30"
/>
<!-- Output to debugger-->
<target xsi:type="Console"
name="StandardConsole"
layout="${longdate} ${processname} ${logger} ${message} ${exception:format=tostring}"
/>
<!-- Output to an attached debugger -->
<target xsi:type="Debugger"
name="AttachedDebugger"
layout="${logger} ${message} ${exception:format=tostring}"
/>
<target xsi:type="NLogViewer"
name="viewer"
includeSourceInfo="true"
layout="${longdate}|${level:uppercase=true}|${processname}|${logger}|${message}|${exception:format=tostring}"
address="udp://127.0.0.1:9999"/>
</targets>
<!-- These are the rules defined by netadmin, these can be modified and additional rules can be added to customize logging-->
<rules>
<!-- Everything needed when developing to class-files -->
<logger name="*" minlevel="Trace" writeTo="ClassLog" enabled="false" />
<!-- All fatal, error, warnings and info are logged to the process specific log file -->
<logger name="*" minlevel="Trace" writeTo="ProcessLog" enabled="true"/>
<!-- Everything is logged to the processlog, default not enabled -->
<logger name="*" writeTo="ProcessLog" enabled="false"/>
<!-- Everything is logged to the console, default not enabled -->
<logger name="*" writeTo="Console" enabled="false"/>
<!-- Everything is logged to an attached debugger, default not enabled -->
<logger name="*" writeTo="AttachedDebugger" enabled="false"/>
<!-- This enables use of Sentinel to view logs in real-time etc -->
<logger name="*" minlevel="Trace" writeTo="viewer" enabled="true" />
</rules>
</nlog>
-
What is the current result? Most logs are written to a file named after the process, but the logs from IIS process (w3wp) are sometimes written to a file named _unknown_.log sometimes, instead of w3wp.log.
-
What is the expected result? All logs should be written to files named after the process.
-
Did you checked the Internal log? Yes
-
Please post full exception details (message, stacktrace, inner exceptions) N/A
-
Are there any workarounds? yes/no No
-
Is there a version in which it did work? Yes, 4.3.7 on .NET Framework 4.5. It started happening when we updated the NuGet package from that version to 4.7.5 and .NET Framework 4.8.
-
Can you help us by writing an unit test? No, probably not.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 20 (12 by maintainers)
@snakefoot I have tried the new build and that works great. No more longs in the _unknown_.log files and no errors as far as I can see. Great!
@thebiffman I would be really grateful if you could verify that the pre-release-build from #4182 will resolve the issue:
NLog.4.7.5.12201-PR4182.nupkg
NLog 4.7.6 is now live!
https://www.nuget.org/packages/NLog/4.7.6/
Will release the new version this week. š
Yes was thinking the same, that if someone used
${processdir}
then it would still break. So I guess Win32 API fallback are here to stay until NetFramework and IIS have left planet earth.@thebiffman Updated nuget-package that should fallback independent of whatever exception:
NLog.4.7.5.12202-PR4182.nupkg