-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to save the log file inside of folder? #60
Comments
I have this path but the file is not saving in the mentioned path. |
I think you need to use forward slash to save correctly |
Also, once you configured this sink, date will never change. I'm assuming you want to create files on different folders based on current date. |
I think this is correct, yes. |
For me path doesn't work either. For those who have problems with saving logs somewhere deeper, set the bucketPath parameter. From documentation:
so, in your example:
result will be bucketName/folder1/folder2/Log_... |
{
var logger = new LoggerConfiguration().WriteTo
.AmazonS3(
"folder1\folder2\" + fileName + "\" + date + "\" + "Log_",
bucketName,
Amazon.RegionEndpoint.APSouth1,
awsAccessKey,
awsSecretKey,
restrictedToMinimumLevel: LogEventLevel.Verbose,
outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}{Exception}",
new CultureInfo("en-US"),
levelSwitch: levelSwitch,
rollingInterval: Serilog.Sinks.AmazonS3.RollingInterval.Day,
encoding: Encoding.Unicode,
failureCallback: e => Console.WriteLine($"An error occured in my sink: {e.Message}")
)
.CreateLogger();
logger.Information(message);
}
The text was updated successfully, but these errors were encountered: