Skip to content

Commit

Permalink
Misc. fixes for .NET Core (#1592)
Browse files Browse the repository at this point in the history
* Added option to not render empty literals on nested json objects (#1580)

* Added option to not render empty objects on nested json objects

* Add support for name parameter on (#1578)

* Bugfix: Use the culture when rendering the layout (#1556)

* Added unit tests

* Use the correct culture for rendering the string

* fix SL / fix tests

* fix culture

* split IFormatProvider and CultureInfo

* added related test

* update/expand tests

* fix xplat

* Allow overwriting possible nlog configuration file paths (#1469)

* Allow overwriting possible nlog configuration file paths

* Redesign after review

* Added tests

* Improvements after review

* move statics to XmlLoggingConfiguration

* FileTarget: Performance improvement for CleanupInvalidFileNameChars (#1582)

* FileTarget: Performance improvement for CleanupInvalidFileNameChars

* Added unit test

* Update for NLog 4.3.7

* Update README.md

[skip ci]

* fix unit test (#1589)

* Misc. fixes for .NET Core

* Remove wrap projects
  • Loading branch information
Peter Jas authored and 304NotModified committed Aug 14, 2016
1 parent bb4db55 commit 086ff66
Show file tree
Hide file tree
Showing 52 changed files with 807 additions and 269 deletions.
72 changes: 64 additions & 8 deletions .travis.yml
@@ -1,10 +1,66 @@
language: csharp
os: osx
mono:
- latest
language: generic

addons:
apt:
packages:
- gettext
- libcurl4-openssl-dev
- libicu-dev
- libssl-dev
- libunwind8
- zlib1g

matrix:
include:
- os: linux
dist: trusty # Ubuntu 14.04
sudo: required
env: CONFIGURATION=Debug
- os: linux
dist: trusty
sudo: required
env: CONFIGURATION=Release
- os: osx
osx_image: xcode7.2 # macOS 10.11
env: CONFIGURATION=Debug
- os: osx
osx_image: xcode7.2
env: CONFIGURATION=Release

before_install:
# Install OpenSSL
- if test "$TRAVIS_OS_NAME" == "osx"; then
brew install openssl;
brew link --force openssl;
export DOTNET_SDK_URL="https://go.microsoft.com/fwlink/?LinkID=809128";
else
export DOTNET_SDK_URL="https://go.microsoft.com/fwlink/?LinkID=809129";
fi

- export DOTNET_INSTALL_DIR="$PWD/.dotnetcli"

# Install .NET CLI
- mkdir $DOTNET_INSTALL_DIR
- curl -L $DOTNET_SDK_URL -o dotnet_package
- tar -xvzf dotnet_package -C $DOTNET_INSTALL_DIR

# Add dotnet to PATH
- export PATH="$DOTNET_INSTALL_DIR:$PATH"

install:
# Display dotnet version info
- which dotnet;
if [ $? -eq 0 ]; then
echo "Using dotnet:";
dotnet --info;
else
echo "dotnet.exe not found"
exit 1;
fi

# Restore dependencies
- dotnet restore

script:
- curl -sSL https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview1/scripts/obtain/dotnet-install.sh | bash /dev/stdin --version 1.0.0-preview1-002702 --install-dir ~/dotnet
- ln -s /usr/local/share/dotnet/dotnet /usr/local/bin/
- dotnet restore .\src\NLog\
- dotnet pack .\src\NLog\ --configuration release
# Run tests
- dotnet test tests/NLog.UnitTests --configuration $CONFIGURATION -f netcoreapp1.0
14 changes: 14 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,20 @@ See also [releases](https://github.com/NLog/NLog/releases) and [milestones](http

This file is new since 4.3.4. If requested, we will try to add the older releases in this file.

### V4.3.7 (2016/08/06)

#### Features
- [#1469](https://github.com/nlog/nlog/pull/1469) Allow overwriting possible nlog configuration file paths (@304NotModified)
- [#1578](https://github.com/nlog/nlog/pull/1578) Add support for name parameter on ${Assembly-version} (@304NotModified)
- [#1580](https://github.com/nlog/nlog/pull/1580) Added option to not render empty literals on nested json objects (@johnkors)

#### Improvements
- [#1558](https://github.com/nlog/nlog/pull/1558) Callsite layout renderer: improve string comparison test (performance) (@304NotModified)
- [#1582](https://github.com/nlog/nlog/pull/1582) FileTarget: Performance improvement for CleanupInvalidFileNameChars (@304NotModified)

#### Fixes
- [#1556](https://github.com/nlog/nlog/pull/1556) Bugfix: Use the culture when rendering the layout (@304NotModified)


### V4.3.6 (2016/07/24)

Expand Down
8 changes: 0 additions & 8 deletions Global.json

This file was deleted.

6 changes: 5 additions & 1 deletion README.md
Expand Up @@ -80,10 +80,14 @@ Frequently Asked Questions (FAQ)
- NLog is fully written in C#, has many years of experience and is easy to extend!

* **Is it free?**
- It's licensed under the BSD license, so you can use it in commercial (closed sourse) programs without problems.
- Yes, it's licensed under the BSD license, so you can use it in commercial (closed sourse) programs without problems.

* **Show me the magic!**
- Check the [tutorial](https://github.com/NLog/NLog/wiki/Tutorial) to get started!

* **Just show me a config example**
- [voilà](https://github.com/NLog/NLog/wiki/NLog-config-Example)


* **I can't see anything?!**
- NLog not working as expected? Check the [troubleshooting guide](https://github.com/NLog/NLog/wiki/Logging-troubleshooting). If you think it's a bug, please check [contributing.md](https://github.com/NLog/NLog/blob/master/CONTRIBUTING.md#bug-reports]) and [create a GitHub issue](https://github.com/NLog/NLog/issues/new)!
Expand Down
32 changes: 0 additions & 32 deletions examples/DnxCore50SimpleConsoleApp/project.json

This file was deleted.

File renamed without changes.
31 changes: 31 additions & 0 deletions examples/DotnetCore10SimpleConsoleApp/project.json
@@ -0,0 +1,31 @@
{
"version": "1.0.0-*",
"description": "DnxCore50SimpleConsoleApp Console Application",
"authors": [ "Vincent" ],
"packOptions": {
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
},

"compilationOptions": {
"emitEntryPoint": true
},

"dependencies": {
},

"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
},
"NLog": {
"target": "project"
}
}
}
}
}
18 changes: 6 additions & 12 deletions examples/UAP10SimpleApp/project.json
@@ -1,17 +1,11 @@
{
"dependencies": {
"Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0",
"NLog": ""
"NLog": {
"target": "project"
},
"Microsoft.NETCore.UniversalWindowsPlatform": "5.2.2"
},
"frameworks": {
"uap10.0": {}
},
"runtimes": {
"win10-arm": {},
"win10-arm-aot": {},
"win10-x86": {},
"win10-x86-aot": {},
"win10-x64": {},
"win10-x64-aot": {}
"uap10.0": { }
}
}
}
6 changes: 6 additions & 0 deletions global.json
@@ -0,0 +1,6 @@
{
"projects": [ "src", "tests" ],
"sdk": {
"version": "1.0.0-preview2-003121"
}
}
34 changes: 17 additions & 17 deletions src/NLog.Extended/project.json
Expand Up @@ -11,27 +11,27 @@
"url": "git://github.com/NLog/NLog"
}
},

"dependencies": {
"NLog": "4.4.0-beta*"
},

"frameworks": {
//"netstandard1.3": {
// "frameworkAssemblies": {
// },
// "buildOptions": {
// "define": [ "NET4_5", "WCF_SUPPORTED", "NETSTANDARD_1plus" ]
// }
//},
".NETFramework,Version=v3.5": {
"frameworkAssemblies": {
"System.Messaging": ""
},
"buildOptions": {
"define": [ "NET3_5", "WCF_SUPPORTED" ]
}
}
},
"frameworks": {
//"netstandard1.3": {
// "buildOptions": {
// "define": [ "NET4_5", "WCF_SUPPORTED", "NETSTANDARD_1plus" ]
// }
//},

".NETFramework,Version=v3.5": {
"frameworkAssemblies": {
"System.Messaging": ""
},
"buildOptions": {
"define": [ "NET3_5", "WCF_SUPPORTED" ]
}
}
},
"buildOptions": {
"keyFile": "../NLog/NLog.snk",
"xmlDoc": true
Expand Down
30 changes: 30 additions & 0 deletions src/NLog/Config/XmlLoggingConfiguration.cs
Expand Up @@ -59,6 +59,8 @@ namespace NLog.Config
/// <summary>
/// A class for configuring NLog through an XML configuration file
/// (App.config style or App.nlog style).
///
/// Parsing of the XML file is also implemented in this class.
/// </summary>
///<remarks>This class is thread-safe.<c>.ToList()</c> is used for that purpose.</remarks>
public class XmlLoggingConfiguration : LoggingConfiguration
Expand Down Expand Up @@ -222,6 +224,8 @@ internal XmlLoggingConfiguration(XmlElement element, string fileName)
/// <param name="ignoreErrors">If set to <c>true</c> errors will be ignored during file processing.</param>
internal XmlLoggingConfiguration(XmlElement element, string fileName, bool ignoreErrors)
{
logFactory = LogManager.LogFactory;

using (var stringReader = new StringReader(element.OuterXml))
{
XmlReader reader = XmlReader.Create(stringReader);
Expand Down Expand Up @@ -298,6 +302,32 @@ public override LoggingConfiguration Reload()
return new XmlLoggingConfiguration(this.originalFileName);
}

/// <summary>
/// Get file paths (including filename) for the possible NLog config files.
/// </summary>
/// <returns>The filepaths to the possible config file</returns>
public static IEnumerable<string> GetCandidateConfigFilePaths()
{
return LogManager.LogFactory.GetCandidateConfigFilePaths();
}

/// <summary>
/// Overwrite the paths (including filename) for the possible NLog config files.
/// </summary>
/// <param name="filePaths">The filepaths to the possible config file</param>
public static void SetCandidateConfigFilePaths(IEnumerable<string> filePaths)
{
LogManager.LogFactory.SetCandidateConfigFilePaths(filePaths);
}

/// <summary>
/// Clear the candidate file paths and return to the defaults.
/// </summary>
public static void ResetCandidateConfigFilePath()
{
LogManager.LogFactory.ResetCandidateConfigFilePath();
}

#endregion

private static bool IsTargetElement(string name)
Expand Down
6 changes: 4 additions & 2 deletions src/NLog/LayoutRenderers/AllEventPropertiesLayoutRenderer.cs
Expand Up @@ -118,8 +118,10 @@ protected override void Append(StringBuilder builder, LogEventInfo logEvent)

first = false;

var key = Convert.ToString(property.Key, CultureInfo.InvariantCulture);
var value = Convert.ToString(property.Value, CultureInfo.InvariantCulture);
var formatProvider = GetFormatProvider(logEvent);

var key = Convert.ToString(property.Key, formatProvider);
var value = Convert.ToString(property.Value, formatProvider);
var pair = Format.Replace("[key]", key)
.Replace("[value]", value);

Expand Down

0 comments on commit 086ff66

Please sign in to comment.