Skip to content

Commit

Permalink
Added nLog v1.0 refresh test logger.
Browse files Browse the repository at this point in the history
Fixed issue 6260 as per suggestion by Dris101.

--HG--
extra : convert_revision : svn%3A1e568ecf-6e86-f84e-81c3-1660d9aa0cee/trunk%405
  • Loading branch information
yarseyah committed Apr 3, 2010
1 parent 58d4184 commit c8388c3
Show file tree
Hide file tree
Showing 7 changed files with 169 additions and 3 deletions.
13 changes: 12 additions & 1 deletion Sentinel.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "SentinelSetup", "SentinelSe
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NLogTester", "NLogTester\NLogTester.csproj", "{93081C58-433D-40D1-B0AD-524AA098D3B2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nLog1Tester", "nLog1Tester\nLog1Tester.csproj", "{44D1E267-AE99-43BE-B824-980B4ABFF9CA}"
EndProject
Global
GlobalSection(SubversionScc) = preSolution
Svn-Managed = True
Expand Down Expand Up @@ -51,7 +53,16 @@ Global
{93081C58-433D-40D1-B0AD-524AA098D3B2}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{93081C58-433D-40D1-B0AD-524AA098D3B2}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{93081C58-433D-40D1-B0AD-524AA098D3B2}.Release|x86.ActiveCfg = Release|Any CPU

{44D1E267-AE99-43BE-B824-980B4ABFF9CA}.Debug|Any CPU.ActiveCfg = Debug|x86
{44D1E267-AE99-43BE-B824-980B4ABFF9CA}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{44D1E267-AE99-43BE-B824-980B4ABFF9CA}.Debug|Mixed Platforms.Build.0 = Debug|x86
{44D1E267-AE99-43BE-B824-980B4ABFF9CA}.Debug|x86.ActiveCfg = Debug|x86
{44D1E267-AE99-43BE-B824-980B4ABFF9CA}.Debug|x86.Build.0 = Debug|x86
{44D1E267-AE99-43BE-B824-980B4ABFF9CA}.Release|Any CPU.ActiveCfg = Release|x86
{44D1E267-AE99-43BE-B824-980B4ABFF9CA}.Release|Mixed Platforms.ActiveCfg = Release|x86
{44D1E267-AE99-43BE-B824-980B4ABFF9CA}.Release|Mixed Platforms.Build.0 = Release|x86
{44D1E267-AE99-43BE-B824-980B4ABFF9CA}.Release|x86.ActiveCfg = Release|x86
{44D1E267-AE99-43BE-B824-980B4ABFF9CA}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
4 changes: 2 additions & 2 deletions Sentinel/Logger/Log.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ public void Clear()
{
lock (Entries)
{
((List<LogEntry>) Entries).Clear();
((IList<ILogEntry>) Entries).Clear();
}

OnPropertyChanged("Entries");

lock (NewEntries)
{
((List<ILogEntry>) NewEntries).Clear();
((IList<ILogEntry>) NewEntries).Clear();
}

GC.Collect();
Expand Down
Binary file added ThirdParty/nLog1/NLog.dll
Binary file not shown.
19 changes: 19 additions & 0 deletions nLog1Tester/NLog.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<targets>
<target name="console"
xsi:type="ColoredConsole"
layout="${message}" />
<target name="viewer"
xsi:type="NLogViewer"
address="udp://127.0.0.1:9999" />
</targets>

<rules>
<logger name="*"
minlevel="Debug"
writeTo="console,viewer" />
</rules>
</nlog>
36 changes: 36 additions & 0 deletions nLog1Tester/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace nLog1Tester
{
using System;
using System.Threading;

class Program
{
private static readonly NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();

private static readonly Random random = new Random();

static void Main()
{
for (int i = 0; i < 1000; i++)
{
log.Trace("Trace message {0}", i);
Thread.Sleep(random.Next(100));
log.Debug("Debug message {0}", i);
Thread.Sleep(random.Next(100));
log.Warn("Warn message {0}", i);
Thread.Sleep(random.Next(100));
log.Info("Info message {0}", i);
Thread.Sleep(random.Next(100));
log.Error("Error message {0}", i);
Thread.Sleep(random.Next(100));
log.Fatal("Fatal message {0}", i);
Thread.Sleep(random.Next(100));
}
}
}
}
36 changes: 36 additions & 0 deletions nLog1Tester/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("nLog1Tester")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("nLog1Tester")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7653b81c-b335-40e1-a607-6febb999d3ed")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
64 changes: 64 additions & 0 deletions nLog1Tester/nLog1Tester.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{44D1E267-AE99-43BE-B824-980B4ABFF9CA}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>nLog1Tester</RootNamespace>
<AssemblyName>nLog1Tester</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="NLog, Version=1.0.0.505, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\ThirdParty\nLog1\NLog.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="NLog.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

0 comments on commit c8388c3

Please sign in to comment.