forked from Topshelf/Topshelf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added logging integrations, verified service behavior under control
- Loading branch information
Showing
45 changed files
with
1,193 additions
and
441 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
:patch: 0 | ||
:special: prerelease | ||
:special: "" | ||
:major: 3 | ||
:minor: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright 2007-2012 Chris Patterson, Dru Sellers, Travis Smith, et. al. | ||
// | ||
// 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. See the License for the | ||
// specific language governing permissions and limitations under the License. | ||
namespace Topshelf | ||
{ | ||
using System; | ||
using System.IO; | ||
using HostConfigurators; | ||
using Logging; | ||
|
||
/// <summary> | ||
/// Extensions for configuring Logging for log4net | ||
/// </summary> | ||
public static class Log4NetConfigurationExtensions | ||
{ | ||
/// <summary> | ||
/// Specify that you want to use the Log4net logging engine. | ||
/// </summary> | ||
/// <param name="configurator"> </param> | ||
public static void UseLog4Net(this HostConfigurator configurator) | ||
{ | ||
Log4NetLogWriterFactory.Use(); | ||
} | ||
|
||
/// <summary> | ||
/// Specify that you want to use the Log4net logging engine. | ||
/// </summary> | ||
/// <param name="configurator"> </param> | ||
/// <param name="configFileName"> The name of the log4net xml configuration file </param> | ||
public static void UseLog4Net(this HostConfigurator configurator, string configFileName) | ||
{ | ||
Log4NetLogWriterFactory.Use(); | ||
|
||
string path = AppDomain.CurrentDomain.BaseDirectory; | ||
|
||
string file = Path.Combine(path, configFileName); | ||
|
||
var configFile = new FileInfo(file); | ||
if (configFile.Exists) | ||
{ | ||
Log4NetLogWriterFactory.Use(file); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.