Reputation: 6893
I thought using args parameter i will see a new custom dimension under customDimensions in Azure Application insights but it is not working for me. I cannot find any good information about how to use this parameter. What is it for and where in App insights is the information can be found?
I simply passed an array of strings but no where this object can be found in AI.
//
// Summary:
// Formats and writes an error log message.
//
// Parameters:
// logger:
// The Microsoft.Extensions.Logging.ILogger to write to.
//
// exception:
// The exception to log.
//
// message:
// Format string of the log message in message template format. Example:
// "User {User} logged in from {Address}"
//
// args:
// An object array that contains zero or more objects to format.
public static void LogError(this ILogger logger, Exception exception, string message, params object[] args)
{
logger.Log(LogLevel.Error, exception, message, args);
}
Upvotes: 2
Views: 2005
Reputation: 29780
I thought using args parameter i will see a new custom dimension under customDimensions in Azure Application insights
It does, but only if you supply a message template. For example, the following won't work:
logger.LogError(ex, "Error occured", "a", "simple", "string");
but this will:
logger.LogError(ex, "Error occured {PropA} {PropB} {PropC}", "a", "simple", "string");
The last line will result in three properties (named PropA, PropB and PropC) in the customDimensions
field of the generated telemetry.
Upvotes: 5