NLog version: 4.3.11
Platform: .Net 4.0
Current NLog config
<configSections>
<section name="nlog" type="NLog.Config.ConfigSectionHandler,NLog"/>
</configSections>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="logfile" xsi:type="File" fileName="${basedir}APILog\${date:format=yyyy-MM-dd}-api.log"/>
</targets>
<rules>
<logger name="*" minlevel="Trace" writeTo="logfile"/>
</rules>
</nlog>
In case of a BUG:
"ExceptionMessage": "Request for the permission of type 'System.Configuration.ConfigurationPermission, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed.", "ExceptionType": "System.Security.SecurityException", "StackTrace": " at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)\r\n at System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission cap, StackCrawlMark& stackMark)\r\n at System.Security.CodeAccessPermission.Demand()\r\n at System.Configuration.BaseConfigurationRecord.CheckPermissionAllowed(String configKey, Boolean requirePermission, Boolean isTrustedWithoutAptca)" }
Thanks for the bug report.
You could try using a separate nlog.config.
@304NotModified Could you please how can I do it with separate nlog.config file. I am afraid I am not able to understand what you said. Also I updated the library from NuGet but still am facing the SecurityException issue
@304NotModified Could you please how can I do it with separate nlog.config fil
Put your config in nlog.config, https://github.com/NLog/NLog/wiki/Tutorial#configuration
Also I updated the library from NuGet but still am facing the SecurityException issue
Yes it's not on nuget yet. Will release a private package in a few minutes
Should this NLog.Config file be presented in my application root folder. Are there any other setups to be done after these configurations are added in separate file?
Should this NLog.Config file be presented in my application root folder.
That's one of the options. See also https://github.com/NLog/NLog/wiki/Configuration-file#configuration-file-locations
Build is still building..
@304NotModified Thanks much for sharing this.. 馃憤 Appreciate the efforts.. 馃 Hopefully, I should be able to run my application after this.. :)
@kshkrao3
could you try this package : https://www.nuget.org/packages/NLog/4.4.1-dev-b4084
Install-Package NLog -Version 4.4.1-dev-b4084 -Pre
Here is the exception details if you want
"ExceptionType": "System.Security.SecurityException", "StackTrace": " at NLog.Common.InternalLogger.LogAssemblyVersion(Assembly assembly)\r\n at NLog.LogFactory.LogConfigurationInitialized()\r\n at NLog.LogFactory.get_Configuration()\r\n at NLog.LogFactory.GetLogger(LoggerCacheKey cacheKey)\r\n at NLog.LogFactory.GetLogger(String name)\r\n at NLog.LogManager.GetCurrentClassLogger()\r\n at BS_API.Helpers.NLogger..cctor() in F:\Projects\Kemmale Projects\Bake Studio API\BS API\BS API\Helpers\NLogger.cs:line 18"
Here is the exception details if you want
It's not the same as before I think, but we could fix it with that stacktrace
Yea, its not same. I did not observe that.. :)
If you set <nlog throwExceptions="false">, it there still an exception?
It should not
Is reading the Assembly property of Type disallowed in Medium trust?
Is reading the Assembly property of Type disallowed in Medium trust?
@304NotModified For this, I might need to ask my hosting provider for the details.
I can try this once
If you set
, it there still an exception? It should not
Do you have more exception details? Message, inner data etc
Do you have more exception details? Message, inner data etc
No bro. That's all I got. :(
If you set , it there still an exception?
It should not
It still hits exception.
I am unable to debug this in local, as I do not face any issue in local.
"ExceptionType": "System.Security.SecurityException", "StackTrace": " at NLog.Common.InternalLogger.LogAssemblyVersion(Assembly assembly)\r\n at NLog.LogFactory.LogConfigurationInitialized()\r\n at NLog.LogFactory.get_Configuration()\r\n at NLog.LogFactory.GetLogger(LoggerCacheKey cacheKey)\r\n at NLog.LogFactory.GetLogger(String name)\r\n at NLog.LogManager.GetCurrentClassLogger()\r\n at BS_API.Helpers.NLogger..cctor() in F:\Projects\Kemmale Projects\Bake Studio API\BS API\BS API\Helpers\NLogger.cs:line 18"
This one is fixed in https://github.com/NLog/NLog/pull/1874
Will link to a nupkg soon
@kshkrao3 update! :
https://www.nuget.org/packages/NLog/4.4.1-dev-b4085
Install-Package NLog -Version 4.4.1-dev-b4085 -Pre
@304NotModified I will try this update and let you know.. :)
@304NotModified I confirm that this works fine. Really happy about the fix and I can't really express it here.. :) :) :) Thank you, Thank you and Thank you so much for the efforts you've put to resolve this.. :)
Great! Will merge it for NLog 4.4.1. Also thanks to @snakefoot!
Thank you @snakefoot .. :) 馃
4.4.1 has been released!
Thank you for the update @304NotModified .. :)