Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<ItemGroup>
<PackageVersion Include="Apache.NMS" Version="2.0.0" />
<PackageVersion Include="Apache.NMS.ActiveMQ" Version="1.7.2" />
<PackageVersion Include="Common.Logging" Version="3.4.1" />
<PackageVersion Include="Common.Logging.Log4Net1213" Version="3.4.1" />
<PackageVersion Include="Common.Logging.Log4Net1215" Version="3.4.1" />
<PackageVersion Include="log4net" Version="3.0.4" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="8.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageVersion Include="NUnit" Version="3.14.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
Expand Down
1 change: 0 additions & 1 deletion examples/Spring/Spring.Calculator/Spring.Calculator.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B1FF7E1F-9BF9-4EB3-B38C-39A0E3EA4D0A}"
ProjectSection(SolutionItems) = preProject
readme.txt = readme.txt
SpringCalculator.snk = SpringCalculator.snk
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Calculator.Services.2010", "src\Spring.Calculator.Services\Spring.Calculator.Services.csproj", "{D9FB04E5-D636-4EC2-A3AB-FAB1C4F37827}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#region License

/*
* Copyright � 2002-2011 the original author or authors.
*
* Copyright � 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -23,7 +23,7 @@
using System;

using AopAlliance.Intercept;
using Common.Logging;
using Microsoft.Extensions.Logging;

#endregion

Expand All @@ -37,21 +37,21 @@ public class CommonLoggingAroundAdvice : IMethodInterceptor
{
#region Logging

private static readonly ILog LOG = LogManager.GetLogger(typeof(CommonLoggingAroundAdvice));
private static readonly ILogger LOG = LogManager.GetLogger(typeof(CommonLoggingAroundAdvice));

#endregion

#region Fields

private LogLevel _level = LogLevel.All;
private LogLevel _level = LogLevel.Trace;

#endregion

#region Properties

public LogLevel Level
{
get { return _level; }
get { return _level; }
set { _level = value; }
}

Expand All @@ -75,28 +75,28 @@ private void Log(string text, params object[] args)
{
switch(Level)
{
case LogLevel.All :
case LogLevel.Trace :
case LogLevel.Debug :
if (LOG.IsDebugEnabled) LOG.Debug(String.Format(text, args));
if (LOG.IsEnabled(LogLevel.Debug)) LOG.LogDebug(String.Format(text, args));
break;
case LogLevel.Error :
if (LOG.IsErrorEnabled) LOG.Error(String.Format(text, args));
if (LOG.IsEnabled(LogLevel.Error)) LOG.LogError(String.Format(text, args));
break;
case LogLevel.Fatal :
if (LOG.IsFatalEnabled) LOG.Fatal(String.Format(text, args));
case LogLevel.Critical :
if (LOG.IsEnabled(LogLevel.Critical)) LOG.LogCritical(String.Format(text, args));
break;
case LogLevel.Info :
if (LOG.IsInfoEnabled) LOG.Info(String.Format(text, args));
case LogLevel.Information :
if (LOG.IsEnabled(LogLevel.Information)) LOG.LogInformation(String.Format(text, args));
break;
case LogLevel.Warn :
if (LOG.IsWarnEnabled) LOG.Warn(String.Format(text, args));
case LogLevel.Warning:
if (LOG.IsEnabled(LogLevel.Warning)) LOG.LogWarning(String.Format(text, args));
break;
case LogLevel.Off:
case LogLevel.None:
default :
break;
}
}

#endregion
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
</Reference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Common.Logging" />
<PackageReference Include="Microsoft.Extensions.Logging" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,6 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Common.Logging">
<HintPath>..\..\..\..\..\lib\Net\2.0\Common.Logging.dll</HintPath>
</Reference>
<Reference Include="Common.Logging.Log4Net1211">
<HintPath>..\..\..\..\..\lib\Net\2.0\Common.Logging.Log4Net1211.dll</HintPath>
</Reference>
<Reference Include="log4net">
<HintPath>..\..\..\..\..\lib\Net\4.0\log4net.dll</HintPath>
</Reference>
<Reference Include="Spring.Aop">
<HintPath>..\..\..\..\..\bin\net\4.0\debug\Spring.Aop.dll</HintPath>
</Reference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<ProjectReference Include="..\Primes\Primes.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Common.Logging" />
<PackageReference Include="Microsoft.Extensions.Logging" />
<Reference Include="System.Configuration" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@

#region Imports

using System;

using Common.Logging;

using Microsoft.Extensions.Logging;
using Spring.Northwind.Domain;

#endregion
Expand All @@ -32,11 +29,11 @@ namespace Spring.Northwind.Service
{
public class FedExShippingService : IShippingService
{
protected static readonly ILog log = LogManager.GetLogger(typeof (FedExShippingService));
protected static readonly ILogger log = LogManager.GetLogger(typeof (FedExShippingService));

public void ShipOrder(Order order)
{
log.Info("Shipping order id = " + order.Id);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
#region Imports

using System;
using System.Collections;

using Common.Logging;

using Microsoft.Extensions.Logging;
using Spring.Transaction.Interceptor;

using Spring.Northwind.Dao;
Expand All @@ -38,7 +36,7 @@ public class FulfillmentService : IFulfillmentService
{
#region Fields

private static readonly ILog log = LogManager.GetLogger(typeof (FulfillmentService));
private static readonly ILogger log = LogManager.GetLogger(typeof (FulfillmentService));

private IProductDao productDao;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
using System;
using System.IO;

using log4net.Appender;
using log4net.Core;
using log4net.Layout;
using log4net.Repository;

using Spring.Northwind.Service;
using Spring.Web.UI;

using LogManager=log4net.LogManager;

public partial class FullfillmentResult : ConversationPage
{
Expand All @@ -28,36 +18,8 @@ public ICustomerEditController CustomerEditController

protected void Page_Load(object sender, EventArgs e)
{
// gather log4net output with small hack to get results...
ILoggerRepository repository = LogManager.GetRepository();
IAppender[] appenders = repository.GetAppenders();
MemoryAppender appender = null;
foreach (IAppender a in appenders)
{
if (a is MemoryAppender)
{
// we found our appender to look results from
appender = a as MemoryAppender;
break;
}
}

if (appender != null)
{
appender.Clear();
fulfillmentService.ProcessCustomer(customerEditController.CurrentCustomer.Id);
LoggingEvent[] events = appender.GetEvents();
StringWriter stringWriter = new StringWriter();
PatternLayout layout = new PatternLayout("%date{HH:mm:ss} %-5level %logger{1}: %message<br />");
foreach (LoggingEvent loggingEvent in events)
{
layout.Format(stringWriter, loggingEvent);
}

results.Text = stringWriter.ToString();
}

}

protected void customerOrders_Click(object sender, EventArgs e)
{
SetResult("Back");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Common.Logging.Log4Net1213" />
<PackageReference Include="Microsoft.Extensions.Logging" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
using System;
using System.IO;

using log4net.Appender;
using log4net.Core;
using log4net.Layout;
using log4net.Repository;

using Spring.Northwind.Service;
using Spring.Web.UI;

using LogManager=log4net.LogManager;

public partial class FullfillmentResult : Page
{
private IFulfillmentService fulfillmentService;
Expand All @@ -28,36 +20,8 @@ public ICustomerEditController CustomerEditController

protected void Page_Load(object sender, EventArgs e)
{
// gather log4net output with small hack to get results...
ILoggerRepository repository = LogManager.GetRepository();
IAppender[] appenders = repository.GetAppenders();
MemoryAppender appender = null;
foreach (IAppender a in appenders)
{
if (a is MemoryAppender)
{
// we found our appender to look results from
appender = a as MemoryAppender;
break;
}
}

if (appender != null)
{
appender.Clear();
fulfillmentService.ProcessCustomer(customerEditController.CurrentCustomer.Id);
LoggingEvent[] events = appender.GetEvents();
StringWriter stringWriter = new StringWriter();
PatternLayout layout = new PatternLayout("%date{HH:mm:ss} %-5level %logger{1}: %message<br />");
foreach (LoggingEvent loggingEvent in events)
{
layout.Format(stringWriter, loggingEvent);
}

results.Text = stringWriter.ToString();
}

}

protected void customerOrders_Click(object sender, EventArgs e)
{
SetResult("Back");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Common.Logging.Log4Net1213" />
<PackageReference Include="Microsoft.Extensions.Logging" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<RootNamespace>Spring</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Common.Logging" />
<PackageReference Include="Microsoft.Extensions.Logging" />
</ItemGroup>
<ItemGroup>
<Reference Include="Spring.Core">
Expand Down
14 changes: 0 additions & 14 deletions examples/Spring/Spring.IoCQuickStart.MovieFinder/src/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,13 @@
<configuration>

<configSections>
<sectionGroup name="common">
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
</sectionGroup>
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/>
<section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core" />
</sectionGroup>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
</configSections>

<common>
<logging>
<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net1215">
<!-- choices are INLINE, FILE, FILE-WATCH, EXTERNAL-->
<!-- otherwise BasicConfigurer.Configure is used -->
<!-- log4net configuration file is specified with key configFile-->
<arg key="configType" value="INLINE" />
</factoryAdapter>
</logging>
</common>

<spring>

<context>
Expand Down
Loading