Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Import ServiceStack.Logging

  • Loading branch information...
commit f1702bc5a23222731536abc461761b64b7925a24 0 parents
@mythz mythz authored
Showing with 10,004 additions and 0 deletions.
  1. +6 −0 .gitignore
  2. +22 −0 README.md
  3. +7 −0 build/deploy.bat
  4. BIN  lib/ServiceStack.Interfaces.dll
  5. BIN  lib/log4net.1.2.9.dll
  6. BIN  lib/log4net.dll
  7. BIN  lib/tests/Rhino.Mocks.dll
  8. +8,127 −0 lib/tests/Rhino.Mocks.xml
  9. BIN  lib/tests/nunit.framework.dll
  10. +36 −0 src/BuildFile.xml
  11. +50 −0 src/ServiceStack.Logging.EventLog/EventLogFactory.cs
  12. +227 −0 src/ServiceStack.Logging.EventLog/EventLogger.cs
  13. +35 −0 src/ServiceStack.Logging.EventLog/Properties/AssemblyInfo.cs
  14. +107 −0 src/ServiceStack.Logging.EventLog/ServiceStack.Logging.EventLog.csproj
  15. +47 −0 src/ServiceStack.Logging.Log4Net/Log4NetFactory.cs
  16. +173 −0 src/ServiceStack.Logging.Log4Net/Log4NetLogger.cs
  17. +35 −0 src/ServiceStack.Logging.Log4Net/Properties/AssemblyInfo.cs
  18. +111 −0 src/ServiceStack.Logging.Log4Net/ServiceStack.Logging.Log4Net.csproj
  19. +5 −0 src/ServiceStack.Logging.Log4Net/ServiceStack.Logging.Log4Net.csproj.user
  20. +47 −0 src/ServiceStack.Logging.Log4Netv129/Log4NetFactory.cs
  21. +179 −0 src/ServiceStack.Logging.Log4Netv129/Log4NetLogger.cs
  22. +35 −0 src/ServiceStack.Logging.Log4Netv129/Properties/AssemblyInfo.cs
  23. +111 −0 src/ServiceStack.Logging.Log4Netv129/ServiceStack.Logging.Log4Netv129.csproj
  24. +58 −0 src/ServiceStack.Logging.sln
  25. +55 −0 src/dashboard.build
  26. +35 −0 tests/ServiceStack.Logging.Tests/Properties/AssemblyInfo.cs
  27. +138 −0 tests/ServiceStack.Logging.Tests/ServiceStack.Logging.Tests.csproj
  28. +5 −0 tests/ServiceStack.Logging.Tests/ServiceStack.Logging.Tests.csproj.user
  29. +46 −0 tests/ServiceStack.Logging.Tests/Support/TestBase.cs
  30. +51 −0 tests/ServiceStack.Logging.Tests/UnitTests/DebugLoggerTests.cs
  31. +24 −0 tests/ServiceStack.Logging.Tests/UnitTests/EventLogFactoryTests.cs
  32. +63 −0 tests/ServiceStack.Logging.Tests/UnitTests/EventLoggerTests.cs
  33. +23 −0 tests/ServiceStack.Logging.Tests/UnitTests/Log4NetFactoryTests.cs
  34. +51 −0 tests/ServiceStack.Logging.Tests/UnitTests/Log4NetLoggerTests.cs
  35. +38 −0 tests/ServiceStack.Logging.Tests/UnitTests/LogManagerTests.cs
  36. +9 −0 tests/ServiceStack.Logging.Tests/UnitTests/UnitTestBase.cs
  37. +10 −0 tests/ServiceStack.Logging.Tests/UseCases/UseCaseBase.cs
  38. +19 −0 tests/ServiceStack.Logging.Tests/UseCases/UsingEventLog.cs
  39. +19 −0 tests/ServiceStack.Logging.Tests/UseCases/UsingLog4Net.cs
6 .gitignore
@@ -0,0 +1,6 @@
+.suo
+bin/
+obj/
+_ReSharper.ServiceStack.Logging/
+.idea/
+release/
22 README.md
@@ -0,0 +1,22 @@
+##ServiceStack.Logging an implementation and dependency-free logging interface to bind to.
+
+Even in the spirit of *Bind to interfaces, not implemenations*, many .NET projects still have
+a hard dependency to [log4net](http://logging.apache.org/log4net/index.html).
+
+Although log4net is the standard for logging in .NET, potential problems can arise from your libraries having a hard dependency on it:
+
+* Your library needs to be shipped with a third-party dependency
+* Potential conflicts can occur when different libraries have dependency on different versions of log4net (e.g. the 1.2.9 / 1.2.10 dependency problem).
+* You may want to use a different logging provider (i.e. network distributed logging)
+* You want your logging for Unit and Integration tests to redirect to the Console or Debug logger without any configuraiton.
+
+ServiceStack.Logging solves these problems by providing an implementation-free ILog interface that your application logic can bind to
+where your Application Host project can bind to the concrete logging implementation at deploy or runtime.
+
+ServiceStack.Logging also includes adapters for the following logging providers:
+
+* Log4Net 1.2.10+
+* Log4Net 1.2.9
+* EventLog
+* Console Log
+* Debug Log
7 build/deploy.bat
@@ -0,0 +1,7 @@
+COPY ..\src\ServiceStack.Logging.EventLog\bin\Release\ServiceStack.Logging.EventLog.* release\ServiceStack.Logging\EventLog
+COPY ..\src\ServiceStack.Logging.Log4Net\bin\Release\ServiceStack.Logging.Log4Net.* release\ServiceStack.Logging\Log4Net
+COPY ..\src\ServiceStack.Logging.Log4Netv129\bin\Release\ServiceStack.Logging.Log4Netv129.* release\ServiceStack.Logging\Log4Netv129
+COPY ..\lib\log4net.1.2.9.dll release\ServiceStack.Logging\Log4Netv129
+COPY ..\lib\log4net.dll release\ServiceStack.Logging\Log4Net
+COPY ..\lib\ServiceStack.Interfaces.dll release\ServiceStack.Logging
+
BIN  lib/ServiceStack.Interfaces.dll
Binary file not shown
BIN  lib/log4net.1.2.9.dll
Binary file not shown
BIN  lib/log4net.dll
Binary file not shown
BIN  lib/tests/Rhino.Mocks.dll
Binary file not shown
8,127 lib/tests/Rhino.Mocks.xml
8,127 additions, 0 deletions not shown
BIN  lib/tests/nunit.framework.dll
Binary file not shown
36 src/BuildFile.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <!-- Import the MSBuild Tasks -->
+ <Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <ClassLibraryOutputDirectory>bin\$(Configuration)</ClassLibraryOutputDirectory>
+ <ProjectDir Condition=" '$(ProjectDir)' == '' ">Null</ProjectDir >
+ <ProjectFileRoot Condition=" '$(ProjectFileRoot)' == '' ">Null</ProjectFileRoot >
+ <ProjectTestDir>$(ProjectDir)\$(ProjectFileRoot).Tests</ProjectTestDir >
+<!-- <ProjectTestDir>$(ProjectDir)\$(ProjectFileRoot).Tests.Integration</ProjectTestDir >-->
+ <ProjectFile>$(ProjectDir)\$(ProjectFileRoot).sln</ProjectFile >
+ <TestProjectFile>$(ProjectTestDir)\$(ProjectFileRoot).Tests.csproj</TestProjectFile >
+<!-- <TestProjectFile>$(ProjectTestDir)\$(ProjectFileRoot).Tests.Integration.csproj</TestProjectFile >-->
+ </PropertyGroup>
+
+ <!-- Build projects by calling the Project files generated by VS -->
+ <Target Name="Build">
+ <MSBuild Projects="$(ProjectFile)" />
+ <MSBuild Projects="$(TestProjectFile)" />
+ </Target>
+
+ <!-- Run Unit tests -->
+ <UsingTask TaskName="BuildTeamCityNUnitArguments" AssemblyFile="C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild\Lib\Brion.MSBuildTasks\Brion.MSBuildTasks.dll"/>
+ <Target Name="Test" DependsOnTargets="Build">
+ <CreateItem Include="$(ProjectDir)\**\bin\$(Configuration)\*Tests*.dll" >
+ <Output TaskParameter="Include" ItemName="TestAssemblies" />
+ </CreateItem>
+ <BuildTeamCityNUnitArguments HaltOnError="true" HaltOnFirstTestFailure="true"
+ HaltOnFailureAtEnd="true" TestAssemblies="@(TestAssemblies)"
+ NUnitResultsOutputFolder="$(ProjectDir)\TestResults"
+ PathOfNUnitArgumentsXmlFile="$(ProjectDir)\nunitarguments.xml" />
+ <Exec Command="D:\BuildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher.exe @@ $(ProjectDir)\nunitarguments.xml" />
+ </Target>
+</Project>
+
50 src/ServiceStack.Logging.EventLog/EventLogFactory.cs
@@ -0,0 +1,50 @@
+using System;
+
+namespace ServiceStack.Logging.EventLog
+{
+ /// <summary>
+ /// ILogFactory used to create an EventLogger
+ /// </summary>
+ public class EventLogFactory : ILogFactory
+ {
+ private readonly string eventLogName;
+ private readonly string eventLogSource;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="EventLogFactory"/> class.
+ /// </summary>
+ /// <param name="eventLogName">Name of the event log.</param>
+ public EventLogFactory(string eventLogName) : this(eventLogName, null) { }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="EventLogFactory"/> class.
+ /// </summary>
+ /// <param name="eventLogName">Name of the event log. Default is 'ServiceStack.Logging.EventLog'</param>
+ /// <param name="eventLogSource">The event log source. Default is 'Application'</param>
+ public EventLogFactory(string eventLogName, string eventLogSource)
+ {
+ this.eventLogName = eventLogName ?? "ServiceStack.Logging.EventLog";
+ this.eventLogSource = eventLogSource ?? "Application";
+ }
+
+ /// <summary>
+ /// Gets the logger.
+ /// </summary>
+ /// <param name="type">The type.</param>
+ /// <returns></returns>
+ public ILog GetLogger(Type type)
+ {
+ return GetLogger(type.ToString());
+ }
+
+ /// <summary>
+ /// Gets the logger.
+ /// </summary>
+ /// <param name="typeName">Name of the type.</param>
+ /// <returns></returns>
+ public ILog GetLogger(string typeName)
+ {
+ return new EventLogger(eventLogName, eventLogSource);
+ }
+ }
+}
227 src/ServiceStack.Logging.EventLog/EventLogger.cs
@@ -0,0 +1,227 @@
+using System;
+using System.Diagnostics;
+using System.Text;
+
+namespace ServiceStack.Logging.EventLog
+{
+ /// <summary>
+ /// ILog used to write to the Event Log
+ /// </summary>
+ public class EventLogger : ILog
+ {
+ private const string NEW_LINE = "\r\n\r\n";
+ private const string ERROR_MSG = "An error occurred in the application: {0}\r\nException: {1}";
+
+ private readonly string eventLogSource;
+ private readonly string eventLogName;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="EventLogger"/> class.
+ /// </summary>
+ /// <param name="eventLogName">Name of the event log.</param>
+ /// <param name="eventLogSource">The event log source.</param>
+ public EventLogger(string eventLogName, string eventLogSource)
+ {
+ if (string.IsNullOrEmpty(eventLogName))
+ {
+ throw new ArgumentNullException("eventLogName");
+ }
+ if (string.IsNullOrEmpty(eventLogSource))
+ {
+ throw new ArgumentNullException("eventLogSource");
+ }
+ this.eventLogName = eventLogName;
+ this.eventLogSource = eventLogSource;
+ }
+
+ public bool IsDebugEnabled { get { return true; } }
+
+ /// <summary>
+ /// Writes the specified message.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ /// <param name="eventLogType">Type of the event log.</param>
+ private void Write(object message, EventLogEntryType eventLogType)
+ {
+ Write(message, null, eventLogType);
+ }
+
+ /// <summary>
+ /// Writes the specified message.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ /// <param name="execption">The execption.</param>
+ /// <param name="eventLogType">Type of the event log.</param>
+ private void Write(object message, Exception execption, EventLogEntryType eventLogType)
+ {
+ StringBuilder sb = new StringBuilder();
+
+ System.Diagnostics.EventLog eventLogger = new System.Diagnostics.EventLog();
+ if (!System.Diagnostics.EventLog.SourceExists(eventLogName))
+ {
+ System.Diagnostics.EventLog.CreateEventSource(eventLogName, eventLogSource);
+ }
+
+ sb.Append(message).Append(NEW_LINE);
+ while (execption != null)
+ {
+ sb.Append("Message: ").Append(execption.Message).Append(NEW_LINE)
+ .Append("Source: ").Append(execption.Source).Append(NEW_LINE)
+ .Append("Target site: ").Append(execption.TargetSite).Append(NEW_LINE)
+ .Append("Stack trace: ").Append(execption.StackTrace).Append(NEW_LINE);
+
+ // Walk the InnerException tree
+ execption = execption.InnerException;
+ }
+
+ eventLogger.Source = eventLogName;
+ eventLogger.WriteEntry(String.Format(ERROR_MSG, eventLogSource, sb), eventLogType);
+ }
+
+ /// <summary>
+ /// Logs a Debug message.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ public void Debug(object message)
+ {
+ Write("DEBUG: " + message, EventLogEntryType.Information);
+ }
+
+ /// <summary>
+ /// Logs a Debug message and exception.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ /// <param name="exception">The exception.</param>
+ public void Debug(object message, Exception exception)
+ {
+ Write("DEBUG: " + message, exception, EventLogEntryType.Information);
+ }
+
+ /// <summary>
+ /// Logs a Debug format message.
+ /// </summary>
+ /// <param name="format">The format.</param>
+ /// <param name="args">The args.</param>
+ public void DebugFormat(string format, params object[] args)
+ {
+ Write("DEBUG: " + string.Format(format, args), EventLogEntryType.Information);
+ }
+
+ /// <summary>
+ /// Logs a Error message.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ public void Error(object message)
+ {
+ Write("ERROR: " + message, EventLogEntryType.Error);
+ }
+
+ /// <summary>
+ /// Logs a Error message and exception.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ /// <param name="exception">The exception.</param>
+ public void Error(object message, Exception exception)
+ {
+ Write("ERROR: " + message, exception, EventLogEntryType.Error);
+ }
+
+ /// <summary>
+ /// Logs a Error format message.
+ /// </summary>
+ /// <param name="format">The format.</param>
+ /// <param name="args">The args.</param>
+ public void ErrorFormat(string format, params object[] args)
+ {
+ Write("ERROR: " + string.Format(format, args), EventLogEntryType.Error);
+ }
+
+ /// <summary>
+ /// Logs a Fatal message.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ public void Fatal(object message)
+ {
+ Write("FATAL: " + message, EventLogEntryType.Error);
+ }
+
+ /// <summary>
+ /// Logs a Fatal message and exception.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ /// <param name="exception">The exception.</param>
+ public void Fatal(object message, Exception exception)
+ {
+ Write("FATAL: " + message, exception, EventLogEntryType.Error);
+ }
+
+ /// <summary>
+ /// Logs a Error format message.
+ /// </summary>
+ /// <param name="format">The format.</param>
+ /// <param name="args">The args.</param>
+ public void FatalFormat(string format, params object[] args)
+ {
+ Write("FATAL: " + string.Format(format, args), EventLogEntryType.Error);
+ }
+
+ /// <summary>
+ /// Logs an Info message and exception.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ public void Info(object message)
+ {
+ Write("INFO: " + message, EventLogEntryType.Information);
+ }
+
+ /// <summary>
+ /// Logs an Info message and exception.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ /// <param name="exception">The exception.</param>
+ public void Info(object message, Exception exception)
+ {
+ Write("INFO: " + message, exception, EventLogEntryType.Information);
+ }
+
+ /// <summary>
+ /// Logs an Info format message.
+ /// </summary>
+ /// <param name="format">The format.</param>
+ /// <param name="args">The args.</param>
+ public void InfoFormat(string format, params object[] args)
+ {
+ Write("INFO: " + string.Format(format, args), EventLogEntryType.Information);
+ }
+
+ /// <summary>
+ /// Logs a Warning message.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ public void Warn(object message)
+ {
+ Write("WARN: " + message, EventLogEntryType.Warning);
+ }
+
+ /// <summary>
+ /// Logs a Warning message and exception.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ /// <param name="exception">The exception.</param>
+ public void Warn(object message, Exception exception)
+ {
+ Write("WARN: " + message, exception, EventLogEntryType.Warning);
+ }
+
+ /// <summary>
+ /// Logs a Warning format message.
+ /// </summary>
+ /// <param name="format">The format.</param>
+ /// <param name="args">The args.</param>
+ public void WarnFormat(string format, params object[] args)
+ {
+ Write("WARN: " + string.Format(format, args), EventLogEntryType.Warning);
+ }
+
+ }
+}
35 src/ServiceStack.Logging.EventLog/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
+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("ServiceStack.Logging.EventLog")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("ServiceStack")]
+[assembly: AssemblyProduct("ServiceStack.Logging.EventLog")]
+[assembly: AssemblyCopyright("Copyright © ServiceStack 2008")]
+[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("350720fd-3394-4b99-b09e-bc8336c502ad")]
+
+// 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 Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
107 src/ServiceStack.Logging.EventLog/ServiceStack.Logging.EventLog.csproj
@@ -0,0 +1,107 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.30729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{D920BA88-E394-4C75-94E3-78D7298A8457}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>ServiceStack.Logging.EventLog</RootNamespace>
+ <AssemblyName>ServiceStack.Logging.EventLog</AssemblyName>
+ <SccProjectName>
+ </SccProjectName>
+ <SccLocalPath>
+ </SccLocalPath>
+ <SccAuxPath>
+ </SccAuxPath>
+ <SccProvider>
+ </SccProvider>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>2.0</OldToolsVersion>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ <PublishUrl>publish\</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>0</ApplicationRevision>
+ <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <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|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="ServiceStack.Interfaces, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\ServiceStack.Interfaces.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="EventLogFactory.cs" />
+ <Compile Include="EventLogger.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework Client Profile</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 2.0 %28x86%29</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.0 %28x86%29</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\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>
47 src/ServiceStack.Logging.Log4Net/Log4NetFactory.cs
@@ -0,0 +1,47 @@
+using System;
+
+namespace ServiceStack.Logging.Log4Net
+{
+ /// <summary>
+ /// ILogFactory that creates an Log4Net ILog logger
+ /// </summary>
+ public class Log4NetFactory : ILogFactory
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Log4NetFactory"/> class.
+ /// </summary>
+ public Log4NetFactory() : this(false) { }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Log4NetFactory"/> class.
+ /// </summary>
+ /// <param name="configureLog4Net">if set to <c>true</c> [will use the xml definition in App.Config to configure log4 net].</param>
+ public Log4NetFactory(bool configureLog4Net)
+ {
+ if (configureLog4Net)
+ {
+ log4net.Config.XmlConfigurator.Configure();
+ }
+ }
+
+ /// <summary>
+ /// Gets the logger.
+ /// </summary>
+ /// <param name="type">The type.</param>
+ /// <returns></returns>
+ public ILog GetLogger(Type type)
+ {
+ return new Log4NetLogger(type);
+ }
+
+ /// <summary>
+ /// Gets the logger.
+ /// </summary>
+ /// <param name="typeName">Name of the type.</param>
+ /// <returns></returns>
+ public ILog GetLogger(string typeName)
+ {
+ return new Log4NetLogger(typeName);
+ }
+ }
+}
173 src/ServiceStack.Logging.Log4Net/Log4NetLogger.cs
@@ -0,0 +1,173 @@
+using System;
+
+namespace ServiceStack.Logging.Log4Net
+{
+ /// <summary>
+ /// Wrapper over the log4net.1.2.10 and above logger
+ /// </summary>
+ public class Log4NetLogger : ILog
+ {
+ private readonly log4net.ILog log;
+
+ public Log4NetLogger(string typeName)
+ {
+ log = log4net.LogManager.GetLogger(typeName);
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Log4NetLogger"/> class.
+ /// </summary>
+ /// <param name="type">The type.</param>
+ public Log4NetLogger(Type type)
+ {
+ log = log4net.LogManager.GetLogger(type);
+ }
+
+ public bool IsDebugEnabled { get { return log.IsDebugEnabled; } }
+
+ /// <summary>
+ /// Logs a Debug message.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ public void Debug(object message)
+ {
+ log.Debug(message);
+ }
+
+ /// <summary>
+ /// Logs a Debug message and exception.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ /// <param name="exception">The exception.</param>
+ public void Debug(object message, Exception exception)
+ {
+ log.Debug(message, exception);
+ }
+
+ /// <summary>
+ /// Logs a Debug format message.
+ /// </summary>
+ /// <param name="format">The format.</param>
+ /// <param name="args">The args.</param>
+ public void DebugFormat(string format, params object[] args)
+ {
+ log.DebugFormat(format, args);
+ }
+
+ /// <summary>
+ /// Logs a Error message.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ public void Error(object message)
+ {
+ log.Error(message);
+ }
+
+ /// <summary>
+ /// Logs a Error message and exception.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ /// <param name="exception">The exception.</param>
+ public void Error(object message, Exception exception)
+ {
+ log.Error(message, exception);
+ }
+
+ /// <summary>
+ /// Logs a Error format message.
+ /// </summary>
+ /// <param name="format">The format.</param>
+ /// <param name="args">The args.</param>
+ public void ErrorFormat(string format, params object[] args)
+ {
+ log.ErrorFormat(format, args);
+ }
+
+ /// <summary>
+ /// Logs a Fatal message.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ public void Fatal(object message)
+ {
+ log.Fatal(message);
+ }
+
+ /// <summary>
+ /// Logs a Fatal message and exception.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ /// <param name="exception">The exception.</param>
+ public void Fatal(object message, Exception exception)
+ {
+ log.Fatal(message, exception);
+ }
+
+ /// <summary>
+ /// Logs a Error format message.
+ /// </summary>
+ /// <param name="format">The format.</param>
+ /// <param name="args">The args.</param>
+ public void FatalFormat(string format, params object[] args)
+ {
+ log.FatalFormat(format, args);
+ }
+
+ /// <summary>
+ /// Logs an Info message and exception.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ public void Info(object message)
+ {
+ log.Info(message);
+ }
+
+ /// <summary>
+ /// Logs an Info message and exception.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ /// <param name="exception">The exception.</param>
+ public void Info(object message, Exception exception)
+ {
+ log.Info(message, exception);
+ }
+
+ /// <summary>
+ /// Logs an Info format message.
+ /// </summary>
+ /// <param name="format">The format.</param>
+ /// <param name="args">The args.</param>
+ public void InfoFormat(string format, params object[] args)
+ {
+ log.InfoFormat(format, args);
+ }
+
+ /// <summary>
+ /// Logs a Warning message.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ public void Warn(object message)
+ {
+ log.Warn(message);
+ }
+
+ /// <summary>
+ /// Logs a Warning message and exception.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ /// <param name="exception">The exception.</param>
+ public void Warn(object message, Exception exception)
+ {
+ log.Warn(message, exception);
+ }
+
+ /// <summary>
+ /// Logs a Warning format message.
+ /// </summary>
+ /// <param name="format">The format.</param>
+ /// <param name="args">The args.</param>
+ public void WarnFormat(string format, params object[] args)
+ {
+ log.WarnFormat(format, args);
+ }
+ }
+}
35 src/ServiceStack.Logging.Log4Net/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
+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("ServiceStack.Logging.Log4Net")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("ServiceStack")]
+[assembly: AssemblyProduct("ServiceStack.Logging.Log4Net")]
+[assembly: AssemblyCopyright("Copyright © ServiceStack 2008")]
+[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("d575bdba-a6db-464c-8c41-bd0694b79b02")]
+
+// 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 Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyFileVersion("1.0.*")]
111 src/ServiceStack.Logging.Log4Net/ServiceStack.Logging.Log4Net.csproj
@@ -0,0 +1,111 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.30729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{C44A6E80-326E-4036-8906-62E881F4727D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>ServiceStack.Logging.Log4Net</RootNamespace>
+ <AssemblyName>ServiceStack.Logging.Log4Net</AssemblyName>
+ <SccProjectName>
+ </SccProjectName>
+ <SccLocalPath>
+ </SccLocalPath>
+ <SccAuxPath>
+ </SccAuxPath>
+ <SccProvider>
+ </SccProvider>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>2.0</OldToolsVersion>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ <PublishUrl>publish\</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>0</ApplicationRevision>
+ <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <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|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\log4net.dll</HintPath>
+ </Reference>
+ <Reference Include="ServiceStack.Interfaces, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\ServiceStack.Interfaces.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Log4NetFactory.cs" />
+ <Compile Include="Log4NetLogger.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework Client Profile</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 2.0 %28x86%29</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.0 %28x86%29</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\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>
5 src/ServiceStack.Logging.Log4Net/ServiceStack.Logging.Log4Net.csproj.user
@@ -0,0 +1,5 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectView>ProjectFiles</ProjectView>
+ </PropertyGroup>
+</Project>
47 src/ServiceStack.Logging.Log4Netv129/Log4NetFactory.cs
@@ -0,0 +1,47 @@
+using System;
+
+namespace ServiceStack.Logging.Log4Net
+{
+ /// <summary>
+ /// Wrapper over the log4net.1.2.10 and above logger
+ /// </summary>
+ public class Log4NetFactory : ILogFactory
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Log4NetFactory"/> class.
+ /// </summary>
+ public Log4NetFactory() : this(false) { }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Log4NetFactory"/> class.
+ /// </summary>
+ /// <param name="configureLog4Net">if set to <c>true</c> [will use the xml definition in App.Config to configure log4 net].</param>
+ public Log4NetFactory(bool configureLog4Net)
+ {
+ if (configureLog4Net)
+ {
+ log4net.Config.XmlConfigurator.Configure();
+ }
+ }
+
+ /// <summary>
+ /// Gets the logger.
+ /// </summary>
+ /// <param name="type">The type.</param>
+ /// <returns></returns>
+ public ILog GetLogger(Type type)
+ {
+ return new Log4NetLogger(type);
+ }
+
+ /// <summary>
+ /// Gets the logger.
+ /// </summary>
+ /// <param name="typeName">Name of the type.</param>
+ /// <returns></returns>
+ public ILog GetLogger(string typeName)
+ {
+ return new Log4NetLogger(typeName);
+ }
+ }
+}
179 src/ServiceStack.Logging.Log4Netv129/Log4NetLogger.cs
@@ -0,0 +1,179 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ServiceStack.Logging.Log4Net
+{
+ /// <summary>
+ /// Log4Net v1.2.9 and below ILog logger
+ /// </summary>
+ public class Log4NetLogger : ILog
+ {
+ private readonly log4net.ILog log;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Log4NetLogger"/> class.
+ /// </summary>
+ /// <param name="typeName">Name of the type.</param>
+ public Log4NetLogger(string typeName)
+ {
+ log = log4net.LogManager.GetLogger(typeName);
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Log4NetLogger"/> class.
+ /// </summary>
+ /// <param name="type">The type.</param>
+ public Log4NetLogger(Type type)
+ {
+ log = log4net.LogManager.GetLogger(type);
+ }
+
+ public bool IsDebugEnabled { get { return log.IsDebugEnabled; } }
+
+ /// <summary>
+ /// Logs a Debug message.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ public void Debug(object message)
+ {
+ log.Debug(message);
+ }
+
+ /// <summary>
+ /// Logs a Debug message and exception.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ /// <param name="exception">The exception.</param>
+ public void Debug(object message, Exception exception)
+ {
+ log.Debug(message, exception);
+ }
+
+ /// <summary>
+ /// Logs a Debug format message.
+ /// </summary>
+ /// <param name="format">The format.</param>
+ /// <param name="args">The args.</param>
+ public void DebugFormat(string format, params object[] args)
+ {
+ log.DebugFormat(format, args);
+ }
+
+ /// <summary>
+ /// Logs a Error message.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ public void Error(object message)
+ {
+ log.Error(message);
+ }
+
+ /// <summary>
+ /// Logs a Error message and exception.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ /// <param name="exception">The exception.</param>
+ public void Error(object message, Exception exception)
+ {
+ log.Error(message, exception);
+ }
+
+ /// <summary>
+ /// Logs a Error format message.
+ /// </summary>
+ /// <param name="format">The format.</param>
+ /// <param name="args">The args.</param>
+ public void ErrorFormat(string format, params object[] args)
+ {
+ log.ErrorFormat(format, args);
+ }
+
+ /// <summary>
+ /// Logs a Fatal message.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ public void Fatal(object message)
+ {
+ log.Fatal(message);
+ }
+
+ /// <summary>
+ /// Logs a Fatal message and exception.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ /// <param name="exception">The exception.</param>
+ public void Fatal(object message, Exception exception)
+ {
+ log.Fatal(message, exception);
+ }
+
+ /// <summary>
+ /// Logs a Error format message.
+ /// </summary>
+ /// <param name="format">The format.</param>
+ /// <param name="args">The args.</param>
+ public void FatalFormat(string format, params object[] args)
+ {
+ log.FatalFormat(format, args);
+ }
+
+ /// <summary>
+ /// Logs an Info message and exception.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ public void Info(object message)
+ {
+ log.Info(message);
+ }
+
+ /// <summary>
+ /// Logs an Info message and exception.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ /// <param name="exception">The exception.</param>
+ public void Info(object message, Exception exception)
+ {
+ log.Info(message, exception);
+ }
+
+ /// <summary>
+ /// Logs an Info format message.
+ /// </summary>
+ /// <param name="format">The format.</param>
+ /// <param name="args">The args.</param>
+ public void InfoFormat(string format, params object[] args)
+ {
+ log.InfoFormat(format, args);
+ }
+
+ /// <summary>
+ /// Logs a Warning message.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ public void Warn(object message)
+ {
+ log.Warn(message);
+ }
+
+ /// <summary>
+ /// Logs a Warning message and exception.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ /// <param name="exception">The exception.</param>
+ public void Warn(object message, Exception exception)
+ {
+ log.Warn(message, exception);
+ }
+
+ /// <summary>
+ /// Logs a Warning format message.
+ /// </summary>
+ /// <param name="format">The format.</param>
+ /// <param name="args">The args.</param>
+ public void WarnFormat(string format, params object[] args)
+ {
+ log.WarnFormat(format, args);
+ }
+ }
+}
35 src/ServiceStack.Logging.Log4Netv129/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
+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("ServiceStack.Logging.Log4Netv129")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("ServiceStack")]
+[assembly: AssemblyProduct("ServiceStack.Logging.Log4Netv129")]
+[assembly: AssemblyCopyright("Copyright © ServiceStack 2008")]
+[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("3a98bbf3-94ef-40a8-9cd4-febb9752dd2b")]
+
+// 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 Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyFileVersion("1.0.*")]
111 src/ServiceStack.Logging.Log4Netv129/ServiceStack.Logging.Log4Netv129.csproj
@@ -0,0 +1,111 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.30729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{0E1FF796-55CF-4F9B-BA72-484FC9D65065}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>ServiceStack.Logging.Log4Net</RootNamespace>
+ <AssemblyName>ServiceStack.Logging.Log4Netv129</AssemblyName>
+ <SccProjectName>
+ </SccProjectName>
+ <SccLocalPath>
+ </SccLocalPath>
+ <SccAuxPath>
+ </SccAuxPath>
+ <SccProvider>
+ </SccProvider>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>2.0</OldToolsVersion>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ <PublishUrl>publish\</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>0</ApplicationRevision>
+ <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <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|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="log4net.1.2.9, Version=1.2.9.0, Culture=neutral, PublicKeyToken=b32731d11ce58905">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\log4net.1.2.9.dll</HintPath>
+ </Reference>
+ <Reference Include="ServiceStack.Interfaces, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\ServiceStack.Interfaces.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Log4NetFactory.cs" />
+ <Compile Include="Log4NetLogger.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework Client Profile</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 2.0 %28x86%29</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.0 %28x86%29</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\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>
58 src/ServiceStack.Logging.sln
@@ -0,0 +1,58 @@
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.Logging.EventLog", "ServiceStack.Logging.EventLog\ServiceStack.Logging.EventLog.csproj", "{D920BA88-E394-4C75-94E3-78D7298A8457}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.Logging.Log4Net", "ServiceStack.Logging.Log4Net\ServiceStack.Logging.Log4Net.csproj", "{C44A6E80-326E-4036-8906-62E881F4727D}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.Logging.Log4Netv129", "ServiceStack.Logging.Log4Netv129\ServiceStack.Logging.Log4Netv129.csproj", "{0E1FF796-55CF-4F9B-BA72-484FC9D65065}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.Logging.Tests", "..\tests\ServiceStack.Logging.Tests\ServiceStack.Logging.Tests.csproj", "{DDDA27EC-5855-4E89-9971-C117EC08BDE3}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {D920BA88-E394-4C75-94E3-78D7298A8457}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D920BA88-E394-4C75-94E3-78D7298A8457}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D920BA88-E394-4C75-94E3-78D7298A8457}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D920BA88-E394-4C75-94E3-78D7298A8457}.Release|Any CPU.Build.0 = Release|Any CPU
+ {C44A6E80-326E-4036-8906-62E881F4727D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C44A6E80-326E-4036-8906-62E881F4727D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C44A6E80-326E-4036-8906-62E881F4727D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C44A6E80-326E-4036-8906-62E881F4727D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {0E1FF796-55CF-4F9B-BA72-484FC9D65065}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0E1FF796-55CF-4F9B-BA72-484FC9D65065}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0E1FF796-55CF-4F9B-BA72-484FC9D65065}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0E1FF796-55CF-4F9B-BA72-484FC9D65065}.Release|Any CPU.Build.0 = Release|Any CPU
+ {DDDA27EC-5855-4E89-9971-C117EC08BDE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {DDDA27EC-5855-4E89-9971-C117EC08BDE3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {DDDA27EC-5855-4E89-9971-C117EC08BDE3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {DDDA27EC-5855-4E89-9971-C117EC08BDE3}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(TeamFoundationVersionControl) = preSolution
+ SccNumberOfProjects = 6
+ SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
+ SccTeamFoundationServer = http://wwldbms1021:8080/
+ SccLocalPath0 = .
+ SccProjectUniqueName1 = Bbc.Ww.Services.Logging\\Bbc.Ww.Services.Logging.csproj
+ SccProjectName1 = Bbc.Ww.Services.Logging
+ SccLocalPath1 = Bbc.Ww.Services.Logging
+ SccProjectUniqueName2 = Bbc.Ww.Services.Logging.Log4Net\\Bbc.Ww.Services.Logging.Log4Net.csproj
+ SccProjectName2 = Bbc.Ww.Services.Logging.Log4Net
+ SccLocalPath2 = Bbc.Ww.Services.Logging.Log4Net
+ SccProjectUniqueName3 = Bbc.Ww.Services.Logging.Log4Netv129\\Bbc.Ww.Services.Logging.Log4Netv129.csproj
+ SccProjectName3 = Bbc.Ww.Services.Logging.Log4Netv129
+ SccLocalPath3 = Bbc.Ww.Services.Logging.Log4Netv129
+ SccProjectUniqueName4 = Bbc.Ww.Services.Logging.Tests\\Bbc.Ww.Services.Logging.Tests.csproj
+ SccProjectName4 = Bbc.Ww.Services.Logging.Tests
+ SccLocalPath4 = Bbc.Ww.Services.Logging.Tests
+ SccProjectUniqueName5 = Bbc.Ww.Services.Logging.EventLog\\Bbc.Ww.Services.Logging.EventLog.csproj
+ SccProjectName5 = Bbc.Ww.Services.Logging.EventLog
+ SccLocalPath5 = Bbc.Ww.Services.Logging.EventLog
+ EndGlobalSection
+EndGlobal
55 src/dashboard.build
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<project name="compileAndGenerateDashboard">
+
+ <property name="dashboard.base.dir" value="C:\SvnProjects\tools\Bbc.Ww.DashboardAutomation\1.0.0.0" />
+
+ <property name="connection.string" value="Data Source=wwldbms7002;Initial Catalog=Bbc.Ww.DashboardAutomation;Uid=dashboard;Pwd=dashboard" />
+
+ <property name="base.dir" value="${project::get-base-directory()}" />
+ <property name="tools.dir" value="${dashboard.base.dir}\Tools" />
+ <property name="output.dir" value="${base.dir}\DashboardReport" />
+ <property name="working.dir" value="${output.dir}\working" />
+
+ <target name="compile">
+ <loadtasks assembly="${tools.dir}\NantContrib\NAnt.Contrib.Tasks.dll"/>
+ <msbuild project="${base.dir}\Bbc.Ww.Services.Logging.sln">
+ <property name="debug" value="true" />
+ </msbuild>
+ </target>
+
+ <target name="dashboard" depends="compile">
+
+ <mkdir dir="${working.dir}" />
+
+ <loadtasks assembly="${dashboard.base.dir}\Bbc.Ww.DashboardAutomation.Nant.Tasks.dll"/>
+
+ <dashboard
+ toolsDirectory="${tools.dir}"
+ workingDirectory="${working.dir}"
+ reportPath="${output.dir}\dashboard.xml"
+ connectionString="${connection.string}"
+ solutionName="Bbc.Ww.Services.Logging"
+ >
+ <appAssemblies>
+ <include name="Bbc.Ww.Services.Logging.Tests\bin\debug\Bbc.Ww.Services.*.dll" />
+ <!-- remove this one when josh has fixed his bug -->
+ <exclude name="Bbc.Ww.Services.Logging.Tests\bin\debug\Bbc.Ww.Services.Logging.dll" />
+ <exclude name="Bbc.Ww.Services.Logging.Tests\bin\debug\Bbc.Ww.Services.Logging.Tests.dll" />
+ </appAssemblies>
+ <unitTestAssemblies>
+ <include name="Bbc.Ww.Services.Logging.Tests\bin\debug\Bbc.Ww.Services.Logging.Tests.dll" />
+ <include name="Bbc.Ww.Services.Logging.Tests\bin\debug\log4net.dll" />
+ </unitTestAssemblies>
+ </dashboard>
+
+ <copy todir="${output.dir}">
+ <fileset basedir="${dashboard.base.dir}\style">
+ <include name="**\*.*" />
+ </fileset>
+ </copy>
+
+ <copy file="${output.dir}\dashboard.xml" tofile="\\wwlis7004\e$\Projects\Dashboards\Bbc.Ww.Services.Logging.xml" />
+
+ </target>
+
+</project>
35 tests/ServiceStack.Logging.Tests/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
+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("ServiceStack.Logging.Tests")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("ServiceStack")]
+[assembly: AssemblyProduct("ServiceStack.Logging.Tests")]
+[assembly: AssemblyCopyright("Copyright © ServiceStack 2008")]
+[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("391f0578-ea4b-43c1-9409-d8dce2d68a71")]
+
+// 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 Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
138 tests/ServiceStack.Logging.Tests/ServiceStack.Logging.Tests.csproj
@@ -0,0 +1,138 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.30729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{DDDA27EC-5855-4E89-9971-C117EC08BDE3}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>ServiceStack.Logging.Tests</RootNamespace>
+ <AssemblyName>ServiceStack.Logging.Tests</AssemblyName>
+ <SccProjectName>
+ </SccProjectName>
+ <SccLocalPath>
+ </SccLocalPath>
+ <SccAuxPath>
+ </SccAuxPath>
+ <SccProvider>
+ </SccProvider>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>2.0</OldToolsVersion>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ <PublishUrl>publish\</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>0</ApplicationRevision>
+ <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <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|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\log4net.dll</HintPath>
+ </Reference>
+ <Reference Include="nunit.framework, Version=2.4.1.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\tests\nunit.framework.dll</HintPath>
+ </Reference>
+ <Reference Include="Rhino.Mocks, Version=3.4.0.0, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\tests\Rhino.Mocks.dll</HintPath>
+ </Reference>
+ <Reference Include="ServiceStack.Interfaces, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\ServiceStack.Interfaces.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Support\TestBase.cs" />
+ <Compile Include="UnitTests\EventLoggerTests.cs" />
+ <Compile Include="UnitTests\EventLogFactoryTests.cs" />
+ <Compile Include="UnitTests\DebugLoggerTests.cs" />
+ <Compile Include="UnitTests\Log4NetFactoryTests.cs" />
+ <Compile Include="UnitTests\Log4NetLoggerTests.cs" />
+ <Compile Include="UnitTests\LogManagerTests.cs" />
+ <Compile Include="UnitTests\UnitTestBase.cs" />
+ <Compile Include="UseCases\UsingEventLog.cs" />
+ <Compile Include="UseCases\UseCaseBase.cs" />
+ <Compile Include="UseCases\UsingLog4Net.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework Client Profile</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 2.0 %28x86%29</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.0 %28x86%29</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\src\ServiceStack.Logging.EventLog\ServiceStack.Logging.EventLog.csproj">
+ <Project>{D920BA88-E394-4C75-94E3-78D7298A8457}</Project>
+ <Name>ServiceStack.Logging.EventLog</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\src\ServiceStack.Logging.Log4Net\ServiceStack.Logging.Log4Net.csproj">
+ <Project>{C44A6E80-326E-4036-8906-62E881F4727D}</Project>
+ <Name>ServiceStack.Logging.Log4Net</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\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>
5 tests/ServiceStack.Logging.Tests/ServiceStack.Logging.Tests.csproj.user
@@ -0,0 +1,5 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectView>ProjectFiles</ProjectView>
+ </PropertyGroup>
+</Project>
46 tests/ServiceStack.Logging.Tests/Support/TestBase.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Diagnostics;
+using NUnit.Framework;
+using Rhino.Mocks;
+
+namespace ServiceStack.Logging.Tests.Support
+{
+ public class TestBase
+ {
+ private MockRepository mocks;
+
+ protected virtual MockRepository Mocks
+ {
+ get { return mocks; }
+ }
+
+ [SetUp]
+ protected virtual void SetUp()
+ {
+ mocks = new MockRepository();
+ }
+
+ [TearDown]
+ protected virtual void TearDown()
+ {
+ mocks = null;
+ }
+
+ protected virtual void ReplayAll()
+ {
+ Mocks.ReplayAll();
+ }
+
+ protected virtual void VerifyAll()
+ {
+ try
+ {
+ Mocks.VerifyAll();
+ }
+ catch (InvalidOperationException ex)
+ {
+ Debug.Print("InvalidOperationException thrown: {0}", ex.Message);
+ }
+ }
+ }
+}
51 tests/ServiceStack.Logging.Tests/UnitTests/DebugLoggerTests.cs
@@ -0,0 +1,51 @@
+using System;
+using ServiceStack.Logging.Support.Logging;
+using NUnit.Framework;
+
+namespace ServiceStack.Logging.Tests.UnitTests
+{
+ [TestFixture]
+ public class DebugLoggerTests
+ {
+ [Test]
+ public void Log4NetLoggerTest()
+ {
+ ILog log = new DebugLogger(GetType());
+ Assert.IsNotNull(log);
+
+ log = new DebugLogger(GetType().Name);
+ Assert.IsNotNull(log);
+ }
+
+ [Test]
+ public void DebugLogger_LoggingTest()
+ {
+ string message = "Error Message";
+ Exception ex = new Exception();
+ string messageFormat = "Message Format: message: {0}, exception: {1}";
+
+ ILog log = new DebugLogger(GetType());
+ Assert.IsNotNull(log);
+
+ log.Debug(message);
+ log.Debug(message, ex);
+ log.DebugFormat(messageFormat, messageFormat, ex.Message);
+
+ log.Error(message);
+ log.Error(message, ex);
+ log.ErrorFormat(messageFormat, messageFormat, ex.Message);
+
+ log.Fatal(message);
+ log.Fatal(message, ex);
+ log.FatalFormat(messageFormat, messageFormat, ex.Message);
+
+ log.Info(message);
+ log.Info(message, ex);
+ log.InfoFormat(messageFormat, messageFormat, ex.Message);
+
+ log.Warn(message);
+ log.Warn(message, ex);
+ log.WarnFormat(messageFormat, messageFormat, ex.Message);
+ }
+ }
+}
24 tests/ServiceStack.Logging.Tests/UnitTests/EventLogFactoryTests.cs
@@ -0,0 +1,24 @@
+using ServiceStack.Logging.EventLog;
+using ServiceStack.Logging.Log4Net;
+using NUnit.Framework;
+
+namespace ServiceStack.Logging.Tests.UnitTests
+{
+ [TestFixture]
+ public class EventLogFactoryTests
+ {
+ [Test]
+ public void EventLogFactoryTest()
+ {
+ EventLogFactory factory = new EventLogFactory("ServiceStack.Logging.Tests", "Application");
+ ILog log = factory.GetLogger(GetType());
+ Assert.IsNotNull(log);
+ Assert.IsNotNull(log as EventLogger);
+
+ factory = new EventLogFactory("ServiceStack.Logging.Tests");
+ log = factory.GetLogger(GetType());
+ Assert.IsNotNull(log);
+ Assert.IsNotNull(log as EventLogger);
+ }
+ }
+}
63 tests/ServiceStack.Logging.Tests/UnitTests/EventLoggerTests.cs
@@ -0,0 +1,63 @@
+using System;
+using ServiceStack.Logging.EventLog;
+using ServiceStack.Logging.Log4Net;
+using NUnit.Framework;
+
+namespace ServiceStack.Logging.Tests.UnitTests
+{
+ [TestFixture]
+ public class EventLoggerTests
+ {
+ [Test]
+ public void EventLoggerTest()
+ {
+ ILog log = new EventLogger("ServiceStack.Logging.Tests", "Application");
+ Assert.IsNotNull(log);
+ }
+
+ [Test]
+ [ExpectedException(typeof(ArgumentNullException))]
+ public void EventLogger_NullLogNameTest()
+ {
+ ILog log = new EventLogger(null, "Application");
+ }
+
+ [Test]
+ [ExpectedException(typeof(ArgumentNullException))]
+ public void EventLogger_NullSourceNameTest()
+ {
+ ILog log = new EventLogger("ServiceStack.Logging.Tests", null);
+ }
+
+ [Test]
+ public void EventLogger_LoggingTest()
+ {
+ string message = "Error Message";
+ Exception ex = new Exception("Exception");
+ string messageFormat = "Message Format: message: {0}, exception: {1}";
+
+ ILog log = new EventLogger("ServiceStack.Logging.Tests", "Application");
+ Assert.IsNotNull(log);
+
+ log.Debug(message);
+ log.Debug(message, ex);
+ log.DebugFormat(messageFormat, message, ex.Message);
+
+ log.Error(message);
+ log.Error(message, ex);
+ log.ErrorFormat(messageFormat, message, ex.Message);
+
+ log.Fatal(message);
+ log.Fatal(message, ex);
+ log.FatalFormat(messageFormat, message, ex.Message);
+
+ log.Info(message);
+ log.Info(message, ex);
+ log.InfoFormat(messageFormat, message, ex.Message);
+
+ log.Warn(message);
+ log.Warn(message, ex);
+ log.WarnFormat(messageFormat, message, ex.Message);
+ }
+ }
+}
23 tests/ServiceStack.Logging.Tests/UnitTests/Log4NetFactoryTests.cs
@@ -0,0 +1,23 @@
+using NUnit.Framework;
+using ServiceStack.Logging.Log4Net;
+
+namespace ServiceStack.Logging.Tests.UnitTests
+{
+ [TestFixture]
+ public class Log4NetFactoryTests
+ {
+ [Test]
+ public void Log4NetFactoryTest()
+ {
+ Log4NetFactory factory = new Log4NetFactory();
+ ILog log = factory.GetLogger(GetType());
+ Assert.IsNotNull(log);
+ Assert.IsNotNull(log as Log4NetLogger);
+
+ factory = new Log4NetFactory(true);
+ log = factory.GetLogger(GetType().Name);
+ Assert.IsNotNull(log);
+ Assert.IsNotNull(log as Log4NetLogger);
+ }
+ }
+}
51 tests/ServiceStack.Logging.Tests/UnitTests/Log4NetLoggerTests.cs
@@ -0,0 +1,51 @@
+using System;
+using ServiceStack.Logging.Log4Net;
+using NUnit.Framework;
+
+namespace ServiceStack.Logging.Tests.UnitTests
+{
+ [TestFixture]
+ public class Log4NetLoggerTests
+ {
+ [Test]
+ public void Log4NetLoggerTest()
+ {
+ ILog log = new Log4NetLogger(GetType());
+ Assert.IsNotNull(log);
+
+ log = new Log4NetLogger(GetType().Name);
+ Assert.IsNotNull(log);
+ }
+
+ [Test]
+ public void Log4NetLogger_LoggingTest()
+ {
+ string message = "Error Message";
+ Exception ex = new Exception();
+ string messageFormat = "Message Format: message: {0}, exception: {1}";
+
+ ILog log = new Log4NetLogger(GetType());
+ Assert.IsNotNull(log);
+
+ log.Debug(message);
+ log.Debug(message, ex);
+ log.DebugFormat(messageFormat, message, ex.Message);
+
+ log.Error(message);
+ log.Error(message, ex);
+ log.ErrorFormat(messageFormat, message, ex.Message);
+
+ log.Fatal(message);
+ log.Fatal(message, ex);
+ log.FatalFormat(messageFormat, message, ex.Message);
+
+ log.Info(message);
+ log.Info(message, ex);
+ log.InfoFormat(messageFormat, message, ex.Message);
+
+ log.Warn(message);
+ log.Warn(message, ex);
+ log.WarnFormat(messageFormat, message, ex.Message);
+ }
+ }
+}
38 tests/ServiceStack.Logging.Tests/UnitTests/LogManagerTests.cs
@@ -0,0 +1,38 @@
+using ServiceStack.Logging.Support.Logging;
+using NUnit.Framework;
+using Rhino.Mocks;
+
+namespace ServiceStack.Logging.Tests.UnitTests
+{
+ [TestFixture]
+ public class LogManagerTests : UnitTestBase
+ {
+ [Test]
+ public void LogManager_DefaultTest()
+ {
+ ILog log = LogManager.GetLogger(GetType());
+ Assert.IsNotNull(log);
+ Assert.IsNotNull(LogManager.LogFactory as DebugLogFactory);
+ Assert.IsNotNull(log as DebugLogger);
+
+ log = LogManager.GetLogger(GetType().Name);
+ Assert.IsNotNull(log);
+ Assert.IsNotNull(LogManager.LogFactory as DebugLogFactory);
+ Assert.IsNotNull(log as DebugLogger);
+ }
+
+ [Test]
+ public void LogManager_InjectionTest()
+ {
+ ILogFactory factory = Mocks.CreateMock<ILogFactory>();
+ Expect.Call(factory.GetLogger(GetType())).Return(Mocks.DynamicMock<ILog>());
+ ReplayAll();
+
+ LogManager.LogFactory = factory;
+ ILog log = LogManager.GetLogger(GetType());
+
+ Assert.IsNotNull(log);
+ VerifyAll();
+ }
+ }
+}
9 tests/ServiceStack.Logging.Tests/UnitTests/UnitTestBase.cs
@@ -0,0 +1,9 @@
+using ServiceStack.Logging.Tests.Support;
+
+namespace ServiceStack.Logging.Tests.UnitTests
+{
+ public class UnitTestBase : TestBase
+ {
+
+ }
+}
10 tests/ServiceStack.Logging.Tests/UseCases/UseCaseBase.cs
@@ -0,0 +1,10 @@
+using ServiceStack.Logging.Tests.Support;
+using NUnit.Framework;
+
+namespace ServiceStack.Logging.Tests.UseCases
+{
+ public class UseCaseBase : TestBase
+ {
+
+ }
+}
19 tests/ServiceStack.Logging.Tests/UseCases/UsingEventLog.cs
@@ -0,0 +1,19 @@
+using ServiceStack.Logging.EventLog;
+using ServiceStack.Logging.Log4Net;
+using NUnit.Framework;
+
+namespace ServiceStack.Logging.Tests.UseCases
+{
+ [TestFixture]
+ public class UsingEventLog
+ {
+ [Test]
+ public void EventLogUseCase()
+ {
+ LogManager.LogFactory = new EventLogFactory("ServiceStack.Logging.Tests", "Application");
+ ILog log = LogManager.GetLogger(GetType());
+
+ log.Debug("Start Logging...");
+ }
+ }
+}
19 tests/ServiceStack.Logging.Tests/UseCases/UsingLog4Net.cs
@@ -0,0 +1,19 @@
+using ServiceStack.Logging.Log4Net;
+using NUnit.Framework;
+
+namespace ServiceStack.Logging.Tests.UseCases
+{
+ [TestFixture]
+ public class UsingLog4Net
+ {
+ [Test]
+ public void Log4NetUseCase()
+ {
+ LogManager.LogFactory = new Log4NetFactory();
+ ILog log = LogManager.GetLogger(GetType());
+
+ log.Debug("Debug Event Log Entry.");
+ log.Warn("Warning Event Log Entry.");
+ }
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.