Skip to content

Commit

Permalink
Merge pull request #3 from NLog/master
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
Uğur Aldanmaz committed Oct 18, 2015
2 parents 929dbc5 + 70bcdcd commit 0658bde
Show file tree
Hide file tree
Showing 62 changed files with 1,450 additions and 395 deletions.
19 changes: 18 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Support & contributing guidelines (March 2, 2015)
Support & contributing guidelines (Oktober 13, 2015)
===
Do you have feature requests, questions or would you like to report a bug? Please follow these guidelines when posting on the [issue list](https://github.com/NLog/NLog/issues). The issues are labeled with the [following guideline](issue-labeling.md).

Expand Down Expand Up @@ -74,4 +74,21 @@ Keep in mind that multiple versions of .Net are supported. Some methods are not
#if #WINDOWS_PHONE_7_1
```

Sync back
===
Is your fork not up-to-date with the NLog code? Most of the time that isn't a problem. But I you like to "sync back" the changes to your repository, execute the following command:

The first time:
```
git remote add upstream https://github.com/NLog/NLog.git
```

After that:

```
git fetch upstream
git checkout <your feature branch>
git merge upstream/master
```

It's also possible to send a PR in the opposite direction, but that's not preferred as it will pollute the commit log.
33 changes: 23 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@ Welcome to NLog

[![Join the chat at https://gitter.im/NLog/NLog](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/NLog/NLog?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Twitter](https://img.shields.io/badge/Twitter-NLogOfficial-blue.svg)](https://twitter.com/nlogofficial)
[![Last News](https://img.shields.io/badge/News-31_aug_2015-orange.svg)](http://nlog-project.org/archives/)

[![Last News](https://img.shields.io/badge/News-12_sept_2015-orange.svg)](http://nlog-project.org/archives/)
[![NuGet downloads](https://img.shields.io/nuget/dt/NLog.svg)](https://www.nuget.org/packages/NLog)
[![Version](https://img.shields.io/nuget/v/NLog.svg)](https://www.nuget.org/packages/NLog)
[![GitHub release](https://img.shields.io/github/release/NLog/NLog.svg)](https://github.com/NLog/NLog/releases)
[![AppVeyor](https://img.shields.io/appveyor/ci/Xharze/nlog-134/master.svg)](https://ci.appveyor.com/project/Xharze/nlog-134/branch/master)
[![codecov.io](https://codecov.io/github/NLog/NLog/coverage.svg?branch=master)](https://codecov.io/github/NLog/NLog?branch=master)


<!--[![Pre-release version](https://img.shields.io/nuget/vpre/NLog.svg)](https://www.nuget.org/packages/NLog)-->

---

[NLog is Looking for Developers!](http://nlog-project.org/2015/08/05/NLog-is-looking-for-developers.html)

---
<!--[NLog is Looking for Developers!](http://nlog-project.org/2015/08/05/NLog-is-looking-for-developers.html)-->


NLog is a free logging platform for .NET with rich log routing and management
capabilities. It makes it easy to produce and manage high-quality logs for
Expand All @@ -30,9 +28,24 @@ or just get started with the tutorials on [the NLog wiki](https://github.com/NLo

[Project news - including RSS feed](http://nlog-project.org/archives/)

Extensions
Packages & Status
---
This is the core of NLog. There are multiple extensions on NLog, some are maintained by NLog and other by the community. Check [the targets](https://github.com/NLog/NLog/wiki/Targets#targets) and [the layout renderers](https://github.com/NLog/NLog/wiki/Layout-Renderers#layout-renderers) wiki pages for more information!
NLog consists of multiple packages. Most of the functionality is inside the NLog (core) package. What's inside the packages? See [targets](https://github.com/NLog/NLog/wiki/Targets) and [layout renderers](https://github.com/NLog/NLog/wiki/Layout-Renderers) overview!

Product | Build status | Nuget |
-------- | :------------ | :------------ | :------------------
NLog (Windows) | [![AppVeyor](https://img.shields.io/appveyor/ci/Xharze/nlog-134/master.svg)](https://ci.appveyor.com/project/Xharze/nlog-134/branch/master) | [![NuGet package](https://img.shields.io/nuget/v/NLog.svg)](https://www.nuget.org/packages/NLog) |
NLog (Mono) | [![Build Status](https://travis-ci.org/NLog/NLog.svg?branch=master)](https://travis-ci.org/NLog/NLog) | |
NLog.Config | [![AppVeyor](https://img.shields.io/appveyor/ci/Xharze/nlog-134/master.svg)](https://ci.appveyor.com/project/Xharze/nlog-134/branch/master) | [![NuGet package](https://img.shields.io/nuget/v/NLog.Config.svg)](https://www.nuget.org/packages/NLog.Config) |
NLog.Extended | [![AppVeyor](https://img.shields.io/appveyor/ci/Xharze/nlog-134/master.svg)](https://ci.appveyor.com/project/Xharze/nlog-134/branch/master) | [![NuGet package](https://img.shields.io/nuget/v/NLog.Extended.svg)](https://www.nuget.org/packages/NLog.Extended) |
[NLog.Elmah](https://github.com/NLog/NLog.Elmah) | [![AppVeyor](https://img.shields.io/appveyor/ci/Xharze/nlog-Elmah/master.svg)](https://ci.appveyor.com/project/Xharze/nlog-Elmah/branch/master) | [![NuGet package](https://img.shields.io/nuget/v/NLog.Elmah.svg)](https://www.nuget.org/packages/NLog.Elmah) |
[NLog.Etw](https://github.com/NLog/NLog.Etw) | [![AppVeyor](https://img.shields.io/appveyor/ci/Xharze/nlog-Etw/master.svg)](https://ci.appveyor.com/project/Xharze/nlog-Etw/branch/master) | [![NuGet package](https://img.shields.io/nuget/v/NLog.Etw.svg)](https://www.nuget.org/packages/NLog.Etw) |
[NLog.ManualFlush](https://github.com/NLog/NLog.ManualFlush) | [![AppVeyor](https://img.shields.io/appveyor/ci/Xharze/nlog-ManualFlush/master.svg)](https://ci.appveyor.com/project/Xharze/nlog-ManualFlush/branch/master) | [![NuGet package](https://img.shields.io/nuget/v/NLog.ManualFlush.svg)](https://www.nuget.org/packages/NLog.ManualFlush) |
NLog.Schema | [![AppVeyor](https://img.shields.io/appveyor/ci/Xharze/nlog-134/master.svg)](https://ci.appveyor.com/project/Xharze/nlog-134/branch/master) | [![NuGet package](https://img.shields.io/nuget/v/NLog.Schema.svg)](https://www.nuget.org/packages/NLog.Schema) |
[NLog.Web](https://github.com/NLog/NLog.Web) | [![AppVeyor](https://img.shields.io/appveyor/ci/Xharze/nlog-web/master.svg)](https://ci.appveyor.com/project/Xharze/nlog-web/branch/master) | [![NuGet package](https://img.shields.io/nuget/v/NLog.Web.svg)](https://www.nuget.org/packages/NLog.Web) |
[NLog.Windows.Forms](https://github.com/NLog/NLog.Windows.Forms) | [![AppVeyor](https://img.shields.io/appveyor/ci/Xharze/nlog-windows/master.svg)](https://ci.appveyor.com/project/Xharze/nlog-windows/branch/master) | [![NuGet package](https://img.shields.io/nuget/v/NLog.Windows.Forms.svg)](https://www.nuget.org/packages/NLog.Windows.Forms) |




Questions, bug reports or feature requests?
Expand Down
12 changes: 11 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
version: 4.0.{build}
clone_folder: c:\projects\nlog
build_script:
- Msbuild.exe src/NLog.proj /verbosity:minimal /t:BuildTests /p:BuildSL5=true /p:BuildSL4=true /p:BuildNetFX35=true /p:BuildNetFX40=true /p:BuildNetFX45=true

before_test:
- .\tests\CreateTestUsers.cmd
test_script:
- xunit.console.clr4 "build\bin\Debug\.NET Framework 3.5\NLog.UnitTests.dll" /appveyor /noshadow
- xunit.console.clr4 "build\bin\Debug\.NET Framework 4.0\NLog.UnitTests.dll" /appveyor /noshadow
- xunit.console.clr4 "build\bin\Debug\.NET Framework 4.5\NLog.UnitTests.dll" /appveyor /noshadow
- nuget.exe install OpenCover -ExcludeVersion
- dir
- OpenCover\tools\OpenCover.Console.exe -register:user -target:"%xunit20%\xunit.console.x86.exe" -targetargs:"\"C:\projects\nlog\build\bin\Debug\.NET Framework 4.5\NLog.UnitTests.dll\" -appveyor -noshadow" -returntargetcode -filter:"+[NLog]* +[NLog.Extended]* -[NLog]JetBrains.Annotations.*" -excludebyattribute:*.ExcludeFromCodeCoverage* -hideskipped:All -output:coverage.xml
- "SET PATH=C:\\Python34;C:\\Python34\\Scripts;%PATH%"
- pip install codecov
- codecov -f "coverage.xml"

after_test:
- .\tests\DeleteTestUsers.cmd
deploy: off
# preserve "packages" directory in the root of build folder but will reset it if packages.config is modified
cache:
- packages -> **\packages.config
Empty file removed msbuild
Empty file.
18 changes: 18 additions & 0 deletions msbuild-commands.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@


Example 4.1.2 RC
===


```
cd nlog/src
msbuild NLog.proj /t:rebuild /t:NuGetPackage /p:BuildLastMajorVersion=4.0.0 /p:AssemblyFileVersion=4.1.2.0 /p:BuildVersion=4.1.2-rc /p:configuration=release /p:BuildLabelOverride=NONE
```


Example 4.1.2 (RTM)

```
cd nlog/src
msbuild NLog.proj /t:rebuild /t:NuGetPackage /p:BuildLastMajorVersion=4.0.0 /p:AssemblyFileVersion=4.1.2 /p:BuildVersion=4.1.2 /p:configuration=release /p:BuildLabelOverride=NONE
```
1 change: 0 additions & 1 deletion src/NLog.Extended/NLog.Extended.mono.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
<Reference Include="System.Data" />
<Reference Include="System.Messaging" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Drawing" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Xml" />
Expand Down
2 changes: 2 additions & 0 deletions src/NLog.proj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<BuildVersion Condition=" '$(BuildVersion)' == '' " >3.2.0.0</BuildVersion>
<BuildVersion Condition=" '$(CCNetLabel)'!='' ">$(CCNetLabel)</BuildVersion>
<BuildLastMajorVersion Condition=" '$(BuildLastMajorVersion)' == '' ">$(BUILD_NUMBER)</BuildLastMajorVersion>
<AssemblyFileVersion></AssemblyFileVersion>
<NuGetVersion>$(BuildVersion)</NuGetVersion>
<NuGetVersion Condition="'$(NuGetPrelease)' != ''">$(BuildVersion)-$(NuGetPrelease)</NuGetVersion>
<BuildProductName>NLog v$(BuildVersion)$(BuildLabel)</BuildProductName>
Expand Down Expand Up @@ -157,6 +158,7 @@
// automatically generated
[assembly: System.Reflection.AssemblyProduct("$(BuildProductName)")]
[assembly: System.Reflection.AssemblyVersion("$(BuildLastMajorVersion)")]
[assembly: System.Reflection.AssemblyFileVersion("$(AssemblyFileVersion)")]
[assembly: System.Reflection.AssemblyInformationalVersion("$(BuildVersion)")]
</BuildInfoFileContent>
</PropertyGroup>
Expand Down
34 changes: 32 additions & 2 deletions src/NLog/Common/InternalLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,16 @@ namespace NLog.Common
using System.Configuration;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Text;
using NLog.Internal;
using NLog.Time;
#if !SILVERLIGHT
using ConfigurationManager = System.Configuration.ConfigurationManager;
using System.Diagnostics;
#endif

/// <summary>
/// <summary>
/// NLog internal logger.
/// </summary>
public static class InternalLogger
Expand Down Expand Up @@ -379,6 +381,30 @@ private static void Write(LogLevel level, string message, object[] args)
}
}

/// <summary>
/// Logs the assembly version and file version of the given Assembly.
/// </summary>
/// <param name="assembly">The assembly to log.</param>
public static void LogAssemblyVersion(Assembly assembly)
{
try
{
#if SILVERLIGHT
Info(assembly.FullName);
#else
var fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location);
Info("{0}. File version: {1}. Product version: {2}.",
assembly.FullName,
fileVersionInfo.FileVersion,
fileVersionInfo.ProductVersion);
#endif
}
catch (Exception exc)
{
Error("Error logging version of assembly {0}: {1}.", assembly.FullName, exc.Message);
}
}

#if !SILVERLIGHT
private static string GetSettingString(string configName, string envName)
{
Expand Down Expand Up @@ -451,7 +477,11 @@ private static void CreateDirectoriesIfNeeded(string filename)
{
try
{
Directory.CreateDirectory(Path.GetDirectoryName(filename));
string parentDirectory = Path.GetDirectoryName(filename);
if (!string.IsNullOrEmpty(parentDirectory))
{
Directory.CreateDirectory(parentDirectory);
}
}
catch (Exception exception)
{
Expand Down
3 changes: 3 additions & 0 deletions src/NLog/Config/AdvancedAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ namespace NLog.Config
/// default in generated documentation.
/// </summary>
[AttributeUsage(AttributeTargets.Property)]
#if NET4_0 || NET4_5
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
#endif
public sealed class AdvancedAttribute : Attribute
{
/// <summary>
Expand Down
46 changes: 34 additions & 12 deletions src/NLog/Config/ConfigurationItemFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ namespace NLog.Config
/// </summary>
public class ConfigurationItemFactory
{
private static ConfigurationItemFactory defaultInstance = null;

private readonly IList<object> allFactories;
private readonly Factory<Target, TargetAttribute> targets;
private readonly Factory<Filter, FilterAttribute> filters;
Expand All @@ -61,15 +63,7 @@ public class ConfigurationItemFactory
private readonly MethodFactory<ConditionMethodsAttribute, ConditionMethodAttribute> conditionMethods;
private readonly Factory<LayoutRenderer, AmbientPropertyAttribute> ambientProperties;
private readonly Factory<TimeSource, TimeSourceAttribute> timeSources;

/// <summary>
/// Initializes static members of the <see cref="ConfigurationItemFactory"/> class.
/// </summary>
static ConfigurationItemFactory()
{
Default = BuildDefaultFactory();
}


/// <summary>
/// Initializes a new instance of the <see cref="ConfigurationItemFactory"/> class.
/// </summary>
Expand Down Expand Up @@ -104,7 +98,20 @@ public ConfigurationItemFactory(params Assembly[] assemblies)
/// <summary>
/// Gets or sets default singleton instance of <see cref="ConfigurationItemFactory"/>.
/// </summary>
public static ConfigurationItemFactory Default { get; set; }
/// <remarks>
/// This property implements lazy instantiation so that the <see cref="ConfigurationItemFactory"/> is not built before
/// the internal logger is configured.
/// </remarks>
public static ConfigurationItemFactory Default
{
get
{
if (defaultInstance == null)
defaultInstance = BuildDefaultFactory();
return defaultInstance;
}
set { defaultInstance = value; }
}

/// <summary>
/// Gets or sets the creator delegate used to instantiate configuration objects.
Expand Down Expand Up @@ -254,8 +261,23 @@ private static ConfigurationItemFactory BuildDefaultFactory()
foreach (var extensionDll in extensionDlls)
{
InternalLogger.Info("Auto loading assembly file: {0}", extensionDll);
var extensionAssembly = Assembly.LoadFrom(extensionDll);
factory.RegisterItemsFromAssembly(extensionAssembly);
var success = false;
try
{
var extensionAssembly = Assembly.LoadFrom(extensionDll);
InternalLogger.LogAssemblyVersion(extensionAssembly);
factory.RegisterItemsFromAssembly(extensionAssembly);
success = true;
}
catch (Exception)
{
InternalLogger.Warn("Auto loading assembly file: {0} failed! Skipping this file.", extensionDll);
}
if (success)
{
InternalLogger.Info("Auto loading assembly file: {0} succeeded!", extensionDll);
}

}
InternalLogger.Debug("Auto loading done");
#endif
Expand Down
7 changes: 3 additions & 4 deletions src/NLog/Config/LoggingRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class LoggingRule
private string loggerNameMatchArgument;

/// <summary>
/// Initializes a new instance of the <see cref="LoggingRule" /> class.
/// Create an empty <see cref="LoggingRule" />.
/// </summary>
public LoggingRule()
{
Expand All @@ -64,7 +64,7 @@ public LoggingRule()
}

/// <summary>
/// Initializes a new instance of the <see cref="LoggingRule" /> class.
/// Create a new <see cref="LoggingRule" /> with a <paramref name="minLevel"/> which writes to <paramref name="target"/>.
/// </summary>
/// <param name="loggerNamePattern">Logger name pattern. It may include the '*' wildcard at the beginning, at the end or at both ends.</param>
/// <param name="minLevel">Minimum log level needed to trigger this rule.</param>
Expand All @@ -83,11 +83,10 @@ public LoggingRule(string loggerNamePattern, LogLevel minLevel, Target target)
}

/// <summary>
/// Initializes a new instance of the <see cref="LoggingRule" /> class.
/// Create a (disabled) <see cref="LoggingRule" />. You should call <see cref="EnableLoggingForLevel"/> to enable logging.
/// </summary>
/// <param name="loggerNamePattern">Logger name pattern. It may include the '*' wildcard at the beginning, at the end or at both ends.</param>
/// <param name="target">Target to be written to when the rule matches.</param>
/// <remarks>By default no logging levels are defined. You should call <see cref="EnableLoggingForLevel"/> and <see cref="DisableLoggingForLevel"/> to set them.</remarks>
public LoggingRule(string loggerNamePattern, Target target)
{
this.Filters = new List<Filter>();
Expand Down

0 comments on commit 0658bde

Please sign in to comment.