I am using a programmatically configuration for NLog, where I added ApplicationInsights to log messages in Azure. But I don't know how to specify a layout for that message (e.g. to add the datetime in the message).
For example, for the file target I specified:
var fileTarget = new FileTarget();
fileTarget.Name = "file";
fileTarget.FileName = @"${basedir}/logs/${shortdate}.log";
fileTarget.Layout = @"${longdate} ${uppercase:${level}} ${message}";
config.AddTarget("file", fileTarget);
But for the Application Insights:
ConfigurationItemFactory.Default.Targets.RegisterDefinition(
"ai",
typeof(ApplicationInsightsTarget)
);
ApplicationInsightsTarget aiTarget = new ApplicationInsightsTarget();
aiTarget.InstrumentationKey = "my_key";
aiTarget.Name = "ai";
config.AddTarget("ai", aiTarget);
How can I specify a layout for ai?