Skip to content

Commit

Permalink
Merge pull request #3437 from NLog/release/4.6.4
Browse files Browse the repository at this point in the history
Release 4.6.4
  • Loading branch information
304NotModified committed May 28, 2019
2 parents dfd3845 + afb2de1 commit 18309ac
Show file tree
Hide file tree
Showing 41 changed files with 1,628 additions and 513 deletions.
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,35 @@ Date format: (year/month/day)

## Change Log

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

#### Bugfixes

- [#3392](https://github.com/NLog/NLog/pull/3392) NLog.Schema: Added missing defaultAction attribute on filters element in XSD (@304NotModified)
- [#3415](https://github.com/NLog/NLog/pull/3415) AsyncWrapper in Blocking Mode can cause deadlock (@snakefoot)

#### Features

- [#3430](https://github.com/NLog/NLog/pull/3430) Added "Properties" property on Logger for reading and editing properties.(@snakefoot, @304NotModified)
- [#3423](https://github.com/NLog/NLog/pull/3423) ${all-event-properties}: Added IncludeEmptyValues option (@304NotModified)
- [#3394](https://github.com/NLog/NLog/pull/3394) ${when}, support for non-string values (@304NotModified)
- [#3398](https://github.com/NLog/NLog/pull/3398) ${whenEmpty} support for non-string values (@snakefoot, @304NotModified)
- [#3391](https://github.com/NLog/NLog/pull/3391) Added ${environment-user} (@snakefoot)
- [#3389](https://github.com/NLog/NLog/pull/3389) Log4JXmlEventLayout - Added support for configuration of Parameters (@snakefoot)
- [#3411](https://github.com/NLog/NLog/pull/3411) LoggingConfigurationParser - Recognize LoggingRule.RuleName property (@snakefoot)

#### Improvements

- [#3393](https://github.com/NLog/NLog/pull/3393) Update package descriptions to note the issues with <PackageReference> (@304NotModified)
- [#3409](https://github.com/NLog/NLog/pull/3409) Various XSD improvements (NLog.Schema package) (@304NotModified)

#### Performance

- [#3398](https://github.com/NLog/NLog/pull/3398) ${whenEmpty} faster rendering of string values (@snakefoot, @304NotModified)
- [#3405](https://github.com/NLog/NLog/pull/3405) FilteringTargetWrapper: Add support for batch writing (@snakefoot, @304NotModified)
- [#3405](https://github.com/NLog/NLog/pull/3405) PostFilteringTargetWrapper: performance optimizations (@snakefoot, @304NotModified)
- [#3435](https://github.com/NLog/NLog/pull/3435) Async / buffering wrapper: Improve performance when blocking (@snakefoot)
- [#3434](https://github.com/NLog/NLog/pull/3434) ObjectReflectionCache - Skip property-reflection for IFormattable (@snakefoot)

### V4.6.3 (2019/04/30)

Expand Down
16 changes: 9 additions & 7 deletions build.ps1
Original file line number Diff line number Diff line change
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.3"
$versionPrefix = "4.6.4"
$versionSuffix = ""
$versionFile = $versionPrefix + "." + ${env:APPVEYOR_BUILD_NUMBER}
$versionProduct = $versionPrefix;
Expand All @@ -18,21 +18,23 @@ if ($env:APPVEYOR_PULL_REQUEST_NUMBER)
$versionSuffix = "PR" + $env:APPVEYOR_PULL_REQUEST_NUMBER
}

# download nuget.exe

$sourceNugetExe = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
$targetNugetExe = "tools\nuget.exe"
Invoke-WebRequest $sourceNugetExe -OutFile $targetNugetExe
if (-Not (test-path $targetNugetExe))
{
# download nuget.exe
$sourceNugetExe = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
Invoke-WebRequest $sourceNugetExe -OutFile $targetNugetExe
}

msbuild /t:Restore,Pack .\src\NLog\ /p:targetFrameworks='"net45;net40-client;net35;netstandard1.3;netstandard1.5;netstandard2.0;sl4;sl5;wp8;monoandroid44;xamarinios10"' /p:VersionPrefix=$versionPrefix /p:VersionSuffix=$versionSuffix /p:FileVersion=$versionFile /p:ProductVersion=$versionProduct /p:Configuration=Release /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg /p:PackageOutputPath=..\..\artifacts /verbosity:minimal
msbuild /t:Restore,Pack .\src\NLog\ /p:targetFrameworks='"net45;net40-client;net35;netstandard1.3;netstandard1.5;netstandard2.0;sl4;sl5;wp8;monoandroid44;xamarinios10"' /p:VersionPrefix=$versionPrefix /p:VersionSuffix=$versionSuffix /p:FileVersion=$versionFile /p:ProductVersion=$versionProduct /p:Configuration=Release /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg /p:PackageOutputPath=..\..\artifacts /verbosity:minimal /maxcpucount
if (-Not $LastExitCode -eq 0)
{ exit $LastExitCode }

function create-package($packageName)
{

$path = ".\src\$packageName\"
msbuild /t:Restore,Pack $path /p:VersionPrefix=$versionPrefix /p:VersionSuffix=$versionSuffix /p:FileVersion=$versionFile /p:ProductVersion=$versionProduct /p:Configuration=Release /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg /p:PackageOutputPath=..\..\artifacts /verbosity:minimal
msbuild /t:Restore,Pack $path /p:VersionPrefix=$versionPrefix /p:VersionSuffix=$versionSuffix /p:FileVersion=$versionFile /p:ProductVersion=$versionProduct /p:Configuration=Release /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg /p:PackageOutputPath=..\..\artifacts /verbosity:minimal /maxcpucount
if (-Not $LastExitCode -eq 0)
{ exit $LastExitCode }

Expand Down
7 changes: 6 additions & 1 deletion src/NLog/Common/LogEventInfoBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,15 @@ public LogEventInfoBuffer(int size, bool growAsNeeded, int growLimit)
}

/// <summary>
/// Gets the number of items in the array.
/// Gets the capacity of the buffer
/// </summary>
public int Size => _buffer.Length;

/// <summary>
/// Gets the number of items in the buffer
/// </summary>
internal int Count { get { lock (_lockObject) return _count; } }

/// <summary>
/// Adds the specified log event to the buffer.
/// </summary>
Expand Down
7 changes: 2 additions & 5 deletions src/NLog/Config/LoggingConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class LoggingConfiguration
/// <summary>
/// Variables defined in xml or in API. name is case case insensitive.
/// </summary>
private readonly Dictionary<string, SimpleLayout> _variables = new Dictionary<string, SimpleLayout>(StringComparer.OrdinalIgnoreCase);
private readonly ThreadSafeDictionary<string, SimpleLayout> _variables = new ThreadSafeDictionary<string, SimpleLayout>(StringComparer.OrdinalIgnoreCase);

/// <summary>
/// Gets the factory that will be configured
Expand Down Expand Up @@ -812,10 +812,7 @@ private List<ISupportsInitialize> GetSupportsInitializes(bool reverse = false)
/// <param name="masterVariables">Master variables dictionary</param>
internal void CopyVariables(IDictionary<string, SimpleLayout> masterVariables)
{
foreach (var variable in masterVariables)
{
Variables[variable.Key] = variable.Value;
}
_variables.CopyFrom(masterVariables);
}

/// <summary>
Expand Down
3 changes: 3 additions & 0 deletions src/NLog/Config/LoggingConfigurationParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,9 @@ private LoggingRule ParseRuleElement(ILoggingConfigurationElement loggerElement)
else
ruleName = childProperty.Value;
break;
case "RULENAME":
ruleName = childProperty.Value; // Legacy Style
break;
case "LOGGER":
namePattern = childProperty.Value;
break;
Expand Down
2 changes: 1 addition & 1 deletion src/NLog/Config/LoggingRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public ReadOnlyCollection<LogLevel> Levels
}

/// <summary>
/// Default action if all filters won't match
/// Default action if none of the filters match
/// </summary>
public FilterResult DefaultFilterResult { get; set; } = FilterResult.Neutral;

Expand Down
9 changes: 5 additions & 4 deletions src/NLog/GlobalDiagnosticsContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ namespace NLog
/// </summary>
public static class GlobalDiagnosticsContext
{
private static readonly object _lockObject = new object();
private static Dictionary<string, object> _dict = new Dictionary<string, object>();
private static Dictionary<string, object> _dictReadOnly; // Reset cache on change

Expand All @@ -63,7 +64,7 @@ public static void Set(string item, string value)
/// <param name="value">Item value.</param>
public static void Set(string item, object value)
{
lock (_dict)
lock (_lockObject)
{
bool requireCopyOnWrite = _dictReadOnly != null && !_dict.ContainsKey(item); // Overwiting existing value is ok (no resize)
GetWritableDict(requireCopyOnWrite)[item] = value;
Expand Down Expand Up @@ -129,7 +130,7 @@ public static bool Contains(string item)
/// <param name="item">Item name.</param>
public static void Remove(string item)
{
lock (_dict)
lock (_lockObject)
{
bool requireCopyOnWrite = _dictReadOnly != null && _dict.ContainsKey(item);
GetWritableDict(requireCopyOnWrite).Remove(item);
Expand All @@ -141,7 +142,7 @@ public static void Remove(string item)
/// </summary>
public static void Clear()
{
lock (_dict)
lock (_lockObject)
{
bool requireCopyOnWrite = _dictReadOnly != null && _dict.Count > 0;
GetWritableDict(requireCopyOnWrite, true).Clear();
Expand All @@ -153,7 +154,7 @@ public static void Clear()
var readOnly = _dictReadOnly;
if (readOnly == null)
{
lock (_dict)
lock (_lockObject)
{
readOnly = _dictReadOnly = _dict;
}
Expand Down

0 comments on commit 18309ac

Please sign in to comment.