I have a web project implementing Policy Based Authorization. I have two different API'es, i want one API to log to one Instance to Application Insights, and the other API to log to another instance.
I am using log4net. I tried two different appenders, and created two different ServiceLoggers for log4net, and used dependency Injection to inject the ServiceLogger to it's respectable API Controller. In every service i used the logger in this manner var specialLogger = LogManager.GetLogger("SomeApplicationInsightAppender");
I added the instrumentation keys in every appender, and in appsettings.json i could only add one instrumentation key.
When i call the api'es, the requests get logged into one instance which is the instrumentation key in the appsettings.json, however, the normal logs using the serviceslogger i created:
- Sometimes i see the log from one API correctly in the Application Insights Instance it should log to, but not the other request in the other Application Insights Instance.
- Sometimes it is the other way around.
Is it a limitation in the framework to log only to one Application Insights Instance per App? Any help would be appreciated.