Skip to content

Commit

Permalink
(GH-1239) Report process id in log files
Browse files Browse the repository at this point in the history
In detecting multiple processes overlapping each other in the log, it
becomes difficult when that information is not shown in the log. Report
the process id in the log file as well to bring more visibility to
whether multiple processes are running a command.
  • Loading branch information
ferventcoder committed Apr 7, 2017
1 parent 8b30161 commit ee9a298
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public sealed class Log4NetAppenderConfiguration
/// <param name="outputDirectory">The output directory.</param>
public static void configure(string outputDirectory = null)
{
GlobalContext.Properties["pid"] = System.Diagnostics.Process.GetCurrentProcess().Id;

var assembly = Assembly.GetExecutingAssembly();
var resource = ApplicationParameters.Log4NetConfigurationResource;
if (Platform.get_platform() != PlatformType.Windows)
Expand Down Expand Up @@ -75,7 +77,7 @@ private static void set_file_appender(string outputDirectory)

var layout = new PatternLayout
{
ConversionPattern = "%date [%-5level] - %message%newline"
ConversionPattern = "%date %property{pid} [%-5level] - %message%newline"
};
layout.ActivateOptions();

Expand Down

0 comments on commit ee9a298

Please sign in to comment.