Skip to content

Commit

Permalink
Merged PR 158973: Added default log path
Browse files Browse the repository at this point in the history
Added default log path

Related work items: #765340
  • Loading branch information
Dor Fire committed Jan 14, 2019
1 parent ea59328 commit 5e010fc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/BuildScriptGeneratorCli/ServiceProviderBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,14 @@ private LoggingConfiguration BuildNLogConfiguration(string logPath)
config.AddRule(NLog.LogLevel.Debug, NLog.LogLevel.Fatal, aiTarget);
}

if (!string.IsNullOrWhiteSpace(logPath))
bool hasLogPath = !string.IsNullOrWhiteSpace(logPath);
if (hasLogPath || config.AllTargets.Count == 0)
{
if (!hasLogPath)
{
logPath = LoggingConstants.DefaultLogPath;
}

// Default layout: "${longdate}|${level:uppercase=true}|${logger}|${message}"
var fileTarget = new NLog.Targets.FileTarget("file") { FileName = Path.GetFullPath(logPath), Layout = "${longdate}|${level:uppercase=true}|${logger}|${message}${exception:format=ToString}" };
config.AddTarget(fileTarget);
Expand Down
2 changes: 2 additions & 0 deletions src/Oryx.Common.Utilities/LoggingConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public static class LoggingConstants

public const string AppServiceAppNameEnvironmentVariableName = "APPSETTING_WEBSITE_SITE_NAME";

public const string DefaultLogPath = "/tmp/oryx.log";

public static readonly TimeSpan FlushTimeout = TimeSpan.FromSeconds(3);
}
}

0 comments on commit 5e010fc

Please sign in to comment.