Sitecore has done very cool implementation for Application Insights (also referenced as App Insights) for logging all Sitecore things there instead of usual Sitecore log files. This is best for PaaS solution or on Cloud as you want to just push log entries to AppInsights. But what if you have also good old Sitecore users that what to see good old log txt files?
My fellow Sitecore MVP João Neto has written great blog post on how to set up Application Insights to Sitecore on prem. Kudos for this detailed explanation and concise instructions.
Problem
Problem is obvious. By default, Application Insights implementation by Sitecore uses this web.config app setting useApplicationInsights to determine whether to log to Sitecore logs or to log to App Insights:

If you set it to true, log entries are going to AppInsights. If you set it to false, Sitecore is pushing log entries to file system to logs folder to log txt files.
This is due to the fact config file that is attached to implementation uses these rules:

Solution
There were two solutions how to enabled logging in both targets:
- rewrite original config file
- write custom appender
First option is not good for upgrade purposes (which we are planning to do soon) therefore I have chosen to go with second option.
I have created another Log4Net appender with name Log4NetLogFileAppender and patch it inside of log4net configuration node.
<log4net>
<appender name="Log4NetLogFileAppender" type="log4net.Appender.SitecoreLogFileAppender, Sitecore.Logging">
<file value="$(dataFolder)/logs/log.{date}.{time}.txt"/>
<appendToFile value="true"/>
<rollingStyle value="Size"/>
<maxSizeRollBackups value="-1"/>
<maximumFileSize value="10MB"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%4t %d{ABSOLUTE} %-5p %m%n"/>
</layout>
<encoding value="utf-8"/>
<filter type="log4net.Filter.LevelRangeFilter" patch:source="Sitecore.log4net.config">
<param name="LevelMin" value="INFO"/>
<param name="LevelMax" value="ERROR"/>
</filter>
</appender>
<root>
<appender-ref ref="Log4NetLogFileAppender" />
</root>
</log4net>
The root will be responsible to add it to AppInsights appender so both will be logged

This will do this trick in your Sitecore log4net configuration and patches log4net root definition like this:

Logging all the things!
