Removing .log extension from the log file name

AspNetCoreModule appends a timestamp followed by ".log" to log file name. Removing extension prevents from creating log files with names like stdout.log.{timestamp}.log
This commit is contained in:
moozzyk 2016-04-14 09:11:44 -07:00
parent 362c093174
commit 7f7742577d
2 changed files with 5 additions and 5 deletions

View File

@ -60,7 +60,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.Tools
// Forward slashes currently work neither in AspNetCoreModule nor in dotnet so they need to be // Forward slashes currently work neither in AspNetCoreModule nor in dotnet so they need to be
// replaced with backwards slashes when the application is published on a non-Windows machine // replaced with backwards slashes when the application is published on a non-Windows machine
var appPath = Path.Combine(configureForAzure ? @"%home%\site" : ".", appName).Replace("/", "\\"); var appPath = Path.Combine(configureForAzure ? @"%home%\site" : ".", appName).Replace("/", "\\");
var logPath = Path.Combine(configureForAzure ? @"\\?\%home%\LogFiles" : @".\logs", "stdout.log").Replace("/", "\\"); var logPath = Path.Combine(configureForAzure ? @"\\?\%home%\LogFiles" : @".\logs", "stdout").Replace("/", "\\");
aspNetCoreElement.SetAttributeValue("processPath", appPath); aspNetCoreElement.SetAttributeValue("processPath", appPath);
SetAttributeValueIfEmpty(aspNetCoreElement, "stdoutLogEnabled", "false"); SetAttributeValueIfEmpty(aspNetCoreElement, "stdoutLogEnabled", "false");

View File

@ -12,7 +12,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.Tools.Tests
<handlers> <handlers>
<add name=""aspNetCore"" path=""*"" verb=""*"" modules=""AspNetCoreModule"" resourceType=""Unspecified""/> <add name=""aspNetCore"" path=""*"" verb=""*"" modules=""AspNetCoreModule"" resourceType=""Unspecified""/>
</handlers> </handlers>
<aspNetCore processPath="".\test.exe"" stdoutLogEnabled=""false"" stdoutLogFile="".\logs\stdout.log"" startupTimeLimit=""3600""/> <aspNetCore processPath="".\test.exe"" stdoutLogEnabled=""false"" stdoutLogFile="".\logs\stdout"" startupTimeLimit=""3600""/>
</system.webServer> </system.webServer>
</configuration>"); </configuration>");
@ -58,7 +58,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.Tools.Tests
[InlineData("aspNetCore", "stdoutLogEnabled", "true")] [InlineData("aspNetCore", "stdoutLogEnabled", "true")]
[InlineData("aspNetCore", "startupTimeLimit", "1200")] [InlineData("aspNetCore", "startupTimeLimit", "1200")]
[InlineData("aspNetCore", "arguments", "arg1")] [InlineData("aspNetCore", "arguments", "arg1")]
[InlineData("aspNetCore", "stdoutLogFile", "logfile.log")] [InlineData("aspNetCore", "stdoutLogFile", "logfile")]
public void WebConfigTransform_wont_override_custom_values(string elementName, string attributeName, string attributeValue) public void WebConfigTransform_wont_override_custom_values(string elementName, string attributeName, string attributeValue)
{ {
var input = WebConfigTemplate; var input = WebConfigTemplate;
@ -130,7 +130,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.Tools.Tests
} }
Assert.Equal( Assert.Equal(
@".\logs\stdout.log", @".\logs\stdout",
(string)WebConfigTransform.Transform(input, "test.exe", configureForAzure: false) (string)WebConfigTransform.Transform(input, "test.exe", configureForAzure: false)
.Descendants().Attributes("stdoutLogFile").Single()); .Descendants().Attributes("stdoutLogFile").Single());
} }
@ -169,7 +169,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.Tools.Tests
Assert.True(XNode.DeepEquals( Assert.True(XNode.DeepEquals(
XDocument.Parse(@"<aspNetCore processPath=""%home%\site\test.exe"" stdoutLogEnabled=""false"" XDocument.Parse(@"<aspNetCore processPath=""%home%\site\test.exe"" stdoutLogEnabled=""false""
stdoutLogFile=""\\?\%home%\LogFiles\stdout.log"" startupTimeLimit=""3600""/>").Root, stdoutLogFile=""\\?\%home%\LogFiles\stdout"" startupTimeLimit=""3600""/>").Root,
aspNetCoreElement)); aspNetCoreElement));
} }