Skip to content
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

Explicitly specifying FileShare.Read attribute when opening log stream #72

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/NReco.Logging.File/FileLoggerProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
private long FileSizeLimitBytes => Options.FileSizeLimitBytes;
private int MaxRollingFiles => Options.MaxRollingFiles;

public LogLevel MinLevel {

Check warning on line 48 in src/NReco.Logging.File/FileLoggerProvider.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'FileLoggerProvider.MinLevel'
get => Options.MinLevel;
set { Options.MinLevel = value; }
}
Expand Down Expand Up @@ -82,13 +82,13 @@
set { Options.HandleFileError = value; }
}

public FileLoggerProvider(string fileName) : this(fileName, true) {

Check warning on line 85 in src/NReco.Logging.File/FileLoggerProvider.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'FileLoggerProvider.FileLoggerProvider(string)'
}

public FileLoggerProvider(string fileName, bool append) : this(fileName, new FileLoggerOptions() { Append = append }) {

Check warning on line 88 in src/NReco.Logging.File/FileLoggerProvider.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'FileLoggerProvider.FileLoggerProvider(string, bool)'
}

public FileLoggerProvider(string fileName, FileLoggerOptions options) {

Check warning on line 91 in src/NReco.Logging.File/FileLoggerProvider.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'FileLoggerProvider.FileLoggerProvider(string, FileLoggerOptions)'
Options = options;
LogFileName = Environment.ExpandEnvironmentVariables(fileName);

Expand All @@ -99,7 +99,7 @@
TaskCreationOptions.LongRunning);
}

public ILogger CreateLogger(string categoryName) {

Check warning on line 102 in src/NReco.Logging.File/FileLoggerProvider.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'FileLoggerProvider.CreateLogger(string)'
return loggers.GetOrAdd(categoryName, CreateLoggerImplementation);
}

Expand Down Expand Up @@ -217,7 +217,7 @@
// so there is no need for a "manual" check first.
fileInfo.Directory.Create();

LogFileStream = new FileStream(LogFileName, FileMode.OpenOrCreate, FileAccess.Write);
LogFileStream = new FileStream(LogFileName, FileMode.OpenOrCreate, FileAccess.Write, FileShare.Read);
if (append) {
LogFileStream.Seek(0, SeekOrigin.End);
} else {
Expand Down
Loading