Project is console application in c# using visual studio
Here is the code:
private void ConfigureLog4net()
{
string convertionPattern = "%-4timestamp [%thread] %-5level %logger %ndc - %message%newline";
string region = "us-east-1";
string loggerAWSAccessKey = "myawsaccesskey";
string loggerAWSSecretKey = "myawssecretkey";
Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository();
PatternLayout patternLayout = new PatternLayout {ConversionPattern = convertionPattern};
patternLayout.ActivateOptions();
var appender = new AWSAppender
{
Layout = patternLayout,
Credentials = new BasicAWSCredentials(loggerAWSAccessKey, loggerAWSSecretKey),
LogGroup = ConfigurationManager.AppSettings["LogGroup"],
Region = region
};
// Set log group and region. Assume credentials will be found using the default profile or IAM credentials.
appender.ActivateOptions();
hierarchy.Root.AddAppender(appender);
hierarchy.Root.Level = Level.All;
hierarchy.Configured = true;
}
This is working with some console application on EC2 instance but not in 1-2 console app.
Project is console application in c# using visual studio
Here is the code:
private void ConfigureLog4net()
{
string convertionPattern = "%-4timestamp [%thread] %-5level %logger %ndc - %message%newline";
This is working with some console application on EC2 instance but not in 1-2 console app.