Common.Logging for custom built log4net - log4net

How can i configure the Common.Logging->log4net which log4net built with a different .snk file?
when i want to build the Project it looks for log4net that has a PublicKeyToken=1b44e1d426115821, but mine is different. I tried to identify my log4net assembly as below. that doesn't work.
<configSections>
<sectionGroup name="common">
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
</sectionGroup>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net,Version=1.2.10.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXXX"/>
thanks

Have you made Common.Logging reference your version of log4net and then rebuilt it (Common.Logging)?
I suspect that you will have to open the Common.Logging.Log4Net project and change the reference to log4net from the log4net that Common.Logging redistributes to your log4net. I think that you should then be able to rebuild Common.Logging and you should also be able to reference your version of log4net in the configuration.
UPDATE...
Another idea would be to write your own log4net factory adapter. Just use the exact source code from Commom.Logging's log4net factory adapter project. There is not really much code there. In your project, reference your own log4net. Configure Common.Logging to use your factory adapter. I don't know that this option is any more or less attractive than rebuilding Commom.Logging with your version of log4net, but I thought I would mention it anyway.

Related

Blazor Shared Components not rendered

I have a problem, and I can't find a solution. This question is maybe already solved a couple of times, but it's hard to find a working solution for my constellation.
I'm using Blazor wasm 3.2.0-preview3.20168.3'. My goal is to move my components in a shared library to use it across my projects.
The problem is my components are not going to be rendered if I'm moving them into a shared library, so the tag <alert><alert/> is not resolved. The browser displays <alert><alert/>.
If they are in the main project, everything is working fine.
In the main project in "_Imports.razor" the dependencies are imported
#using BlazingWebShared.Services
#using BlazingWebShared.Component
My library .csproj looks more or less like this (not including comments etc):
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.0-preview3.20168.3" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="3.2.0-preview3.20168.3" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="3.2.0-preview3.20168.3" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.HttpClient" Version="3.2.0-preview3.20168.3" />
</ItemGroup>
</Project>
Does someone have an idea what I'm doing wrong? Or can someone share a library I can use as a blueprint?
Thank you very much for your time and help.
The line
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
tells me that you checked "support for pages and views" when you created your Razor Class Library (RCL). Make a new one without that check. You get a very different project setup with or without that checkmark. Amongst other things it will target the wrong platform, core 3.x instead of standard 2.x
And don't forget that you also have to import the .css and maybe .js files from the RCL into your _Host.razor or Index.cshtml . See this answer for that.

Convert <log4j:configuration> (in log4j 1.x) to <Configuration> (in log4j 2.x)

I need to migrate log4j 1.x XML configuration to log4j 2.x configuration XML. I couldn't find log4j2 equivalent configurations to some of the log4j1 configuration attributes. I have following line in log4j1 XML:
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" threshold="trace" reset="true" debug="false">
I want to have an equivalent log4j2 configuration, something like:
<Configuration>
I know status="debug" would enable extensive logging of log4j2 internals. But by default it is turned off as I need. Could anyone suggest the equivalent configurations for threshold="trace" and reset="true" in log4j2 XML?
Log4j2 does not support either of those attributes.

Log4j - configuring AsyncAppender in log4j.properties

I've seen tons of materials on how to use AsyncAppender in log4j.xml. However, I can't use a xml configuration, as I'm using Jboss Fuse - and this technology only allows .properties configuration.
Is there a way to translate the following configuration to .properties?
<appender name="async" class="org.apache.log4j.AsyncAppender">
<param name="BufferSize" value="500"/>
<appender-ref ref="console"/>
</appender>
I'd imagine that a solution looks somewhat like that:
log4j.appender.async=org.apache.log4j.AsyncAppender
log4j.appender.async.appenders=console
According to documentation, this is not possible in property configurer:
https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PropertyConfigurator.html
However, as I'm using Jboss Fuse and Jboss Fuse is using ops4j pax-logging, it has been solved and the configuration I submitted
log4j.appender.async.appenders=console
does work in Jboss Fuse

Log4net event logging integration with Fellow Oak Dicom dicom.log4net

I'm trying to use log4net to write to the Windows Event log. I'm using the Fellow Oak DICOM log4net connector
I have setup log4net as I would in any service: the XmlConfigurator in AssemblyInfo, the *exe.logger is Copy to output, Copy Always. I have the nuget package Dicom.Log4net and the log4net package installed.
After looking at the wiki, I've added
Dicom.Log.LogManager.SetImplementation(Dicom.Log.Log4NetManager.Instance);
Can I use my log4net xml config or would I need to initialize it like the Logging Serilog example?
It turned out that the failure to identify the [XmlConfigurator] attribute in the AssemblyInfo.cs file was due to insufficient initialization of the underlying log4net LogManager, see issue #244 and pull request #248.
As of April 12, 2016, this issue has been corrected in the development branch of fo-dicom and will be incorporated in the next release.

What does the owin:AppStartup key in the ASP.Net Identity Samples Web.Config do?

I am using the code from the
Microsoft ASP.NET Identity Samples 2.1.0-alpha1
There's one area of the code that I do not understand and that is the web.config entry below:
<appSettings>
<add key="owin:AppStartup" value="IdentitySample.Startup,WebApplication3" />
My code does work without this but I am wondering if I should have something like this.
Can anyone explain to me what this does?
Basically this tells OWIN what method to execute on the application start. And IdentitySample.Startup method contains code that bootstraps your application.
You can specify this class via an attribute [assembly: OwinStartup(typeof(StartupDemo.TestStartup))] if you wish.
But this one is web.config so it can be changed for different deployment strategies without recompiling the project.
See more details in documentation.

Resources