Skip to content

NLog successfully creates the logging group, but not any log events #54

@jdk339

Description

@jdk339

Here is where I configure the logger with code:

public ILogger GetLogger() {
 if (logger != null) {
  return logger;
 }
 var config = new LoggingConfiguration();

 var consoleTarget = new ColoredConsoleTarget();
 config.AddTarget("console", consoleTarget);

 var awsTarget = new AWSTarget() {
  LogGroup = "NLog.UnitTestLibrary",
   Region = "us-east-1"
 };
 config.AddTarget("aws", awsTarget);

 config.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, consoleTarget));
 config.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, awsTarget));

 LogManager.Configuration = config;
 return LogManager.GetCurrentClassLogger();
}

This is how I call it:

_logger.Debug(response.Content.ReadAsStringAsync().Result);
 _logger.Debug("hey!");

The AWS profile has the following access:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "logs:CreateLogGroup",
        "logs:CreateLogStream",
        "logs:PutLogEvents",
        "logs:DescribeLogGroups"
      ],
      "Resource": [
        "arn:aws:logs:*:*:*"
      ]
    }
  ]
}

I also tried it with a profile with full access, and it still didn't work. What am I missing here? Is there a way I can debug this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions