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

Include pID in managed logs filename #6161

Merged
merged 2 commits 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
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#nullable enable

using System;
using System.Globalization;
using System.IO;
using Datadog.Trace.Agent;
using Datadog.Trace.Configuration;
Expand Down Expand Up @@ -101,14 +102,13 @@ static bool Contains(string?[]? array, string toMatch)

if (config.File is { } fileConfig)
{
// Ends in a dash because of the date postfix
var managedLogPath = Path.Combine(fileConfig.LogDirectory, $"dotnet-tracer-managed-{domainMetadata.ProcessName}-.log");
var managedLogPath = Path.Combine(fileConfig.LogDirectory, $"dotnet-tracer-managed-{domainMetadata.ProcessName}-{domainMetadata.ProcessId.ToString(CultureInfo.InvariantCulture)}.log");

loggerConfiguration
.WriteTo.File(
managedLogPath,
outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj} {Exception} {Properties}{NewLine}",
rollingInterval: RollingInterval.Day,
rollingInterval: RollingInterval.Infinite, // don't do daily rolling, rely on the file size limit for rolling instead
rollOnFileSizeLimit: true,
fileSizeLimitBytes: fileConfig.MaxLogFileSizeBytes,
shared: true);
Expand Down
Loading