Take the community feedback survey now.
Take the community feedback survey now.
Can confirm I was able to use Serilog on DXP. If it is officially supported, however, I'm not sure
The Foundation project uses Serilog: https://github.com/episerver/Foundation/blob/main/src/Foundation/Program.cs
We have also used it on DXP sites without any (known) problems. 🙂
Do you think making the log file json (Structure logging) would be an issue? Might just need to test.
Set it up so that you log to Application Insights. No need to write to log files.
Hi! A follow-up on this topic. Migrating sites from On-Prem to DXP atm and understanding that Application Insights is doing the logging (I have confirmed that it is logging correctly), what do I do with the current configuration since its invalid?!
Example EPiServerLog.config
:
<appender name="errorFileLogAppender" type="log4net.Appender.RollingFileAppender" >
<!-- Consider moving the log files to a location outside the web application -->
<file value="D:\Logs\WebSites\mysite.se\EPiServerErrors.log" />
<encoding value="utf-8" />
<staticLogFileName value="true"/>
<datePattern value=".yyyyMMdd.'log'" />
<rollingStyle value="Date" />
<threshold value="Error" />
<!--<threshold value="Debug" />-->
<!-- Enable MinimalLock to share log file, use with caution since logging will be considerably slower -->
<!--lockingModel type="log4net.Appender.FileAppender+MinimalLock" /-->
<appendToFile value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %level %logger: %message%n" />
</layout>
</appender>
I guess I do not remove the appender section, but perhaps remove the file path and add comment that it is logged by Application Insights and that the settings can be changed in Azure Portal?
I would remove log4net completely. In general for Application Insights on DXP I try to set up similar to these posts:
https://world.optimizely.com/blogs/arjanblog/dates/2023/7/finetuning-application-insights-in-cms12/
https://krompaco.nu/2024/06/changing-which-ip-http-header-to-use-in-application-insights/
I see blog posts about plugging in additional logging with Optimizely 12, for example with Serilog. Is this supported on a DXP hosted site?