[ 
https://issues.apache.org/jira/browse/LOG4NET-611?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17570000#comment-17570000
 ] 

Davyd McColl commented on LOG4NET-611:
--------------------------------------

[~nazgul] I've tried to repro as per your guidance, but to no avail - see:
[https://github.com/apache/logging-log4net/tree/master/src/integration-testing/log4net-611-main]
(net462 and net6.0) which references
[https://github.com/apache/logging-log4net/tree/master/src/integration-testing/log4net-611-lib]
(netstandard2.0, implementing a derived RollingFileAppender).
If you build & run the main .exe, you'll see no errors and the output is 
recorded to file & read back out again, eg:

{{> .\log4net-611-main.exe}}
{{Clearing out old logs...}}
{{logging...}}
{{[console] test log 0}}
{{[console] test log 1}}
{{[console] test log 2}}
{{[console] test log 3}}
{{[console] test log 4}}
{{[console] test log 5}}
{{[console] test log 6}}
{{[console] test log 7}}
{{[console] test log 8}}
{{[console] test log 9}}
{{log file: Logs\2022-07-22-Xyz.xml}}
{{[file] DerivedAppender test log 0}}
{{[file] DerivedAppender test log 1}}
{{[file] DerivedAppender test log 2}}
{{[file] DerivedAppender test log 3}}
{{[file] DerivedAppender test log 4}}
{{[file] DerivedAppender test log 5}}
{{[file] DerivedAppender test log 6}}
{{[file] DerivedAppender test log 7}}
{{[file] DerivedAppender test log 8}}
{{[file] DerivedAppender test log 9}}

Please have a look so I can figure out what's different between my attempt to 
repro and your project(s).

> Failed to create netstandard version of logger
> ----------------------------------------------
>
>                 Key: LOG4NET-611
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-611
>             Project: Log4net
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.8
>         Environment: Windows Server 2010 R2
>            Reporter: Andrei Stryia
>            Assignee: Dominik Psenner
>            Priority: Critical
>              Labels: RollingFileAppender
>
> I'm using netstandard version of the logger which is constantly fails wit 
> error:
> {code:java}
> System.MethodAccessException: Attempt by security transparent method 
> 'log4net.Appender.RollingFileAppender.ActivateOptions()' to access security 
> critical method 'System.Threading.Mutex..ctor(Boolean, System.String)' failed.
> Assembly 'log4net, Version=2.0.8.0, Culture=neutral, 
> PublicKeyToken=669e0ddf0bb1aa2a' is marked with the 
> AllowPartiallyTrustedCallersAttribute, and uses the level 2 security 
> transparency model. Level 2 transparency causes all methods in 
> AllowPartiallyTrustedCallers assemblies to become security transparent by 
> default, which may be the cause of this exception.
>  at log4net.Appender.RollingFileAppender.ActivateOptions()
>  at Log.CreateTimestampedFileAppender(LoggingSettings settings)
>  at Log.InitForComponent(String componentName, LoggingSettings settings)
> ...
> {code}
> My logger assembly is a netstandard asembly which is using by .net framework 
> console app.
> Error disappears, when I'm replacing log4net netstandard1.3 version by 
> net45-full



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to