November Happy Hour will be moved to Thursday December 5th.

Replacing Log4Net in EpiServier 7.5

Vote:
 

I am trying to replace the out of the box Log4Net logging in EPiServer with Syslog. I've got this working by following the guide under the heading 'Implementing the API' at the bottom of this page world.episerver.com/documentation/Items/Developers-Guide/Episerver-CMS/75/Logging/logging-api/ The last step says the following: 

The Logging API currently only supports one logger type and the API will use the first factory type it can find when scanning assemblies. It is therefore recommended that you make sure that the EPiServer.Logging.Log4Net assembly is removed before deploying another implementation.

However, at the top of the page it says this:

Initially the EPiServer.CMS package will have a package dependency to EPiServer.Logging.Log4Net, which is the log4net implementation of the API to maintain compatibility and ease the transitioning. This dependency is planned to be removed as a part of a future update.

True enough I cannot remove the EPiServer.Logging.Log4Net from my solution as CMS Core (we're on 7.19.2) depends on it. Does this mean I cannot use a different Logging solution in EPiServer 7.5?

#199130
Nov 16, 2018 10:18
Vote:
 

If I remember correctly the loggin abstraction was added in CMS 9, so you would need to upgrade to use a different logging solution

#199138
Nov 16, 2018 11:44
Vote:
 

That's a shame. Thanks for confirming.

#199142
Nov 16, 2018 12:47
Vote:
 

you can still use log4net to "capture" log entries coming from Episerver (as you cannot replace logging engine underneath) and have configured Udp appender to "forward" entries to Syslog.

Sample config below:

<appender name="UdpAppender" type="log4net.Appender.UdpAppender">
    <param name="RemoteAddress" value="127.0.0.1" />
    <param name="RemotePort" value="514" />
    <layout type="log4net.Layout.PatternLayout, log4net">
        <conversionPattern value="%-5level %logger [%property{NDC}] - %message%newline" />
    </layout>
</appender>
#199148
Nov 16, 2018 14:33
Vote:
 

@Valdis: I'm trying to make him upgrade here. it's for the best of everybody ;)

#199153
Nov 16, 2018 14:41
Vote:
 

I'm sorry for ruing that. Yes, discard my answer - go upgrade! :)

#199154
Nov 16, 2018 14:45
Vote:
 
#199182
Edited, Nov 19, 2018 15:19
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.