Skip to content

Commit

Permalink
Merge pull request #3465 from NLog/release/4.6.5
Browse files Browse the repository at this point in the history
Release 4.6.5
  • Loading branch information
304NotModified committed Jun 13, 2019
2 parents 7dfbf65 + 1fb0b97 commit eccb737
Show file tree
Hide file tree
Showing 74 changed files with 539 additions and 183 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,29 @@ Date format: (year/month/day)

## Change Log

### V4.6.5 (2019/06/13)

#### Bugfixes

- [#3476](https://github.com/NLog/NLog/pull/3476) Fix broken XSD schema - NLog.Schema package (@snakefoot, @304NotModified)

#### Features

- [#3478](https://github.com/NLog/NLog/pull/3478) XSD: Support <value> in <variable> (@304NotModified)
- [#3477](https://github.com/NLog/NLog/pull/3477) ${AppSetting} - Added support for ConnectionStrings Lookup (@snakefoot)
- [#3469](https://github.com/NLog/NLog/pull/3469) LogLevel - Added support for TypeConverter (@snakefoot)
- [#3453](https://github.com/NLog/NLog/pull/3453) Added null terminator line ending for network target (@Kahath)
- [#3442](https://github.com/NLog/NLog/pull/3442) Log4JXmlEventLayout - Added IncludeCallSite + IncludeSourceInfo (@snakefoot)

#### Improvements

- [#3482](https://github.com/NLog/NLog/pull/3482) Fix typos in docs and comments (@304NotModified)

#### Performance

- [#3444](https://github.com/NLog/NLog/pull/3444) RetryingMultiProcessFileAppender - better init BufferSize (@snakefoot)


### V4.6.4 (2019/05/28)

#### Bugfixes
Expand Down
57 changes: 57 additions & 0 deletions Test-XmlFile.ps1
@@ -0,0 +1,57 @@
function Test-XmlFile
{
<#
from: https://stackoverflow.com/a/16618560/201303
.Synopsis
Validates an xml file against an xml schema file.
.Example
PS> dir *.xml | Test-XmlFile schema.xsd
#>
[CmdletBinding()]
param (
[Parameter(Mandatory=$true)]
[string] $SchemaFile,

[Parameter(ValueFromPipeline=$true, Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[alias('Fullname')]
[string] $XmlFile,

[scriptblock] $ValidationEventHandler = { Write-Error $args[1].Exception }
)

begin {
$schemaReader = New-Object System.Xml.XmlTextReader $SchemaFile
$schema = [System.Xml.Schema.XmlSchema]::Read($schemaReader, $ValidationEventHandler)
}

process {
$ret = $true
try {
$xml = New-Object System.Xml.XmlDocument
$xml.Schemas.Add($schema) | Out-Null
$xml.Load($XmlFile)
$xml.Validate({
throw ([PsCustomObject] @{
SchemaFile = $SchemaFile
XmlFile = $XmlFile
Exception = $args[1].Exception
})
})
} catch {
Write-Error $_
$ret = $false
}
$ret
}

end {
$schemaReader.Close()
}
}

# Needs absolute paths. Will throw a error if one of the files is not found
$pwd = get-location;

# Returns true if valid
return Test-XmlFile "$pwd\src\NLog\bin\Release\NLog.xsd" "$pwd\src\NuGet\NLog.Config\content\NLog.config"
2 changes: 1 addition & 1 deletion build.ps1
Expand Up @@ -5,7 +5,7 @@ dotnet --version
# dotnet restore .\src\NLog\
# dotnet pack .\src\NLog\ --configuration release --include-symbols -o ..\..\artifacts

$versionPrefix = "4.6.4"
$versionPrefix = "4.6.5"
$versionSuffix = ""
$versionFile = $versionPrefix + "." + ${env:APPVEYOR_BUILD_NUMBER}
$versionProduct = $versionPrefix;
Expand Down
7 changes: 7 additions & 0 deletions run-tests.ps1
@@ -1,3 +1,10 @@

if(.\Test-XmlFile.ps1){
Write-Output "Valid XSD"
}else {
exit 400;
}

dotnet restore .\src\NLog\
if (-Not $LastExitCode -eq 0)
{ exit $LastExitCode }
Expand Down
8 changes: 7 additions & 1 deletion src/NLog.sln.DotSettings
Expand Up @@ -7,4 +7,10 @@
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantToStringCall/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=EOF/@EntryIndexedValue">EOF</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GDC/@EntryIndexedValue">GDC</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MDC/@EntryIndexedValue">MDC</s:String></wpf:ResourceDictionary>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MDC/@EntryIndexedValue">MDC</s:String>
<s:Boolean x:Key="/Default/UserDictionary/Words/=MDLC/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=NDLC/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=precalculate/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Renderers/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=serialisation/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=suppressions/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
2 changes: 1 addition & 1 deletion src/NLog/Annotations.cs
Expand Up @@ -208,7 +208,7 @@ public NotifyPropertyChangedInvocatorAttribute([NotNull] string parameterName)
/// </list>
/// If method has single input parameter, it's name could be omitted.<br/>
/// Using <c>halt</c> (or <c>void</c>/<c>nothing</c>, which is the same) for method output
/// means that the methos doesn't return normally (throws or terminates the process).<br/>
/// means that the methods doesn't return normally (throws or terminates the process).<br/>
/// Value <c>canbenull</c> is only applicable for output parameters.<br/>
/// You can use multiple <c>[ContractAnnotation]</c> for each FDT row, or use single attribute
/// with rows separated by semicolon. There is no notion of order rows, all rows are checked
Expand Down
2 changes: 1 addition & 1 deletion src/NLog/Common/InternalLogger.cs
Expand Up @@ -452,7 +452,7 @@ private static void WriteToErrorConsole(string message)
/// <param name="message">A message to write.</param>
/// <remarks>
/// Works when property <see cref="LogToTrace"/> set to true.
/// The <see cref="System.Diagnostics.Trace"/> is used in Debug and Relese configuration.
/// The <see cref="System.Diagnostics.Trace"/> is used in Debug and Release configuration.
/// The <see cref="System.Diagnostics.Debug"/> works only in Debug configuration and this is reason why is replaced by <see cref="System.Diagnostics.Trace"/>.
/// in DEBUG
/// </remarks>
Expand Down
2 changes: 1 addition & 1 deletion src/NLog/Conditions/ConditionRelationalExpression.cs
Expand Up @@ -177,7 +177,7 @@ private static void PromoteTypes(ref object leftValue, ref object rightValue)
}

/// <summary>
/// Promoto <paramref name="val"/> to type
/// Promotes <paramref name="val"/> to type
/// </summary>
/// <param name="val"></param>
/// <param name="type1"></param>
Expand Down
4 changes: 2 additions & 2 deletions src/NLog/Config/ConfigurationItemFactory.cs
Expand Up @@ -199,7 +199,7 @@ public IValueFormatter ValueFormatter
public IPropertyTypeConverter PropertyTypeConverter { get; set; } = new PropertyTypeConverter();

/// <summary>
/// Perform mesage template parsing and formatting of LogEvent messages (True = Always, False = Never, Null = Auto Detect)
/// Perform message template parsing and formatting of LogEvent messages (True = Always, False = Never, Null = Auto Detect)
/// </summary>
/// <remarks>
/// - Null (Auto Detect) : NLog-parser checks <see cref="LogEventInfo.Message"/> for positional parameters, and will then fallback to string.Format-rendering.
Expand Down Expand Up @@ -317,7 +317,7 @@ private void CallPreload(Type type)
var parameters = CreatePreloadParameters(preloadMethod, this);

preloadMethod.Invoke(null, parameters);
InternalLogger.Debug("Preload succesfully invoked for '{0}'", type.FullName);
InternalLogger.Debug("Preload successfully invoked for '{0}'", type.FullName);
}
catch (Exception e)
{
Expand Down
2 changes: 1 addition & 1 deletion src/NLog/Config/ExceptionRenderingFormat.cs
Expand Up @@ -34,7 +34,7 @@
namespace NLog.Config
{
/// <summary>
/// Format of the excpetion output to the specific target.
/// Format of the exception output to the specific target.
/// </summary>
public enum ExceptionRenderingFormat
{
Expand Down
2 changes: 1 addition & 1 deletion src/NLog/Config/Factory.cs
Expand Up @@ -249,7 +249,7 @@ public void RegisterFuncLayout(string name, FuncLayoutRenderer renderer)
/// <returns>True if instance was created successfully, false otherwise.</returns>
public override bool TryCreateInstance(string itemName, out LayoutRenderer result)
{
//first try func renderers, as they should have the possiblity to overwrite a current one.
//first try func renderers, as they should have the possibility to overwrite a current one.
if (_funcRenderers != null)
{
FuncLayoutRenderer funcResult;
Expand Down
2 changes: 1 addition & 1 deletion src/NLog/Config/LoggerNameMatcher.cs
Expand Up @@ -236,7 +236,7 @@ public override bool NameMatches(string loggerName)
/// <summary>
/// Defines a <see cref="LoggerNameMatcher"/> that matches with a complex wildcards combinations:
/// <list type="bullet">
/// <item>'*' means zero or more occurrecnces of any character</item>
/// <item>'*' means zero or more occurrences of any character</item>
/// <item>'?' means exactly one occurrence of any character</item>
/// </list>
/// used when pattern is a string containing any number of '?' or '*' in any position
Expand Down
4 changes: 2 additions & 2 deletions src/NLog/Config/XmlLoggingConfiguration.cs
Expand Up @@ -125,7 +125,7 @@ private static XmlReader CreateFileReader(string fileName)
{
fileName = fileName.Trim();
#if __ANDROID__
//suport loading config from special assets folder in nlog.config
//support loading config from special assets folder in nlog.config
if (fileName.StartsWith(AssetsPrefix, StringComparison.OrdinalIgnoreCase))
{
//remove prefix
Expand Down Expand Up @@ -597,7 +597,7 @@ private void ConfigureFromFilesByMask(string baseDirectory, string fileMask, boo
#endif
foreach (var file in files)
{
//note we exclude ourself in ConfigureFromFile
//note we exclude our self in ConfigureFromFile
ConfigureFromFile(file, autoReloadDefault);
}
}
Expand Down
51 changes: 51 additions & 0 deletions src/NLog/Internal/ConfigurationManager2.cs
@@ -0,0 +1,51 @@
//
// Copyright (c) 2004-2019 Jaroslaw Kowalski <jaak@jkowalski.net>, Kim Christensen, Julian Verdurmen
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * Neither the name of Jaroslaw Kowalski nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
// THE POSSIBILITY OF SUCH DAMAGE.
//

#if !SILVERLIGHT && !__IOS__ && !__ANDROID__ && !NETSTANDARD

namespace NLog.Internal
{
using System.Collections.Specialized;

internal class ConfigurationManager2 : IConfigurationManager2
{
public System.Configuration.ConnectionStringSettings LookupConnectionString(string name)
{
return System.Configuration.ConfigurationManager.ConnectionStrings[name];
}

public NameValueCollection AppSettings => System.Configuration.ConfigurationManager.AppSettings;
}
}

#endif
21 changes: 11 additions & 10 deletions src/NLog/Internal/FileAppenders/BaseFileAppender.cs
Expand Up @@ -92,7 +92,7 @@ internal set
public DateTime CreationTimeSource { get; private set; }

/// <summary>
/// Gets the last time the file associated with the appeander is opened. The time returned is in Coordinated
/// Gets the last time the file associated with the appender is opened. The time returned is in Coordinated
/// Universal Time [UTC] standard.
/// </summary>
/// <returns>The time the file was last opened.</returns>
Expand Down Expand Up @@ -133,7 +133,7 @@ public void Write(byte[] bytes)
public abstract DateTime? GetFileCreationTimeUtc();

/// <summary>
/// Gets the length in bytes of the file associated with the appeander.
/// Gets the length in bytes of the file associated with the appender.
/// </summary>
/// <returns>A long value representing the length of the file in bytes.</returns>
public abstract long? GetFileLength();
Expand Down Expand Up @@ -163,8 +163,9 @@ protected virtual void Dispose(bool disposing)
/// Creates the file stream.
/// </summary>
/// <param name="allowFileSharedWriting">If set to <c>true</c> sets the file stream to allow shared writing.</param>
/// <param name="overrideBufferSize">If larger than 0 then it will be used instead of the default BufferSize for the FileStream.</param>
/// <returns>A <see cref="FileStream"/> object which can be used to write to the file.</returns>
protected FileStream CreateFileStream(bool allowFileSharedWriting)
protected FileStream CreateFileStream(bool allowFileSharedWriting, int overrideBufferSize = 0)
{
int currentDelay = CreateFileParameters.ConcurrentWriteAttemptDelay;

Expand All @@ -175,7 +176,7 @@ protected FileStream CreateFileStream(bool allowFileSharedWriting)
{
try
{
return TryCreateFileStream(allowFileSharedWriting);
return TryCreateFileStream(allowFileSharedWriting, overrideBufferSize);
}
catch (DirectoryNotFoundException)
{
Expand All @@ -194,7 +195,7 @@ protected FileStream CreateFileStream(bool allowFileSharedWriting)
//if creating a directory failed, don't retry for this message (e.g the ConcurrentWriteAttempts below)
throw new NLogRuntimeException("Could not create directory {0}", directoryName);
}
return TryCreateFileStream(allowFileSharedWriting);
return TryCreateFileStream(allowFileSharedWriting, overrideBufferSize);

}
}
Expand All @@ -217,7 +218,7 @@ protected FileStream CreateFileStream(bool allowFileSharedWriting)

#if !SILVERLIGHT && !MONO && !__IOS__ && !__ANDROID__ && !NETSTANDARD
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "Objects are disposed elsewhere")]
private FileStream WindowsCreateFile(string fileName, bool allowFileSharedWriting)
private FileStream WindowsCreateFile(string fileName, bool allowFileSharedWriting, int overrideBufferSize)
{
int fileShare = Win32FileNativeMethods.FILE_SHARE_READ;

Expand Down Expand Up @@ -250,7 +251,7 @@ private FileStream WindowsCreateFile(string fileName, bool allowFileSharedWritin
Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
}

fileStream = new FileStream(handle, FileAccess.Write, CreateFileParameters.BufferSize);
fileStream = new FileStream(handle, FileAccess.Write, overrideBufferSize > 0 ? overrideBufferSize : CreateFileParameters.BufferSize);
fileStream.Seek(0, SeekOrigin.End);
return fileStream;
}
Expand All @@ -266,7 +267,7 @@ private FileStream WindowsCreateFile(string fileName, bool allowFileSharedWritin
}
#endif

private FileStream TryCreateFileStream(bool allowFileSharedWriting)
private FileStream TryCreateFileStream(bool allowFileSharedWriting, int overrideBufferSize)
{
UpdateCreationTime();

Expand All @@ -275,7 +276,7 @@ private FileStream TryCreateFileStream(bool allowFileSharedWriting)
{
if (!CreateFileParameters.ForceManaged && PlatformDetector.IsWin32 && !PlatformDetector.IsMono)
{
return WindowsCreateFile(FileName, allowFileSharedWriting);
return WindowsCreateFile(FileName, allowFileSharedWriting, overrideBufferSize);
}
}
catch (SecurityException)
Expand All @@ -295,7 +296,7 @@ private FileStream TryCreateFileStream(bool allowFileSharedWriting)
FileMode.Append,
FileAccess.Write,
fileShare,
CreateFileParameters.BufferSize);
overrideBufferSize > 0 ? overrideBufferSize : CreateFileParameters.BufferSize);
}

private void UpdateCreationTime()
Expand Down
Expand Up @@ -117,7 +117,7 @@ public override void Flush()
}

/// <summary>
/// Gets the length in bytes of the file associated with the appeander.
/// Gets the length in bytes of the file associated with the appender.
/// </summary>
/// <returns>A long value representing the length of the file in bytes.</returns>
public override long? GetFileLength()
Expand Down
2 changes: 1 addition & 1 deletion src/NLog/Internal/FileAppenders/FileAppenderCache.cs
Expand Up @@ -339,7 +339,7 @@ public void CloseAppenders(string reason)
}

/// <summary>
/// Close the allocated appenders initialised before the supplied time.
/// Close the allocated appenders initialized before the supplied time.
/// </summary>
/// <param name="expireTime">The time which prior the appenders considered expired</param>
public void CloseAppenders(DateTime expireTime)
Expand Down
Expand Up @@ -193,7 +193,7 @@ public override void Flush()
}

/// <summary>
/// Gets the length in bytes of the file associated with the appeander.
/// Gets the length in bytes of the file associated with the appender.
/// </summary>
/// <returns>A long value representing the length of the file in bytes.</returns>
public override long? GetFileLength()
Expand Down

0 comments on commit eccb737

Please sign in to comment.