Merge remote-tracking branch 'origin/master' into Feature/111-Dropping-support-for-older-runtimes
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..a2d23c5
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,135 @@
+indent_style = space
+indent_size = 4
+
+[*.{cs,vb}]
+#### Naming styles ####
+
+# Naming rules
+
+dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
+dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
+dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
+
+dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
+dotnet_naming_rule.types_should_be_pascal_case.symbols = types
+dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
+
+dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
+dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
+dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
+
+# Symbol specifications
+
+dotnet_naming_symbols.interface.applicable_kinds = interface
+dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
+dotnet_naming_symbols.interface.required_modifiers =
+
+dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
+dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
+dotnet_naming_symbols.types.required_modifiers =
+
+dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
+dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
+dotnet_naming_symbols.non_field_members.required_modifiers =
+
+# Naming styles
+
+dotnet_naming_style.begins_with_i.required_prefix = I
+dotnet_naming_style.begins_with_i.required_suffix =
+dotnet_naming_style.begins_with_i.word_separator =
+dotnet_naming_style.begins_with_i.capitalization = pascal_case
+
+dotnet_naming_style.pascal_case.required_prefix =
+dotnet_naming_style.pascal_case.required_suffix =
+dotnet_naming_style.pascal_case.word_separator =
+dotnet_naming_style.pascal_case.capitalization = pascal_case
+
+dotnet_naming_style.pascal_case.required_prefix =
+dotnet_naming_style.pascal_case.required_suffix =
+dotnet_naming_style.pascal_case.word_separator =
+dotnet_naming_style.pascal_case.capitalization = pascal_case
+dotnet_style_operator_placement_when_wrapping = beginning_of_line
+tab_width = 2
+indent_size = 2
+end_of_line = crlf
+dotnet_style_coalesce_expression = true:suggestion
+dotnet_style_null_propagation = true:suggestion
+dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
+dotnet_style_prefer_auto_properties = true:suggestion
+dotnet_style_object_initializer = true:suggestion
+dotnet_style_collection_initializer = true:suggestion
+dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
+dotnet_style_prefer_conditional_expression_over_assignment = true:silent
+dotnet_style_prefer_conditional_expression_over_return = true:silent
+dotnet_style_explicit_tuple_names = true:suggestion
+dotnet_style_prefer_inferred_tuple_names = true:suggestion
+dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
+dotnet_style_prefer_compound_assignment = true:suggestion
+dotnet_style_prefer_simplified_interpolation = true:suggestion
+dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion
+dotnet_style_namespace_match_folder = true:suggestion
+dotnet_style_readonly_field = true:suggestion
+dotnet_style_predefined_type_for_locals_parameters_members = true:silent
+dotnet_style_predefined_type_for_member_access = true:silent
+dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
+dotnet_style_allow_multiple_blank_lines_experimental = true:silent
+dotnet_style_allow_statement_immediately_after_block_experimental = true:silent
+dotnet_code_quality_unused_parameters = all:suggestion
+dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
+dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
+dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
+dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
+dotnet_style_qualification_for_field = false:silent
+dotnet_style_qualification_for_property = false:silent
+dotnet_style_qualification_for_method = false:silent
+dotnet_style_qualification_for_event = false:silent
+
+[*.cs]
+csharp_indent_labels = one_less_than_current
+csharp_using_directive_placement = outside_namespace:silent
+csharp_prefer_simple_using_statement = true:suggestion
+csharp_prefer_braces = true:suggestion
+csharp_style_namespace_declarations = block_scoped:silent
+csharp_style_prefer_method_group_conversion = true:silent
+csharp_style_prefer_top_level_statements = false:silent
+csharp_style_prefer_primary_constructors = false:suggestion
+csharp_style_expression_bodied_methods = false:silent
+csharp_style_expression_bodied_constructors = false:silent
+csharp_style_expression_bodied_operators = false:silent
+csharp_style_expression_bodied_properties = true:silent
+csharp_style_expression_bodied_indexers = true:silent
+csharp_style_expression_bodied_accessors = true:silent
+csharp_style_expression_bodied_lambdas = true:silent
+csharp_style_expression_bodied_local_functions = false:silent
+csharp_style_throw_expression = true:suggestion
+csharp_style_prefer_null_check_over_type_check = true:suggestion
+csharp_prefer_simple_default_expression = true:suggestion
+csharp_space_around_binary_operators = before_and_after
+csharp_style_prefer_local_over_anonymous_function = true:suggestion
+csharp_style_prefer_index_operator = true:suggestion
+csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
+csharp_style_prefer_range_operator = true:suggestion
+csharp_style_prefer_tuple_swap = true:suggestion
+csharp_style_prefer_utf8_string_literals = true:suggestion
+csharp_style_inlined_variable_declaration = true:suggestion
+csharp_style_deconstructed_variable_declaration = true:suggestion
+csharp_style_unused_value_assignment_preference = discard_variable:suggestion
+csharp_style_unused_value_expression_statement_preference = discard_variable:silent
+csharp_prefer_static_local_function = true:suggestion
+csharp_style_prefer_readonly_struct = true:suggestion
+csharp_style_prefer_readonly_struct_member = true:suggestion
+csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent
+csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent
+csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true:silent
+csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent
+csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent
+csharp_style_conditional_delegate_call = true:suggestion
+csharp_style_prefer_switch_expression = true:suggestion
+csharp_style_prefer_pattern_matching = true:silent
+csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
+csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
+csharp_style_prefer_not_pattern = true:suggestion
+csharp_style_prefer_extended_property_pattern = true:suggestion
+csharp_style_var_for_built_in_types = false:silent
+csharp_style_var_when_type_is_apparent = false:silent
+csharp_style_var_elsewhere = false:silent
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 32ccf02..d909334 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,8 +21,11 @@
[Bb]in/
[Oo]bj/
-# Visual Studio 2015 cache/options directory
+# Visual Studio cache/options directory
.vs/
+src
+/.vs/
+examples/.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..8a59a8a
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,36 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+# MAINTAINER Jan Friedrich
+
+FROM mono:latest
+
+RUN apt-get update \
+ && apt-get upgrade -y \
+ && apt-get install -y wget \
+ && apt-get install -y tree \
+ && wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh \
+ && chmod +x ./dotnet-install.sh \
+ && ./dotnet-install.sh --channel 8.0
+ENV DOTNET_NOLOGO=true
+ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
+ENV DOTNET_ROOT=/root/.dotnet
+ENV PATH="$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools"
+
+ADD . /logging-log4net
+RUN dotnet restore /logging-log4net/src/log4net.sln
+RUN dotnet build /logging-log4net/src/log4net.sln
+CMD /bin/bash
\ No newline at end of file
diff --git a/Jenkinsfile b/Jenkinsfile
deleted file mode 100644
index 3b99034..0000000
--- a/Jenkinsfile
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-
-pipeline {
- options {
- timeout(time: 1, unit: 'HOURS')
- }
- agent { label 'Windows' }
- tools {
- maven 'Maven 3.3.9 (Windows)'
- jdk 'JDK 1.8 (latest)'
- }
- environment {
- // TODO: find a better way to determine nant installation path
- NAnt = 'F:\\jenkins\\tools\\nant\\nant-0.92\\bin\\NAnt.exe'
- }
- stages {
- stage('Checkout') {
- steps {
- checkout scm
- }
- }
- stage('Build') {
- steps {
- bat "${NAnt} -buildfile:log4net.build"
- }
- }
- stage('Test on Windows') {
- steps {
- bat "${NAnt} -buildfile:tests\\nant.build"
- }
- }
- stage('Build-Site') {
- steps {
- bat "${NAnt} -buildfile:log4net.build generate-site"
- }
- }
- stage('Deploy-Site') {
- when {
- branch 'master'
- }
- steps {
- echo 'This is a placeholder for the deployment of the site'
- }
- }
- }
- post {
- failure {
- step([$class: 'Mailer', notifyEveryUnstableBuild: false, recipients: 'dev@logging.apache.org'])
- }
- }
-}
-
diff --git a/STATUS.txt b/STATUS.txt
index f9e0e9d..82aae61 100644
--- a/STATUS.txt
+++ b/STATUS.txt
@@ -22,6 +22,7 @@
Active Committers
=================
* Davyd McColl (davydm)
+* Jan Friedrich (freeandnil)
Former Committers
================
@@ -30,5 +31,4 @@
* Gert Driesen (drieseng)
* Ron Grabowski (rgrabowski)
* Stefan Bodewig (bodewig)
-* Dominik Psenner (dpsenner)
-
+* Dominik Psenner (dpsenner)
\ No newline at end of file
diff --git a/appveyer.yml b/appveyor.yml
similarity index 100%
rename from appveyer.yml
rename to appveyor.yml
diff --git a/build.cmd b/build.cmd
deleted file mode 100755
index db88512..0000000
--- a/build.cmd
+++ /dev/null
@@ -1,131 +0,0 @@
-rem
-rem
-rem Licensed to the Apache Software Foundation (ASF) under one
-rem or more contributor license agreements. See the NOTICE file
-rem distributed with this work for additional information
-rem regarding copyright ownership. The ASF licenses this file
-rem to you under the Apache License, Version 2.0 (the
-rem "License"); you may not use this file except in compliance
-rem with the License. You may obtain a copy of the License at
-rem
-rem http://www.apache.org/licenses/LICENSE-2.0
-rem
-rem Unless required by applicable law or agreed to in writing,
-rem software distributed under the License is distributed on an
-rem "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-rem KIND, either express or implied. See the License for the
-rem specific language governing permissions and limitations
-rem under the License.
-rem
-rem
-@ECHO OFF
-
-REM We are going to change the environment variables, so protect the current settings.
-SETLOCAL ENABLEDELAYEDEXPANSION
-
-IF "%1"=="-?" GOTO CommandLineOptions
-
-REM Figure out the path to the log4net directory
-CALL :ComputeBase %~f0
-SET LOG4NET_DIR=%RESULT%
-ECHO LOG4NET_DIR is %LOG4NET_DIR%
-
-REM Get path to NAnt.exe
-
-REM Try and determine if NAnt is in the PATH
-SET NANTEXE_PATH=nant.exe
-"%NANTEXE_PATH%" -help >NUL: 2>NUL:
-IF NOT ERRORLEVEL 1 goto FoundNAnt
-
-REM Try hard coded path for NAnt
-SET NANTEXE_PATH=C:\Program Files\NAnt\nant-0.85\bin\nant.exe
-"%NANTEXE_PATH%" -help >NUL: 2>NUL:
-IF NOT ERRORLEVEL 1 goto FoundNAnt
-
-REM We have not found NAnt
-ECHO.
-ECHO NAnt does not appear to be installed. NAnt.exe failed to execute.
-ECHO Please ensure NAnt is installed and can be found in the PATH.
-GOTO EndError
-
-
-:FoundNAnt
-ECHO NANTEXE_PATH is %NANTEXE_PATH%
-
-REM Setup the build file
-IF EXIST nant.build (
- SET BUILD_FILE=nant.build
-) ELSE (
- SET BUILD_FILE=%LOG4NET_DIR%\log4net.build
-)
-
-ECHO BUILD_FILE is %BUILD_FILE%
-
-
-IF "%1"=="package" GOTO Package
-
-"%NANTEXE_PATH%" "-buildfile:%BUILD_FILE%" %1 %2 %3 %4 %5 %6 %7 %8
-GOTO EndOk
-
-:Package
-IF "%2"=="" GOTO NoProjectVersion
-
-"%NANTEXE_PATH%" "-buildfile:%BUILD_FILE%" package "-D:package.version=%2" %3 %4 %5 %6 %7 %8
-GOTO EndOk
-
-:NoProjectVersion
-ECHO.
-ECHO SYNTAX ERROR: Missing Version String.
-ECHO Please specify the version number of log4net that you want to package.
-GOTO CommandLineOptions
-
-:CommandLineOptions
-ECHO.
-ECHO Use the following command line syntax:
-ECHO.
-ECHO build.cmd -?
-ECHO build.cmd -projecthelp
-ECHO build.cmd [nant target]
-ECHO build.cmd package [version string]
-ECHO.
-ECHO To get a list of all NAnt build targets run build.cmd with the -projecthelp option.
-ECHO If no NAnt target is specified then the default target is 'compile-all'. This will compile all configurations on all available frameworks.
-ECHO When using the 'package' command the version label for the package must be specified.
-ECHO.
-ECHO Examples:
-ECHO.
-ECHO build.cmd compile-mono-1.0
-ECHO build.cmd compile-all
-ECHO build.cmd package 1.3.0
-ECHO build.cmd package 2.1.0-alpha
-ECHO.
-GOTO EndError
-
-
-REM ------------------------------------------
-REM Expand a string to a full path
-REM ------------------------------------------
-:FullPath
-SET RESULT=%~f1
-GOTO :EOF
-
-REM ------------------------------------------
-REM Compute the current directory
-REM given a path to this batch script.
-REM ------------------------------------------
-:ComputeBase
-SET RESULT=%~dp1
-REM Remove the trailing \
-SET RESULT=%RESULT:~0,-1%
-CALL :FullPath %RESULT%
-GOTO :EOF
-
-
-:EndOk
-ENDLOCAL
-EXIT /B 0
-
-:EndError
-ENDLOCAL
-EXIT /B 1
-
diff --git a/doc/BUILDING.md b/doc/BUILDING.md
index 87d0491..acd8888 100644
--- a/doc/BUILDING.md
+++ b/doc/BUILDING.md
@@ -1,27 +1,31 @@
## Building log4net
-Log4net provides support for a wide array of targets, including
-- older .net 2 and 3.5 (including client profile for net-40)
-- more modern net40/net45
-- netstandard1.3/2.0
-
-As such, it does require a relatively full .net environment on Windows to build.
-I have recently found a fairly freshly-installed win11 machine to work adequately,
-after adding the "windows feature" for ".NET Framework 3.5 (includes .NET 2.0 and 3.0)"
+Log4net provides support for the following targets
+- net462
+- netstandard2.0
TL;DR (Windows):
- install Visual Studio Build Tools (at least VS2019)
- install nodejs (at least v16)
-- install dotnet (v7+) and the .NET SDK (current latest)
-- install dotnet 2, 3, 3.5 via "add windows features"
+- install dotnet (v8+) and the .NET SDK (current latest)
- in the project folder:
- `npm i`
- `npm run build`
+TL;DR (Docker):
+- install docker (if you haven't already)
+ - https://docs.docker.com/engine/install/
+- in logging/log4net run
+ - `docker build -t log4net-builder .`
+ - `docker run -it log4net-builder`
+ - this will
+ - install all dependencies in the container
+ - build src/log4net.sln
+ - inside the container run
+ - `dotnet test /logging-log4net/src/log4net.sln`
+
TL;DR (!Windows):
-- install the dotnet SDK - v7 or better (at time of writing, v8 is current but
- I've had some issues elsewhere, so I'm waiting a bit before recommending it
- everywhere
+- install the dotnet SDK - v8 or better
- install Mono (you're going to need it to target certain versions of .NET)
- install nodejs 16+
- in the project folder:
@@ -38,21 +42,7 @@
- Visual Studio 2019 Build Tools
- include desktop targets at least
- include dotnet core targets or download and install
- the latest dotnet sdk (you will need at least v2.1)
- - note that build is possible with VS2022 build tools, but I had to
- install VS2019 build tools _as well_ to get msbuild to recognise
- the legacy net35-profile target
- - Ensure you have .NET Framework 3.5 SP1 installed
- - on Win10+, this can only be installed via Add/Remove Windows Components
- - on other platforms, see https://dotnet.microsoft.com/download/dotnet-framework/net35-sp1
- - Building against .net 2/3.5, especially Client Profile, is not supported on Mono
- - Log4Net supports some older, out-of-support .net SDKs, particularly
- dotnet core 1.1 and .net framework client profiles for 3.5 and 4.0.
- There are helper powershell scripts in the root of this
- repository to assist with obtaining and installing these
- SDKs from Microsoft servers. Please see:
- - [install-dotnet-core-sdk-1.1.ps1](install-dotnet-core-sdk-1.1.ps1)
- - [install-net-framework-sdk-3.5.ps1](install-net-framework-sdk-3.5.ps1)
+ the latest dotnet sdk (you will need at least v8)
- Binaries can be built with a Visual Studio or Rider installation
- Binaries, packages and a release zip can be built via commandline
- Ensure that you have a reasonably modern NodeJS installed (at least version 8+)
@@ -65,10 +55,10 @@
- `npm i`
- `npm run build`
- build via docker for windows, using the `build-with-docker-for-windows.bat` script
-- build via the vs2019 Windows AppVeyer image. There is an appveyer.yml file
+- build via the vs2019 Windows AppVeyor image. There is an appveyor.yml file
included which (should) build if you set up AppVeyer to track
your fork. AppVeyer is free for open-source projects.
- (TODO: should have a link to the official AppVeyer build)
+ (TODO: should have a link to the official AppVeyor build)
## Updating the site
diff --git a/doc/CONTRIBUTING.md b/doc/CONTRIBUTING.md
index d06343a..6973263 100644
--- a/doc/CONTRIBUTING.md
+++ b/doc/CONTRIBUTING.md
@@ -8,7 +8,6 @@
Getting Started
---------------
-+ Make sure you have a [JIRA account](https://issues.apache.org/jira/).
+ Make sure you have a [GitHub account](https://github.com/signup/free).
+ If you're planning to implement a new feature it makes sense to discuss your changes on the [dev list](https://logging.apache.org/log4net/mail-lists.html) first. This way you can make sure you're not wasting your time on something that isn't considered to be in Apache log4net's scope.
+ Submit a ticket for your issue, assuming one does not already exist.
@@ -24,14 +23,14 @@
+ Respect the original code style:
+ Create minimal diffs - disable on save actions like reformat source code or organize imports. If you feel the source code should be reformatted create a separate PR for this change.
+ Check for unnecessary whitespace with git diff --check before committing.
-+ Make sure your commit messages are in the proper format. Your commit message should contain the key of the JIRA issue.
++ Make sure your commit messages are in the proper format. Your commit message should contain the key of the github issue.
+ Make sure you have added the necessary tests for your changes.
-+ Run all the tests with `nant` inside the `tests` directory to assure nothing else was accidentally broken.
++ Run all the tests with `npm test` to assure nothing else was accidentally broken.
Making Trivial Changes
----------------------
-For changes of a trivial nature to comments and documentation, it is not always necessary to create a new ticket in JIRA.
+For changes of a trivial nature to comments and documentation, it is not always necessary to create a new ticket in github.
In this case, it is appropriate to start the first line of a commit with '(doc)' instead of a ticket number.
Submitting Changes
@@ -40,12 +39,10 @@
+ Sign the [Contributor License Agreement][cla] if you haven't already.
+ Push your changes to a topic branch in your fork of the repository.
+ Submit a pull request to the repository in the apache organization.
-+ Update your JIRA ticket and include a link to the pull request in the ticket.
Additional Resources
--------------------
-+ [Apache log4net JIRA project page](https://issues.apache.org/jira/browse/LOG4NET)
+ [Contributor License Agreement][cla]
+ [General GitHub documentation](https://help.github.com/)
+ [GitHub pull request documentation](https://help.github.com/send-pull-requests/)
diff --git a/examples/Appenders/SampleAppendersApp/App.config b/examples/Appenders/SampleAppendersApp/App.config
new file mode 100644
index 0000000..46a4256
--- /dev/null
+++ b/examples/Appenders/SampleAppendersApp/App.config
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+
+-->
+
+<!--
+ .NET application configuration file
+ This file must have the exact same name as your application with .config appended to it.
+
+ For example if your application is ConsoleApp.exe then the config file must be ConsoleApp.exe.config.
+ It must also be in the same directory as the application.
+ -->
+<configuration>
+ <!-- Register a section handler for the log4net section -->
+ <configSections>
+ <section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
+ </configSections>
+
+ <appSettings>
+ <!-- To enable internal log4net logging specify the following appSettings key -->
+ <!-- <add key="log4net.Internal.Debug" value="true"/> -->
+ </appSettings>
+
+ <!-- This section contains the log4net configuration settings -->
+ <log4net>
+
+ <appender name="WmiAppender" type="log4net.Appender.WmiAppender,log4net.Appender.WmiAppender">
+ </appender>
+
+ <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
+ <layout type="log4net.Layout.PatternLayout" value="%date [%thread] %-5level %logger - %message%newline" />
+ </appender>
+
+ <appender name="MessageBoxAppender" type="SampleAppendersApp.Appender.MessageBoxAppender, SampleAppendersApp">
+
+ <layout type="log4net.Layout.PatternLayout" value="%date [%thread] %-5level %logger [%ndc] <%property{auth}> - %message%newline"/>
+ <titleLayout type="log4net.Layout.PatternLayout" value="LoggingEvent: %-5level %logger"/>
+ <mapping>
+ <level value="ERROR" />
+ <icon value="Error" />
+ </mapping>
+
+ </appender>
+
+
+ <appender name="FireEventAppender" type="SampleAppendersApp.Appender.FireEventAppender, SampleAppendersApp">
+ </appender>
+
+ <appender name="ColoredConsoleAppender" type="log4net.Appender.ColoredConsoleAppender">
+ <layout type="log4net.Layout.PatternLayout" value="%date [%thread] %-5level %logger - %properties%newline" />
+ <mapping>
+ <level value="DEBUG" />
+ <backColor value="Blue" />
+ <foreColor value="White" />
+ </mapping>
+ </appender>
+
+ <appender name="MessageObjectExpanderAppender" type="SampleAppendersApp.Appender.MessageObjectExpanderAppender, SampleAppendersApp">
+ <appender-ref ref="ColoredConsoleAppender" />
+ </appender>
+
+ <appender name="AsyncConsoleAppender" type="SampleAppendersApp.Appender.AsyncAppender, SampleAppendersApp">
+ <appender-ref ref="ColoredConsoleAppender" />
+ </appender>
+
+ <appender name="PatternFileAppender" type="SampleAppendersApp.Appender.PatternFileAppender, SampleAppendersApp">
+ <!-- File pattern to group files by date, then by session property -->
+ <file value="%date{yyyy-MM-dd}\%property{session}\output.log" />
+ <layout type="log4net.Layout.PatternLayout" value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
+ </appender>
+
+ <!-- Setup the root category, add the appenders and set the default level -->
+ <root>
+ <level value="ALL" />
+
+ <appender-ref ref="WmiAppender" />
+ <appender-ref ref="PatternFileAppender" />
+ <appender-ref ref="ConsoleAppender" />
+ <appender-ref ref="MessageObjectExpanderAppender" />
+ <appender-ref ref="MessageBoxAppender" />
+ <appender-ref ref="FireEventAppender" />
+ <appender-ref ref="AsyncConsoleAppender" />
+
+ </root>
+
+ </log4net>
+</configuration>
\ No newline at end of file
diff --git a/examples/Appenders/SampleAppendersApp/Appender/AsyncAppender.cs b/examples/Appenders/SampleAppendersApp/Appender/AsyncAppender.cs
new file mode 100644
index 0000000..a4ef5c1
--- /dev/null
+++ b/examples/Appenders/SampleAppendersApp/Appender/AsyncAppender.cs
@@ -0,0 +1,152 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+using System;
+using System.Threading;
+using log4net.Appender;
+using log4net.Core;
+using log4net.Util;
+
+namespace SampleAppendersApp.Appender
+{
+ /// <summary>
+ /// Appender that forwards LoggingEvents asynchronously
+ /// </summary>
+ /// <remarks>
+ /// This appender forwards LoggingEvents to a list of attached appenders.
+ /// The events are forwarded asynchronously using the ThreadPool.
+ /// This allows the calling thread to be released quickly, however it does
+ /// not guarantee the ordering of events delivered to the attached appenders.
+ /// </remarks>
+ public sealed class AsyncAppender : IAppender, IBulkAppender, IOptionHandler, IAppenderAttachable
+ {
+ private readonly object syncRoot = new();
+
+ /// <inheritdoc/>
+ public string Name { get; set; } = string.Empty;
+
+ /// <inheritdoc/>
+ public void ActivateOptions()
+ { }
+
+ /// <inheritdoc/>
+ public FixFlags Fix { get; set; } = FixFlags.All;
+
+ /// <inheritdoc/>
+ public void Close()
+ {
+ // Remove all the attached appenders
+ lock (syncRoot)
+ appenderAttachedImpl?.RemoveAllAppenders();
+ }
+
+ /// <inheritdoc/>
+ public void DoAppend(LoggingEvent loggingEvent)
+ {
+ ArgumentNullException.ThrowIfNull(loggingEvent);
+ loggingEvent.Fix = Fix;
+ ThreadPool.QueueUserWorkItem(new WaitCallback(AsyncAppend), loggingEvent);
+ }
+
+ /// <inheritdoc/>
+ public void DoAppend(LoggingEvent[] loggingEvents)
+ {
+ ArgumentNullException.ThrowIfNull(loggingEvents);
+ foreach (LoggingEvent loggingEvent in loggingEvents)
+ loggingEvent.Fix = Fix;
+ ThreadPool.QueueUserWorkItem(new WaitCallback(AsyncAppend), loggingEvents);
+ }
+
+ private void AsyncAppend(object? state)
+ {
+ if (appenderAttachedImpl != null)
+ {
+ if (state is LoggingEvent loggingEvent)
+ appenderAttachedImpl.AppendLoopOnAppenders(loggingEvent);
+ else if (state is LoggingEvent[] loggingEvents)
+ appenderAttachedImpl.AppendLoopOnAppenders(loggingEvents);
+ }
+ }
+
+ #region IAppenderAttachable Members
+
+ /// <inheritdoc/>
+ public void AddAppender(IAppender appender)
+ {
+ ArgumentNullException.ThrowIfNull(appender);
+ lock (syncRoot)
+ (appenderAttachedImpl ??= new()).AddAppender(appender);
+ }
+
+ /// <inheritdoc/>
+ public AppenderCollection Appenders
+ {
+ get
+ {
+ lock (syncRoot)
+ return appenderAttachedImpl?.Appenders ?? AppenderCollection.EmptyCollection;
+ }
+ }
+
+ /// <inheritdoc/>
+ public IAppender? GetAppender(string name)
+ {
+ lock (syncRoot)
+ {
+ if (appenderAttachedImpl is null || name is null)
+ return null;
+
+ return appenderAttachedImpl.GetAppender(name);
+ }
+ }
+
+ /// <inheritdoc/>
+ public void RemoveAllAppenders()
+ {
+ lock (syncRoot)
+ if (appenderAttachedImpl is not null)
+ {
+ appenderAttachedImpl.RemoveAllAppenders();
+ appenderAttachedImpl = null;
+ }
+ }
+
+ /// <inheritdoc/>
+ public IAppender? RemoveAppender(IAppender appender)
+ {
+ lock (syncRoot)
+ if (appender is not null && appenderAttachedImpl is not null)
+ return appenderAttachedImpl.RemoveAppender(appender);
+ return null;
+ }
+
+ /// <inheritdoc/>
+ public IAppender? RemoveAppender(string name)
+ {
+ lock (syncRoot)
+ if (name is not null && appenderAttachedImpl is not null)
+ return appenderAttachedImpl.RemoveAppender(name);
+ return null;
+ }
+
+ #endregion
+
+ private AppenderAttachedImpl? appenderAttachedImpl;
+ }
+}
diff --git a/examples/Appenders/SampleAppendersApp/Appender/FireEventAppender.cs b/examples/Appenders/SampleAppendersApp/Appender/FireEventAppender.cs
new file mode 100644
index 0000000..4fbe1d7
--- /dev/null
+++ b/examples/Appenders/SampleAppendersApp/Appender/FireEventAppender.cs
@@ -0,0 +1,70 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+using System;
+
+using log4net.Core;
+
+namespace SampleAppendersApp.Appender
+{
+ /// <inheritdoc/>
+ public sealed class MessageLoggedEventArgs(LoggingEvent loggingEvent) : EventArgs
+ {
+ /// <inheritdoc/>
+ public LoggingEvent LoggingEvent { get; } = loggingEvent;
+ }
+
+ /// <summary>
+ /// Appender that raises an event for each LoggingEvent received
+ /// </summary>
+ /// <remarks>
+ /// Raises a MessageLoggedEvent for each LoggingEvent object received
+ /// by this appender.
+ /// </remarks>
+ public class FireEventAppender : log4net.Appender.AppenderSkeleton
+ {
+ /// <summary>
+ /// Event handler
+ /// </summary>
+ public event EventHandler<MessageLoggedEventArgs>? MessageLoggedEvent;
+
+ /// <summary>
+ /// Easy singleton, gets the last instance created
+ /// </summary>
+ public static FireEventAppender? Instance { get; private set; }
+
+ /// <inheritdoc/>
+ public FireEventAppender() => Instance = this; // Store the instance created
+
+ /// <inheritdoc/>
+ public virtual FixFlags Fix { get; set; } = FixFlags.All;
+
+ /// <inheritdoc/>
+ protected override void Append(LoggingEvent loggingEvent)
+ {
+ ArgumentNullException.ThrowIfNull(loggingEvent);
+ // Because we the LoggingEvent may be used beyond the lifetime
+ // of the Append() method we must fix any volatile data in the event
+ loggingEvent.Fix = Fix;
+
+ // Raise the event
+ MessageLoggedEvent?.Invoke(this, new MessageLoggedEventArgs(loggingEvent));
+ }
+ }
+}
\ No newline at end of file
diff --git a/examples/Appenders/SampleAppendersApp/Appender/MessageBoxAppender.cs b/examples/Appenders/SampleAppendersApp/Appender/MessageBoxAppender.cs
new file mode 100644
index 0000000..b9cae73
--- /dev/null
+++ b/examples/Appenders/SampleAppendersApp/Appender/MessageBoxAppender.cs
@@ -0,0 +1,91 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+using System;
+using System.IO;
+using System.Windows.Forms;
+
+using log4net.Appender;
+using log4net.Core;
+using log4net.Layout;
+using log4net.Util;
+
+namespace SampleAppendersApp.Appender
+{
+ /// <summary>
+ /// Displays messages as message boxes
+ /// </summary>
+ /// <remarks>
+ /// Displays each LoggingEvent as a MessageBox. The message box is UI modal
+ /// and will block the calling thread until it is dismissed by the user.
+ /// </remarks>
+ public sealed class MessageBoxAppender : AppenderSkeleton
+ {
+ private LevelMapping levelMapping = new();
+
+ /// <inheritdoc/>
+ public void AddMapping(LevelIcon mapping) => levelMapping.Add(mapping);
+
+ /// <inheritdoc/>
+ public PatternLayout? TitleLayout { get; set; }
+
+ /// <inheritdoc/>
+ protected override void Append(LoggingEvent loggingEvent)
+ {
+ ArgumentNullException.ThrowIfNull(loggingEvent);
+
+ MessageBoxIcon messageBoxIcon = MessageBoxIcon.Information;
+
+ if (levelMapping.Lookup(loggingEvent.Level) is LevelIcon levelIcon)
+ // Prepend the Ansi Color code
+ messageBoxIcon = levelIcon.Icon;
+
+ string message = RenderLoggingEvent(loggingEvent);
+
+ string? title = null;
+ if (TitleLayout is null)
+ {
+ title = "LoggingEvent: " + loggingEvent.Level.Name;
+ }
+ else
+ {
+ using StringWriter titleWriter = new(System.Globalization.CultureInfo.InvariantCulture);
+ TitleLayout.Format(titleWriter, loggingEvent);
+ title = titleWriter.ToString();
+ }
+
+ MessageBox.Show(message, title, MessageBoxButtons.OK, messageBoxIcon);
+ }
+
+ /// <inheritdoc/>
+ public override void ActivateOptions()
+ {
+ base.ActivateOptions();
+ levelMapping.ActivateOptions();
+ }
+
+ /// <inheritdoc/>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1034:Nested types should not be visible")]
+ public sealed class LevelIcon : LevelMappingEntry
+ {
+ /// <inheritdoc/>
+ public MessageBoxIcon Icon { get; set; }
+ }
+ }
+}
diff --git a/examples/Appenders/SampleAppendersApp/Appender/MessageObjectExpanderAppender.cs b/examples/Appenders/SampleAppendersApp/Appender/MessageObjectExpanderAppender.cs
new file mode 100644
index 0000000..616fcea
--- /dev/null
+++ b/examples/Appenders/SampleAppendersApp/Appender/MessageObjectExpanderAppender.cs
@@ -0,0 +1,66 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+using System;
+using System.Reflection;
+
+using log4net.Core;
+
+namespace SampleAppendersApp.Appender
+{
+ /// <summary>
+ /// Forwarding Appender that introspects the <see cref="LoggingEvent.MessageObject"/>
+ /// and extracts all public properties and fields and stores them in the
+ /// <see cref="LoggingEvent.Properties"/>
+ /// </summary>
+ public sealed class MessageObjectExpanderAppender : log4net.Appender.ForwardingAppender
+ {
+ /// <inheritdoc/>
+ protected override void Append(LoggingEvent loggingEvent)
+ {
+ ArgumentNullException.ThrowIfNull(loggingEvent);
+ object messageObject = loggingEvent.MessageObject;
+
+ if (messageObject != null && !(messageObject is string))
+ {
+ Type messageType = messageObject.GetType();
+
+ // Get all public instance properties
+ if (ExpandProperties)
+ foreach (PropertyInfo propertyInfo in messageType.GetProperties(BindingFlags.Instance | BindingFlags.Public))
+ if (propertyInfo.CanRead)
+ loggingEvent.Properties[propertyInfo.Name] = propertyInfo.GetValue(messageObject, null);
+
+ // Get all public instance fields
+ if (ExpandFields)
+ foreach (FieldInfo fieldInfo in messageType.GetFields(BindingFlags.Instance | BindingFlags.Public))
+ loggingEvent.Properties[fieldInfo.Name] = fieldInfo.GetValue(messageObject);
+ }
+
+ // Delegate to base class which will forward
+ base.Append(loggingEvent);
+ }
+
+ /// <inheritdoc/>
+ public bool ExpandProperties { get; set; } = true;
+
+ /// <inheritdoc/>
+ public bool ExpandFields { get; set; } = true;
+ }
+}
\ No newline at end of file
diff --git a/examples/Appenders/SampleAppendersApp/Appender/PatternFileAppender.cs b/examples/Appenders/SampleAppendersApp/Appender/PatternFileAppender.cs
new file mode 100644
index 0000000..8808820
--- /dev/null
+++ b/examples/Appenders/SampleAppendersApp/Appender/PatternFileAppender.cs
@@ -0,0 +1,106 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+using System;
+using System.IO;
+using System.Text;
+using log4net.Appender;
+using log4net.Util;
+using log4net.Layout;
+using log4net.Core;
+
+namespace SampleAppendersApp.Appender
+{
+ /// <summary>
+ /// Appender that writes to a file named using a pattern
+ /// </summary>
+ /// <remarks>
+ /// The file to write to is selected for each event using a
+ /// PatternLayout specified in the File property. This allows
+ /// each LoggingEvent to be written to a file based on properties
+ /// of the event.
+ /// The output file is opened to write each LoggingEvent as it arrives
+ /// and closed afterwards.
+ /// </remarks>
+ public sealed class PatternFileAppender : AppenderSkeleton
+ {
+ /// <inheritdoc/>
+ public PatternLayout? File { get; set; }
+
+ /// <inheritdoc/>
+ public Encoding Encoding { get; set; } = Encoding.Default;
+
+ /// <inheritdoc/>
+ public SecurityContext? SecurityContext { get; set; }
+
+ /// <inheritdoc/>
+ public override void ActivateOptions()
+ {
+ base.ActivateOptions();
+ SecurityContext ??= SecurityContextProvider.DefaultProvider.CreateSecurityContext(this);
+ }
+
+ /// <inheritdoc/>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Reliability", "CA2000:Dispose objects before losing scope")]
+ protected override void Append(LoggingEvent loggingEvent)
+ {
+ try
+ {
+ // Render the file name
+ using StringWriter stringWriter = new();
+ ArgumentNullException.ThrowIfNull(File);
+ File.Format(stringWriter, loggingEvent);
+ string fileName = stringWriter.ToString();
+
+ fileName = SystemInfo.ConvertToFullPath(fileName);
+
+ FileStream? fileStream = null;
+
+ ArgumentNullException.ThrowIfNull(SecurityContext);
+ using (SecurityContext.Impersonate(this))
+ {
+ // Ensure that the directory structure exists
+ string? directoryFullName = Path.GetDirectoryName(fileName);
+ ArgumentNullException.ThrowIfNull(directoryFullName);
+
+ // Only create the directory if it does not exist
+ // doing this check here resolves some permissions failures
+ if (!Directory.Exists(directoryFullName))
+ Directory.CreateDirectory(directoryFullName);
+
+ // Open file stream while impersonating
+ fileStream = new(fileName, FileMode.Append, FileAccess.Write, FileShare.Read);
+ }
+
+ if (fileStream is not null)
+ {
+ using (StreamWriter streamWriter = new(fileStream, Encoding))
+ RenderLoggingEvent(streamWriter, loggingEvent);
+
+ fileStream.Close();
+ }
+ }
+ catch (Exception ex)
+ {
+ ErrorHandler.Error("Failed to append to file", ex);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/examples/Appenders/SampleAppendersApp/Appender/PatternLayoutAdoNetAppender.cs b/examples/Appenders/SampleAppendersApp/Appender/PatternLayoutAdoNetAppender.cs
new file mode 100644
index 0000000..db1219c
--- /dev/null
+++ b/examples/Appenders/SampleAppendersApp/Appender/PatternLayoutAdoNetAppender.cs
@@ -0,0 +1,85 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+using System;
+using System.Collections;
+using log4net.Appender;
+using log4net.Layout;
+using log4net.Util;
+
+namespace SampleAppendersApp.Appender
+{
+ /// <summary>
+ ///
+ /// </summary>
+ /// <example>
+ /// <code>
+ /// <![CDATA[
+ /// <appender name="PatternLayoutAdoNetAppender" type="ConsoleApplication1.PatternLayoutAdoNetAppender, ConsoleApplication1">
+ /// <connectionType value="log4net.Tests.Appender.AdoNet.Log4NetConnection, log4net.Tests" />
+ /// <connectionString value="..." />
+ /// <commandText value="INSERT INTO Log4Net (CustomValue1, CustomValue2) VALUES (@CustomValue1, @CustsomValue2)" />
+ /// <converter>
+ /// <name value="echo" />
+ /// <type value="ConsoleApplication1.EchoConverter, ConsoleApplication1" />
+ /// </converter>
+ /// <converter>
+ /// <name value="reverse" />
+ /// <type value="ConsoleApplication1.ReverseConverter, ConsoleApplication1" />
+ /// </converter>
+ /// <patternLayoutParameter>
+ /// <parameterName value="@CustomValue1"/>
+ /// <dbType value="String" />
+ /// <conversionPattern value="%echo{Hello World}" />
+ /// </patternLayoutParameter>
+ /// <patternLayoutParameter>
+ /// <parameterName value="@CustomValue2"/>
+ /// <dbType value="String" />
+ /// <conversionPattern value="%reverse{Goodbye}" />
+ /// </patternLayoutParameter>
+ /// </appender>
+ /// ]]>
+ /// </code>
+ /// </example>
+ public sealed class PatternLayoutAdoNetAppender : AdoNetAppender
+ {
+ private readonly ArrayList converters = [];
+
+ /// <inheritdoc/>
+ public void AddConverter(ConverterInfo converterInfo) => converters.Add(converterInfo);
+
+ /// <inheritdoc/>
+ public void AddPatternLayoutParameter(PatternLayoutAdoNetAppenderParameter parameter)
+ {
+ ArgumentNullException.ThrowIfNull(parameter);
+ PatternLayout patternLayout = new(parameter.ConversionPattern);
+ AddConveters(patternLayout);
+ patternLayout.ActivateOptions();
+
+ parameter.Layout = new Layout2RawLayoutAdapter(patternLayout);
+ m_parameters.Add(parameter);
+ }
+
+ private void AddConveters(PatternLayout patternLayout)
+ {
+ foreach (ConverterInfo conveterInfo in converters)
+ patternLayout.AddConverter(conveterInfo);
+ }
+ }
+}
\ No newline at end of file
diff --git a/extensions/net/1.0/log4net.Ext.Trace/cs/src/ITraceLog.cs b/examples/Appenders/SampleAppendersApp/Appender/PatternLayoutAdoNetAppenderParameter.cs
similarity index 75%
rename from extensions/net/1.0/log4net.Ext.Trace/cs/src/ITraceLog.cs
rename to examples/Appenders/SampleAppendersApp/Appender/PatternLayoutAdoNetAppenderParameter.cs
index d5b107c..4e42e0d 100644
--- a/extensions/net/1.0/log4net.Ext.Trace/cs/src/ITraceLog.cs
+++ b/examples/Appenders/SampleAppendersApp/Appender/PatternLayoutAdoNetAppenderParameter.cs
@@ -17,18 +17,14 @@
//
#endregion
-using System;
+using log4net.Appender;
-using log4net;
-
-namespace log4net.Ext.Trace
+namespace SampleAppendersApp.Appender
{
- public interface ITraceLog : ILog
- {
- void Trace(object message);
- void Trace(object message, Exception t);
- void TraceFormat(string format, params object[] args);
- bool IsTraceEnabled { get; }
- }
-}
-
+ /// <inheritdoc/>
+ public sealed class PatternLayoutAdoNetAppenderParameter : AdoNetAppenderParameter
+ {
+ /// <inheritdoc/>
+ public string? ConversionPattern { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/examples/Appenders/SampleAppendersApp/LoggingExample.cs b/examples/Appenders/SampleAppendersApp/LoggingExample.cs
new file mode 100644
index 0000000..88a1875
--- /dev/null
+++ b/examples/Appenders/SampleAppendersApp/LoggingExample.cs
@@ -0,0 +1,114 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+using System;
+
+using SampleAppendersApp.Appender;
+
+// Configure log4net using the .config file
+[assembly: log4net.Config.XmlConfigurator(Watch = true)]
+// This will cause log4net to look for a configuration file
+// called ConsoleApp.exe.config in the application base
+// directory (i.e. the directory containing SampleAppendersApp.exe)
+
+namespace SampleAppendersApp
+{
+ /// <summary>
+ /// Example of how to simply configure and use log4net
+ /// </summary>
+ public static class LoggingExample
+ {
+ // Create a logger for use in this class
+ private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(LoggingExample));
+
+ /// <summary>
+ /// Application entry point
+ /// </summary>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Globalization", "CA1303:Do not pass literals as localized parameters")]
+ public static void Main()
+ {
+ log4net.ThreadContext.Properties["session"] = 21;
+
+ // Hookup the FireEventAppender event
+ if (FireEventAppender.Instance is not null)
+ FireEventAppender.Instance.MessageLoggedEvent += FireEventAppender_MessageLoggedEventHandler;
+
+ // Log an info level message
+ if (log.IsInfoEnabled) log.Info("Application [ConsoleApp] Start");
+
+ // Log a debug message. Test if debug is enabled before
+ // attempting to log the message. This is not required but
+ // can make running without logging faster.
+ if (log.IsDebugEnabled) log.Debug("This is a debug message");
+
+ // Log a custom object as the log message
+ log.Warn(new MsgObj(42, "So long and thanks for all the fish"));
+
+ try
+ {
+ Bar();
+ }
+ catch (ArithmeticException ex)
+ {
+ // Log an error with an exception
+ log.Error("Exception thrown from method Bar", ex);
+ }
+
+ log.Error("Hey this is an error!");
+
+ // Log an info level message
+ if (log.IsInfoEnabled) log.Info("Application [ConsoleApp] End");
+
+ Console.Write("Press Enter to exit...");
+ Console.ReadLine();
+ }
+
+ // Helper methods to demonstrate location information and nested exceptions
+
+ private static void Bar() => Goo();
+
+ private static void Foo() => throw new InvalidTimeZoneException("This is an Exception");
+
+ private static void Goo()
+ {
+ try
+ {
+ Foo();
+ }
+ catch (Exception ex)
+ {
+ throw new ArithmeticException("Failed in Goo. Calling Foo. Inner Exception provided", ex);
+ }
+ }
+
+ private static void FireEventAppender_MessageLoggedEventHandler(object? sender, MessageLoggedEventArgs e)
+ => System.Diagnostics.Trace.WriteLine("EVENT ****" + e.LoggingEvent.RenderedMessage + "****");
+
+ /// <inheritdoc/>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1034:Nested types should not be visible")]
+ public sealed class MsgObj(int type, string error)
+ {
+ /// <inheritdoc/>
+ public int MessageType { get; } = type;
+
+ /// <inheritdoc/>
+ public string ErrorText { get; } = error;
+ }
+ }
+}
diff --git a/examples/Appenders/SampleAppendersApp/SampleAppendersApp.csproj b/examples/Appenders/SampleAppendersApp/SampleAppendersApp.csproj
new file mode 100644
index 0000000..c3e85a7
--- /dev/null
+++ b/examples/Appenders/SampleAppendersApp/SampleAppendersApp.csproj
@@ -0,0 +1,11 @@
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <OutputType>WinExe</OutputType>
+ <TargetFramework>net8.0-windows</TargetFramework>
+ <UseWindowsForms>true</UseWindowsForms>
+ <Nullable>enable</Nullable>
+ </PropertyGroup>
+ <ItemGroup>
+ <PackageReference Include="log4net" Version="$(Log4NetPackageVersion)" />
+ </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/examples/Appenders/WmiAppender/IWmiBoundEvent.cs b/examples/Appenders/WmiAppender/IWmiBoundEvent.cs
new file mode 100644
index 0000000..6878505
--- /dev/null
+++ b/examples/Appenders/WmiAppender/IWmiBoundEvent.cs
@@ -0,0 +1,52 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+using log4net.Core;
+using System.Management.Instrumentation;
+
+namespace log4net.Appender
+{
+ /// <summary>
+ /// Subclass of <see cref="IEvent"/> for events that need to bind to a <see cref="LoggingEvent"/>
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// If the <see cref="LoggingEvent"/>.<see cref="LoggingEvent.MessageObject"/> is
+ /// a <see cref="IWmiBoundEvent"/> then the default behavior of the <see cref="WmiLayout"/>
+ /// is to call the <see cref="Bind"/> method passing the <see cref="LoggingEvent"/>.
+ /// This allows the event object to capture additional data from the <see cref="LoggingEvent"/>
+ /// before it is fired.
+ /// </para>
+ /// </remarks>
+ public interface IWmiBoundEvent : IEvent
+ {
+ /// <summary>
+ /// This method is called before this instance is fired
+ /// </summary>
+ /// <param name="loggingEvent">the <see cref="LoggingEvent"/> containing the data</param>
+ /// <remarks>
+ /// <para>
+ /// The <see cref="WmiLayout"/> calls this method passing the <see cref="LoggingEvent"/>
+ /// object. Implementors should capture any required data from the <paramref name="loggingEvent"/>
+ /// and store it in their instance prior to firing to WMI.
+ /// </para>
+ /// </remarks>
+ void Bind(LoggingEvent loggingEvent);
+ }
+}
\ No newline at end of file
diff --git a/examples/Appenders/WmiAppender/WmiAppender.cs b/examples/Appenders/WmiAppender/WmiAppender.cs
new file mode 100644
index 0000000..b625ba7
--- /dev/null
+++ b/examples/Appenders/WmiAppender/WmiAppender.cs
@@ -0,0 +1,186 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+using System;
+using log4net.Core;
+using System.Management.Instrumentation;
+using log4net.Util;
+
+// This is the WMI namespace for event objects in this assembly
+[assembly: Instrumented("root/log4net")]
+
+namespace log4net.Appender
+{
+ /// <summary>
+ /// <see cref="WmiAppender"/> fires instrumented events for each <see cref="LoggingEvent"/>
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// This appender fires Windows Management Instrumentation (WMI) events for
+ /// each <see cref="LoggingEvent"/>.
+ /// </para>
+ /// <para>
+ /// By default this appender fires <see cref="WmiLoggingEvent"/> objects, however
+ /// this can be overridden by specifying a custom <see cref="Layout"/> or by setting
+ /// the <see cref="LoggingEvent"/>.<see cref="LoggingEvent.MessageObject"/> to an
+ /// <see cref="IEvent"/> instance.
+ /// </para>
+ /// <para>
+ /// This assembly must be registered with WMI. Use the <c>InstallUtil</c> tool
+ /// shipped with the .NET framework to install this assembly. This will register
+ /// the <c>root/log4net</c> WMI namespace.
+ /// </para>
+ /// </remarks>
+ public sealed class WmiAppender : IAppender, IOptionHandler
+ {
+ #region Private Instance Fields
+
+ /// <summary>
+ /// It is assumed and enforced that errorHandler is never null.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// It is assumed and enforced that errorHandler is never null.
+ /// </para>
+ /// <para>
+ /// See <see cref="ErrorHandler"/> for more information.
+ /// </para>
+ /// </remarks>
+ private IErrorHandler errorHandler = new OnlyOnceErrorHandler("WmiAppender");
+
+ #endregion
+
+ #region Public Instance Properties
+
+ /// <summary>
+ /// Gets or sets the name of this appender.
+ /// </summary>
+ /// <value>The name of the appender.</value>
+ /// <remarks>
+ /// <para>
+ /// The name uniquely identifies the appender.
+ /// </para>
+ /// </remarks>
+ public string? Name { get; set; }
+
+ /// <summary>
+ /// Gets or sets the threshold <see cref="Level"/> of this appender.
+ /// </summary>
+ /// <value>
+ /// The threshold <see cref="Level"/> of the appender.
+ /// </value>
+ /// <remarks>
+ /// <para>
+ /// All log events with lower level than the threshold level are ignored
+ /// by the appender.
+ /// </para>
+ /// <para>
+ /// In configuration files this option is specified by setting the
+ /// value of the <see cref="Threshold"/> option to a level
+ /// string, such as "DEBUG", "INFO" and so on.
+ /// </para>
+ /// </remarks>
+ public Level? Threshold { get; set; }
+
+ /// <summary>
+ /// Gets or sets the <see cref="WmiLayout"/> for this appender.
+ /// </summary>
+ /// <value>The layout of the appender.</value>
+ /// <remarks>
+ /// <para>
+ /// The <see cref="WmiLayout"/> to use to format the
+ /// <see cref="LoggingEvent"/> as an <see cref="IEvent"/>.
+ /// </para>
+ /// </remarks>
+ public WmiLayout? Layout { get; set; }
+
+ /// <summary>
+ /// Gets or sets the <see cref="IErrorHandler"/> for this appender.
+ /// </summary>
+ /// <value>The <see cref="IErrorHandler"/> of the appender</value>
+ /// <remarks>
+ /// <para>
+ /// The default value is a <see cref="OnlyOnceErrorHandler"/>.
+ /// </para>
+ /// </remarks>
+ public IErrorHandler ErrorHandler
+ {
+ get => errorHandler;
+ set
+ {
+ if (value is null)
+ // We do not throw exception here since the cause is probably a bad config file.
+ LogLog.Warn(GetType(), "WmiAppender: You have tried to set a null error-handler.");
+ else
+ errorHandler = value;
+ }
+ }
+
+ #endregion Public Instance Properties
+
+ /// <summary>
+ /// Activate this appender
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// If a <see cref="Layout"/> has not been specified then this
+ /// method will create a default <see cref="WmiLayout"/> instance.
+ /// </para>
+ /// </remarks>
+ public void ActivateOptions() => Layout ??= new WmiLayout();
+
+ /// <summary>
+ /// Close this appender
+ /// </summary>
+ public void Close()
+ { }
+
+ /// <summary>
+ /// Process a <see cref="LoggingEvent"/>
+ /// </summary>
+ /// <param name="loggingEvent">the <see cref="LoggingEvent"/> containing the data</param>
+ /// <remarks>
+ /// <para>
+ /// Uses the <see cref="Layout"/> to format the <paramref name="loggingEvent"/>
+ /// as an <see cref="IEvent"/>. This <see cref="IEvent"/> is then fired.
+ /// </para>
+ /// </remarks>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types")]
+ public void DoAppend(LoggingEvent loggingEvent)
+ {
+ if (loggingEvent is null)
+ throw new ArgumentNullException(nameof(loggingEvent));
+
+ try
+ {
+ if (IsAsSevereAsThreshold(loggingEvent.Level))
+ (Layout?.Format(loggingEvent))?.Fire();
+ }
+ catch (Exception ex)
+ {
+ ErrorHandler.Error("Failed in DoAppend", ex);
+ }
+ }
+
+ /// <summary>
+ /// Checks if the message level is below this appender's threshold.
+ /// </summary>
+ private bool IsAsSevereAsThreshold(Level level) => ((Threshold == null) || level >= Threshold);
+ }
+}
\ No newline at end of file
diff --git a/examples/Appenders/WmiAppender/WmiAppender.csproj b/examples/Appenders/WmiAppender/WmiAppender.csproj
new file mode 100644
index 0000000..bb74386
--- /dev/null
+++ b/examples/Appenders/WmiAppender/WmiAppender.csproj
@@ -0,0 +1,18 @@
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <TargetFramework>net462</TargetFramework>
+ <Nullable>enable</Nullable>
+ </PropertyGroup>
+ <ItemGroup>
+ <PackageReference Include="log4net" Version="$(Log4NetPackageVersion)" />
+ <Reference Include="System">
+ <Name>System</Name>
+ </Reference>
+ <Reference Include="System.Configuration.Install">
+ <Name>System.Configuration.Install</Name>
+ </Reference>
+ <Reference Include="System.Management">
+ <Name>System.Management</Name>
+ </Reference>
+ </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/examples/net/2.0/Appenders/WmiAppender/cs/src/WmiInstaller.cs b/examples/Appenders/WmiAppender/WmiInstaller.cs
similarity index 81%
rename from examples/net/2.0/Appenders/WmiAppender/cs/src/WmiInstaller.cs
rename to examples/Appenders/WmiAppender/WmiInstaller.cs
index 03bb865..77e3a48 100644
--- a/examples/net/2.0/Appenders/WmiAppender/cs/src/WmiInstaller.cs
+++ b/examples/Appenders/WmiAppender/WmiInstaller.cs
@@ -17,16 +17,14 @@
//
#endregion
-using System;
using System.Management.Instrumentation;
namespace log4net.Appender
{
- /// <summary>
- /// Register this assembly with WMI
- /// </summary>
- [System.ComponentModel.RunInstaller(true)]
- public class WmiInstaller : DefaultManagementProjectInstaller
- {
- }
-}
+ /// <summary>
+ /// Register this assembly with WMI
+ /// </summary>
+ [System.ComponentModel.RunInstaller(true)]
+ public sealed class WmiInstaller : DefaultManagementProjectInstaller
+ { }
+}
\ No newline at end of file
diff --git a/examples/Appenders/WmiAppender/WmiLayout.cs b/examples/Appenders/WmiAppender/WmiLayout.cs
new file mode 100644
index 0000000..3ce3e10
--- /dev/null
+++ b/examples/Appenders/WmiAppender/WmiLayout.cs
@@ -0,0 +1,98 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+using log4net.Core;
+using System;
+using System.Management.Instrumentation;
+
+namespace log4net.Appender
+{
+ /// <inheritdoc/>
+ public class WmiLayout
+ {
+ /// <summary>
+ /// Formats a <see cref="LoggingEvent"/> for instrumentation
+ /// </summary>
+ /// <param name="loggingEvent">the <see cref="LoggingEvent"/> containing the data</param>
+ /// <returns>an instrumentation event that can be fired</returns>
+ /// <remarks>
+ /// <para>
+ /// If the <see cref="LoggingEvent.MessageObject"/> of the
+ /// <paramref name="loggingEvent" /> is an <see cref="IEvent"/> then
+ /// that instance is returned. If the instance also implements the
+ /// <see cref="IWmiBoundEvent"/> interface then the <see cref="IWmiBoundEvent.Bind"/>
+ /// method will be called on the instance with the <paramref name="loggingEvent" />
+ /// parameter.
+ /// </para>
+ /// <para>
+ /// If the <see cref="LoggingEvent.MessageObject"/> of the
+ /// <paramref name="loggingEvent" /> is not an <see cref="IEvent"/>
+ /// then the <see cref="CreateEvent"/> method will be called
+ /// to create an appropriate instrumentation event object.
+ /// </para>
+ /// </remarks>
+ public virtual IEvent Format(LoggingEvent loggingEvent)
+ {
+ // See if the caller gave us an Instrumentation Event
+ if (loggingEvent?.MessageObject is IEvent instrumentationEvent)
+ {
+ // See if the caller gave us a Bound Instrumentation Event
+ // Attach the logging event to the bound instrumentation event
+ (instrumentationEvent as IWmiBoundEvent)?.Bind(loggingEvent);
+
+ return instrumentationEvent;
+ }
+
+ // We must create our own IEvent
+ return CreateEvent(loggingEvent!);
+ }
+
+ /// <summary>
+ /// Create the <see cref="IEvent"/> instance that should be fired
+ /// </summary>
+ /// <param name="loggingEvent">the <see cref="LoggingEvent"/> containing the data</param>
+ /// <returns>an instrumentation event that can be fired</returns>
+ /// <remarks>
+ /// <para>
+ /// The default implementation of this method creates a <see cref="WmiLoggingEvent"/>
+ /// instance using the data from the <paramref name="loggingEvent" />.
+ /// </para>
+ /// <para>
+ /// Subclasses should override this method to return their own custom
+ /// instrumentation event object.
+ /// </para>
+ /// </remarks>
+ protected virtual IEvent CreateEvent(LoggingEvent loggingEvent)
+ {
+ if (loggingEvent is null)
+ throw new ArgumentNullException(nameof(loggingEvent));
+
+ return new WmiLoggingEvent
+ {
+ TimeStamp = loggingEvent.TimeStamp,
+ LoggerName = loggingEvent.LoggerName,
+ Level = loggingEvent.Level.DisplayName,
+ Message = loggingEvent.RenderedMessage,
+ ThreadName = loggingEvent.ThreadName,
+ ExceptionString = loggingEvent.GetExceptionString(),
+ Domain = loggingEvent.Domain
+ };
+ }
+ }
+}
\ No newline at end of file
diff --git a/examples/Appenders/WmiAppender/WmiLoggingEvent.cs b/examples/Appenders/WmiAppender/WmiLoggingEvent.cs
new file mode 100644
index 0000000..6acca6b
--- /dev/null
+++ b/examples/Appenders/WmiAppender/WmiLoggingEvent.cs
@@ -0,0 +1,51 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+using System;
+using System.Management.Instrumentation;
+
+namespace log4net.Appender
+{
+ /// <summary>
+ /// The default instrumented event raised by the <see cref="WmiAppender"/>
+ /// </summary>
+ /// <para>
+ /// This is the default event fired by the <see cref="WmiAppender"/>.
+ /// To fire a custom event set the <see cref="WmiAppender.Layout"/> to a
+ /// subclass of <see cref="WmiLayout"/> that overrides the <see cref="WmiLayout.CreateEvent"/>
+ /// method.
+ /// </para>
+ public sealed class WmiLoggingEvent : BaseEvent
+ {
+ /// <inheritdoc/>
+ public DateTime TimeStamp { get; set; }
+ /// <inheritdoc/>
+ public string? LoggerName { get; set; }
+ /// <inheritdoc/>
+ public string? Level { get; set; }
+ /// <inheritdoc/>
+ public string? Message { get; set; }
+ /// <inheritdoc/>
+ public string? ThreadName { get; set; }
+ /// <inheritdoc/>
+ public string? ExceptionString { get; set; }
+ /// <inheritdoc/>
+ public string? Domain { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/examples/Directory.Build.props b/examples/Directory.Build.props
new file mode 100644
index 0000000..30b62ed
--- /dev/null
+++ b/examples/Directory.Build.props
@@ -0,0 +1,40 @@
+<Project>
+ <PropertyGroup>
+ <Version>3.0.0</Version>
+ <AssemblyVersion>$(Version)</AssemblyVersion>
+ <Deterministic>true</Deterministic>
+ <LangVersion>latest</LangVersion>
+ <Nullable>enable</Nullable>
+ <AnalysisLevel>8</AnalysisLevel>
+ <AnalysisMode>AllEnabledByDefault</AnalysisMode>
+ <RunAnalyzersDuringLiveAnalysis>true</RunAnalyzersDuringLiveAnalysis>
+ <RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
+ <_SkipUpgradeNetAnalyzersNuGetWarning>true</_SkipUpgradeNetAnalyzersNuGetWarning>
+ <AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
+ <GenerateDocumentationFile>true</GenerateDocumentationFile>
+ <SelfContained>false</SelfContained>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ </PropertyGroup>
+ <PropertyGroup>
+ <Log4NetPackageVersion>2.0.17</Log4NetPackageVersion>
+ </PropertyGroup>
+ <PropertyGroup Label="GenerateAssemblyInfo">
+ <GenerateAssemblyVersionAttribute>true</GenerateAssemblyVersionAttribute>
+ <GenerateAssemblyFileVersionAttribute>true</GenerateAssemblyFileVersionAttribute>
+ </PropertyGroup>
+ <PropertyGroup Label="Metadata">
+ <AssemblyTitle>$(AssemblyName)</AssemblyTitle>
+ <Company>Apache Foundation</Company>
+ <Product>log4net</Product>
+ <Copyright>Copyright %A9 2008 - $([System.DateTime]::Now.Year)</Copyright>
+ <RepositoryType>git</RepositoryType>
+ <RepositoryUrl>https://github.com/apache/logging-log4net</RepositoryUrl>
+ </PropertyGroup>
+</Project>
\ No newline at end of file
diff --git a/examples/net/2.0/Extensibility/EventIDLogApp/cs/src/App.config b/examples/Extensibility/EventIDLogApp/App.config
similarity index 100%
rename from examples/net/2.0/Extensibility/EventIDLogApp/cs/src/App.config
rename to examples/Extensibility/EventIDLogApp/App.config
diff --git a/examples/Extensibility/EventIDLogApp/EventIDLogApp.cs b/examples/Extensibility/EventIDLogApp/EventIDLogApp.cs
new file mode 100644
index 0000000..f2bfaf8
--- /dev/null
+++ b/examples/Extensibility/EventIDLogApp/EventIDLogApp.cs
@@ -0,0 +1,49 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+using System;
+using log4net.Ext.EventID;
+
+// Configure this assembly using the 'EventIDLogApp.exe.config' config file
+[assembly: log4net.Config.XmlConfigurator(Watch = true)]
+
+namespace EventIDLogApp
+{
+ /// <summary>
+ /// EventIDLogApp
+ /// </summary>
+ internal static class EventIDLogApp
+ {
+ // Create a logger for use in this class
+ private static readonly IEventIDLog log = EventIDLogManager.GetLogger(typeof(EventIDLogApp));
+
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main()
+ {
+ log.Info(1, "Application [" + typeof(EventIDLogApp).Assembly.GetName().Name + "] Start");
+
+ log.Warn(40, "This is a warn message ");
+
+ log.Info(2, "Application [" + typeof(EventIDLogApp).Assembly.GetName().Name + "] Stop");
+ }
+ }
+}
\ No newline at end of file
diff --git a/examples/Extensibility/EventIDLogApp/EventIDLogApp.csproj b/examples/Extensibility/EventIDLogApp/EventIDLogApp.csproj
new file mode 100644
index 0000000..6612f08
--- /dev/null
+++ b/examples/Extensibility/EventIDLogApp/EventIDLogApp.csproj
@@ -0,0 +1,12 @@
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>net8.0</TargetFramework>
+ </PropertyGroup>
+ <ItemGroup>
+ <PackageReference Include="log4net" Version="$(Log4NetPackageVersion)" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\Extensions\log4net.Ext.EventID\log4net.Ext.EventID.csproj" />
+ </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/examples/Extensibility/TraceLogApp/App.config b/examples/Extensibility/TraceLogApp/App.config
new file mode 100644
index 0000000..0e64580
--- /dev/null
+++ b/examples/Extensibility/TraceLogApp/App.config
@@ -0,0 +1,21 @@
+<configuration>
+ <!-- Register a section handler for the log4net section -->
+ <configSections>
+ <section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
+ </configSections>
+ <!-- This section contains the log4net configuration settings -->
+ <log4net debug="false" threshold="TRACE">
+ <!-- Define some output appenders -->
+ <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
+ <layout type="log4net.Layout.PatternLayout">
+ <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
+ </layout>
+ </appender>
+
+ <!-- Setup the root category, add the appenders and set the default priority -->
+ <root>
+ <level value="TRACE" />
+ <appender-ref ref="ConsoleAppender" />
+ </root>
+ </log4net>
+</configuration>
\ No newline at end of file
diff --git a/examples/Extensibility/TraceLogApp/TraceLogApp.cs b/examples/Extensibility/TraceLogApp/TraceLogApp.cs
new file mode 100644
index 0000000..5df6420
--- /dev/null
+++ b/examples/Extensibility/TraceLogApp/TraceLogApp.cs
@@ -0,0 +1,48 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+using System;
+
+using log4net.Ext.Trace;
+
+// Configure this assembly using the 'TraceLogApp.exe.log4net' config file
+[assembly: log4net.Config.XmlConfigurator(ConfigFileExtension = "log4net", Watch = true)]
+
+namespace TraceLogApp
+{
+ /// <inheritdoc/>
+ internal static class TraceLogApp
+ {
+ // Create a logger for use in this class
+ private static readonly ITraceLog log = TraceLogManager.GetLogger(typeof(TraceLogApp));
+
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main()
+ {
+ for (int i = 0; i < 10; i++)
+ {
+ log.Trace("This is a trace message " + i);
+ System.Threading.Thread.Sleep(new TimeSpan(0, 0, 2));
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/examples/Extensibility/TraceLogApp/TraceLogApp.csproj b/examples/Extensibility/TraceLogApp/TraceLogApp.csproj
new file mode 100644
index 0000000..9013463
--- /dev/null
+++ b/examples/Extensibility/TraceLogApp/TraceLogApp.csproj
@@ -0,0 +1,12 @@
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>net8.0</TargetFramework>
+ </PropertyGroup>
+ <ItemGroup>
+ <PackageReference Include="log4net" Version="$(Log4NetPackageVersion)" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\Extensions\log4net.Ext.Trace\log4net.Ext.Trace.csproj" />
+ </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/examples/Extensions/log4net.Ext.EventID/EventIDLogImpl.cs b/examples/Extensions/log4net.Ext.EventID/EventIDLogImpl.cs
new file mode 100644
index 0000000..d48cb99
--- /dev/null
+++ b/examples/Extensions/log4net.Ext.EventID/EventIDLogImpl.cs
@@ -0,0 +1,98 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+using System;
+
+using log4net.Core;
+
+namespace log4net.Ext.EventID
+{
+ /// <summary>
+ /// Implementation for <see cref="IEventIDLog"/>
+ /// </summary>
+ /// <inheritdoc/>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1711:Identifiers should not have incorrect suffix")]
+ public sealed class EventIDLogImpl(ILogger logger) : LogImpl(logger), IEventIDLog
+ {
+ /// <summary>
+ /// The fully qualified name of this declaring type not the type of any subclass.
+ /// </summary>
+ private readonly static Type ThisDeclaringType = typeof(EventIDLogImpl);
+
+ #region Implementation of IEventIDLog
+
+ /// <inheritdoc/>
+ public void Info(int eventId, object message) => Info(eventId, message, null);
+
+ /// <inheritdoc/>
+ public void Info(int eventId, object message, Exception? t)
+ {
+ if (IsInfoEnabled)
+ {
+ LoggingEvent loggingEvent = new(ThisDeclaringType, Logger.Repository, Logger.Name, Level.Info, message, t);
+ loggingEvent.Properties["EventID"] = eventId;
+ Logger.Log(loggingEvent);
+ }
+ }
+
+ /// <inheritdoc/>
+ public void Warn(int eventId, object message) => Warn(eventId, message, null);
+
+ /// <inheritdoc/>
+ public void Warn(int eventId, object message, Exception? t)
+ {
+ if (IsWarnEnabled)
+ {
+ LoggingEvent loggingEvent = new(ThisDeclaringType, Logger.Repository, Logger.Name, Level.Warn, message, t);
+ loggingEvent.Properties["EventID"] = eventId;
+ Logger.Log(loggingEvent);
+ }
+ }
+
+ /// <inheritdoc/>
+ public void Error(int eventId, object message) => Error(eventId, message, null);
+
+ /// <inheritdoc/>
+ public void Error(int eventId, object message, Exception? t)
+ {
+ if (IsErrorEnabled)
+ {
+ LoggingEvent loggingEvent = new(ThisDeclaringType, Logger.Repository, Logger.Name, Level.Error, message, t);
+ loggingEvent.Properties["EventID"] = eventId;
+ Logger.Log(loggingEvent);
+ }
+ }
+
+ /// <inheritdoc/>
+ public void Fatal(int eventId, object message) => Fatal(eventId, message, null);
+
+ /// <inheritdoc/>
+ public void Fatal(int eventId, object message, Exception? t)
+ {
+ if (IsFatalEnabled)
+ {
+ LoggingEvent loggingEvent = new(ThisDeclaringType, Logger.Repository, Logger.Name, Level.Fatal, message, t);
+ loggingEvent.Properties["EventID"] = eventId;
+ Logger.Log(loggingEvent);
+ }
+ }
+
+ #endregion Implementation of IEventIDLog
+ }
+}
diff --git a/examples/Extensions/log4net.Ext.EventID/EventIDLogManager.cs b/examples/Extensions/log4net.Ext.EventID/EventIDLogManager.cs
new file mode 100644
index 0000000..4c62dd8
--- /dev/null
+++ b/examples/Extensions/log4net.Ext.EventID/EventIDLogManager.cs
@@ -0,0 +1,256 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+using System;
+using System.Reflection;
+using log4net.Core;
+
+namespace log4net.Ext.EventID
+{
+ /// <summary>
+ /// Custom Logging Class to support Event IDs.
+ /// </summary>
+ public sealed class EventIDLogManager
+ {
+ #region Static Member Variables
+
+ /// <summary>
+ /// The wrapper map to use to hold the <see cref="EventIDLogImpl"/> objects
+ /// </summary>
+ private static readonly WrapperMap wrapperMap = new(new(WrapperCreationHandler));
+
+ #endregion
+
+ #region Constructor
+
+ /// <summary>
+ /// Private constructor to prevent object creation
+ /// </summary>
+ private EventIDLogManager() { }
+
+ #endregion
+
+ #region Type Specific Manager Methods
+
+ /// <summary>
+ /// Returns the named logger if it exists
+ /// </summary>
+ /// <remarks>
+ /// <para>If the named logger exists (in the default hierarchy) then it
+ /// returns a reference to the logger, otherwise it returns
+ /// <see langword="null"/>.</para>
+ /// </remarks>
+ /// <param name="name">The fully qualified logger name to look for</param>
+ /// <returns>The logger found, or null</returns>
+ public static IEventIDLog Exists(string name) => Exists(Assembly.GetCallingAssembly(), name);
+
+ /// <summary>
+ /// Returns the named logger if it exists
+ /// </summary>
+ /// <remarks>
+ /// <para>If the named logger exists (in the specified domain) then it
+ /// returns a reference to the logger, otherwise it returns
+ /// <see langword="null"/>.</para>
+ /// </remarks>
+ /// <param name="domain">the domain to lookup in</param>
+ /// <param name="name">The fully qualified logger name to look for</param>
+ /// <returns>The logger found, or null</returns>
+ public static IEventIDLog Exists(string domain, string name)
+ => WrapLogger(LoggerManager.Exists(domain, name));
+
+ /// <summary>
+ /// Returns the named logger if it exists
+ /// </summary>
+ /// <remarks>
+ /// <para>If the named logger exists (in the specified assembly's domain) then it
+ /// returns a reference to the logger, otherwise it returns
+ /// <see langword="null"/>.</para>
+ /// </remarks>
+ /// <param name="assembly">the assembly to use to lookup the domain</param>
+ /// <param name="name">The fully qualified logger name to look for</param>
+ /// <returns>The logger found, or null</returns>
+ public static IEventIDLog Exists(Assembly assembly, string name)
+ => WrapLogger(LoggerManager.Exists(assembly, name));
+
+ /// <summary>
+ /// Returns all the currently defined loggers in the default domain.
+ /// </summary>
+ /// <remarks>
+ /// <para>The root logger is <b>not</b> included in the returned array.</para>
+ /// </remarks>
+ /// <returns>All the defined loggers</returns>
+ public static IEventIDLog[] GetCurrentLoggers()
+ => GetCurrentLoggers(Assembly.GetCallingAssembly());
+
+ /// <summary>
+ /// Returns all the currently defined loggers in the specified domain.
+ /// </summary>
+ /// <param name="domain">the domain to lookup in</param>
+ /// <remarks>
+ /// The root logger is <b>not</b> included in the returned array.
+ /// </remarks>
+ /// <returns>All the defined loggers</returns>
+ public static IEventIDLog[] GetCurrentLoggers(string domain)
+ => WrapLoggers(LoggerManager.GetCurrentLoggers(domain));
+
+ /// <summary>
+ /// Returns all the currently defined loggers in the specified assembly's domain.
+ /// </summary>
+ /// <param name="assembly">the assembly to use to lookup the domain</param>
+ /// <remarks>
+ /// The root logger is <b>not</b> included in the returned array.
+ /// </remarks>
+ /// <returns>All the defined loggers</returns>
+ public static IEventIDLog[] GetCurrentLoggers(Assembly assembly)
+ => WrapLoggers(LoggerManager.GetCurrentLoggers(assembly));
+
+ /// <summary>
+ /// Retrieve or create a named logger.
+ /// </summary>
+ /// <remarks>
+ /// <para>Retrieve a logger named as the <paramref name="name"/>
+ /// parameter. If the named logger already exists, then the
+ /// existing instance will be returned. Otherwise, a new instance is
+ /// created.</para>
+ ///
+ /// <para>By default, loggers do not have a set level but inherit
+ /// it from the hierarchy. This is one of the central features of
+ /// log4net.</para>
+ /// </remarks>
+ /// <param name="name">The name of the logger to retrieve.</param>
+ /// <returns>the logger with the name specified</returns>
+ public static IEventIDLog GetLogger(string name)
+ => GetLogger(Assembly.GetCallingAssembly(), name);
+
+ /// <summary>
+ /// Retrieve or create a named logger.
+ /// </summary>
+ /// <remarks>
+ /// <para>Retrieve a logger named as the <paramref name="name"/>
+ /// parameter. If the named logger already exists, then the
+ /// existing instance will be returned. Otherwise, a new instance is
+ /// created.</para>
+ ///
+ /// <para>By default, loggers do not have a set level but inherit
+ /// it from the hierarchy. This is one of the central features of
+ /// log4net.</para>
+ /// </remarks>
+ /// <param name="domain">the domain to lookup in</param>
+ /// <param name="name">The name of the logger to retrieve.</param>
+ /// <returns>the logger with the name specified</returns>
+ public static IEventIDLog GetLogger(string domain, string name)
+ => WrapLogger(LoggerManager.GetLogger(domain, name));
+
+ /// <summary>
+ /// Retrieve or create a named logger.
+ /// </summary>
+ /// <remarks>
+ /// <para>Retrieve a logger named as the <paramref name="name"/>
+ /// parameter. If the named logger already exists, then the
+ /// existing instance will be returned. Otherwise, a new instance is
+ /// created.</para>
+ ///
+ /// <para>By default, loggers do not have a set level but inherit
+ /// it from the hierarchy. This is one of the central features of
+ /// log4net.</para>
+ /// </remarks>
+ /// <param name="assembly">the assembly to use to lookup the domain</param>
+ /// <param name="name">The name of the logger to retrieve.</param>
+ /// <returns>the logger with the name specified</returns>
+ public static IEventIDLog GetLogger(Assembly assembly, string name)
+ => WrapLogger(LoggerManager.GetLogger(assembly, name));
+
+ /// <summary>
+ /// Shorthand for <see cref="LogManager.GetLogger(string)"/>.
+ /// </summary>
+ /// <remarks>
+ /// Get the logger for the fully qualified name of the type specified.
+ /// </remarks>
+ /// <param name="type">The full name of <paramref name="type"/> will
+ /// be used as the name of the logger to retrieve.</param>
+ /// <returns>the logger with the name specified</returns>
+ public static IEventIDLog GetLogger(Type type)
+ {
+ ArgumentNullException.ThrowIfNull(type);
+ return GetLogger(Assembly.GetCallingAssembly(), type.FullName ?? string.Empty);
+ }
+
+ /// <summary>
+ /// Shorthand for <see cref="LogManager.GetLogger(string)"/>.
+ /// </summary>
+ /// <remarks>
+ /// Get the logger for the fully qualified name of the type specified.
+ /// </remarks>
+ /// <param name="domain">the domain to lookup in</param>
+ /// <param name="type">The full name of <paramref name="type"/> will
+ /// be used as the name of the logger to retrieve.</param>
+ /// <returns>the logger with the name specified</returns>
+ public static IEventIDLog GetLogger(string domain, Type type)
+ => WrapLogger(LoggerManager.GetLogger(domain, type));
+
+ /// <summary>
+ /// Shorthand for <see cref="LogManager.GetLogger(string)"/>.
+ /// </summary>
+ /// <remarks>
+ /// Get the logger for the fully qualified name of the type specified.
+ /// </remarks>
+ /// <param name="assembly">the assembly to use to lookup the domain</param>
+ /// <param name="type">The full name of <paramref name="type"/> will
+ /// be used as the name of the logger to retrieve.</param>
+ /// <returns>the logger with the name specified</returns>
+ public static IEventIDLog GetLogger(Assembly assembly, Type type)
+ => WrapLogger(LoggerManager.GetLogger(assembly, type));
+
+ #endregion
+
+ #region Extension Handlers
+
+ /// <summary>
+ /// Lookup the wrapper object for the logger specified
+ /// </summary>
+ /// <param name="logger">the logger to get the wrapper for</param>
+ /// <returns>the wrapper for the logger specified</returns>
+ private static IEventIDLog WrapLogger(ILogger logger) => (IEventIDLog)wrapperMap.GetWrapper(logger);
+
+ /// <summary>
+ /// Lookup the wrapper objects for the loggers specified
+ /// </summary>
+ /// <param name="loggers">the loggers to get the wrappers for</param>
+ /// <returns>Lookup the wrapper objects for the loggers specified</returns>
+ private static IEventIDLog[] WrapLoggers(ILogger[] loggers)
+ {
+ IEventIDLog[] results = new IEventIDLog[loggers.Length];
+ for (int i = 0; i < loggers.Length; i++)
+ {
+ results[i] = WrapLogger(loggers[i]);
+ }
+ return results;
+ }
+
+ /// <summary>
+ /// Method to create the <see cref="ILoggerWrapper"/> objects used by
+ /// this manager.
+ /// </summary>
+ /// <param name="logger">The logger to wrap</param>
+ /// <returns>The wrapper for the logger specified</returns>
+ private static EventIDLogImpl WrapperCreationHandler(ILogger logger) => new(logger);
+
+ #endregion
+ }
+}
diff --git a/examples/Extensions/log4net.Ext.EventID/IEventIDLog.cs b/examples/Extensions/log4net.Ext.EventID/IEventIDLog.cs
new file mode 100644
index 0000000..063a1f8
--- /dev/null
+++ b/examples/Extensions/log4net.Ext.EventID/IEventIDLog.cs
@@ -0,0 +1,77 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+/*
+ * Custom Logging Classes to support Event IDs.
+ */
+
+using System;
+
+using log4net;
+
+namespace log4net.Ext.EventID
+{
+ /// <summary>
+ /// ILog-Extension
+ /// </summary>
+ public interface IEventIDLog : ILog
+ {
+ /// <summary>
+ /// Info
+ /// </summary>
+ void Info(int eventId, object message);
+
+ /// <summary>
+ /// Info
+ /// </summary>
+ void Info(int eventId, object message, Exception t);
+
+ /// <summary>
+ /// Warn
+ /// </summary>
+ void Warn(int eventId, object message);
+
+ /// <summary>
+ /// Warn
+ /// </summary>
+ void Warn(int eventId, object message, Exception t);
+
+ /// <summary>
+ /// Error
+ /// </summary>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1716:Identifiers should not match keywords")]
+ void Error(int eventId, object message);
+
+ /// <summary>
+ /// Error
+ /// </summary>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1716:Identifiers should not match keywords")]
+ void Error(int eventId, object message, Exception t);
+
+ /// <summary>
+ /// Fatal
+ /// </summary>
+ void Fatal(int eventId, object message);
+
+ /// <summary>
+ /// Fatal
+ /// </summary>
+ void Fatal(int eventId, object message, Exception t);
+ }
+}
\ No newline at end of file
diff --git a/examples/Extensions/log4net.Ext.EventID/log4net.Ext.EventID.csproj b/examples/Extensions/log4net.Ext.EventID/log4net.Ext.EventID.csproj
new file mode 100644
index 0000000..7eb3b79
--- /dev/null
+++ b/examples/Extensions/log4net.Ext.EventID/log4net.Ext.EventID.csproj
@@ -0,0 +1,8 @@
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <TargetFramework>net8.0</TargetFramework>
+ </PropertyGroup>
+ <ItemGroup>
+ <PackageReference Include="log4net" Version="$(Log4NetPackageVersion)" />
+ </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/AssemblyInfo.cs b/examples/Extensions/log4net.Ext.MarshalByRef/AssemblyInfo.cs
similarity index 100%
rename from extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/AssemblyInfo.cs
rename to examples/Extensions/log4net.Ext.MarshalByRef/AssemblyInfo.cs
diff --git a/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/MarshalByRefLogImpl.cs b/examples/Extensions/log4net.Ext.MarshalByRef/MarshalByRefLogImpl.cs
similarity index 100%
rename from extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/MarshalByRefLogImpl.cs
rename to examples/Extensions/log4net.Ext.MarshalByRef/MarshalByRefLogImpl.cs
diff --git a/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/MarshalByRefLogManager.cs b/examples/Extensions/log4net.Ext.MarshalByRef/MarshalByRefLogManager.cs
similarity index 100%
rename from extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/MarshalByRefLogManager.cs
rename to examples/Extensions/log4net.Ext.MarshalByRef/MarshalByRefLogManager.cs
diff --git a/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/log4net.Ext.MarshalByRef.csproj b/examples/Extensions/log4net.Ext.MarshalByRef/log4net.Ext.MarshalByRef.csproj
similarity index 100%
rename from extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/log4net.Ext.MarshalByRef.csproj
rename to examples/Extensions/log4net.Ext.MarshalByRef/log4net.Ext.MarshalByRef.csproj
diff --git a/extensions/net/1.0/log4net.Ext.Trace/cs/src/ITraceLog.cs b/examples/Extensions/log4net.Ext.Trace/ITraceLog.cs
similarity index 73%
copy from extensions/net/1.0/log4net.Ext.Trace/cs/src/ITraceLog.cs
copy to examples/Extensions/log4net.Ext.Trace/ITraceLog.cs
index d5b107c..2296928 100644
--- a/extensions/net/1.0/log4net.Ext.Trace/cs/src/ITraceLog.cs
+++ b/examples/Extensions/log4net.Ext.Trace/ITraceLog.cs
@@ -19,16 +19,18 @@
using System;
-using log4net;
-
namespace log4net.Ext.Trace
{
- public interface ITraceLog : ILog
- {
- void Trace(object message);
- void Trace(object message, Exception t);
- void TraceFormat(string format, params object[] args);
- bool IsTraceEnabled { get; }
- }
-}
-
+ /// <inheritdoc/>
+ public interface ITraceLog : ILog
+ {
+ /// <inheritdoc/>
+ void Trace(object message);
+ /// <inheritdoc/>
+ void Trace(object message, Exception t);
+ /// <inheritdoc/>
+ void TraceFormat(string format, params object[] args);
+ /// <inheritdoc/>
+ bool IsTraceEnabled { get; }
+ }
+}
\ No newline at end of file
diff --git a/examples/Extensions/log4net.Ext.Trace/TraceLogImpl.cs b/examples/Extensions/log4net.Ext.Trace/TraceLogImpl.cs
new file mode 100644
index 0000000..33331bf
--- /dev/null
+++ b/examples/Extensions/log4net.Ext.Trace/TraceLogImpl.cs
@@ -0,0 +1,85 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+using System;
+using System.Globalization;
+using log4net.Core;
+using log4net.Util;
+
+namespace log4net.Ext.Trace
+{
+ /// <inheritdoc/>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1711:Identifiers should not have incorrect suffix")]
+ public sealed class TraceLogImpl(ILogger logger) : LogImpl(logger), ITraceLog
+ {
+ /// <summary>
+ /// The fully qualified name of this declaring type not the type of any subclass.
+ /// </summary>
+ private readonly static Type ThisDeclaringType = typeof(TraceLogImpl);
+
+ /// <summary>
+ /// The default value for the TRACE level
+ /// </summary>
+ private readonly static Level s_defaultLevelTrace = new(20000, "TRACE");
+
+ /// <summary>
+ /// The current value for the TRACE level
+ /// </summary>
+ private Level? levelTrace;
+
+ /// <summary>
+ /// Lookup the current value of the TRACE level
+ /// </summary>
+ protected override void ReloadLevels(Repository.ILoggerRepository repository)
+ {
+ base.ReloadLevels(repository);
+ ArgumentNullException.ThrowIfNull(repository);
+ levelTrace = repository.LevelMap.LookupWithDefault(s_defaultLevelTrace);
+ }
+
+ #region Implementation of ITraceLog
+
+ /// <inheritdoc/>
+ public void Trace(object message)
+ => Logger.Log(ThisDeclaringType, levelTrace, message, null);
+
+ /// <inheritdoc/>
+ public void Trace(object message, Exception t)
+ => Logger.Log(ThisDeclaringType, levelTrace, message, t);
+
+ /// <inheritdoc/>
+ public void TraceFormat(string format, params object[] args)
+ {
+ if (IsTraceEnabled)
+ Logger.Log(ThisDeclaringType, levelTrace, new SystemStringFormat(CultureInfo.InvariantCulture, format, args), null);
+ }
+
+ /// <inheritdoc/>
+ public void TraceFormat(IFormatProvider provider, string format, params object[] args)
+ {
+ if (IsTraceEnabled)
+ Logger.Log(ThisDeclaringType, levelTrace, new SystemStringFormat(provider, format, args), null);
+ }
+
+ /// <inheritdoc/>
+ public bool IsTraceEnabled => Logger.IsEnabledFor(levelTrace);
+
+ #endregion Implementation of ITraceLog
+ }
+}
\ No newline at end of file
diff --git a/examples/Extensions/log4net.Ext.Trace/TraceLogManager.cs b/examples/Extensions/log4net.Ext.Trace/TraceLogManager.cs
new file mode 100644
index 0000000..e5f4805
--- /dev/null
+++ b/examples/Extensions/log4net.Ext.Trace/TraceLogManager.cs
@@ -0,0 +1,243 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+using System;
+using System.Reflection;
+using log4net.Core;
+
+namespace log4net.Ext.Trace
+{
+ /// <summary>
+ /// Custom Logging Class to support additional logging levels
+ /// </summary>
+ public static class TraceLogManager
+ {
+ #region Static Member Variables
+
+ /// <summary>
+ /// The wrapper map to use to hold the <see cref="TraceLogImpl"/> objects
+ /// </summary>
+ private static readonly WrapperMap s_wrapperMap = new(new WrapperCreationHandler(WrapperCreationHandler));
+
+ #endregion
+
+ #region Type Specific Manager Methods
+
+ /// <summary>
+ /// Returns the named logger if it exists
+ /// </summary>
+ /// <remarks>
+ /// <para>If the named logger exists (in the default hierarchy) then it
+ /// returns a reference to the logger, otherwise it returns
+ /// <see langword="null"/>.</para>
+ /// </remarks>
+ /// <param name="name">The fully qualified logger name to look for</param>
+ /// <returns>The logger found, or null</returns>
+ public static ITraceLog Exists(string name) => Exists(Assembly.GetCallingAssembly(), name);
+
+ /// <summary>
+ /// Returns the named logger if it exists
+ /// </summary>
+ /// <remarks>
+ /// <para>If the named logger exists (in the specified domain) then it
+ /// returns a reference to the logger, otherwise it returns
+ /// <see langword="null"/>.</para>
+ /// </remarks>
+ /// <param name="domain">the domain to lookup in</param>
+ /// <param name="name">The fully qualified logger name to look for</param>
+ /// <returns>The logger found, or null</returns>
+ public static ITraceLog Exists(string domain, string name)
+ => WrapLogger(LoggerManager.Exists(domain, name));
+
+ /// <summary>
+ /// Returns the named logger if it exists
+ /// </summary>
+ /// <remarks>
+ /// <para>If the named logger exists (in the specified assembly's domain) then it
+ /// returns a reference to the logger, otherwise it returns
+ /// <see langword="null"/>.</para>
+ /// </remarks>
+ /// <param name="assembly">the assembly to use to lookup the domain</param>
+ /// <param name="name">The fully qualified logger name to look for</param>
+ /// <returns>The logger found, or null</returns>
+ public static ITraceLog Exists(Assembly assembly, string name)
+ => WrapLogger(LoggerManager.Exists(assembly, name));
+
+ /// <summary>
+ /// Returns all the currently defined loggers in the default domain.
+ /// </summary>
+ /// <remarks>
+ /// <para>The root logger is <b>not</b> included in the returned array.</para>
+ /// </remarks>
+ /// <returns>All the defined loggers</returns>
+ public static ITraceLog[] GetCurrentLoggers() => GetCurrentLoggers(Assembly.GetCallingAssembly());
+
+ /// <summary>
+ /// Returns all the currently defined loggers in the specified domain.
+ /// </summary>
+ /// <param name="domain">the domain to lookup in</param>
+ /// <remarks>
+ /// The root logger is <b>not</b> included in the returned array.
+ /// </remarks>
+ /// <returns>All the defined loggers</returns>
+ public static ITraceLog[] GetCurrentLoggers(string domain)
+ => WrapLoggers(LoggerManager.GetCurrentLoggers(domain));
+
+ /// <summary>
+ /// Returns all the currently defined loggers in the specified assembly's domain.
+ /// </summary>
+ /// <param name="assembly">the assembly to use to lookup the domain</param>
+ /// <remarks>
+ /// The root logger is <b>not</b> included in the returned array.
+ /// </remarks>
+ /// <returns>All the defined loggers</returns>
+ public static ITraceLog[] GetCurrentLoggers(Assembly assembly)
+ => WrapLoggers(LoggerManager.GetCurrentLoggers(assembly));
+
+ /// <summary>
+ /// Retrieve or create a named logger.
+ /// </summary>
+ /// <remarks>
+ /// <para>Retrieve a logger named as the <paramref name="name"/>
+ /// parameter. If the named logger already exists, then the
+ /// existing instance will be returned. Otherwise, a new instance is
+ /// created.</para>
+ ///
+ /// <para>By default, loggers do not have a set level but inherit
+ /// it from the hierarchy. This is one of the central features of
+ /// log4net.</para>
+ /// </remarks>
+ /// <param name="name">The name of the logger to retrieve.</param>
+ /// <returns>the logger with the name specified</returns>
+ public static ITraceLog GetLogger(string name) => GetLogger(Assembly.GetCallingAssembly(), name);
+
+ /// <summary>
+ /// Retrieve or create a named logger.
+ /// </summary>
+ /// <remarks>
+ /// <para>Retrieve a logger named as the <paramref name="name"/>
+ /// parameter. If the named logger already exists, then the
+ /// existing instance will be returned. Otherwise, a new instance is
+ /// created.</para>
+ ///
+ /// <para>By default, loggers do not have a set level but inherit
+ /// it from the hierarchy. This is one of the central features of
+ /// log4net.</para>
+ /// </remarks>
+ /// <param name="domain">the domain to lookup in</param>
+ /// <param name="name">The name of the logger to retrieve.</param>
+ /// <returns>the logger with the name specified</returns>
+ public static ITraceLog GetLogger(string domain, string name)
+ => WrapLogger(LoggerManager.GetLogger(domain, name));
+
+ /// <summary>
+ /// Retrieve or create a named logger.
+ /// </summary>
+ /// <remarks>
+ /// <para>Retrieve a logger named as the <paramref name="name"/>
+ /// parameter. If the named logger already exists, then the
+ /// existing instance will be returned. Otherwise, a new instance is
+ /// created.</para>
+ ///
+ /// <para>By default, loggers do not have a set level but inherit
+ /// it from the hierarchy. This is one of the central features of
+ /// log4net.</para>
+ /// </remarks>
+ /// <param name="assembly">the assembly to use to lookup the domain</param>
+ /// <param name="name">The name of the logger to retrieve.</param>
+ /// <returns>the logger with the name specified</returns>
+ public static ITraceLog GetLogger(Assembly assembly, string name)
+ => WrapLogger(LoggerManager.GetLogger(assembly, name));
+
+ /// <summary>
+ /// Shorthand for <see cref="LogManager.GetLogger(string)"/>.
+ /// </summary>
+ /// <remarks>
+ /// Get the logger for the fully qualified name of the type specified.
+ /// </remarks>
+ /// <param name="type">The full name of <paramref name="type"/> will
+ /// be used as the name of the logger to retrieve.</param>
+ /// <returns>the logger with the name specified</returns>
+ public static ITraceLog GetLogger(Type type)
+ {
+ ArgumentNullException.ThrowIfNull(type?.FullName);
+ return GetLogger(Assembly.GetCallingAssembly(), type.FullName);
+ }
+
+ /// <summary>
+ /// Shorthand for <see cref="LogManager.GetLogger(string)"/>.
+ /// </summary>
+ /// <remarks>
+ /// Get the logger for the fully qualified name of the type specified.
+ /// </remarks>
+ /// <param name="domain">the domain to lookup in</param>
+ /// <param name="type">The full name of <paramref name="type"/> will
+ /// be used as the name of the logger to retrieve.</param>
+ /// <returns>the logger with the name specified</returns>
+ public static ITraceLog GetLogger(string domain, Type type)
+ => WrapLogger(LoggerManager.GetLogger(domain, type));
+
+ /// <summary>
+ /// Shorthand for <see cref="LogManager.GetLogger(string)"/>.
+ /// </summary>
+ /// <remarks>
+ /// Get the logger for the fully qualified name of the type specified.
+ /// </remarks>
+ /// <param name="assembly">the assembly to use to lookup the domain</param>
+ /// <param name="type">The full name of <paramref name="type"/> will
+ /// be used as the name of the logger to retrieve.</param>
+ /// <returns>the logger with the name specified</returns>
+ public static ITraceLog GetLogger(Assembly assembly, Type type)
+ => WrapLogger(LoggerManager.GetLogger(assembly, type));
+
+ #endregion
+
+ #region Extension Handlers
+
+ /// <summary>
+ /// Lookup the wrapper object for the logger specified
+ /// </summary>
+ /// <param name="logger">the logger to get the wrapper for</param>
+ /// <returns>the wrapper for the logger specified</returns>
+ private static ITraceLog WrapLogger(ILogger logger) => (ITraceLog)s_wrapperMap.GetWrapper(logger);
+
+ /// <summary>
+ /// Lookup the wrapper objects for the loggers specified
+ /// </summary>
+ /// <param name="loggers">the loggers to get the wrappers for</param>
+ /// <returns>Lookup the wrapper objects for the loggers specified</returns>
+ private static ITraceLog[] WrapLoggers(ILogger[] loggers)
+ {
+ ITraceLog[] results = new ITraceLog[loggers.Length];
+ for (int i = 0; i < loggers.Length; i++)
+ results[i] = WrapLogger(loggers[i]);
+ return results;
+ }
+
+ /// <summary>
+ /// Method to create the <see cref="ILoggerWrapper"/> objects used by
+ /// this manager.
+ /// </summary>
+ /// <param name="logger">The logger to wrap</param>
+ /// <returns>The wrapper for the logger specified</returns>
+ private static TraceLogImpl WrapperCreationHandler(ILogger logger) => new(logger);
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/examples/Extensions/log4net.Ext.Trace/log4net.Ext.Trace.csproj b/examples/Extensions/log4net.Ext.Trace/log4net.Ext.Trace.csproj
new file mode 100644
index 0000000..7eb3b79
--- /dev/null
+++ b/examples/Extensions/log4net.Ext.Trace/log4net.Ext.Trace.csproj
@@ -0,0 +1,8 @@
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <TargetFramework>net8.0</TargetFramework>
+ </PropertyGroup>
+ <ItemGroup>
+ <PackageReference Include="log4net" Version="$(Log4NetPackageVersion)" />
+ </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/examples/Layouts/SampleLayoutsApp/App.config b/examples/Layouts/SampleLayoutsApp/App.config
new file mode 100644
index 0000000..fec29b1
--- /dev/null
+++ b/examples/Layouts/SampleLayoutsApp/App.config
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+
+-->
+
+<!--
+ .NET application configuration file
+ This file must have the exact same name as your application with .config appended to it.
+
+ For example if your application is ConsoleApp.exe then the config file must be ConsoleApp.exe.config.
+ It must also be in the same directory as the application.
+ -->
+<configuration>
+ <!-- Register a section handler for the log4net section -->
+ <configSections>
+ <section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
+ </configSections>
+
+ <appSettings>
+ <!-- To enable internal log4net logging specify the following appSettings key -->
+ <!-- <add key="log4net.Internal.Debug" value="true"/> -->
+ </appSettings>
+
+ <!-- This section contains the log4net configuration settings -->
+ <log4net>
+
+ <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
+ <layout type="SampleLayoutsApp.Layout.LineWrappingLayout,SampleLayoutsApp">
+ <indent value="8" />
+ <layout type="log4net.Layout.PatternLayout" value="%date [%thread] %-5level %logger - %message%newline" />
+ </layout>
+ </appender>
+
+ <!-- Setup the root category, add the appenders and set the default level -->
+ <root>
+ <level value="ALL" />
+
+ <appender-ref ref="ConsoleAppender" />
+ </root>
+
+ </log4net>
+</configuration>
diff --git a/examples/Layouts/SampleLayoutsApp/Layout/ForwardingLayout.cs b/examples/Layouts/SampleLayoutsApp/Layout/ForwardingLayout.cs
new file mode 100644
index 0000000..341feb5
--- /dev/null
+++ b/examples/Layouts/SampleLayoutsApp/Layout/ForwardingLayout.cs
@@ -0,0 +1,148 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+using System.IO;
+using log4net.Core;
+using log4net.Layout;
+
+namespace SampleLayoutsApp.Layout
+{
+ /// <summary>
+ /// The ForwardingLayout forwards to a nested <see cref="ILayout"/>
+ /// </summary>
+ /// <remarks>
+ /// The ForwardingLayout base class is used by layouts that want
+ /// to decorate other <see cref="ILayout"/> objects.
+ /// </remarks>
+ public abstract class ForwardingLayout : ILayout, IOptionHandler
+ {
+ /// <inheritdoc/>
+ protected ForwardingLayout()
+ {
+ }
+
+ /// <inheritdoc/>
+ public ILayout? Layout { get; set; }
+
+ #region Implementation of IOptionHandler
+
+ /// <summary>
+ /// Activate component options
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// This is part of the <see cref="IOptionHandler"/> delayed object
+ /// activation scheme. The <see cref="ActivateOptions"/> method must
+ /// be called on this object after the configuration properties have
+ /// been set. Until <see cref="ActivateOptions"/> is called this
+ /// object is in an undefined state and must not be used.
+ /// </para>
+ /// <para>
+ /// If any of the configuration properties are modified then
+ /// <see cref="ActivateOptions"/> must be called again.
+ /// </para>
+ /// <para>
+ /// This method must be implemented by the subclass.
+ /// </para>
+ /// </remarks>
+ public virtual void ActivateOptions()
+ {
+ if (Layout is IOptionHandler optionHandler)
+ optionHandler.ActivateOptions();
+ }
+
+ #endregion
+
+ #region Implementation of ILayout
+
+ /// <summary>
+ /// Implement this method to create your own layout format.
+ /// </summary>
+ /// <param name="writer">The TextWriter to write the formatted event to</param>
+ /// <param name="loggingEvent">The event to format</param>
+ /// <remarks>
+ /// <para>
+ /// This method is called by an appender to format
+ /// the <paramref name="loggingEvent"/> as text.
+ /// </para>
+ /// </remarks>
+ virtual public void Format(TextWriter writer, LoggingEvent loggingEvent)
+ => Layout?.Format(writer, loggingEvent);
+
+ /// <summary>
+ /// The content type output by this layout.
+ /// </summary>
+ /// <value>The content type is <c>"text/plain"</c></value>
+ /// <remarks>
+ /// <para>
+ /// The content type output by this layout.
+ /// </para>
+ /// <para>
+ /// This base class uses the value <c>"text/plain"</c>.
+ /// To change this value a subclass must override this
+ /// property.
+ /// </para>
+ /// </remarks>
+ public virtual string ContentType => Layout?.ContentType ?? "text/plain";
+
+ /// <summary>
+ /// The header for the layout format.
+ /// </summary>
+ /// <value>the layout header</value>
+ /// <remarks>
+ /// <para>
+ /// The Header text will be appended before any logging events
+ /// are formatted and appended.
+ /// </para>
+ /// </remarks>
+ public virtual string? Header => Layout?.Header;
+
+ /// <summary>
+ /// The footer for the layout format.
+ /// </summary>
+ /// <value>the layout footer</value>
+ /// <remarks>
+ /// <para>
+ /// The Footer text will be appended after all the logging events
+ /// have been formatted and appended.
+ /// </para>
+ /// </remarks>
+ public virtual string? Footer => Layout?.Footer;
+
+ /// <summary>
+ /// Flag indicating if this layout handles exceptions
+ /// </summary>
+ /// <value><c>false</c> if this layout handles exceptions</value>
+ /// <remarks>
+ /// <para>
+ /// If this layout handles the exception object contained within
+ /// <see cref="LoggingEvent"/>, then the layout should return
+ /// <c>false</c>. Otherwise, if the layout ignores the exception
+ /// object, then the layout should return <c>true</c>.
+ /// </para>
+ /// <para>
+ /// Set this value to override a this default setting. The default
+ /// value is <c>true</c>, this layout does not handle the exception.
+ /// </para>
+ /// </remarks>
+ public virtual bool IgnoresException => Layout?.IgnoresException ?? true;
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/extensions/net/1.0/log4net.Ext.Trace/cs/src/ITraceLog.cs b/examples/Layouts/SampleLayoutsApp/Layout/LevelConversionPattern.cs
similarity index 74%
copy from extensions/net/1.0/log4net.Ext.Trace/cs/src/ITraceLog.cs
copy to examples/Layouts/SampleLayoutsApp/Layout/LevelConversionPattern.cs
index d5b107c..6365101 100644
--- a/extensions/net/1.0/log4net.Ext.Trace/cs/src/ITraceLog.cs
+++ b/examples/Layouts/SampleLayoutsApp/Layout/LevelConversionPattern.cs
@@ -17,18 +17,17 @@
//
#endregion
-using System;
+using log4net.Core;
-using log4net;
-
-namespace log4net.Ext.Trace
+namespace SampleLayoutsApp.Layout
{
- public interface ITraceLog : ILog
- {
- void Trace(object message);
- void Trace(object message, Exception t);
- void TraceFormat(string format, params object[] args);
- bool IsTraceEnabled { get; }
- }
-}
+ /// <inheritdoc/>
+ public sealed class LevelConversionPattern
+ {
+ /// <inheritdoc/>
+ public required Level Level { get; init; }
+ /// <inheritdoc/>
+ public required string ConversionPattern { get; init; }
+ }
+}
\ No newline at end of file
diff --git a/examples/Layouts/SampleLayoutsApp/Layout/LevelPatternLayout.cs b/examples/Layouts/SampleLayoutsApp/Layout/LevelPatternLayout.cs
new file mode 100644
index 0000000..bc9f081
--- /dev/null
+++ b/examples/Layouts/SampleLayoutsApp/Layout/LevelPatternLayout.cs
@@ -0,0 +1,50 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+using System;
+using System.Collections;
+using System.IO;
+using log4net.Core;
+using log4net.Layout;
+
+namespace SampleLayoutsApp.Layout
+{
+ /// <inheritdoc/>
+ public sealed class LevelPatternLayout : PatternLayout
+ {
+ private readonly Hashtable levelToPatternLayout = [];
+
+ /// <inheritdoc/>
+ public override void Format(TextWriter writer, LoggingEvent loggingEvent)
+ {
+ ArgumentNullException.ThrowIfNull(loggingEvent);
+ if (levelToPatternLayout[loggingEvent.Level] is not PatternLayout patternLayout)
+ base.Format(writer, loggingEvent);
+ else
+ patternLayout.Format(writer, loggingEvent);
+ }
+
+ /// <inheritdoc/>
+ public void AddLevelConversionPattern(LevelConversionPattern levelLayout)
+ {
+ ArgumentNullException.ThrowIfNull(levelLayout);
+ levelToPatternLayout[levelLayout.Level] = new PatternLayout(levelLayout.ConversionPattern);
+ }
+ }
+}
\ No newline at end of file
diff --git a/examples/Layouts/SampleLayoutsApp/Layout/LineWrappingLayout.cs b/examples/Layouts/SampleLayoutsApp/Layout/LineWrappingLayout.cs
new file mode 100644
index 0000000..b8ee4a9
--- /dev/null
+++ b/examples/Layouts/SampleLayoutsApp/Layout/LineWrappingLayout.cs
@@ -0,0 +1,87 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+using System;
+using System.IO;
+using log4net.Core;
+
+namespace SampleLayoutsApp.Layout
+{
+ /// <summary>
+ /// The LineWrappingLayout wraps the output of a nested layout
+ /// </summary>
+ /// <remarks>
+ /// The output of the nested layout is wrapped at
+ /// <see cref="LineWidth"/>. Each of the continuation lines
+ /// is prefixed with a number of spaces specified by <see cref="Indent"/>.
+ /// </remarks>
+ public sealed class LineWrappingLayout : ForwardingLayout
+ {
+ /// <inheritdoc/>
+ public int LineWidth { get; set; } = 76;
+
+ /// <inheritdoc/>
+ public int Indent { get; set; } = 4;
+
+ /// <inheritdoc/>
+ public override void Format(TextWriter writer, LoggingEvent loggingEvent)
+ {
+ ArgumentNullException.ThrowIfNull(writer);
+ using StringWriter stringWriter = new();
+
+ base.Format(stringWriter, loggingEvent);
+
+ string formattedString = stringWriter.ToString();
+
+ WrapText(writer, formattedString);
+ }
+
+ private void WrapText(TextWriter writer, string text)
+ {
+ if (text.Length <= LineWidth)
+ writer.Write(text);
+ else
+ {
+ // Do the first line
+ writer.WriteLine(text.AsSpan(0, LineWidth));
+ string rest = text[LineWidth..];
+
+ string indentString = new(' ', Indent);
+ int continuationLineWidth = LineWidth - Indent;
+
+ // Do the continuation lines
+ while (true)
+ {
+ writer.Write(indentString);
+
+ if (rest.Length > continuationLineWidth)
+ {
+ writer.WriteLine(rest[..continuationLineWidth]);
+ rest = rest[continuationLineWidth..];
+ }
+ else
+ {
+ writer.Write(rest);
+ break;
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/examples/Layouts/SampleLayoutsApp/LoggingExample.cs b/examples/Layouts/SampleLayoutsApp/LoggingExample.cs
new file mode 100644
index 0000000..7597397
--- /dev/null
+++ b/examples/Layouts/SampleLayoutsApp/LoggingExample.cs
@@ -0,0 +1,63 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+using System;
+
+// Configure log4net using the .config file
+[assembly: log4net.Config.XmlConfigurator(Watch = true)]
+// This will cause log4net to look for a configuration file
+// called ConsoleApp.exe.config in the application base
+// directory (i.e. the directory containing SampleAppendersApp.exe)
+
+namespace SampleLayoutsApp
+{
+ /// <summary>
+ /// Example of how to simply configure and use log4net
+ /// </summary>
+ public static class LoggingExample
+ {
+ // Create a logger for use in this class
+ private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(LoggingExample));
+
+ /// <summary>
+ /// Application entry point
+ /// </summary>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Globalization", "CA1303:Do not pass literals as localized parameters")]
+ public static void Main()
+ {
+ // Log an info level message
+ if (log.IsInfoEnabled) log.Info("Application [SampleLayoutsApp] Start");
+
+ // Log a debug message. Test if debug is enabled before
+ // attempting to log the message. This is not required but
+ // can make running without logging faster.
+ if (log.IsDebugEnabled) log.Debug("This is a debug message");
+
+ log.Info("This is a long line of logging text. This should test if the LineWrappingLayout works. This text should be wrapped over multiple lines of output. Could you get a log message longer than this?");
+
+ log.Error("Hey this is an error!");
+
+ // Log an info level message
+ if (log.IsInfoEnabled) log.Info("Application [SampleLayoutsApp] End");
+
+ Console.Write("Press Enter to exit...");
+ Console.ReadLine();
+ }
+ }
+}
\ No newline at end of file
diff --git a/examples/Layouts/SampleLayoutsApp/SampleLayoutsApp.csproj b/examples/Layouts/SampleLayoutsApp/SampleLayoutsApp.csproj
new file mode 100644
index 0000000..1d912ff
--- /dev/null
+++ b/examples/Layouts/SampleLayoutsApp/SampleLayoutsApp.csproj
@@ -0,0 +1,9 @@
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>net8.0</TargetFramework>
+ </PropertyGroup>
+ <ItemGroup>
+ <PackageReference Include="log4net" Version="$(Log4NetPackageVersion)" />
+ </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/examples/Performance/NotLogging/NotLogging.cs b/examples/Performance/NotLogging/NotLogging.cs
new file mode 100644
index 0000000..8c05e80
--- /dev/null
+++ b/examples/Performance/NotLogging/NotLogging.cs
@@ -0,0 +1,398 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+using System;
+using System.Collections;
+using System.Globalization;
+using log4net;
+using log4net.Appender;
+using log4net.Layout;
+using log4net.Repository.Hierarchy;
+
+namespace NotLogging
+{
+ /// <summary>
+ /// NotLogging
+ /// </summary>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Globalization", "CA1305:Specify IFormatProvider")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Globalization", "CA1303:Do not pass literals as localized parameters")]
+ internal static class NotLogging
+ {
+ #region Init Code
+
+ private static int warmupCycles = 10000;
+ private static readonly ILog SHORT_LOG = LogManager.GetLogger("A0123456789");
+ private static readonly ILog MEDIUM_LOG = LogManager.GetLogger("A0123456789.B0123456789");
+ private static readonly ILog LONG_LOG = LogManager.GetLogger("A0123456789.B0123456789.C0123456789");
+ private static readonly ILog INEXISTENT_SHORT_LOG = LogManager.GetLogger("I0123456789");
+ private static readonly ILog INEXISTENT_MEDIUM_LOG = LogManager.GetLogger("I0123456789.B0123456789");
+ private static readonly ILog INEXISTENT_LONG_LOG = LogManager.GetLogger("I0123456789.B0123456789.C0123456789");
+ private static readonly ILog[] LOG_ARRAY = [
+ SHORT_LOG,
+ MEDIUM_LOG,
+ LONG_LOG,
+ INEXISTENT_SHORT_LOG,
+ INEXISTENT_MEDIUM_LOG,
+ INEXISTENT_LONG_LOG];
+ private static readonly TimedTest[] TIMED_TESTS = [
+ new SimpleMessage_Bare(),
+ new SimpleMessage_Array(),
+ new SimpleMessage_MethodGuard_Bare(),
+ new SimpleMessage_LocalGuard_Bare(),
+ new ComplexMessage_Bare(),
+ new ComplexMessage_Array(),
+ new ComplexMessage_MethodGuard_Bare(),
+ new ComplexMessage_MethodGuard_Array(),
+ new ComplexMessage_MemberGuard_Bare(),
+ new ComplexMessage_LocalGuard_Bare()];
+
+ private static void Usage()
+ {
+ Console.WriteLine(
+ "Usage: NotLogging <true|false> <runLength>" + Environment.NewLine +
+ "\t true indicates shipped code" + Environment.NewLine +
+ "\t false indicates code in development" + Environment.NewLine +
+ "\t runLength is an int representing the run length of loops" + Environment.NewLine +
+ "\t We suggest that runLength be at least 1000000 (1 million).");
+ Environment.Exit(1);
+ }
+
+ /// <summary>
+ /// Program wide initialization method
+ /// </summary>
+ /// <param name="args"></param>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Globalization", "CA1303:Do not pass literals as localized parameters")]
+ private static int ProgramInit(string[] args)
+ {
+ if (args is not string[] { Length: 2 })
+ {
+ Usage();
+ return 0;
+ }
+ if (!int.TryParse(args[1], NumberStyles.Integer, CultureInfo.InvariantCulture, out int runLength))
+ {
+ Usage();
+ return 0;
+ }
+
+ ConsoleAppender appender = new() { Layout = new SimpleLayout() };
+ ((SimpleLayout)appender.Layout).ActivateOptions();
+ appender.ActivateOptions();
+
+ if ("false" == args[0])
+ {
+ // nothing to do
+ }
+ else if ("true" == args[0])
+ {
+ Console.WriteLine("Flagging as shipped code.");
+ ((Hierarchy)LogManager.GetRepository()).Threshold = log4net.Core.Level.Warn;
+ }
+ else
+ {
+ Usage();
+ }
+
+ ((Logger)SHORT_LOG.Logger).Level = log4net.Core.Level.Info;
+ ((Hierarchy)LogManager.GetRepository()).Root.Level = log4net.Core.Level.Info;
+ ((Hierarchy)LogManager.GetRepository()).Root.AddAppender(appender);
+
+ return runLength;
+ }
+
+ #endregion
+
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ private static void Main(string[] argv)
+ {
+ if (System.Diagnostics.Debugger.IsAttached)
+ {
+ warmupCycles = 0;
+ argv = ["false", "2"];
+ }
+ if (argv.Length != 2)
+ Usage();
+
+ int runLength = ProgramInit(argv);
+
+ Console.WriteLine();
+ Console.Write("Warming Up...");
+
+ if (warmupCycles > 0)
+ foreach (ILog logger in LOG_ARRAY)
+ foreach (TimedTest timedTest in TIMED_TESTS)
+ timedTest.Run(logger, warmupCycles);
+
+ Console.WriteLine("Done");
+ Console.WriteLine();
+
+ // Calculate maximum description length
+ int maxDescLen = 0;
+ foreach (TimedTest timedTest in TIMED_TESTS)
+ maxDescLen = Math.Max(maxDescLen, timedTest.Description.Length);
+
+ string formatString = "{0,-" + (maxDescLen + 1) + "} {1,9:G} ticks. Log: {2}";
+ double delta;
+
+ ArrayList averageData = [];
+
+ foreach (TimedTest timedTest in TIMED_TESTS)
+ {
+ double total = 0;
+ foreach (ILog logger in LOG_ARRAY)
+ {
+ delta = timedTest.Run(logger, runLength);
+ Console.WriteLine(string.Format(formatString, timedTest.Description, delta, ((Logger)logger.Logger).Name));
+
+ total += delta;
+ }
+ Console.WriteLine();
+
+ averageData.Add(new object[] { timedTest, total / ((double)LOG_ARRAY.Length) });
+ }
+ Console.WriteLine();
+ Console.WriteLine("Averages:");
+ Console.WriteLine();
+
+ foreach (object[] pair in averageData)
+ {
+ string avgFormatString = "{0,-" + (maxDescLen + 1) + "} {1,9:G} ticks.";
+ Console.WriteLine(string.Format(avgFormatString, ((TimedTest)pair[0]).Description, ((double)pair[1])));
+ }
+ }
+
+ internal abstract class TimedTest
+ {
+ public abstract double Run(ILog log, long runLength);
+ public abstract string Description { get; }
+ }
+
+ #region Tests calling Debug(string)
+
+ internal sealed class SimpleMessage_Bare : TimedTest
+ {
+ public override double Run(ILog log, long runLength)
+ {
+ DateTime before = DateTime.Now;
+ for (int i = 0; i < runLength; i++)
+ {
+ log.Debug("msg");
+ }
+ DateTime after = DateTime.Now;
+ TimeSpan diff = after - before;
+ return ((double)diff.Ticks) / ((double)runLength);
+ }
+
+ public override string Description => "log.Debug(\"msg\");";
+ }
+
+ internal sealed class ComplexMessage_MethodGuard_Bare : TimedTest
+ {
+ public override double Run(ILog log, long runLength)
+ {
+ DateTime before = DateTime.Now;
+ for (int i = 0; i < runLength; i++)
+ {
+ if (log.IsDebugEnabled)
+ {
+ log.Debug("msg" + i + "msg");
+ }
+ }
+ DateTime after = DateTime.Now;
+ TimeSpan diff = after - before;
+ return ((double)diff.Ticks) / ((double)runLength);
+ }
+
+ public override string Description => "if(log.IsDebugEnabled) log.Debug(\"msg\" + i + \"msg\");";
+ }
+
+ internal sealed class ComplexMessage_Bare : TimedTest
+ {
+ public override double Run(ILog log, long runLength)
+ {
+ DateTime before = DateTime.Now;
+ for (int i = 0; i < runLength; i++)
+ {
+ log.Debug("msg" + i + "msg");
+ }
+ DateTime after = DateTime.Now;
+ TimeSpan diff = after - before;
+ return ((double)diff.Ticks) / ((double)runLength);
+ }
+
+ public override string Description => "log.Debug(\"msg\" + i + \"msg\");";
+ }
+
+ #endregion
+
+ #region Tests calling Debug(new object[] { ... })
+
+ internal sealed class SimpleMessage_Array : TimedTest
+ {
+ public override double Run(ILog log, long runLength)
+ {
+ DateTime before = DateTime.Now;
+ for (int i = 0; i < runLength; i++)
+ {
+ log.Debug(new object[] { "msg" });
+ }
+ DateTime after = DateTime.Now;
+ TimeSpan diff = after - before;
+ return ((double)diff.Ticks) / ((double)runLength);
+ }
+
+ public override string Description => "log.Debug(new object[] { \"msg\" });";
+ }
+
+ internal sealed class ComplexMessage_MethodGuard_Array : TimedTest
+ {
+ public override double Run(ILog log, long runLength)
+ {
+ DateTime before = DateTime.Now;
+ for (int i = 0; i < runLength; i++)
+ {
+ if (log.IsDebugEnabled)
+ {
+ log.Debug(new object[] { "msg", i, "msg" });
+ }
+ }
+ DateTime after = DateTime.Now;
+ TimeSpan diff = after - before;
+ return ((double)diff.Ticks) / ((double)runLength);
+ }
+
+ public override string Description => "if(log.IsDebugEnabled) log.Debug(new object[] { \"msg\" , i , \"msg\" });";
+ }
+
+ internal sealed class ComplexMessage_Array : TimedTest
+ {
+ public override double Run(ILog log, long runLength)
+ {
+ DateTime before = DateTime.Now;
+ for (int i = 0; i < runLength; i++)
+ {
+ log.Debug(new object[] { "msg", i, "msg" });
+ }
+ DateTime after = DateTime.Now;
+ TimeSpan diff = after - before;
+ return ((double)diff.Ticks) / ((double)runLength);
+ }
+
+ public override string Description => "log.Debug(new object[] { \"msg\" , i , \"msg\" });";
+ }
+
+ #endregion
+
+ #region Tests calling Debug(string) (using class members)
+
+ internal sealed class ComplexMessage_MemberGuard_Bare : TimedTest
+ {
+ public override double Run(ILog log, long runLength) => new Impl(log).Run(runLength);
+
+ public override string Description => "if (m_isEnabled) log.Debug(\"msg\" + i + \"msg\");";
+
+ private sealed class Impl
+ {
+ private readonly ILog log;
+ private readonly bool isEnabled;
+
+ public Impl(ILog log)
+ {
+ this.log = log;
+ isEnabled = this.log.IsDebugEnabled;
+ }
+
+ public double Run(long runLength)
+ {
+
+ DateTime before = DateTime.Now;
+ for (int i = 0; i < runLength; i++)
+ {
+ if (isEnabled)
+ {
+ log.Debug("msg" + i + "msg");
+ }
+ }
+ DateTime after = DateTime.Now;
+ TimeSpan diff = after - before;
+ return ((double)diff.Ticks) / ((double)runLength);
+ }
+ }
+ }
+
+ internal sealed class SimpleMessage_LocalGuard_Bare : TimedTest
+ {
+ public override double Run(ILog log, long runLength)
+ {
+ bool isEnabled = log.IsDebugEnabled;
+
+ DateTime before = DateTime.Now;
+ for (int i = 0; i < runLength; i++)
+ {
+ if (isEnabled) log.Debug("msg");
+ }
+ DateTime after = DateTime.Now;
+ TimeSpan diff = after - before;
+ return ((double)diff.Ticks) / ((double)runLength);
+ }
+
+ public override string Description => "if (isEnabled) log.Debug(\"msg\");";
+ }
+
+ internal sealed class SimpleMessage_MethodGuard_Bare : TimedTest
+ {
+ public override double Run(ILog log, long runLength)
+ {
+ DateTime before = DateTime.Now;
+ for (int i = 0; i < runLength; i++)
+ {
+ if (log.IsDebugEnabled) log.Debug("msg");
+ }
+ DateTime after = DateTime.Now;
+ TimeSpan diff = after - before;
+ return ((double)diff.Ticks) / ((double)runLength);
+ }
+
+ public override string Description => "if (log.IsDebugEnabled) log.Debug(\"msg\");";
+ }
+
+ internal sealed class ComplexMessage_LocalGuard_Bare : TimedTest
+ {
+ public override double Run(ILog log, long runLength)
+ {
+ bool isEnabled = log.IsDebugEnabled;
+
+ DateTime before = DateTime.Now;
+ for (int i = 0; i < runLength; i++)
+ {
+ if (isEnabled) log.Debug("msg" + i + "msg");
+ }
+ DateTime after = DateTime.Now;
+ TimeSpan diff = after - before;
+ return ((double)diff.Ticks) / ((double)runLength);
+ }
+
+ public override string Description => "if (isEnabled) log.Debug(\"msg\" + i + \"msg\");";
+ }
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/examples/Performance/NotLogging/NotLogging.csproj b/examples/Performance/NotLogging/NotLogging.csproj
new file mode 100644
index 0000000..e84e0f1
--- /dev/null
+++ b/examples/Performance/NotLogging/NotLogging.csproj
@@ -0,0 +1,10 @@
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>net8.0</TargetFramework>
+ <Nullable>enable</Nullable>
+ </PropertyGroup>
+ <ItemGroup>
+ <PackageReference Include="log4net" Version="$(Log4NetPackageVersion)" />
+ </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/examples/Tutorials/ConsoleApp/App.config b/examples/Tutorials/ConsoleApp/App.config
new file mode 100644
index 0000000..01c431c
--- /dev/null
+++ b/examples/Tutorials/ConsoleApp/App.config
@@ -0,0 +1,214 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+
+-->
+
+<!--
+ .NET application configuration file
+ This file must have the exact same name as your application with .config appended to it.
+
+ For example if your application is ConsoleApp.exe then the config file must be ConsoleApp.exe.config.
+ It must also be in the same directory as the application.
+ -->
+<configuration>
+ <!-- Register a section handler for the log4net section -->
+ <configSections>
+ <section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
+ </configSections>
+ <appSettings>
+ <!-- To enable internal log4net logging specify the following appSettings key -->
+ <!-- <add key="log4net.Internal.Debug" value="true"/> -->
+ </appSettings>
+ <!-- This section contains the log4net configuration settings -->
+ <log4net>
+ <!-- Define some output appenders -->
+ <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
+ <file value="rolling-log.txt" />
+ <appendToFile value="true" />
+ <maxSizeRollBackups value="10" />
+ <maximumFileSize value="100" />
+ <rollingStyle value="Size" />
+ <staticLogFileName value="true" />
+ <layout type="log4net.Layout.PatternLayout">
+ <header value="[Header] " />
+ <footer value="[Footer] " />
+ <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
+ </layout>
+ </appender>
+ <appender name="LogFileAppender" type="log4net.Appender.FileAppender">
+ <file value="log-file.txt" />
+ <!-- Example using environment variables in params -->
+ <!-- <file value="${TMP}\log-file.txt" /> -->
+ <appendToFile value="true" />
+ <!-- An alternate output encoding can be specified -->
+ <!-- <encoding value="unicodeFFFE" /> -->
+ <layout type="log4net.Layout.PatternLayout">
+ <header value="[Header] " />
+ <footer value="[Footer] " />
+ <conversionPattern value="%date [%thread] %-5level %logger [%ndc] <%property{auth}> - %message%newline" />
+ </layout>
+ <!-- Alternate layout using XML
+ <layout type="log4net.Layout.XMLLayout" /> -->
+ </appender>
+ <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
+ <layout type="log4net.Layout.PatternLayout">
+ <conversionPattern value="%date [%thread] %-5level %logger [%ndc] <%property{auth}> - %message%newline" />
+ </layout>
+ </appender>
+ <appender name="NetSendAppender" type="log4net.Appender.NetSendAppender">
+ <threshold value="ERROR" />
+ <server value="SQUARE" />
+ <recipient value="nicko" />
+ <layout type="log4net.Layout.PatternLayout">
+ <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
+ </layout>
+ </appender>
+ <!-- Example of how to configure the AdoNetAppender
+ <appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender" >
+ <connectionString value="Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Work\cvs_root\log4net-1.2\access.mdb;UID=;PWD=;" />
+ <layout type="log4net.Layout.PatternLayout">
+ <conversionPattern value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message]) VALUES ('%date','%thread','%level','%logger','%message')" />
+ </layout>
+ </appender>
+ -->
+ <!--
+ <appender name="A" type="log4net.Appender.ForwardingAppender" >
+ <threshold value="WARN"/>
+ <appender-ref ref="ConsoleAppender" />
+ </appender>
+ <appender name="B" type="log4net.Appender.ForwardingAppender" >
+ <filter type="log4net.Filter.LevelRangeFilter">
+ <levelMin value="DEBUG"/>
+ <levelMax value="INFO"/>
+ </filter>
+ <appender-ref ref="ConsoleAppender" />
+ </appender>
+ -->
+ <!-- Example of how to configure the AdoNetAppender to connect to MS Access -->
+ <appender name="ADONetAppender_Access" type="log4net.Appender.AdoNetAppender">
+ <connectionString value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Work\cvs_root\log4net-1.2\access.mdb;User Id=;Password=;" />
+ <commandText value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message]) VALUES (@log_date, @thread, @log_level, @logger, @message)" />
+ <parameter>
+ <parameterName value="@log_date" />
+ <dbType value="String" />
+ <size value="255" />
+ <layout type="log4net.Layout.PatternLayout">
+ <conversionPattern value="%date" />
+ </layout>
+ </parameter>
+ <parameter>
+ <parameterName value="@thread" />
+ <dbType value="String" />
+ <size value="255" />
+ <layout type="log4net.Layout.PatternLayout">
+ <conversionPattern value="%thread" />
+ </layout>
+ </parameter>
+ <parameter>
+ <parameterName value="@log_level" />
+ <dbType value="String" />
+ <size value="50" />
+ <layout type="log4net.Layout.PatternLayout">
+ <conversionPattern value="%level" />
+ </layout>
+ </parameter>
+ <parameter>
+ <parameterName value="@logger" />
+ <dbType value="String" />
+ <size value="255" />
+ <layout type="log4net.Layout.PatternLayout">
+ <conversionPattern value="%logger" />
+ </layout>
+ </parameter>
+ <parameter>
+ <parameterName value="@message" />
+ <dbType value="String" />
+ <size value="1024" />
+ <layout type="log4net.Layout.PatternLayout">
+ <conversionPattern value="%message" />
+ </layout>
+ </parameter>
+ </appender>
+ <!-- Example of how to configure the AdoNetAppender to connect to MS SQL Server -->
+ <appender name="ADONetAppender_SqlServer" type="log4net.Appender.AdoNetAppender">
+ <bufferSize value="1" />
+ <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <connectionString value="data source=SQLSVR;initial catalog=test_log4net;integrated security=false;persist security info=True;" />
+ <commandText value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message]) VALUES (@log_date, @thread, @log_level, @logger, @message)" />
+ <parameter>
+ <parameterName value="@log_date" />
+ <dbType value="DateTime" />
+ <!--
+ <layout type="log4net.Layout.PatternLayout">
+ <conversionPattern value="%date{yyyy'-'MM'-'dd HH':'mm':'ss'.'fff}" />
+ </layout>
+ -->
+ <layout type="log4net.Layout.RawTimeStampLayout" />
+ </parameter>
+ <parameter>
+ <parameterName value="@thread" />
+ <dbType value="String" />
+ <size value="255" />
+ <layout type="log4net.Layout.PatternLayout">
+ <conversionPattern value="%thread" />
+ </layout>
+ </parameter>
+ <parameter>
+ <parameterName value="@log_level" />
+ <dbType value="String" />
+ <size value="50" />
+ <layout type="log4net.Layout.PatternLayout">
+ <conversionPattern value="%level" />
+ </layout>
+ </parameter>
+ <parameter>
+ <parameterName value="@logger" />
+ <dbType value="String" />
+ <size value="255" />
+ <layout type="log4net.Layout.PatternLayout">
+ <conversionPattern value="%logger" />
+ </layout>
+ </parameter>
+ <parameter>
+ <parameterName value="@message" />
+ <dbType value="String" />
+ <size value="4000" />
+ <layout type="log4net.Layout.PatternLayout">
+ <conversionPattern value="%message" />
+ </layout>
+ </parameter>
+ </appender>
+ <!-- Setup the root category, add the appenders and set the default level -->
+ <root>
+ <level value="WARN" />
+ <appender-ref ref="LogFileAppender" />
+ <appender-ref ref="ConsoleAppender" />
+ <!-- <appender-ref ref="ADONetAppender_SqlServer" /> -->
+ <appender-ref ref="NetSendAppender" />
+ <!-- <appender-ref ref="A" /> -->
+ </root>
+ <!-- Specify the level for some specific categories -->
+ <logger name="ConsoleApp.LoggingExample">
+ <!-- <appender-ref ref="B" /> -->
+ <level value="ALL" />
+ <appender-ref ref="RollingLogFileAppender" />
+ </logger>
+ </log4net>
+</configuration>
diff --git a/examples/Tutorials/ConsoleApp/ConsoleApp.csproj b/examples/Tutorials/ConsoleApp/ConsoleApp.csproj
new file mode 100644
index 0000000..e84e0f1
--- /dev/null
+++ b/examples/Tutorials/ConsoleApp/ConsoleApp.csproj
@@ -0,0 +1,10 @@
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>net8.0</TargetFramework>
+ <Nullable>enable</Nullable>
+ </PropertyGroup>
+ <ItemGroup>
+ <PackageReference Include="log4net" Version="$(Log4NetPackageVersion)" />
+ </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/examples/Tutorials/ConsoleApp/LoggingExample.cs b/examples/Tutorials/ConsoleApp/LoggingExample.cs
new file mode 100644
index 0000000..61e9c9d
--- /dev/null
+++ b/examples/Tutorials/ConsoleApp/LoggingExample.cs
@@ -0,0 +1,102 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+// Configure log4net using the .config file
+[assembly: log4net.Config.XmlConfigurator(Watch = true)]
+// This will cause log4net to look for a configuration file
+// called ConsoleApp.exe.config in the application base
+// directory (i.e. the directory containing ConsoleApp.exe)
+
+namespace ConsoleApp
+{
+ using System;
+
+ /// <summary>
+ /// Example of how to simply configure and use log4net
+ /// </summary>
+ public static class LoggingExample
+ {
+ // Create a logger for use in this class
+ private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(LoggingExample));
+
+ /// <summary>
+ /// Application entry point
+ /// </summary>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Globalization", "CA1303:Do not pass literals as localized parameters")]
+ public static void Main()
+ {
+ // Log an info level message
+ if (log.IsInfoEnabled) log.Info("Application [ConsoleApp] Start");
+
+ // Log a debug message. Test if debug is enabled before
+ // attempting to log the message. This is not required but
+ // can make running without logging faster.
+ if (log.IsDebugEnabled) log.Debug("This is a debug message");
+
+ try
+ {
+ Bar();
+ }
+ catch (InvalidOperationException ex)
+ {
+ // Log an error with an exception
+ log.Error("Exception thrown from method Bar", ex);
+ }
+
+ log.Error("Hey this is an error!");
+
+ // Push a message on to the Nested Diagnostic Context stack
+ using (log4net.NDC.Push("NDC_Message"))
+ {
+ log.Warn("This should have an NDC message");
+
+ // Set a Mapped Diagnostic Context value
+ log4net.MDC.Set("auth", "auth-none");
+ log.Warn("This should have an MDC message for the key 'auth'");
+
+ } // The NDC message is popped off the stack at the end of the using {} block
+
+ log.Warn("See the NDC has been popped of! The MDC 'auth' key is still with us.");
+
+ // Log an info level message
+ if (log.IsInfoEnabled) log.Info("Application [ConsoleApp] End");
+
+ Console.Write("Press Enter to exit...");
+ Console.ReadLine();
+ }
+
+ // Helper methods to demonstrate location information and nested exceptions
+
+ private static void Bar() => Goo();
+
+ private static void Foo() => throw new InvalidOperationException("This is an Exception");
+
+ private static void Goo()
+ {
+ try
+ {
+ Foo();
+ }
+ catch (Exception ex)
+ {
+ throw new ArithmeticException("Failed in Goo. Calling Foo. Inner Exception provided", ex);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/examples/examples.sln b/examples/examples.sln
new file mode 100644
index 0000000..e603c56
--- /dev/null
+++ b/examples/examples.sln
@@ -0,0 +1,77 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.9.34622.214
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5886EE0F-0A11-48A5-8618-75112878F381}"
+ ProjectSection(SolutionItems) = preProject
+ ..\..\Directory.Build.props = ..\..\Directory.Build.props
+ EndProjectSection
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp", "Tutorials\ConsoleApp\ConsoleApp.csproj", "{988F2EF8-7CD9-4F78-A8C3-FBFBCE7CC5D2}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "log4net.Ext.EventID", "Extensions\log4net.Ext.EventID\log4net.Ext.EventID.csproj", "{E80233BC-0345-46EA-B965-45F60DB92ABF}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventIDLogApp", "Extensibility\EventIDLogApp\EventIDLogApp.csproj", "{8ABFD87C-1666-4DA0-9329-465AD154EF2D}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotLogging", "Performance\NotLogging\NotLogging.csproj", "{79B1930A-63AE-4640-B130-084687B3EDD7}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "log4net.Ext.Trace", "Extensions\log4net.Ext.Trace\log4net.Ext.Trace.csproj", "{8C73DF1C-AB2B-4309-A3EC-1ED594239E15}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TraceLogApp", "Extensibility\TraceLogApp\TraceLogApp.csproj", "{EB508341-D73A-4165-846D-E7E317E12518}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleLayoutsApp", "Layouts\SampleLayoutsApp\SampleLayoutsApp.csproj", "{CD7A8094-D383-46BC-A75D-9F65F746E24F}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleAppendersApp", "Appenders\SampleAppendersApp\SampleAppendersApp.csproj", "{9E715F72-7F70-421B-A2BF-E9CB42F88F5C}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WmiAppender", "Appenders\WmiAppender\WmiAppender.csproj", "{BE56F892-37BA-489C-A91D-F2761FDB96EF}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {988F2EF8-7CD9-4F78-A8C3-FBFBCE7CC5D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {988F2EF8-7CD9-4F78-A8C3-FBFBCE7CC5D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {988F2EF8-7CD9-4F78-A8C3-FBFBCE7CC5D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {988F2EF8-7CD9-4F78-A8C3-FBFBCE7CC5D2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E80233BC-0345-46EA-B965-45F60DB92ABF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E80233BC-0345-46EA-B965-45F60DB92ABF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E80233BC-0345-46EA-B965-45F60DB92ABF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E80233BC-0345-46EA-B965-45F60DB92ABF}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8ABFD87C-1666-4DA0-9329-465AD154EF2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8ABFD87C-1666-4DA0-9329-465AD154EF2D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8ABFD87C-1666-4DA0-9329-465AD154EF2D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8ABFD87C-1666-4DA0-9329-465AD154EF2D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {79B1930A-63AE-4640-B130-084687B3EDD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {79B1930A-63AE-4640-B130-084687B3EDD7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {79B1930A-63AE-4640-B130-084687B3EDD7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {79B1930A-63AE-4640-B130-084687B3EDD7}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8C73DF1C-AB2B-4309-A3EC-1ED594239E15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8C73DF1C-AB2B-4309-A3EC-1ED594239E15}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8C73DF1C-AB2B-4309-A3EC-1ED594239E15}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8C73DF1C-AB2B-4309-A3EC-1ED594239E15}.Release|Any CPU.Build.0 = Release|Any CPU
+ {EB508341-D73A-4165-846D-E7E317E12518}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {EB508341-D73A-4165-846D-E7E317E12518}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {EB508341-D73A-4165-846D-E7E317E12518}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {EB508341-D73A-4165-846D-E7E317E12518}.Release|Any CPU.Build.0 = Release|Any CPU
+ {CD7A8094-D383-46BC-A75D-9F65F746E24F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {CD7A8094-D383-46BC-A75D-9F65F746E24F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {CD7A8094-D383-46BC-A75D-9F65F746E24F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {CD7A8094-D383-46BC-A75D-9F65F746E24F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9E715F72-7F70-421B-A2BF-E9CB42F88F5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9E715F72-7F70-421B-A2BF-E9CB42F88F5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9E715F72-7F70-421B-A2BF-E9CB42F88F5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9E715F72-7F70-421B-A2BF-E9CB42F88F5C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {BE56F892-37BA-489C-A91D-F2761FDB96EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {BE56F892-37BA-489C-A91D-F2761FDB96EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {BE56F892-37BA-489C-A91D-F2761FDB96EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {BE56F892-37BA-489C-A91D-F2761FDB96EF}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {97F6BEF0-A2F3-4574-9BDB-070F253055FA}
+ EndGlobalSection
+EndGlobal
diff --git a/examples/mono/1.0/Performance/NotLogging/cs/nant.build b/examples/mono/1.0/Performance/NotLogging/cs/nant.build
deleted file mode 100644
index 4d5ac2c..0000000
--- a/examples/mono/1.0/Performance/NotLogging/cs/nant.build
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- copy log4net build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="${log4net.output.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- compile the example -->
- <csc noconfig="true" target="exe" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.csc}" output="${current.bin.dir}/NotLogging.exe">
- <sources defaultexcludes="true">
- <include name="src/**/*.cs" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.cs" />
- </sources>
- <references basedir="${current.bin.dir}">
- <include name="log4net.dll" />
- </references>
- </csc>
- </target>
-</project>
diff --git a/examples/mono/1.0/Performance/NotLogging/cs/nant.config b/examples/mono/1.0/Performance/NotLogging/cs/nant.config
deleted file mode 100644
index 52613e8..0000000
--- a/examples/mono/1.0/Performance/NotLogging/cs/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/mono/1.0/Performance/NotLogging/cs/src/AssemblyInfo.cs b/examples/mono/1.0/Performance/NotLogging/cs/src/AssemblyInfo.cs
deleted file mode 100644
index b278ed8..0000000
--- a/examples/mono/1.0/Performance/NotLogging/cs/src/AssemblyInfo.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// 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("log4net - NotLogging")]
-[assembly: AssemblyDescription("log4net performance test - NotLogging")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyProduct("log4net - NotLogging")]
-[assembly: AssemblyCulture("")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("")]
-[assembly: AssemblyKeyName("")]
diff --git a/examples/mono/1.0/Performance/NotLogging/cs/src/NotLogging.cs b/examples/mono/1.0/Performance/NotLogging/cs/src/NotLogging.cs
deleted file mode 100644
index 0501ef9..0000000
--- a/examples/mono/1.0/Performance/NotLogging/cs/src/NotLogging.cs
+++ /dev/null
@@ -1,434 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-namespace NotLogging
-{
- using System;
- using System.Collections;
-
- using log4net;
- using log4net.Appender;
- using log4net.Layout;
- using log4net.Repository;
- using log4net.Repository.Hierarchy;
-
- public class NotLogging
- {
- #region Init Code
-
- private static int WARM_UP_CYCLES = 10000;
-
- static readonly ILog SHORT_LOG = LogManager.GetLogger("A0123456789");
- static readonly ILog MEDIUM_LOG= LogManager.GetLogger("A0123456789.B0123456789");
- static readonly ILog LONG_LOG = LogManager.GetLogger("A0123456789.B0123456789.C0123456789");
-
- static readonly ILog INEXISTENT_SHORT_LOG = LogManager.GetLogger("I0123456789");
- static readonly ILog INEXISTENT_MEDIUM_LOG= LogManager.GetLogger("I0123456789.B0123456789");
- static readonly ILog INEXISTENT_LONG_LOG = LogManager.GetLogger("I0123456789.B0123456789.C0123456789");
-
-
- static readonly ILog[] LOG_ARRAY = new ILog[] {
- SHORT_LOG,
- MEDIUM_LOG,
- LONG_LOG,
- INEXISTENT_SHORT_LOG,
- INEXISTENT_MEDIUM_LOG,
- INEXISTENT_LONG_LOG};
-
- static readonly TimedTest[] TIMED_TESTS = new TimedTest[] {
- new SimpleMessage_Bare(),
- new SimpleMessage_Array(),
- new SimpleMessage_MethodGuard_Bare(),
- new SimpleMessage_LocalGuard_Bare(),
- new ComplexMessage_Bare(),
- new ComplexMessage_Array(),
- new ComplexMessage_MethodGuard_Bare(),
- new ComplexMessage_MethodGuard_Array(),
- new ComplexMessage_MemberGuard_Bare(),
- new ComplexMessage_LocalGuard_Bare()};
-
- private static void Usage()
- {
- System.Console.WriteLine(
- "Usage: NotLogging <true|false> <runLength>" + Environment.NewLine +
- "\t true indicates shipped code" + Environment.NewLine +
- "\t false indicates code in development" + Environment.NewLine +
- "\t runLength is an int representing the run length of loops" + Environment.NewLine +
- "\t We suggest that runLength be at least 1000000 (1 million).");
- Environment.Exit(1);
- }
-
-
- /// <summary>
- /// Program wide initialization method
- /// </summary>
- /// <param name="args"></param>
- private static int ProgramInit(String[] args)
- {
- int runLength = 0;
-
- try
- {
- runLength = int.Parse(args[1]);
- }
- catch(Exception e)
- {
- System.Console.Error.WriteLine(e);
- Usage();
- }
-
- ConsoleAppender appender = new ConsoleAppender(new SimpleLayout());
-
- if("false" == args[0])
- {
- // nothing to do
- }
- else if ("true" == args[0])
- {
- System.Console.WriteLine("Flagging as shipped code.");
- ((Hierarchy)LogManager.GetRepository()).Threshold = log4net.Core.Level.Warn;
- }
- else
- {
- Usage();
- }
-
- ((Logger)SHORT_LOG.Logger).Level = log4net.Core.Level.Info;
- ((Hierarchy)LogManager.GetRepository()).Root.Level = log4net.Core.Level.Info;
- ((Hierarchy)LogManager.GetRepository()).Root.AddAppender(appender);
-
- return runLength;
- }
-
- #endregion
-
- /// <summary>
- /// The main entry point for the application.
- /// </summary>
- [STAThread]
- static void Main(string[] argv)
- {
- if (System.Diagnostics.Debugger.IsAttached)
- {
- WARM_UP_CYCLES = 0;
- argv = new string[] { "false", "2" };
- }
- if(argv.Length != 2)
- {
- Usage();
- }
-
- int runLength = ProgramInit(argv);
-
- System.Console.WriteLine();
- System.Console.Write("Warming Up...");
-
- if (WARM_UP_CYCLES > 0)
- {
- foreach(ILog logger in LOG_ARRAY)
- {
- foreach(TimedTest timedTest in TIMED_TESTS)
- {
- timedTest.Run(logger, WARM_UP_CYCLES);
- }
- }
- }
- System.Console.WriteLine("Done");
- System.Console.WriteLine();
-
- // Calculate maximum description length
- int maxDescLen = 0;
- foreach(TimedTest timedTest in TIMED_TESTS)
- {
- maxDescLen = Math.Max(maxDescLen, timedTest.Description.Length);
- }
-
- string formatString = "{0,-"+(maxDescLen+1)+"} {1,9:G} ticks. Log: {2}";
- double delta;
-
- ArrayList averageData = new ArrayList();
-
- foreach(TimedTest timedTest in TIMED_TESTS)
- {
- double total = 0;
- foreach(ILog logger in LOG_ARRAY)
- {
- delta = timedTest.Run(logger, runLength);
- System.Console.WriteLine(string.Format(formatString, timedTest.Description, delta, ((Logger)logger.Logger).Name));
-
- total += delta;
- }
- System.Console.WriteLine();
-
- averageData.Add(new object[] { timedTest, total/((double)LOG_ARRAY.Length) });
- }
- System.Console.WriteLine();
- System.Console.WriteLine("Averages:");
- System.Console.WriteLine();
-
- foreach(object[] pair in averageData)
- {
- string avgFormatString = "{0,-"+(maxDescLen+1)+"} {1,9:G} ticks.";
- System.Console.WriteLine(string.Format(avgFormatString, ((TimedTest)pair[0]).Description, ((double)pair[1])));
- }
- }
- }
-
- abstract class TimedTest
- {
- abstract public double Run(ILog log, long runLength);
- abstract public string Description {get;}
- }
-
- #region Tests calling Debug(string)
-
- class SimpleMessage_Bare : TimedTest
- {
- override public double Run(ILog log, long runLength)
- {
- DateTime before = DateTime.Now;
- for(int i = 0; i < runLength; i++)
- {
- log.Debug("msg");
- }
- DateTime after = DateTime.Now;
- TimeSpan diff = after - before;
- return ((double)diff.Ticks)/((double)runLength);
- }
-
- override public string Description
- {
- get { return "log.Debug(\"msg\");"; }
- }
- }
- class ComplexMessage_MethodGuard_Bare : TimedTest
- {
- override public double Run(ILog log, long runLength)
- {
- DateTime before = DateTime.Now;
- for(int i = 0; i < runLength; i++)
- {
- if(log.IsDebugEnabled)
- {
- log.Debug("msg" + i + "msg");
- }
- }
- DateTime after = DateTime.Now;
- TimeSpan diff = after - before;
- return ((double)diff.Ticks)/((double)runLength);
- }
-
- override public string Description
- {
- get { return "if(log.IsDebugEnabled) log.Debug(\"msg\" + i + \"msg\");"; }
- }
- }
- class ComplexMessage_Bare : TimedTest
- {
- override public double Run(ILog log, long runLength)
- {
- DateTime before = DateTime.Now;
- for(int i = 0; i < runLength; i++)
- {
- log.Debug("msg" + i + "msg");
- }
- DateTime after = DateTime.Now;
- TimeSpan diff = after - before;
- return ((double)diff.Ticks)/((double)runLength);
- }
-
- override public string Description
- {
- get { return "log.Debug(\"msg\" + i + \"msg\");"; }
- }
- }
-
- #endregion
-
- #region Tests calling Debug(new object[] { ... })
-
- class SimpleMessage_Array : TimedTest
- {
- override public double Run(ILog log, long runLength)
- {
- DateTime before = DateTime.Now;
- for(int i = 0; i < runLength; i++)
- {
- log.Debug(new object[] { "msg" });
- }
- DateTime after = DateTime.Now;
- TimeSpan diff = after - before;
- return ((double)diff.Ticks)/((double)runLength);
- }
-
- override public string Description
- {
- get { return "log.Debug(new object[] { \"msg\" });"; }
- }
- }
- class ComplexMessage_MethodGuard_Array : TimedTest
- {
- override public double Run(ILog log, long runLength)
- {
- DateTime before = DateTime.Now;
- for(int i = 0; i < runLength; i++)
- {
- if(log.IsDebugEnabled)
- {
- log.Debug(new object[] { "msg" , i , "msg" });
- }
- }
- DateTime after = DateTime.Now;
- TimeSpan diff = after - before;
- return ((double)diff.Ticks)/((double)runLength);
- }
-
- override public string Description
- {
- get { return "if(log.IsDebugEnabled) log.Debug(new object[] { \"msg\" , i , \"msg\" });"; }
- }
- }
- class ComplexMessage_Array : TimedTest
- {
- override public double Run(ILog log, long runLength)
- {
- DateTime before = DateTime.Now;
- for(int i = 0; i < runLength; i++)
- {
- log.Debug(new object[] { "msg" , i , "msg" });
- }
- DateTime after = DateTime.Now;
- TimeSpan diff = after - before;
- return ((double)diff.Ticks)/((double)runLength);
- }
-
- override public string Description
- {
- get { return "log.Debug(new object[] { \"msg\" , i , \"msg\" });"; }
- }
- }
-
- #endregion
-
- #region Tests calling Debug(string) (using class members)
-
- class ComplexMessage_MemberGuard_Bare : TimedTest
- {
- override public double Run(ILog log, long runLength)
- {
- return (new Impl(log)).Run(runLength);
- }
-
- override public string Description
- {
- get { return "if(m_isEnabled) m_log.Debug(\"msg\" + i + \"msg\");"; }
- }
-
- class Impl
- {
- private readonly ILog m_log;
- private readonly bool m_isEnabled;
-
- public Impl(ILog log)
- {
- m_log = log;
- m_isEnabled = m_log.IsDebugEnabled;
- }
-
- public double Run(long runLength)
- {
-
- DateTime before = DateTime.Now;
- for(int i = 0; i < runLength; i++)
- {
- if(m_isEnabled)
- {
- m_log.Debug("msg" + i + "msg");
- }
- }
- DateTime after = DateTime.Now;
- TimeSpan diff = after - before;
- return ((double)diff.Ticks)/((double)runLength);
- }
- }
- }
- class SimpleMessage_LocalGuard_Bare : TimedTest
- {
- override public double Run(ILog log, long runLength)
- {
- bool isEnabled = log.IsDebugEnabled;
-
- DateTime before = DateTime.Now;
- for(int i = 0; i < runLength; i++)
- {
- if (isEnabled) log.Debug("msg");
- }
- DateTime after = DateTime.Now;
- TimeSpan diff = after - before;
- return ((double)diff.Ticks)/((double)runLength);
- }
-
- override public string Description
- {
- get { return "if (isEnabled) log.Debug(\"msg\");"; }
- }
- }
- class SimpleMessage_MethodGuard_Bare : TimedTest
- {
- override public double Run(ILog log, long runLength)
- {
- DateTime before = DateTime.Now;
- for(int i = 0; i < runLength; i++)
- {
- if (log.IsDebugEnabled) log.Debug("msg");
- }
- DateTime after = DateTime.Now;
- TimeSpan diff = after - before;
- return ((double)diff.Ticks)/((double)runLength);
- }
-
- override public string Description
- {
- get { return "if (log.IsDebugEnabled) log.Debug(\"msg\");"; }
- }
- }
- class ComplexMessage_LocalGuard_Bare : TimedTest
- {
- override public double Run(ILog log, long runLength)
- {
- bool isEnabled = log.IsDebugEnabled;
-
- DateTime before = DateTime.Now;
- for(int i = 0; i < runLength; i++)
- {
- if(isEnabled) log.Debug("msg" + i + "msg");
- }
- DateTime after = DateTime.Now;
- TimeSpan diff = after - before;
- return ((double)diff.Ticks)/((double)runLength);
- }
-
- override public string Description
- {
- get { return "if (isEnabled) log.Debug(\"msg\" + i + \"msg\");"; }
- }
- }
- #endregion
-
-}
diff --git a/examples/mono/1.0/Performance/NotLogging/nant.build b/examples/mono/1.0/Performance/NotLogging/nant.build
deleted file mode 100644
index 5917924..0000000
--- a/examples/mono/1.0/Performance/NotLogging/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="notlogging-example" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile NotLogging example -->
- <target name="compile" description="Builds NotLogging example">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/mono/1.0/Performance/NotLogging/nant.config b/examples/mono/1.0/Performance/NotLogging/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/mono/1.0/Performance/NotLogging/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/mono/1.0/Performance/nant.build b/examples/mono/1.0/Performance/nant.build
deleted file mode 100644
index 50cad4a..0000000
--- a/examples/mono/1.0/Performance/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="performance-examples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile Performance examples -->
- <target name="compile" description="Builds Performance examples">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/mono/1.0/Performance/nant.config b/examples/mono/1.0/Performance/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/mono/1.0/Performance/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/mono/1.0/Repository/SharedModule/cs/nant.build b/examples/mono/1.0/Repository/SharedModule/cs/nant.build
deleted file mode 100644
index 36fce7f..0000000
--- a/examples/mono/1.0/Repository/SharedModule/cs/nant.build
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- compile the example -->
- <csc noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" define="${current.build.defines.csc}" output="${current.bin.dir}/SharedModule.dll">
- <sources>
- <include name="src/**/*.cs" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.cs" />
- </sources>
- <references basedir="${log4net.output.dir}">
- <include name="log4net.dll" />
- </references>
- </csc>
- </target>
-</project>
diff --git a/examples/mono/1.0/Repository/SharedModule/cs/nant.config b/examples/mono/1.0/Repository/SharedModule/cs/nant.config
deleted file mode 100644
index 52613e8..0000000
--- a/examples/mono/1.0/Repository/SharedModule/cs/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/mono/1.0/Repository/SharedModule/cs/src/AssemblyInfo.cs b/examples/mono/1.0/Repository/SharedModule/cs/src/AssemblyInfo.cs
deleted file mode 100644
index ee75642..0000000
--- a/examples/mono/1.0/Repository/SharedModule/cs/src/AssemblyInfo.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// 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("log4net - SharedModule")]
-[assembly: AssemblyDescription("log4net SharedModule")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyProduct("log4net - SharedModule")]
-[assembly: AssemblyCulture("")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("")]
-[assembly: AssemblyKeyName("")]
diff --git a/examples/mono/1.0/Repository/SharedModule/cs/src/Math.cs b/examples/mono/1.0/Repository/SharedModule/cs/src/Math.cs
deleted file mode 100644
index 64211dc..0000000
--- a/examples/mono/1.0/Repository/SharedModule/cs/src/Math.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-namespace SharedModule
-{
- /// <summary>
- /// Summary description for Math.
- /// </summary>
- public class Math
- {
- // Create a logger for use in this class
- private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
-
- public Math()
- {
- if (log.IsDebugEnabled) log.Debug("Constructor");
- }
-
- public int Subtract(int left, int right)
- {
- int result = left - right;
- if (log.IsInfoEnabled) log.Info(""+left+" - "+right+" = "+result);
- return result;
- }
- }
-}
diff --git a/examples/mono/1.0/Repository/SharedModule/nant.build b/examples/mono/1.0/Repository/SharedModule/nant.build
deleted file mode 100644
index a11e9cd..0000000
--- a/examples/mono/1.0/Repository/SharedModule/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="sharedmodule-example" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile SharedModule example -->
- <target name="compile" description="Builds SharedModule example">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/mono/1.0/Repository/SharedModule/nant.config b/examples/mono/1.0/Repository/SharedModule/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/mono/1.0/Repository/SharedModule/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/mono/1.0/Repository/SimpleApp/cs/nant.build b/examples/mono/1.0/Repository/SimpleApp/cs/nant.build
deleted file mode 100644
index 40688e3..0000000
--- a/examples/mono/1.0/Repository/SimpleApp/cs/nant.build
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- copy log4net build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="${log4net.output.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- build SharedModule assembly -->
- <nant buildfile="../../SharedModule/cs/nant.build" target="compile" inheritall="true" />
- <!-- build SimpleModule assembly -->
- <nant buildfile="../../SimpleModule/cs/nant.build" target="compile" inheritall="true" />
- <!-- copy SharedModule build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="../../SharedModule/cs/${current.bin.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- copy SimpleModule build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="../../SimpleModule/cs/${current.bin.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- compile the example -->
- <csc noconfig="true" warnaserror="true" target="exe" debug="${current.build.debug}" define="${current.build.defines.csc}" output="${current.bin.dir}/SimpleApp.exe">
- <sources>
- <include name="src/**/*.cs" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.cs" />
- </sources>
- <references>
- <include name="${current.bin.dir}/SimpleModule.dll" />
- <include name="${current.bin.dir}/SharedModule.dll" />
- <include name="${current.bin.dir}/log4net.dll" />
- </references>
- </csc>
- <!-- copy the SimpleApp log4net configuration file -->
- <copy file="src/SimpleApp.exe.log4net" todir="${current.bin.dir}" />
- <!-- copy the SimpleApp application configuration file -->
- <copy file="src/App.config" tofile="${current.bin.dir}/SimpleApp.exe.config" />
- </target>
-</project>
diff --git a/examples/mono/1.0/Repository/SimpleApp/cs/nant.config b/examples/mono/1.0/Repository/SimpleApp/cs/nant.config
deleted file mode 100644
index 52613e8..0000000
--- a/examples/mono/1.0/Repository/SimpleApp/cs/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/mono/1.0/Repository/SimpleApp/cs/src/App.config b/examples/mono/1.0/Repository/SimpleApp/cs/src/App.config
deleted file mode 100644
index 10a5b29..0000000
--- a/examples/mono/1.0/Repository/SimpleApp/cs/src/App.config
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<configuration>
- <appSettings>
- <!-- To enable internal log4net logging specify the following appSettings key -->
- <!--
- <add key="log4net.Internal.Debug" value="true"/>
- -->
- </appSettings>
-</configuration>
diff --git a/examples/mono/1.0/Repository/SimpleApp/cs/src/AssemblyInfo.cs b/examples/mono/1.0/Repository/SimpleApp/cs/src/AssemblyInfo.cs
deleted file mode 100644
index cc3415d..0000000
--- a/examples/mono/1.0/Repository/SimpleApp/cs/src/AssemblyInfo.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// 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("log4net - SimpleApp")]
-[assembly: AssemblyDescription("log4net SimpleApp")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyProduct("log4net - SimpleApp")]
-[assembly: AssemblyCulture("")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("")]
-[assembly: AssemblyKeyName("")]
diff --git a/examples/mono/1.0/Repository/SimpleApp/cs/src/EntryPoint.cs b/examples/mono/1.0/Repository/SimpleApp/cs/src/EntryPoint.cs
deleted file mode 100644
index a2a9f35..0000000
--- a/examples/mono/1.0/Repository/SimpleApp/cs/src/EntryPoint.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-// Configure logging for this assembly using the 'SimpleApp.exe.log4net' file
-[assembly: log4net.Config.XmlConfigurator(ConfigFileExtension="log4net", Watch=true)]
-
-// The following alias attribute can be used to capture the logging
-// repository for the 'SimpleModule' assembly. Without specifying this
-// attribute the logging configuration for the 'SimpleModule' assembly
-// will be read from the 'SimpleModule.dll.log4net' file. When this
-// attribute is specified the configuration will be shared with this
-// assemby's configuration.
-//[assembly: log4net.Config.AliasRepository("SimpleModule")]
-
-namespace SimpleApp
-{
- using System;
-
- /// <summary>
- /// Summary description for Class1.
- /// </summary>
- class EntryPoint
- {
- // Create a logger for use in this class
- private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
-
- /// <summary>
- /// The main entry point for the application.
- /// </summary>
- [STAThread]
- static void Main(string[] args)
- {
- if (log.IsInfoEnabled) log.Info(args);
-
- if (args.Length != 2)
- {
- log.Error("Must supply 2 command line arguments");
- }
- else
- {
- int left = int.Parse(args[0]);
- int right = int.Parse(args[1]);
- int result = 0;
-
- if (log.IsDebugEnabled) log.Debug("Adding ["+left+"] to ["+right+"]");
-
- result = (new SimpleModule.Math()).Add(left, right);
-
- if (log.IsDebugEnabled) log.Debug("Result ["+result+"]");
-
- Console.Out.WriteLine(result);
-
-
- if (log.IsDebugEnabled) log.Debug("Subtracting ["+right+"] from ["+left+"]");
-
- result = (new SharedModule.Math()).Subtract(left, right);
-
- if (log.IsDebugEnabled) log.Debug("Result ["+result+"]");
-
- Console.Out.WriteLine(result);
- }
- }
- }
-}
diff --git a/examples/mono/1.0/Repository/SimpleApp/cs/src/SimpleApp.exe.log4net b/examples/mono/1.0/Repository/SimpleApp/cs/src/SimpleApp.exe.log4net
deleted file mode 100644
index ffef958..0000000
--- a/examples/mono/1.0/Repository/SimpleApp/cs/src/SimpleApp.exe.log4net
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!-- This section contains the log4net configuration settings -->
-<log4net>
- <!-- Define some output appenders -->
- <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
- <layout type="log4net.Layout.PatternLayout">
- <param name="ConversionPattern" value="[SimpleAppConfig] %date [%thread] %-5level %logger - %message%newline" />
- </layout>
- </appender>
- <!-- Setup the root category, add the appenders and set the default priority -->
- <root>
- <level value="DEBUG" />
- <appender-ref ref="ConsoleAppender" />
- </root>
-</log4net>
diff --git a/examples/mono/1.0/Repository/SimpleApp/nant.build b/examples/mono/1.0/Repository/SimpleApp/nant.build
deleted file mode 100644
index d92e4c5..0000000
--- a/examples/mono/1.0/Repository/SimpleApp/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="simpleapp-example" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile SimpleApp example -->
- <target name="compile" description="Builds SimpleApp example">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/mono/1.0/Repository/SimpleApp/nant.config b/examples/mono/1.0/Repository/SimpleApp/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/mono/1.0/Repository/SimpleApp/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/mono/1.0/Repository/SimpleModule/cs/nant.build b/examples/mono/1.0/Repository/SimpleModule/cs/nant.build
deleted file mode 100644
index 9ee2cbe..0000000
--- a/examples/mono/1.0/Repository/SimpleModule/cs/nant.build
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- compile the example -->
- <csc noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" define="${current.build.defines.csc}" output="${current.bin.dir}/SimpleModule.dll">
- <sources>
- <include name="src/**/*.cs" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.cs" />
- </sources>
- <references basedir="${log4net.output.dir}">
- <include name="log4net.dll" />
- </references>
- </csc>
- <!-- copy the log4net configuration file to the output directory -->
- <copy file="src/SimpleModule.dll.log4net" todir="${current.bin.dir}" />
- </target>
-</project>
diff --git a/examples/mono/1.0/Repository/SimpleModule/cs/nant.config b/examples/mono/1.0/Repository/SimpleModule/cs/nant.config
deleted file mode 100644
index 52613e8..0000000
--- a/examples/mono/1.0/Repository/SimpleModule/cs/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/mono/1.0/Repository/SimpleModule/cs/src/AssemblyInfo.cs b/examples/mono/1.0/Repository/SimpleModule/cs/src/AssemblyInfo.cs
deleted file mode 100644
index 1c32a35..0000000
--- a/examples/mono/1.0/Repository/SimpleModule/cs/src/AssemblyInfo.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// 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("log4net - SimpleModule")]
-[assembly: AssemblyDescription("log4net SimpleModule")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyProduct("log4net - SimpleModule")]
-[assembly: AssemblyCulture("")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("")]
-[assembly: AssemblyKeyName("")]
diff --git a/examples/mono/1.0/Repository/SimpleModule/cs/src/Math.cs b/examples/mono/1.0/Repository/SimpleModule/cs/src/Math.cs
deleted file mode 100644
index 3c01a79..0000000
--- a/examples/mono/1.0/Repository/SimpleModule/cs/src/Math.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-// We want this assembly to have a seperate logging repository to the
-// rest of the application. We will configure this repository seperatly.
-[assembly: log4net.Config.Repository("SimpleModule")]
-
-// Configure logging for this assembly using the 'SimpleModule.dll.log4net' file
-[assembly: log4net.Config.XmlConfigurator(ConfigFileExtension="log4net", Watch=true)]
-
-namespace SimpleModule
-{
- /// <summary>
- /// Summary description for Math.
- /// </summary>
- public class Math
- {
- // Create a logger for use in this class
- private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
-
- public Math()
- {
- if (log.IsDebugEnabled) log.Debug("Constructor");
- }
-
- public int Add(int left, int right)
- {
- int result = left + right;
- if (log.IsInfoEnabled) log.Info(""+left+" + "+right+" = "+result);
- return result;
- }
- }
-}
diff --git a/examples/mono/1.0/Repository/SimpleModule/cs/src/SimpleModule.dll.log4net b/examples/mono/1.0/Repository/SimpleModule/cs/src/SimpleModule.dll.log4net
deleted file mode 100644
index cd01ae1..0000000
--- a/examples/mono/1.0/Repository/SimpleModule/cs/src/SimpleModule.dll.log4net
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!-- This section contains the log4net configuration settings -->
-<log4net>
- <!-- Define some output appenders -->
- <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
- <layout type="log4net.Layout.PatternLayout">
- <param name="ConversionPattern" value="[SimpleModuleConfig] %date [%thread] %-5level %logger - %message%newline" />
- </layout>
- </appender>
- <!-- Setup the root category, add the appenders and set the default priority -->
- <root>
- <level value="DEBUG" />
- <appender-ref ref="ConsoleAppender" />
- </root>
-</log4net>
diff --git a/examples/mono/1.0/Repository/SimpleModule/nant.build b/examples/mono/1.0/Repository/SimpleModule/nant.build
deleted file mode 100644
index 614f891..0000000
--- a/examples/mono/1.0/Repository/SimpleModule/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="simplemodule-example" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile SimpleModule example -->
- <target name="compile" description="Builds SimpleModule example">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/mono/1.0/Repository/SimpleModule/nant.config b/examples/mono/1.0/Repository/SimpleModule/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/mono/1.0/Repository/SimpleModule/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/mono/1.0/Repository/nant.build b/examples/mono/1.0/Repository/nant.build
deleted file mode 100644
index 27c3394..0000000
--- a/examples/mono/1.0/Repository/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="repository-examples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile Domain examples -->
- <target name="compile" description="Builds Repository examples">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/mono/1.0/Repository/nant.config b/examples/mono/1.0/Repository/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/mono/1.0/Repository/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/mono/1.0/Tutorials/ConsoleApp/cs/nant.build b/examples/mono/1.0/Tutorials/ConsoleApp/cs/nant.build
deleted file mode 100644
index c88e310..0000000
--- a/examples/mono/1.0/Tutorials/ConsoleApp/cs/nant.build
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- copy log4net build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="${log4net.output.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- compile the example -->
- <csc noconfig="true" warnaserror="true" target="exe" debug="${current.build.debug}" define="${current.build.defines.csc}" output="${current.bin.dir}/ConsoleApp.exe">
- <sources>
- <include name="src/**/*.cs" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.cs" />
- </sources>
- <references>
- <include name="${current.bin.dir}/log4net.dll" />
- </references>
- </csc>
- <!-- copy the ConsoleApp application configuration file -->
- <copy file="src/App.config" tofile="${current.bin.dir}/ConsoleApp.exe.config" />
- </target>
-</project>
diff --git a/examples/mono/1.0/Tutorials/ConsoleApp/cs/nant.config b/examples/mono/1.0/Tutorials/ConsoleApp/cs/nant.config
deleted file mode 100644
index 2be781b..0000000
--- a/examples/mono/1.0/Tutorials/ConsoleApp/cs/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/mono/1.0/Tutorials/ConsoleApp/cs/src/App.config b/examples/mono/1.0/Tutorials/ConsoleApp/cs/src/App.config
deleted file mode 100644
index 93ce611..0000000
--- a/examples/mono/1.0/Tutorials/ConsoleApp/cs/src/App.config
+++ /dev/null
@@ -1,208 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<!--
- .NET application configuration file
-
- This file must have the exact same name as your application with
- .config appended to it. For example if your application is ConsoleApp.exe
- then the config file must be ConsoleApp.exe.config it mut also be in the
- same directory as the application.
--->
-<configuration>
- <!-- Register a section handler for the log4net section -->
- <configSections>
- <section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
- </configSections>
- <!-- Enable internal debugging in log4net -->
- <appSettings>
- <!-- To enable internal log4net logging specify the following appSettings key -->
- <!-- <add key="log4net.Internal.Debug" value="true"/> -->
- </appSettings>
- <!-- This section contains the log4net configuration settings -->
- <log4net>
- <!-- Define some output appenders -->
- <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
- <file value="rolling-log.txt" />
- <appendToFile value="true" />
- <maxSizeRollBackups value="10" />
- <maximumFileSize value="100" />
- <rollingStyle value="Size" />
- <staticLogFileName value="true" />
- <layout type="log4net.Layout.PatternLayout">
- <header value="[Header] " />
- <footer value="[Footer] " />
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
- </layout>
- </appender>
- <appender name="LogFileAppender" type="log4net.Appender.FileAppender">
- <file value="log-file.txt" />
- <!-- Example using environment variables in params -->
- <!-- <file value="${TMP}\log-file.txt" /> -->
- <appendToFile value="true" />
- <!-- An alternate output encoding can be specified -->
- <!-- <param name="Encoding" value="unicodeFFFE" /> -->
- <layout type="log4net.Layout.PatternLayout">
- <header value="[Header] " />
- <footer value="[Footer] " />
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] <%property{auth}> - %message%newline" />
- </layout>
- <!-- Alternate layout using XML
- <layout type="log4net.Layout.XMLLayout" />
- -->
- </appender>
- <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] <%property{auth}> - %message%newline" />
- </layout>
- </appender>
- <!-- Example of how to configure the AdoNetAppender
- <appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender" >
- <connectionString value="Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Work\cvs_root\log4net-1.2\access.mdb;UID=;PWD=;" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message]) VALUES ('%date','%thread','%level','%logger','%message')" />
- </layout>
- </appender>
- -->
- <!--
- <appender name="A" type="log4net.Appender.ForwardingAppender" >
- <threshold value="WARN"/>
- <appender-ref ref="ConsoleAppender" />
- </appender>
- <appender name="B" type="log4net.Appender.ForwardingAppender" >
- <filter type="log4net.Filter.LevelRangeFilter">
- <levelMin value="DEBUG"/>
- <levelMax value="INFO"/>
- </filter>
- <appender-ref ref="ConsoleAppender" />
- </appender>
- -->
- <!-- Example of how to configure the AdoNetAppender to connect to MS Access -->
- <appender name="ADONetAppender_Access" type="log4net.Appender.AdoNetAppender">
- <connectionString value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Work\cvs_root\log4net-1.2\access.mdb;User Id=;Password=;" />
- <commandText value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message]) VALUES (@log_date, @thread, @log_level, @logger, @message)" />
- <parameter>
- <parameterName value="@log_date" />
- <dbType value="String" />
- <size value="255" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date" />
- </layout >
- </parameter>
- <parameter>
- <parameterName value="@thread" />
- <dbType value="String" />
- <size value="255" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%thread" />
- </layout>
- </parameter>
- <parameter>
- <parameterName value="@log_level" />
- <dbType value="String" />
- <size value="50" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%level" />
- </layout >
- </parameter>
- <parameter>
- <parameterName value="@logger" />
- <dbType value="String" />
- <size value="255" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%logger" />
- </layout >
- </parameter>
- <parameter>
- <parameterName value="@message" />
- <dbType value="String" />
- <size value="1024" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%message" />
- </layout >
- </parameter>
- </appender>
- <!-- Example of how to configure the AdoNetAppender to connect to MS SQL Server -->
- <appender name="ADONetAppender_SqlServer" type="log4net.Appender.AdoNetAppender">
- <bufferSize value="1" />
- <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
- <connectionString value="data source=SQLSVR;initial catalog=test_log4net;integrated security=false;persist security info=True;" />
- <commandText value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message]) VALUES (@log_date, @thread, @log_level, @logger, @message)" />
- <parameter>
- <parameterName value="@log_date" />
- <dbType value="DateTime" />
- <!--
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date{yyyy'-'MM'-'dd HH':'mm':'ss'.'fff}" />
- </layout >
- -->
- <layout type="log4net.Layout.RawTimeStampLayout" />
- </parameter>
- <parameter>
- <parameterName value="@thread" />
- <dbType value="String" />
- <size value="255" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%thread" />
- </layout >
- </parameter>
- <parameter>
- <parameterName value="@log_level" />
- <dbType value="String" />
- <size value="50" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%level" />
- </layout >
- </parameter>
- <parameter>
- <parameterName value="@logger" />
- <dbType value="String" />
- <size value="255" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%logger" />
- </layout >
- </parameter>
- <parameter>
- <parameterName value="@message" />
- <dbType value="String" />
- <size value="4000" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%message" />
- </layout >
- </parameter>
- </appender>
- <!-- Setup the root category, add the appenders and set the default level -->
- <root>
- <level value="WARN" />
- <appender-ref ref="LogFileAppender" />
- <appender-ref ref="ConsoleAppender" />
- <!-- <appender-ref ref="ADONetAppender_SqlServer" /> -->
- <!-- <appender-ref ref="A" /> -->
- </root>
- <!-- Specify the level for some specific categories -->
- <logger name="ConsoleApp.LoggingExample">
- <!-- <appender-ref ref="B" /> -->
- <level value="ALL" />
- <appender-ref ref="RollingLogFileAppender" />
- </logger>
- </log4net>
-</configuration>
diff --git a/examples/mono/1.0/Tutorials/ConsoleApp/cs/src/AssemblyInfo.cs b/examples/mono/1.0/Tutorials/ConsoleApp/cs/src/AssemblyInfo.cs
deleted file mode 100644
index 5d78024..0000000
--- a/examples/mono/1.0/Tutorials/ConsoleApp/cs/src/AssemblyInfo.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// 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("log4net - ConsoleApp")]
-[assembly: AssemblyDescription("log4net ConsoleApp")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyProduct("log4net - TestApp")]
-[assembly: AssemblyCulture("")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("")]
-[assembly: AssemblyKeyName("")]
diff --git a/examples/mono/1.0/Tutorials/ConsoleApp/cs/src/LoggingExample.cs b/examples/mono/1.0/Tutorials/ConsoleApp/cs/src/LoggingExample.cs
deleted file mode 100644
index d1c53d1..0000000
--- a/examples/mono/1.0/Tutorials/ConsoleApp/cs/src/LoggingExample.cs
+++ /dev/null
@@ -1,112 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-// Configure log4net using the .config file
-[assembly: log4net.Config.XmlConfigurator(Watch=true)]
-// This will cause log4net to look for a configuration file
-// called ConsoleApp.exe.config in the application base
-// directory (i.e. the directory containing ConsoleApp.exe)
-
-namespace ConsoleApp
-{
- using System;
-
- /// <summary>
- /// Example of how to simply configure and use log4net
- /// </summary>
- public class LoggingExample
- {
- // Create a logger for use in this class
- private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
- // NOTE that using System.Reflection.MethodBase.GetCurrentMethod().DeclaringType
- // is equivalent to typeof(LoggingExample) but is more portable
- // i.e. you can copy the code directly into another class without
- // needing to edit the code.
-
- /// <summary>
- /// Application entry point
- /// </summary>
- /// <param name="args">command line arguments</param>
- public static void Main(string[] args)
- {
- // Log an info level message
- if (log.IsInfoEnabled) log.Info("Application [ConsoleApp] Start");
-
- // Log a debug message. Test if debug is enabled before
- // attempting to log the message. This is not required but
- // can make running without logging faster.
- if (log.IsDebugEnabled) log.Debug("This is a debug message");
-
- try
- {
- Bar();
- }
- catch(Exception ex)
- {
- // Log an error with an exception
- log.Error("Exception thrown from method Bar", ex);
- }
-
- log.Error("Hey this is an error!");
-
- // Push a message on to the Nested Diagnostic Context stack
- using(log4net.NDC.Push("NDC_Message"))
- {
- log.Warn("This should have an NDC message");
-
- // Set a Mapped Diagnostic Context value
- log4net.MDC.Set("auth", "auth-none");
- log.Warn("This should have an MDC message for the key 'auth'");
-
- } // The NDC message is popped off the stack at the end of the using {} block
-
- log.Warn("See the NDC has been popped of! The MDC 'auth' key is still with us.");
-
- // Log an info level message
- if (log.IsInfoEnabled) log.Info("Application [ConsoleApp] End");
-
- Console.Write("Press Enter to exit...");
- Console.ReadLine();
- }
-
- // Helper methods to demonstrate location information and nested exceptions
-
- private static void Bar()
- {
- Goo();
- }
-
- private static void Foo()
- {
- throw new Exception("This is an Exception");
- }
-
- private static void Goo()
- {
- try
- {
- Foo();
- }
- catch(Exception ex)
- {
- throw new ArithmeticException("Failed in Goo. Calling Foo. Inner Exception provided", ex);
- }
- }
- }
-}
diff --git a/examples/mono/1.0/Tutorials/ConsoleApp/nant.build b/examples/mono/1.0/Tutorials/ConsoleApp/nant.build
deleted file mode 100644
index 9b5a1db..0000000
--- a/examples/mono/1.0/Tutorials/ConsoleApp/nant.build
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="consoleapp-example" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile ConsoleApp example -->
- <target name="compile" description="Builds ConsoleApp example">
- <nant buildfile="cs/nant.build" target="compile" />
- </target>
-</project>
diff --git a/examples/mono/1.0/Tutorials/ConsoleApp/nant.config b/examples/mono/1.0/Tutorials/ConsoleApp/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/mono/1.0/Tutorials/ConsoleApp/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/mono/1.0/Tutorials/nant.build b/examples/mono/1.0/Tutorials/nant.build
deleted file mode 100644
index 0da253c..0000000
--- a/examples/mono/1.0/Tutorials/nant.build
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="tutorials-examples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile Tutorials examples -->
- <target name="compile" description="Builds Tutorials examples">
- <nant buildfile="ConsoleApp/nant.build" target="compile" />
- </target>
-</project>
diff --git a/examples/mono/1.0/Tutorials/nant.config b/examples/mono/1.0/Tutorials/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/mono/1.0/Tutorials/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/mono/1.0/nant.build b/examples/mono/1.0/nant.build
deleted file mode 100644
index 652f1f2..0000000
--- a/examples/mono/1.0/nant.build
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="mono-1.0-examples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- include configuration file -->
- <include buildfile="nant.config" />
- <!-- compile all Mono 1.0 examples -->
- <target name="compile" description="Builds Mono 1.0 examples">
- <if test="${framework::exists(project.runtime.config + '-' + project.runtime.version)}">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </if>
- <if test="${not framework::exists(project.runtime.config + '-' + project.runtime.version)}">
- <if test="${property::exists('project.build.package') and project.build.package}">
- <fail message="${project.runtime.description} is not available." />
- </if>
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo message="${project.runtime.description} is not available. Examples skipped." />
- </if>
- </if>
- </target>
-</project>
diff --git a/examples/mono/1.0/nant.config b/examples/mono/1.0/nant.config
deleted file mode 100644
index 8c74b78..0000000
--- a/examples/mono/1.0/nant.config
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set runtime version -->
- <property name="project.runtime.version" value="1.0" />
- <!-- Set runtime description -->
- <property name="project.runtime.description" value="Mono 1.0" />
-</project>
diff --git a/examples/mono/nant.build b/examples/mono/nant.build
deleted file mode 100644
index 51b1f9a..0000000
--- a/examples/mono/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="mono-examples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile Mono examples -->
- <target name="compile" description="Builds Mono examples">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/mono/nant.config b/examples/mono/nant.config
deleted file mode 100644
index 529fce0..0000000
--- a/examples/mono/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="mono-configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set runtime configuration -->
- <property name="project.runtime.config" value="mono" />
-</project>
diff --git a/examples/nant.build b/examples/nant.build
deleted file mode 100644
index 9d55bd7..0000000
--- a/examples/nant.build
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="examples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <target name="compile" description="Builds examples">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
- <target name="update-version-info" description="Updates the AssemblyVersionInfo.cs of the examples">
- <nant buildfile="net/nant.build" target="update-version-info" />
- </target>
-</project>
diff --git a/examples/nant.config b/examples/nant.config
deleted file mode 100644
index 3a304c1..0000000
--- a/examples/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="examples-configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Set build configuration -->
- <property name="project.build.config" value="debug" />
-</project>
diff --git a/examples/net/1.1/Repository/SharedModule/js/nant.build b/examples/net/1.1/Repository/SharedModule/js/nant.build
deleted file mode 100644
index 3fa705a..0000000
--- a/examples/net/1.1/Repository/SharedModule/js/nant.build
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- compile the example -->
- <jsc target="library" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.jsc}" output="${current.bin.dir}/SharedModule.dll">
- <sources>
- <include name="src/**/*.js" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.js" />
- </sources>
- <references basedir="${log4net.output.dir}">
- <include name="log4net.dll" />
- </references>
- </jsc>
- </target>
-</project>
diff --git a/examples/net/1.1/Repository/SharedModule/js/nant.config b/examples/net/1.1/Repository/SharedModule/js/nant.config
deleted file mode 100644
index 52613e8..0000000
--- a/examples/net/1.1/Repository/SharedModule/js/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/net/1.1/Repository/SharedModule/js/src/AssemblyInfo.js b/examples/net/1.1/Repository/SharedModule/js/src/AssemblyInfo.js
deleted file mode 100644
index 6707228..0000000
--- a/examples/net/1.1/Repository/SharedModule/js/src/AssemblyInfo.js
+++ /dev/null
@@ -1,61 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-
-import System.Reflection;
-import System.Runtime.CompilerServices;
-
-[assembly: System.CLSCompliant(true)]
-
-//
-// 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("log4net - SharedModule")]
-[assembly:AssemblyDescription("log4net SharedModule")]
-[assembly:AssemblyConfiguration("")]
-[assembly:AssemblyProduct("log4net - ConsoleApp")]
-[assembly:AssemblyCulture("")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly:AssemblyDelaySign(false)]
-[assembly:AssemblyKeyFile("")]
-[assembly: AssemblyKeyName("")]
diff --git a/examples/net/1.1/Repository/SharedModule/js/src/Math.js b/examples/net/1.1/Repository/SharedModule/js/src/Math.js
deleted file mode 100644
index f2e279e..0000000
--- a/examples/net/1.1/Repository/SharedModule/js/src/Math.js
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-
-package SharedModule {
- /// <summary>
- /// Summary description for Math.
- /// </summary>
- public class Math {
- // Create a logger for use in this class
- private static var log : log4net.ILog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
-
- public function Math() {
- if (log.IsDebugEnabled) log.Debug("Constructor");
- }
-
- public function Subtract(left : int, right : int) : int
- {
- var result : int = left - right;
- if (log.IsInfoEnabled) log.Info("" + left + " - " + right + " = " + result);
- return result;
- }
- }
-}
diff --git a/examples/net/1.1/Repository/SharedModule/nant.build b/examples/net/1.1/Repository/SharedModule/nant.build
deleted file mode 100644
index a11e9cd..0000000
--- a/examples/net/1.1/Repository/SharedModule/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="sharedmodule-example" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile SharedModule example -->
- <target name="compile" description="Builds SharedModule example">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/net/1.1/Repository/SharedModule/nant.config b/examples/net/1.1/Repository/SharedModule/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/net/1.1/Repository/SharedModule/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/net/1.1/Repository/SimpleApp/js/nant.build b/examples/net/1.1/Repository/SimpleApp/js/nant.build
deleted file mode 100644
index cb182e0..0000000
--- a/examples/net/1.1/Repository/SimpleApp/js/nant.build
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- copy log4net build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="${log4net.output.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- build SharedModule assembly -->
- <nant buildfile="../../SharedModule/js/nant.build" target="compile" inheritall="true" />
- <!-- build SimpleModule assembly -->
- <nant buildfile="../../SimpleModule/js/nant.build" target="compile" inheritall="true" />
- <!-- copy SharedModule build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="../../SharedModule/js/${current.bin.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- copy SimpleModule build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="../../SimpleModule/js/${current.bin.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- compile the example -->
- <jsc target="exe" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.jsc}" output="${current.bin.dir}/SimpleApp.exe">
- <sources>
- <include name="src/**/*.js" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.js" />
- </sources>
- <references basedir="${current.bin.dir}">
- <include name="SharedModule.dll" />
- <include name="SimpleModule.dll" />
- <include name="log4net.dll" />
- </references>
- </jsc>
- <!-- copy the SimpleApp log4net configuration file -->
- <copy file="src/SimpleApp.exe.log4net" todir="${current.bin.dir}" />
- <!-- copy the SimpleApp application configuration file -->
- <copy file="src/App.config" tofile="${current.bin.dir}/SimpleApp.exe.config" />
- </target>
-</project>
diff --git a/examples/net/1.1/Repository/SimpleApp/js/nant.config b/examples/net/1.1/Repository/SimpleApp/js/nant.config
deleted file mode 100644
index 52613e8..0000000
--- a/examples/net/1.1/Repository/SimpleApp/js/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/net/1.1/Repository/SimpleApp/js/src/App.config b/examples/net/1.1/Repository/SimpleApp/js/src/App.config
deleted file mode 100644
index c37efd0..0000000
--- a/examples/net/1.1/Repository/SimpleApp/js/src/App.config
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<configuration>
- <appSettings>
- <!-- To enable internal log4net logging specify the
- following appSettings key -->
- <!-- <add key="log4net.Internal.Debug" value="true"/> -->
- </appSettings>
-</configuration>
diff --git a/examples/net/1.1/Repository/SimpleApp/js/src/AssemblyInfo.js b/examples/net/1.1/Repository/SimpleApp/js/src/AssemblyInfo.js
deleted file mode 100644
index a661868..0000000
--- a/examples/net/1.1/Repository/SimpleApp/js/src/AssemblyInfo.js
+++ /dev/null
@@ -1,61 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-
-import System.Reflection;
-import System.Runtime.CompilerServices;
-
-[assembly: System.CLSCompliant(true)]
-
-//
-// 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("log4net - SimpleApp")]
-[assembly:AssemblyDescription("log4net SimpleApp")]
-[assembly:AssemblyConfiguration("")]
-[assembly:AssemblyProduct("log4net - ConsoleApp")]
-[assembly:AssemblyCulture("")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly:AssemblyDelaySign(false)]
-[assembly:AssemblyKeyFile("")]
-[assembly: AssemblyKeyName("")]
diff --git a/examples/net/1.1/Repository/SimpleApp/js/src/EntryPoint.js b/examples/net/1.1/Repository/SimpleApp/js/src/EntryPoint.js
deleted file mode 100644
index 086482e..0000000
--- a/examples/net/1.1/Repository/SimpleApp/js/src/EntryPoint.js
+++ /dev/null
@@ -1,79 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-
-// JScript.NET does not support application entry points (like vb.Net and C#),
-// instead it supports global code.
-SimpleApp.EntryPoint.Main();
-
-import System;
-
-import log4net;
-
-import SimpleModule;
-import SharedModule;
-
-// Configure logging for this assembly using the 'SimpleApp.exe.log4net' file
-[assembly: log4net.Config.XmlConfigurator(ConfigFileExtension="log4net", Watch=true)]
-
-// The following alias attribute can be used to capture the logging
-// repository for the 'SimpleModule' assembly. Without specifying this
-// attribute the logging configuration for the 'SimpleModule' assembly
-// will be read from the 'SimpleModule.dll.log4net' file. When this
-// attribute is specified the configuration will be shared with this
-// assemby's configuration.
-//[assembly: log4net.Config.AliasRepository("SimpleModule")]
-
-package SimpleApp {
- public class EntryPoint {
- // Create a logger for use in this class
- private static var log : log4net.ILog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
-
- /// <summary>
- /// The main entry point for the application.
- /// </summary>
- public static function Main() {
- var args : String[] = System.Environment.GetCommandLineArgs();
-
- if (log.IsInfoEnabled) log.Info(args);
-
- // First commandline argument is always the assembly itself
- if (args.Length != 3) {
- log.Error("Must supply 2 command line arguments");
- } else {
- var left : int = int.Parse(args[1]);
- var right : int = int.Parse(args[2]);
- var result : int = 0;
-
- if (log.IsDebugEnabled) log.Debug("Adding [" + left + "] to [" + right + "]");
-
- result = (new SimpleModule.Math()).Add(left, right);
-
- if (log.IsDebugEnabled) log.Debug("Result [" + result + "]");
-
- Console.Out.WriteLine(result);
-
- if (log.IsDebugEnabled) log.Debug("Subtracting [" + right + "] from [" + left + "]");
-
- result = (new SharedModule.Math()).Subtract(left, right);
-
- if (log.IsDebugEnabled) log.Debug("Result [" + result + "]");
-
- Console.Out.WriteLine(result);
- }
- }
- }
-}
diff --git a/examples/net/1.1/Repository/SimpleApp/js/src/SimpleApp.exe.log4net b/examples/net/1.1/Repository/SimpleApp/js/src/SimpleApp.exe.log4net
deleted file mode 100644
index 4c14df1..0000000
--- a/examples/net/1.1/Repository/SimpleApp/js/src/SimpleApp.exe.log4net
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!-- This section contains the log4net configuration settings -->
-<log4net>
- <!-- Define some output appenders -->
- <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="[SimpleAppConfig] %date [%thread] %-5level %logger - %message%newline" />
- </layout>
- </appender>
- <!-- Setup the root category, add the appenders and set the default level -->
- <root>
- <level value="DEBUG" />
- <appender-ref ref="ConsoleAppender" />
- </root>
-
-</log4net>
diff --git a/examples/net/1.1/Repository/SimpleApp/nant.build b/examples/net/1.1/Repository/SimpleApp/nant.build
deleted file mode 100644
index d92e4c5..0000000
--- a/examples/net/1.1/Repository/SimpleApp/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="simpleapp-example" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile SimpleApp example -->
- <target name="compile" description="Builds SimpleApp example">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/net/1.1/Repository/SimpleApp/nant.config b/examples/net/1.1/Repository/SimpleApp/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/net/1.1/Repository/SimpleApp/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/net/1.1/Repository/SimpleModule/js/nant.build b/examples/net/1.1/Repository/SimpleModule/js/nant.build
deleted file mode 100644
index 36a0640..0000000
--- a/examples/net/1.1/Repository/SimpleModule/js/nant.build
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- compile the example -->
- <jsc target="library" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.jsc}" output="${current.bin.dir}/SimpleModule.dll">
- <sources>
- <include name="src/**/*.js" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.js" />
- </sources>
- <references basedir="${log4net.output.dir}">
- <include name="log4net.dll" />
- </references>
- </jsc>
- <!-- copy the log4net configuration file to the output directory -->
- <copy file="src/SimpleModule.dll.log4net" todir="${current.bin.dir}" />
- </target>
-</project>
diff --git a/examples/net/1.1/Repository/SimpleModule/js/nant.config b/examples/net/1.1/Repository/SimpleModule/js/nant.config
deleted file mode 100644
index 52613e8..0000000
--- a/examples/net/1.1/Repository/SimpleModule/js/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/net/1.1/Repository/SimpleModule/js/src/AssemblyInfo.js b/examples/net/1.1/Repository/SimpleModule/js/src/AssemblyInfo.js
deleted file mode 100644
index f994979..0000000
--- a/examples/net/1.1/Repository/SimpleModule/js/src/AssemblyInfo.js
+++ /dev/null
@@ -1,61 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-
-import System.Reflection;
-import System.Runtime.CompilerServices;
-
-[assembly: System.CLSCompliant(true)]
-
-//
-// 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("log4net - SimpleModule")]
-[assembly:AssemblyDescription("log4net SimpleModule")]
-[assembly:AssemblyConfiguration("")]
-[assembly:AssemblyProduct("log4net - ConsoleApp")]
-[assembly:AssemblyCulture("")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly:AssemblyDelaySign(false)]
-[assembly:AssemblyKeyFile("")]
-[assembly: AssemblyKeyName("")]
diff --git a/examples/net/1.1/Repository/SimpleModule/js/src/Math.js b/examples/net/1.1/Repository/SimpleModule/js/src/Math.js
deleted file mode 100644
index 752185b..0000000
--- a/examples/net/1.1/Repository/SimpleModule/js/src/Math.js
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-
-import log4net;
-
-// We want this assembly to have a seperate logging repository to the
-// rest of the application. We will configure this repository seperatly.
-[assembly: log4net.Config.Repository("SimpleModule")]
-
-// Configure logging for this assembly using the 'SimpleModule.dll.log4net' file
-[assembly: log4net.Config.XmlConfigurator(ConfigFileExtension="log4net", Watch=true)]
-
-package SimpleModule {
- /// <summary>
- /// Summary description for Math.
- /// </summary>
- public class Math {
- // Create a logger for use in this class
- private static var log : log4net.ILog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
-
- public function Math() {
- if (log.IsDebugEnabled) log.Debug("Constructor");
- }
-
- public function Add(left : int, right : int) : int {
- var result : int = left + right;
- if (log.IsInfoEnabled) log.Info("" + left + " + " + right + " = " + result);
- return result;
- }
- }
-}
diff --git a/examples/net/1.1/Repository/SimpleModule/js/src/SimpleModule.dll.log4net b/examples/net/1.1/Repository/SimpleModule/js/src/SimpleModule.dll.log4net
deleted file mode 100644
index 66703e9..0000000
--- a/examples/net/1.1/Repository/SimpleModule/js/src/SimpleModule.dll.log4net
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!-- This section contains the log4net configuration settings -->
-<log4net>
- <!-- Define some output appenders -->
- <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="[SimpleModuleConfig] %date [%thread] %-5level %logger - %message%newline" />
- </layout>
- </appender>
-
- <!-- Setup the root category, add the appenders and set the default priority -->
- <root>
- <level value="DEBUG" />
- <appender-ref ref="ConsoleAppender" />
- </root>
-</log4net>
diff --git a/examples/net/1.1/Repository/SimpleModule/nant.build b/examples/net/1.1/Repository/SimpleModule/nant.build
deleted file mode 100644
index 614f891..0000000
--- a/examples/net/1.1/Repository/SimpleModule/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="simplemodule-example" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile SimpleModule example -->
- <target name="compile" description="Builds SimpleModule example">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/net/1.1/Repository/SimpleModule/nant.config b/examples/net/1.1/Repository/SimpleModule/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/net/1.1/Repository/SimpleModule/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/net/1.1/Repository/nant.build b/examples/net/1.1/Repository/nant.build
deleted file mode 100644
index d1b4514..0000000
--- a/examples/net/1.1/Repository/nant.build
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="repository-examples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile Domain examples -->
- <target name="compile" description="Builds Repository examples">
- <nant buildfile="SharedModule/nant.build" target="compile" />
- <nant buildfile="SimpleApp/nant.build" target="compile" />
- <nant buildfile="SimpleModule/nant.build" target="compile" />
- </target>
-</project>
diff --git a/examples/net/1.1/Repository/nant.config b/examples/net/1.1/Repository/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/net/1.1/Repository/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/net/1.1/Tutorials/ConsoleApp/cpp/nant.build b/examples/net/1.1/Tutorials/ConsoleApp/cpp/nant.build
deleted file mode 100644
index 253445f..0000000
--- a/examples/net/1.1/Tutorials/ConsoleApp/cpp/nant.build
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- copy log4net build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="${log4net.output.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- compile the example -->
- <cl managedextensions="true" characterset="MultiByte" options="/Od /D "WIN32" ${current.build.defines.cl} /FD /EHsc /MTd /GS /W3 /Zi" outputdir="${current.bin.dir}">
- <sources>
- <include name="src/**/*.cpp" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.cpp" />
- </sources>
- <forcedusingfiles basedir="${current.bin.dir}">
- <include name="log4net.dll" />
- </forcedusingfiles>
- </cl>
- <!-- link the example -->
- <link options="/INCREMENTAL /DEBUG /PDB:"${current.bin.dir}/ConsoleApp.pdb" kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib" output="${current.bin.dir}/ConsoleApp.exe">
- <sources basedir="${current.bin.dir}">
- <include name="*.obj" />
- </sources>
- </link>
- <!-- copy the ConsoleApp application configuration file -->
- <copy file="src/App.config" tofile="${current.bin.dir}/ConsoleApp.exe.config" />
- </target>
-</project>
diff --git a/examples/net/1.1/Tutorials/ConsoleApp/cpp/nant.config b/examples/net/1.1/Tutorials/ConsoleApp/cpp/nant.config
deleted file mode 100644
index 52613e8..0000000
--- a/examples/net/1.1/Tutorials/ConsoleApp/cpp/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/net/1.1/Tutorials/ConsoleApp/cpp/src/App.config b/examples/net/1.1/Tutorials/ConsoleApp/cpp/src/App.config
deleted file mode 100644
index 82dc979..0000000
--- a/examples/net/1.1/Tutorials/ConsoleApp/cpp/src/App.config
+++ /dev/null
@@ -1,214 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<!--
- .NET application configuration file
- This file must have the exact same name as your application with .config appended to it.
-
- For example if your application is ConsoleApp.exe then the config file must be ConsoleApp.exe.config.
- It must also be in the same directory as the application.
- -->
-<configuration>
- <!-- Register a section handler for the log4net section -->
- <configSections>
- <section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
- </configSections>
- <appSettings>
- <!-- To enable internal log4net logging specify the following appSettings key -->
- <!-- <add key="log4net.Internal.Debug" value="true"/> -->
- </appSettings>
- <!-- This section contains the log4net configuration settings -->
- <log4net>
- <!-- Define some output appenders -->
- <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
- <file value="rolling-log.txt" />
- <appendToFile value="true" />
- <maxSizeRollBackups value="10" />
- <maximumFileSize value="100" />
- <rollingStyle value="Size" />
- <staticLogFileName value="true" />
- <layout type="log4net.Layout.PatternLayout">
- <header value="[Header] " />
- <footer value="[Footer] " />
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
- </layout>
- </appender>
- <appender name="LogFileAppender" type="log4net.Appender.FileAppender">
- <file value="log-file.txt" />
- <!-- Example using environment variables in params -->
- <!-- <file value="${TMP}\log-file.txt" /> -->
- <sppendToFile value="true" />
- <!-- An alternate output encoding can be specified -->
- <!-- <encoding value="unicodeFFFE" /> -->
- <layout type="log4net.Layout.PatternLayout">
- <geader value="[Header] " />
- <footer value="[Footer] " />
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] <%property{auth}> - %message%newline" />
- </layout>
- <!-- Alternate layout using XML
- <layout type="log4net.Layout.XMLLayout" /> -->
- </appender>
- <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] <%property{auth}> - %message%newline" />
- </layout>
- </appender>
- <appender name="NetSendAppender" type="log4net.Appender.NetSendAppender">
- <threshold value="ERROR" />
- <server value="SQUARE" />
- <recipient value="nicko" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
- </layout>
- </appender>
- <!-- Example of how to configure the AdoNetAppender
- <appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender" >
- <connectionString value="Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Work\cvs_root\log4net-1.2\access.mdb;UID=;PWD=;" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message]) VALUES ('%date','%thread','%level','%logger','%message')" />
- </layout>
- </appender>
- -->
- <!--
- <appender name="A" type="log4net.Appender.ForwardingAppender" >
- <threshold value="WARN"/>
- <appender-ref ref="ConsoleAppender" />
- </appender>
- <appender name="B" type="log4net.Appender.ForwardingAppender" >
- <filter type="log4net.Filter.LevelRangeFilter">
- <levelMin value="DEBUG"/>
- <levelMax value="INFO"/>
- </filter>
- <appender-ref ref="ConsoleAppender" />
- </appender>
- -->
- <!-- Example of how to configure the AdoNetAppender to connect to MS Access -->
- <appender name="ADONetAppender_Access" type="log4net.Appender.AdoNetAppender">
- <connectionString value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Work\cvs_root\log4net-1.2\access.mdb;User Id=;Password=;" />
- <commandText" value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message]) VALUES (@log_date, @thread, @log_level, @logger, @message)" />
- <parameter>
- <parameterName value="@log_date" />
- <dbType value="String" />
- <size value="255" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date" />
- </param>
- </parameter>
- <parameter>
- <parameterName value="@thread" />
- <dbType value="String" />
- <size value="255" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%thread" />
- </layout>
- </parameter>
- <parameter>
- <parameterName value="@log_level" />
- <dbType value="String" />
- <size value="50" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%level" />
- </layout>
- </parameter>
- <parameter>
- <parameterName value="@logger" />
- <dbType value="String" />
- <size value="255" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%logger" />
- </layout>
- </parameter>
- <parameter>
- <parameterName value="@message" />
- <dbType value="String" />
- <size value="1024" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%message" />
- </layout>
- </parameter>
- </appender>
- <!-- Example of how to configure the AdoNetAppender to connect to MS SQL Server -->
- <appender name="ADONetAppender_SqlServer" type="log4net.Appender.AdoNetAppender">
- <bufferSize value="1" />
- <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
- <connectionString value="data source=SQLSVR;initial catalog=test_log4net;integrated security=false;persist security info=True;" />
- <commandText value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message]) VALUES (@log_date, @thread, @log_level, @logger, @message)" />
- <parameter>
- <parameterName value="@log_date" />
- <dbType value="DateTime" />
- <!--
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date{yyyy'-'MM'-'dd HH':'mm':'ss'.'fff}" />
- </layout>
- -->
- <layout type="log4net.Layout.RawTimeStampLayout" />
- </parameter>
- <parameter>
- <parameterName value="@thread" />
- <dbType value="String" />
- <size value="255" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%thread" />
- </layout>
- </parameter>
- <parameter>
- <parameterName value="@log_level" />
- <dbType value="String" />
- <size value="50" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%level" />
- </layout>
- </parameter>
- <parameter>
- <parameterName value="@logger" />
- <dbType value="String" />
- <size value="255" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%logger" />
- </layout>
- </parameter>
- <parameter>
- <parameterName value="@message" />
- <dbType value="String" />
- <size value="4000" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%message" />
- </layout>
- </parameter>
- </appender>
- <!-- Setup the root category, add the appenders and set the default level -->
- <root>
- <level value="WARN" />
- <appender-ref ref="LogFileAppender" />
- <appender-ref ref="ConsoleAppender" />
- <!-- <appender-ref ref="ADONetAppender_SqlServer" /> -->
- <appender-ref ref="NetSendAppender" />
- <!-- <appender-ref ref="A" /> -->
- </root>
- <!-- Specify the level for some specific categories -->
- <logger name="ConsoleApp.LoggingExample">
- <!-- <appender-ref ref="B" /> -->
- <level value="ALL" />
- <appender-ref ref="RollingLogFileAppender" />
- </logger>
- </log4net>
-</configuration>
diff --git a/examples/net/1.1/Tutorials/ConsoleApp/cpp/src/AssemblyInfo.cpp b/examples/net/1.1/Tutorials/ConsoleApp/cpp/src/AssemblyInfo.cpp
deleted file mode 100644
index 59c8f33..0000000
--- a/examples/net/1.1/Tutorials/ConsoleApp/cpp/src/AssemblyInfo.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-
-#using <mscorlib.dll>
-
-using namespace System::Reflection;
-using namespace System::Runtime::CompilerServices;
-
-//
-// 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("log4net - ConsoleApp")];
-[assembly: AssemblyDescription("log4net ConsoleApp")];
-[assembly: AssemblyConfiguration("")];
-[assembly: AssemblyProduct("log4net - ConsoleApp")];
-[assembly: AssemblyCulture("")];
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project directory.
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly:AssemblyDelaySignAttribute(false)];
-[assembly:AssemblyKeyFileAttribute("")];
-[assembly:AssemblyKeyNameAttribute("")];
-
diff --git a/examples/net/1.1/Tutorials/ConsoleApp/cpp/src/ConsoleApp.cpp b/examples/net/1.1/Tutorials/ConsoleApp/cpp/src/ConsoleApp.cpp
deleted file mode 100644
index fa6ed9a..0000000
--- a/examples/net/1.1/Tutorials/ConsoleApp/cpp/src/ConsoleApp.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-
-#using <mscorlib.dll>
-#include <tchar.h>
-
-using namespace System;
-
-// Configure log4net using the .config file
-[assembly: log4net::Config::XmlConfiguratorAttribute(Watch=true)];
-// This will cause log4net to look for a configuration file
-// called ConsoleApp.exe.config in the application base
-// directory (i.e. the directory containing ConsoleApp.exe)
-
-
-namespace ConsoleApp
-{
- /// <summary>
- /// Example of how to simply configure and use log4net
- /// </summary>
- public __gc class LoggingExample
- {
- private:
- // Create a logger for use in this class
- static log4net::ILog* log = log4net::LogManager::GetLogger(System::Reflection::MethodBase::GetCurrentMethod()->DeclaringType);
- // NOTE that using System.Reflection.MethodBase.GetCurrentMethod().DeclaringType
- // is equivalent to typeof(LoggingExample) but is more portable
- // i.e. you can copy the code directly into another class without
- // needing to edit the code.
-
- public:
- /// <summary>
- /// Application entry point
- /// </summary>
- /// <param name="args">command line arguments</param>
- static void Main(String* args[])
- {
- // Log an info level message
- if (log->IsInfoEnabled) log->Info(S"Application [ConsoleApp] Start");
-
- // Log a debug message. Test if debug is enabled before
- // attempting to log the message. This is not required but
- // can make running without logging faster.
- if (log->IsDebugEnabled) log->Debug(S"This is a debug message");
-
- try
- {
- Bar();
- }
- catch(Exception* ex)
- {
- // Log an error with an exception
- log->Error(S"Exception thrown from method Bar", ex);
- }
-
- log->Error(S"Hey this is an error!");
-
- try
- {
- // Push a message on to the Nested Diagnostic Context stack
- log4net::NDC::Push(S"NDC_Message");
- log->Warn(S"This should have an NDC message");
-
- // Set a Mapped Diagnostic Context value
- log4net::MDC::Set(S"auth", S"auth-none");
- log->Warn(S"This should have an MDC message for the key 'auth'");
-
- }
- __finally
- {
- // Pop the NDC message off the stack at the end of the block
- log4net::NDC::Pop();
- }
-
- log->Warn(S"See the NDC has been popped of! The MDC 'auth' key is still with us.");
-
- // Log an info level message
- if (log->IsInfoEnabled) log->Info(S"Application [ConsoleApp] End");
-
- Console::Write(S"Press Enter to exit...");
- Console::ReadLine();
- }
-
- private:
- // Helper methods to demonstrate location information and nested exceptions
-
- static void Bar()
- {
- Goo();
- }
-
- static void Foo()
- {
- throw new Exception(S"This is an Exception");
- }
-
- static void Goo()
- {
- try
- {
- Foo();
- }
- catch(Exception* ex)
- {
- throw new ArithmeticException(S"Failed in Goo. Calling Foo. Inner Exception provided", ex);
- }
- }
- };
-}
-
-// This is the entry point for this application
-int _tmain(void)
-{
- // TODO: Please replace the sample code below with your own.
- //Console::WriteLine(S"Hello World");
-
- ConsoleApp::LoggingExample::Main(NULL);
- return 0;
-}
diff --git a/examples/net/1.1/Tutorials/ConsoleApp/cpp/src/ConsoleApp.vcproj b/examples/net/1.1/Tutorials/ConsoleApp/cpp/src/ConsoleApp.vcproj
deleted file mode 100644
index 17328f3..0000000
--- a/examples/net/1.1/Tutorials/ConsoleApp/cpp/src/ConsoleApp.vcproj
+++ /dev/null
@@ -1,186 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="ConsoleApp"
- ProjectGUID="{EF2FAB20-8AC6-420A-BCBF-B3C8D8467323}"
- Keyword="ManagedCProj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="..\build\debug"
- IntermediateDirectory="Debug"
- ConfigurationType="1"
- CharacterSet="2"
- ManagedExtensions="TRUE">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- PreprocessorDefinitions="WIN32;_DEBUG"
- MinimalRebuild="FALSE"
- BasicRuntimeChecks="0"
- RuntimeLibrary="1"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- ForcedUsingFiles="..\..\..\..\..\..\..\bin\net\1.1\release\log4net.dll"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)/ConsoleApp.exe"
- LinkIncremental="2"
- GenerateDebugInformation="TRUE"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="..\build\release"
- IntermediateDirectory="Release"
- ConfigurationType="1"
- CharacterSet="2"
- ManagedExtensions="TRUE">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- InlineFunctionExpansion="1"
- PreprocessorDefinitions="WIN32;NDEBUG"
- MinimalRebuild="FALSE"
- RuntimeLibrary="0"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- ForcedUsingFiles="..\..\..\..\..\..\..\bin\net\1.1\release\log4net.dll"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)/ConsoleApp.exe"
- LinkIncremental="1"
- GenerateDebugInformation="TRUE"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
- <File
- RelativePath="AssemblyInfo.cpp">
- </File>
- <File
- RelativePath="..\..\..\..\..\..\..\src\AssemblyVersionInfo.cpp">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- ObjectFile="$(IntDir)/$(InputName)1.obj"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- ObjectFile="$(IntDir)/$(InputName)1.obj"/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="ConsoleApp.cpp">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;r">
- </Filter>
- <File
- RelativePath="App.config"
- DeploymentContent="TRUE">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCustomBuildTool"
- CommandLine="copy $(InputPath) $(TargetDir)\ConsoleApp.exe.config
-"
- Outputs="$(TargetDir)\ConsoleApp.exe.config"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCustomBuildTool"
- CommandLine="copy $(InputPath) $(TargetDir)\ConsoleApp.exe.config
-"
- Outputs="$(TargetDir)\ConsoleApp.exe.config"/>
- </FileConfiguration>
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/examples/net/1.1/Tutorials/ConsoleApp/js/nant.build b/examples/net/1.1/Tutorials/ConsoleApp/js/nant.build
deleted file mode 100644
index 6dcc4d4..0000000
--- a/examples/net/1.1/Tutorials/ConsoleApp/js/nant.build
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- copy log4net build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="${log4net.output.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- compile the example -->
- <jsc target="exe" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.jsc}" output="${current.bin.dir}/ConsoleApp.exe">
- <sources>
- <include name="src/**/*.js" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.js" />
- </sources>
- <references basedir="${current.bin.dir}">
- <include name="log4net.dll" />
- </references>
- </jsc>
- <!-- copy the ConsoleApp application configuration file -->
- <copy file="src/App.config" tofile="${current.bin.dir}/ConsoleApp.exe.config" />
- </target>
-</project>
diff --git a/examples/net/1.1/Tutorials/ConsoleApp/js/nant.config b/examples/net/1.1/Tutorials/ConsoleApp/js/nant.config
deleted file mode 100644
index 52613e8..0000000
--- a/examples/net/1.1/Tutorials/ConsoleApp/js/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/net/1.1/Tutorials/ConsoleApp/js/src/App.config b/examples/net/1.1/Tutorials/ConsoleApp/js/src/App.config
deleted file mode 100644
index 4b7bba2..0000000
--- a/examples/net/1.1/Tutorials/ConsoleApp/js/src/App.config
+++ /dev/null
@@ -1,214 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<!--
- .NET application configuration file
- This file must have the exact same name as your application with .config appended to it.
-
- For example if your application is ConsoleApp.exe then the config file must be ConsoleApp.exe.config.
- It must also be in the same directory as the application.
- -->
-<configuration>
- <!-- Register a section handler for the log4net section -->
- <configSections>
- <section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
- </configSections>
- <appSettings>
- <!-- To enable internal log4net logging specify the following appSettings key -->
- <!-- <add key="log4net.Internal.Debug" value="true"/> -->
- </appSettings>
- <!-- This section contains the log4net configuration settings -->
- <log4net>
- <!-- Define some output appenders -->
- <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
- <file value="rolling-log.txt" />
- <appendToFile value="true" />
- <maxSizeRollBackups value="10" />
- <maximumFileSize value="100" />
- <rollingStyle value="Size" />
- <staticLogFileName value="true" />
- <layout type="log4net.Layout.PatternLayout">
- <header value="[Header] " />
- <footer value="[Footer] " />
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
- </layout>
- </appender>
- <appender name="LogFileAppender" type="log4net.Appender.FileAppender">
- <file value="log-file.txt" />
- <!-- Example using environment variables in params -->
- <!-- <file value="${TMP}\log-file.txt" /> -->
- <sppendToFile value="true" />
- <!-- An alternate output encoding can be specified -->
- <!-- <encoding value="unicodeFFFE" /> -->
- <layout type="log4net.Layout.PatternLayout">
- <header value="[Header] " />
- <footer value="[Footer] " />
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] <%property{auth}> - %message%newline" />
- </layout>
- <!-- Alternate layout using XML
- <layout type="log4net.Layout.XMLLayout" /> -->
- </appender>
- <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] <%property{auth}> - %message%newline" />
- </layout>
- </appender>
- <appender name="NetSendAppender" type="log4net.Appender.NetSendAppender">
- <threshold value="ERROR" />
- <server value="SQUARE" />
- <recipient value="nicko" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
- </layout>
- </appender>
- <!-- Example of how to configure the AdoNetAppender
- <appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender" >
- <connectionString value="Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Work\cvs_root\log4net-1.2\access.mdb;UID=;PWD=;" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message]) VALUES ('%date','%thread','%level','%logger','%message')" />
- </layout>
- </appender>
- -->
- <!--
- <appender name="A" type="log4net.Appender.ForwardingAppender" >
- <threshold value="WARN"/>
- <appender-ref ref="ConsoleAppender" />
- </appender>
- <appender name="B" type="log4net.Appender.ForwardingAppender" >
- <filter type="log4net.Filter.LevelRangeFilter">
- <levelMin value="DEBUG"/>
- <levelMax value="INFO"/>
- </filter>
- <appender-ref ref="ConsoleAppender" />
- </appender>
- -->
- <!-- Example of how to configure the AdoNetAppender to connect to MS Access -->
- <appender name="ADONetAppender_Access" type="log4net.Appender.AdoNetAppender">
- <connectionString value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Work\cvs_root\log4net-1.2\access.mdb;User Id=;Password=;" />
- <commandText value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message]) VALUES (@log_date, @thread, @log_level, @logger, @message)" />
- <parameter>
- <parameterName value="@log_date" />
- <dbType value="String" />
- <size value="255" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date" />
- </layout>
- </parameter>
- <parameter>
- <parameterName value="@thread" />
- <dbType value="String" />
- <size value="255" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%thread" />
- </layout>
- </parameter>
- <parameter>
- <parameterName value="@log_level" />
- <dbType value="String" />
- <size value="50" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%level" />
- </layout>
- </parameter>
- <parameter>
- <parameterName value="@logger" />
- <dbType value="String" />
- <size value="255" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%logger" />
- </layout>
- </parameter>
- <parameter>
- <parameterName value="@message" />
- <dbType value="String" />
- <size value="1024" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%message" />
- </layout>
- </parameter>
- </appender>
- <!-- Example of how to configure the AdoNetAppender to connect to MS SQL Server -->
- <appender name="ADONetAppender_SqlServer" type="log4net.Appender.AdoNetAppender">
- <bufferSize value="1" />
- <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
- <connectionString value="data source=SQLSVR;initial catalog=test_log4net;integrated security=false;persist security info=True;" />
- <commandText value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message]) VALUES (@log_date, @thread, @log_level, @logger, @message)" />
- <parameter>
- <parameterName value="@log_date" />
- <dbType value="DateTime" />
- <!--
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date{yyyy'-'MM'-'dd HH':'mm':'ss'.'fff}" />
- </layout>
- -->
- <layout type="log4net.Layout.RawTimeStampLayout" />
- </parameter>
- <parameter>
- <parameterName value="@thread" />
- <dbType value="String" />
- <size value="255" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%thread" />
- </layout>
- </parameter>
- <parameter>
- <parameterName value="@log_level" />
- <dbType value="String" />
- <size value="50" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%level" />
- </layout>
- </parameter>
- <parameter>
- <parameterName value="@logger" />
- <dbType value="String" />
- <size value="255" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%logger" />
- </layout>
- </parameter>
- <parameter>
- <parameterName value="@message" />
- <dbType value="String" />
- <size value="4000" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%message" />
- </layout>
- </parameter>
- </appender>
- <!-- Setup the root category, add the appenders and set the default level -->
- <root>
- <level value="WARN" />
- <appender-ref ref="LogFileAppender" />
- <appender-ref ref="ConsoleAppender" />
- <!-- <appender-ref ref="ADONetAppender_SqlServer" /> -->
- <appender-ref ref="NetSendAppender" />
- <!-- <appender-ref ref="A" /> -->
- </root>
- <!-- Specify the level for some specific categories -->
- <logger name="ConsoleApp.LoggingExample">
- <!-- <appender-ref ref="B" /> -->
- <level value="ALL" />
- <appender-ref ref="RollingLogFileAppender" />
- </logger>
- </log4net>
-</configuration>
diff --git a/examples/net/1.1/Tutorials/ConsoleApp/js/src/AssemblyInfo.js b/examples/net/1.1/Tutorials/ConsoleApp/js/src/AssemblyInfo.js
deleted file mode 100644
index 29a0ee7..0000000
--- a/examples/net/1.1/Tutorials/ConsoleApp/js/src/AssemblyInfo.js
+++ /dev/null
@@ -1,61 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-
-import System.Reflection;
-import System.Runtime.CompilerServices;
-
-[assembly: System.CLSCompliant(true)]
-
-//
-// 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("log4net - ConsoleApp")]
-[assembly:AssemblyDescription("log4net ConsoleApp")]
-[assembly:AssemblyConfiguration("")]
-[assembly:AssemblyProduct("log4net - ConsoleApp")]
-[assembly:AssemblyCulture("")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly:AssemblyDelaySign(false)]
-[assembly:AssemblyKeyFile("")]
-[assembly: AssemblyKeyName("")]
diff --git a/examples/net/1.1/Tutorials/ConsoleApp/js/src/LoggingExample.js b/examples/net/1.1/Tutorials/ConsoleApp/js/src/LoggingExample.js
deleted file mode 100644
index 9d80ad9..0000000
--- a/examples/net/1.1/Tutorials/ConsoleApp/js/src/LoggingExample.js
+++ /dev/null
@@ -1,104 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-
-// JScript.NET does not support application entry points (like vb.Net and C#),
-// instead it supports global code.
-ConsoleApp.LoggingExample.Main();
-
-import System;
-
-import log4net;
-
-// Configure log4net using the .config file
-[assembly:log4net.Config.XmlConfigurator()]
-// This will cause log4net to look for a configuration file
-// called ConsoleApp.exe.config in the application base
-// directory (i.e. the directory containing ConsoleApp.exe)
-
-package ConsoleApp {
- // Example of how to simply configure and use log4net
- public class LoggingExample {
- // Create a logger for use in this class
- private static var log : log4net.ILog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
- // NOTE that using System.Reflection.MethodBase.GetCurrentMethod().DeclaringType
- // is equivalent to typeof(LoggingExample) but is more portable
- // i.e. you can copy the code directly into another class without
- // needing to edit the code.
-
- // Application entry point
- public static function Main() {
- // Log an info level message
- if (log.IsInfoEnabled) log.Info("Application [ConsoleApp] Start");
-
- // Log a debug message. Test if debug is enabled before
- // attempting to log the message. This is not required but
- // can make running without logging faster.
- if (log.IsDebugEnabled) log.Debug("This is a debug message");
-
- try {
- Bar();
- } catch (ex : Exception) {
- // Log an error with an exception
- log.Error("Exception thrown from method Bar", ex);
- }
-
- log.Error("Hey this is an error!");
-
- var disposableFrame : IDisposable;
-
- try {
- // Push a message on to the Nested Diagnostic Context stack
- disposableFrame = log4net.NDC.Push("NDC_Message");
-
- log.Warn("This should have an NDC message");
-
- // Set a Mapped Diagnostic Context value
- log4net.MDC.Set("auth", "auth-none");
- log.Warn("This should have an MDC message for the key 'auth'");
- } finally {
- // The NDC message is popped off the stack by using the Dispose method
- if (disposableFrame != null) disposableFrame.Dispose();
- }
-
- log.Warn("See the NDC has been popped of! The MDC 'auth' key is still with us.");
-
- // Log an info level message
- if (log.IsInfoEnabled) log.Info("Application [ConsoleApp] End");
-
- Console.Write("Press Enter to exit...");
- Console.ReadLine();
- }
-
- // Helper methods to demonstrate location information and nested exceptions
-
- private static function Bar() {
- Goo();
- }
-
- private static function Foo() {
- throw new Exception("This is an Exception");
- }
-
- private static function Goo() {
- try {
- Foo();
- } catch (ex : Exception) {
- throw new ArithmeticException("Failed in Goo. Calling Foo. Inner Exception provided", ex);
- }
- }
- }
-}
diff --git a/examples/net/1.1/Tutorials/ConsoleApp/nant.build b/examples/net/1.1/Tutorials/ConsoleApp/nant.build
deleted file mode 100644
index 89822ce..0000000
--- a/examples/net/1.1/Tutorials/ConsoleApp/nant.build
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="consoleapp-example" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile ConsoleApp example -->
- <target name="compile" description="Builds ConsoleApp example">
- <nant buildfile="js/nant.build" target="compile" />
- </target>
-</project>
diff --git a/examples/net/1.1/Tutorials/ConsoleApp/nant.config b/examples/net/1.1/Tutorials/ConsoleApp/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/net/1.1/Tutorials/ConsoleApp/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/net/1.1/Tutorials/nant.build b/examples/net/1.1/Tutorials/nant.build
deleted file mode 100644
index 0da253c..0000000
--- a/examples/net/1.1/Tutorials/nant.build
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="tutorials-examples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile Tutorials examples -->
- <target name="compile" description="Builds Tutorials examples">
- <nant buildfile="ConsoleApp/nant.build" target="compile" />
- </target>
-</project>
diff --git a/examples/net/1.1/Tutorials/nant.config b/examples/net/1.1/Tutorials/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/net/1.1/Tutorials/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/net/1.1/cpp-examples.sln b/examples/net/1.1/cpp-examples.sln
deleted file mode 100644
index 5fda71b..0000000
--- a/examples/net/1.1/cpp-examples.sln
+++ /dev/null
@@ -1,41 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 8.00
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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.
-#
-#
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConsoleApp", "Tutorials\ConsoleApp\cpp\src\ConsoleApp.vcproj", "{EF2FAB20-8AC6-420A-BCBF-B3C8D8467323}"
- ProjectSection(ProjectDependencies) = postProject
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfiguration) = preSolution
- Debug = Debug
- Release = Release
- EndGlobalSection
- GlobalSection(ProjectConfiguration) = postSolution
- {EF2FAB20-8AC6-420A-BCBF-B3C8D8467323}.Debug.ActiveCfg = Debug|Win32
- {EF2FAB20-8AC6-420A-BCBF-B3C8D8467323}.Debug.Build.0 = Debug|Win32
- {EF2FAB20-8AC6-420A-BCBF-B3C8D8467323}.Release.ActiveCfg = Release|Win32
- {EF2FAB20-8AC6-420A-BCBF-B3C8D8467323}.Release.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- EndGlobalSection
- GlobalSection(ExtensibilityAddIns) = postSolution
- EndGlobalSection
-EndGlobal
diff --git a/examples/net/1.1/nant.build b/examples/net/1.1/nant.build
deleted file mode 100644
index 143e461..0000000
--- a/examples/net/1.1/nant.build
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="net-1.1-examples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- include configuration file -->
- <include buildfile="nant.config" />
- <!-- compile all .NET Framework 1.0 examples -->
- <target name="compile" description="Builds .NET Framework 1.1 examples">
- <if test="${framework::exists(project.runtime.config + '-' + project.runtime.version)}">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </if>
- <if test="${not framework::exists(project.runtime.config + '-' + project.runtime.version)}">
- <if test="${property::exists('project.build.package') and project.build.package}">
- <fail message="${project.runtime.description} is not available." />
- </if>
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo message="${project.runtime.description} is not available. Examples skipped." />
- </if>
- </if>
- </target>
-</project>
diff --git a/examples/net/1.1/nant.config b/examples/net/1.1/nant.config
deleted file mode 100644
index 9c19c2f..0000000
--- a/examples/net/1.1/nant.config
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set runtime version -->
- <property name="project.runtime.version" value="1.1" />
- <!-- Set runtime description -->
- <property name="project.runtime.description" value=".NET Framework 1.1" />
-</project>
diff --git a/examples/net/2.0/Appenders/SampleAppendersApp/cs/nant.build b/examples/net/2.0/Appenders/SampleAppendersApp/cs/nant.build
deleted file mode 100644
index 54a62be..0000000
--- a/examples/net/2.0/Appenders/SampleAppendersApp/cs/nant.build
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="sampleappendersapp-cs-example" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- copy log4net build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="${log4net.output.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- compile the example -->
- <csc noconfig="true" target="exe" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.csc}" output="${current.bin.dir}/SampleAppendersApp.exe">
- <sources>
- <include name="src/**/*.cs" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.cs" />
- </sources>
- <references basedir="${current.bin.dir}">
- <include name="log4net.dll" />
- <include name="System.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Windows.Forms.dll" />
- <include name="System.Messaging.dll" />
- </references>
- </csc>
- <!-- copy the ConsoleApp application configuration file -->
- <copy file="src/App.config" tofile="${current.bin.dir}/SampleAppendersApp.exe.config" />
- </target>
-</project>
diff --git a/examples/net/2.0/Appenders/SampleAppendersApp/cs/nant.config b/examples/net/2.0/Appenders/SampleAppendersApp/cs/nant.config
deleted file mode 100644
index 52613e8..0000000
--- a/examples/net/2.0/Appenders/SampleAppendersApp/cs/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/App.config b/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/App.config
deleted file mode 100644
index 33e306e..0000000
--- a/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/App.config
+++ /dev/null
@@ -1,126 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<!--
- .NET application configuration file
- This file must have the exact same name as your application with .config appended to it.
-
- For example if your application is ConsoleApp.exe then the config file must be ConsoleApp.exe.config.
- It must also be in the same directory as the application.
- -->
-<configuration>
- <!-- Register a section handler for the log4net section -->
- <configSections>
- <section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
- </configSections>
-
- <appSettings>
- <!-- To enable internal log4net logging specify the following appSettings key -->
- <!-- <add key="log4net.Internal.Debug" value="true"/> -->
- </appSettings>
-
- <!-- This section contains the log4net configuration settings -->
- <log4net>
-
- <appender name="WmiAppender" type="log4net.Appender.WmiAppender,log4net.Appender.WmiAppender">
- </appender>
-
- <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
- <layout type="log4net.Layout.PatternLayout" value="%date [%thread] %-5level %logger - %message%newline" />
- </appender>
-
- <appender name="MessageBoxAppender" type="SampleAppendersApp.Appender.MessageBoxAppender, SampleAppendersApp">
-
- <layout type="log4net.Layout.PatternLayout" value="%date [%thread] %-5level %logger [%ndc] <%property{auth}> - %message%newline"/>
- <titleLayout type="log4net.Layout.PatternLayout" value="LoggingEvent: %-5level %logger"/>
- <mapping>
- <level value="ERROR" />
- <icon value="Error" />
- </mapping>
-
- </appender>
-
-
- <appender name="FireEventAppender" type="SampleAppendersApp.Appender.FireEventAppender, SampleAppendersApp">
- </appender>
-
- <appender name="SimpleSmtpAppender" type="SampleAppendersApp.Appender.SimpleSmtpAppender, SampleAppendersApp">
- <layout type="log4net.Layout.PatternLayout" value="%date [%thread] %-5level %logger - %message%newline" />
- <subject value="%-5level %logger" />
-
- <to value="you@me.co.uk" />
- <from value="me@me.co.uk" />
- <smtpHost value="my-smtp-server" />
- </appender>
-
- <appender name="ColoredConsoleAppender" type="log4net.Appender.ColoredConsoleAppender">
- <layout type="log4net.Layout.PatternLayout" value="%date [%thread] %-5level %logger - %properties%newline" />
- <mapping>
- <level value="DEBUG" />
- <backColor value="Blue" />
- <foreColor value="White" />
- </mapping>
- </appender>
-
- <appender name="MessageObjectExpanderAppender" type="SampleAppendersApp.Appender.MessageObjectExpanderAppender, SampleAppendersApp">
- <appender-ref ref="ColoredConsoleAppender" />
- </appender>
-
- <appender name="MsmqAppender" type="SampleAppendersApp.Appender.MsmqAppender, SampleAppendersApp">
- <queueName value=".\Private$\log-test" />
- <labelLayout value="LOG [%level] %date" />
- <layout type="log4net.Layout.PatternLayout" value="%date [%thread] %-5level %logger - %message%newline" />
- </appender>
-
- <appender name="AsyncConsoleAppender" type="SampleAppendersApp.Appender.AsyncAppender, SampleAppendersApp">
- <appender-ref ref="ColoredConsoleAppender" />
- </appender>
-
- <appender name="FastDbAppender" type="SampleAppendersApp.Appender.FastDbAppender, SampleAppendersApp">
- <connectionString value="Persist Security Info=False;Integrated Security=false;server=ate;database=log4net_test;Connect Timeout=30;" />
- </appender>
-
- <appender name="PatternFileAppender" type="SampleAppendersApp.Appender.PatternFileAppender, SampleAppendersApp">
- <!-- File pattern to group files by date, then by session property -->
- <file value="%date{yyyy-MM-dd}\%property{session}\output.log" />
- <layout type="log4net.Layout.PatternLayout" value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
- </appender>
-
- <!-- Setup the root category, add the appenders and set the default level -->
- <root>
- <level value="ALL" />
-
- <appender-ref ref="WmiAppender" />
- <appender-ref ref="PatternFileAppender" />
- <appender-ref ref="ConsoleAppender" />
- <appender-ref ref="MessageObjectExpanderAppender" />
- <appender-ref ref="MessageBoxAppender" />
- <appender-ref ref="FireEventAppender" />
- <appender-ref ref="SimpleSmtpAppender" />
- <appender-ref ref="MsmqAppender" />
- <appender-ref ref="AsyncConsoleAppender" />
- <appender-ref ref="FastDbAppender" />
-
- </root>
-
- </log4net>
-</configuration>
diff --git a/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/AsyncAppender.cs b/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/AsyncAppender.cs
deleted file mode 100644
index 2682757..0000000
--- a/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/AsyncAppender.cs
+++ /dev/null
@@ -1,194 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System;
-using System.Threading;
-using log4net.Appender;
-using log4net.Core;
-using log4net.Util;
-
-namespace SampleAppendersApp.Appender
-{
- /// <summary>
- /// Appender that forwards LoggingEvents asynchronously
- /// </summary>
- /// <remarks>
- /// This appender forwards LoggingEvents to a list of attached appenders.
- /// The events are forwarded asynchronously using the ThreadPool.
- /// This allows the calling thread to be released quickly, however it does
- /// not guarantee the ordering of events delivered to the attached appenders.
- /// </remarks>
- public sealed class AsyncAppender : IAppender, IBulkAppender, IOptionHandler, IAppenderAttachable
- {
- private string m_name;
-
- public string Name
- {
- get { return m_name; }
- set { m_name = value; }
- }
-
- public void ActivateOptions()
- {
- }
-
- public FixFlags Fix
- {
- get { return m_fixFlags; }
- set { m_fixFlags = value; }
- }
-
- public void Close()
- {
- // Remove all the attached appenders
- lock(this)
- {
- if (m_appenderAttachedImpl != null)
- {
- m_appenderAttachedImpl.RemoveAllAppenders();
- }
- }
- }
-
- public void DoAppend(LoggingEvent loggingEvent)
- {
- loggingEvent.Fix = m_fixFlags;
- System.Threading.ThreadPool.QueueUserWorkItem(new WaitCallback(AsyncAppend), loggingEvent);
- }
-
- public void DoAppend(LoggingEvent[] loggingEvents)
- {
- foreach(LoggingEvent loggingEvent in loggingEvents)
- {
- loggingEvent.Fix = m_fixFlags;
- }
- System.Threading.ThreadPool.QueueUserWorkItem(new WaitCallback(AsyncAppend), loggingEvents);
- }
-
- private void AsyncAppend(object state)
- {
- if (m_appenderAttachedImpl != null)
- {
- LoggingEvent loggingEvent = state as LoggingEvent;
- if (loggingEvent != null)
- {
- m_appenderAttachedImpl.AppendLoopOnAppenders(loggingEvent);
- }
- else
- {
- LoggingEvent[] loggingEvents = state as LoggingEvent[];
- if (loggingEvents != null)
- {
- m_appenderAttachedImpl.AppendLoopOnAppenders(loggingEvents);
- }
- }
- }
- }
-
- #region IAppenderAttachable Members
-
- public void AddAppender(IAppender newAppender)
- {
- if (newAppender == null)
- {
- throw new ArgumentNullException("newAppender");
- }
- lock(this)
- {
- if (m_appenderAttachedImpl == null)
- {
- m_appenderAttachedImpl = new log4net.Util.AppenderAttachedImpl();
- }
- m_appenderAttachedImpl.AddAppender(newAppender);
- }
- }
-
- public AppenderCollection Appenders
- {
- get
- {
- lock(this)
- {
- if (m_appenderAttachedImpl == null)
- {
- return AppenderCollection.EmptyCollection;
- }
- else
- {
- return m_appenderAttachedImpl.Appenders;
- }
- }
- }
- }
-
- public IAppender GetAppender(string name)
- {
- lock(this)
- {
- if (m_appenderAttachedImpl == null || name == null)
- {
- return null;
- }
-
- return m_appenderAttachedImpl.GetAppender(name);
- }
- }
-
- public void RemoveAllAppenders()
- {
- lock(this)
- {
- if (m_appenderAttachedImpl != null)
- {
- m_appenderAttachedImpl.RemoveAllAppenders();
- m_appenderAttachedImpl = null;
- }
- }
- }
-
- public IAppender RemoveAppender(IAppender appender)
- {
- lock(this)
- {
- if (appender != null && m_appenderAttachedImpl != null)
- {
- return m_appenderAttachedImpl.RemoveAppender(appender);
- }
- }
- return null;
- }
-
- public IAppender RemoveAppender(string name)
- {
- lock(this)
- {
- if (name != null && m_appenderAttachedImpl != null)
- {
- return m_appenderAttachedImpl.RemoveAppender(name);
- }
- }
- return null;
- }
-
- #endregion
-
- private AppenderAttachedImpl m_appenderAttachedImpl;
- private FixFlags m_fixFlags = FixFlags.All;
- }
-}
diff --git a/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/FastDbAppender.cs b/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/FastDbAppender.cs
deleted file mode 100644
index 4bfdd0d..0000000
--- a/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/FastDbAppender.cs
+++ /dev/null
@@ -1,201 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System.Data;
-using System.Data.SqlClient;
-using log4net.Appender;
-using log4net.Core;
-
-namespace SampleAppendersApp.Appender
-{
- /// <summary>
- /// Simple database appender
- /// </summary>
- /// <remarks>
- /// <para>
- /// This database appender is very simple and does not support a configurable
- /// data schema. The schema supported is hardcoded into the appender.
- /// Also by not extending the AppenderSkeleton base class this appender
- /// avoids the serializable locking that it enforces.
- /// </para>
- /// <para>
- /// This appender can be subclassed to change the database connection
- /// type, or the database schema supported.
- /// </para>
- /// <para>
- /// To change the database connection type the <see cref="GetConnection"/>
- /// method must be overridden.
- /// </para>
- /// <para>
- /// To change the database schema supported by the appender the <see cref="InitializeCommand"/>
- /// and <see cref="SetCommandValues"/> methods must be overridden.
- /// </para>
- /// </remarks>
- public class FastDbAppender : IAppender, IBulkAppender, IOptionHandler
- {
- private string m_name;
- private string m_connectionString;
-
- public string Name
- {
- get { return m_name; }
- set { m_name = value; }
- }
-
- public string ConnectionString
- {
- get { return m_connectionString; }
- set { m_connectionString = value; }
- }
-
- public virtual void ActivateOptions()
- {
- }
-
- public virtual void Close()
- {
- }
-
- public virtual void DoAppend(LoggingEvent loggingEvent)
- {
- using(IDbConnection connection = GetConnection())
- {
- if (connection.State == ConnectionState.Closed)
- {
- // Open the connection for each event, this takes advantage
- // of the builtin connection pooling
- connection.Open();
- }
-
- using(IDbCommand command = connection.CreateCommand())
- {
- InitializeCommand(command);
-
- SetCommandValues(command, loggingEvent);
- command.ExecuteNonQuery();
- }
- }
- }
-
- public virtual void DoAppend(LoggingEvent[] loggingEvents)
- {
- using(IDbConnection connection = GetConnection())
- {
- // Open the connection for each event, this takes advantage
- // of the builtin connection pooling
- connection.Open();
-
- using(IDbCommand command = connection.CreateCommand())
- {
- InitializeCommand(command);
-
- foreach(LoggingEvent loggingEvent in loggingEvents)
- {
- SetCommandValues(command, loggingEvent);
- command.ExecuteNonQuery();
- }
- }
- }
- }
-
- /// <summary>
- /// Create the connection object
- /// </summary>
- /// <returns>the connection</returns>
- /// <remarks>
- /// <para>
- /// This implementation returns a <see cref="SqlConnection"/>.
- /// To change the connection subclass this appender and
- /// return a different connection type.
- /// </para>
- /// </remarks>
- virtual protected IDbConnection GetConnection()
- {
- return new SqlConnection(m_connectionString);
- }
-
- /// <summary>
- /// Initialize the command object supplied
- /// </summary>
- /// <param name="command">the command to initialize</param>
- /// <remarks>
- /// <para>
- /// This method must setup the database command and the
- /// parameters.
- /// </para>
- /// </remarks>
- virtual protected void InitializeCommand(IDbCommand command)
- {
- command.CommandType = CommandType.Text;
- command.CommandText = "INSERT INTO [LogTable] ([Time],[Logger],[Level],[Thread],[Message]) VALUES (@Time,@Logger,@Level,@Thread,@Message)";
-
- IDbDataParameter param;
-
- // @Time
- param = command.CreateParameter();
- param.ParameterName = "@Time";
- param.DbType = DbType.DateTime;
- command.Parameters.Add(param);
-
- // @Logger
- param = command.CreateParameter();
- param.ParameterName = "@Logger";
- param.DbType = DbType.String;
- command.Parameters.Add(param);
-
- // @Level
- param = command.CreateParameter();
- param.ParameterName = "@Level";
- param.DbType = DbType.String;
- command.Parameters.Add(param);
-
- // @Thread
- param = command.CreateParameter();
- param.ParameterName = "@Thread";
- param.DbType = DbType.String;
- command.Parameters.Add(param);
-
- // @Message
- param = command.CreateParameter();
- param.ParameterName = "@Message";
- param.DbType = DbType.String;
- command.Parameters.Add(param);
- }
-
- /// <summary>
- /// Set the values for the command parameters
- /// </summary>
- /// <param name="command">the command to update</param>
- /// <param name="loggingEvent">the current logging event to retrieve the values from</param>
- /// <remarks>
- /// <para>
- /// Set the values of the parameters created by the
- /// <see cref="InitializeCommand"/> method.
- /// </para>
- /// </remarks>
- virtual protected void SetCommandValues(IDbCommand command, LoggingEvent loggingEvent)
- {
- ((IDbDataParameter)command.Parameters["@Time"]).Value = loggingEvent.TimeStamp;
- ((IDbDataParameter)command.Parameters["@Logger"]).Value = loggingEvent.LoggerName;
- ((IDbDataParameter)command.Parameters["@Level"]).Value = loggingEvent.Level.Name;
- ((IDbDataParameter)command.Parameters["@Thread"]).Value = loggingEvent.ThreadName;
- ((IDbDataParameter)command.Parameters["@Message"]).Value = loggingEvent.RenderedMessage;
- }
- }
-}
diff --git a/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/FireEventAppender.cs b/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/FireEventAppender.cs
deleted file mode 100644
index e0be018..0000000
--- a/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/FireEventAppender.cs
+++ /dev/null
@@ -1,90 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System;
-
-using log4net.Core;
-
-namespace SampleAppendersApp.Appender
-{
- public delegate void MessageLoggedEventHandler(object sender, MessageLoggedEventArgs e);
-
- public class MessageLoggedEventArgs : EventArgs
- {
- private LoggingEvent m_loggingEvent;
-
- public MessageLoggedEventArgs(LoggingEvent loggingEvent)
- {
- m_loggingEvent = loggingEvent;
- }
- public LoggingEvent LoggingEvent
- {
- get { return m_loggingEvent; }
- }
- }
-
- /// <summary>
- /// Appender that raises an event for each LoggingEvent received
- /// </summary>
- /// <remarks>
- /// Raises a MessageLoggedEvent for each LoggingEvent object received
- /// by this appender.
- /// </remarks>
- public class FireEventAppender : log4net.Appender.AppenderSkeleton
- {
- private static FireEventAppender m_instance;
-
- private FixFlags m_fixFlags = FixFlags.All;
-
- // Event handler
- public event MessageLoggedEventHandler MessageLoggedEvent;
-
- // Easy singleton, gets the last instance created
- public static FireEventAppender Instance
- {
- get { return m_instance; }
- }
-
- public FireEventAppender()
- {
- // Store the instance created
- m_instance = this;
- }
-
- virtual public FixFlags Fix
- {
- get { return m_fixFlags; }
- set { m_fixFlags = value; }
- }
-
- override protected void Append(LoggingEvent loggingEvent)
- {
- // Because we the LoggingEvent may be used beyond the lifetime
- // of the Append() method we must fix any volatile data in the event
- loggingEvent.Fix = this.Fix;
-
- // Raise the event
- MessageLoggedEventHandler handler = MessageLoggedEvent;
- if (handler != null)
- {
- handler(this, new MessageLoggedEventArgs(loggingEvent));
- }
- }
- }
-}
diff --git a/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/MessageBoxAppender.cs b/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/MessageBoxAppender.cs
deleted file mode 100644
index 0877ea4..0000000
--- a/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/MessageBoxAppender.cs
+++ /dev/null
@@ -1,103 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System;
-using System.IO;
-using System.Windows.Forms;
-
-using log4net.Appender;
-using log4net.Core;
-using log4net.Layout;
-using log4net.Util;
-
-namespace SampleAppendersApp.Appender
-{
- /// <summary>
- /// Displays messages as message boxes
- /// </summary>
- /// <remarks>
- /// Displays each LoggingEvent as a MessageBox. The message box is UI modal
- /// and will block the calling thread until it is dismissed by the user.
- /// </remarks>
- public class MessageBoxAppender : AppenderSkeleton
- {
- private PatternLayout m_titleLayout;
- private LevelMapping m_levelMapping = new LevelMapping();
-
- public MessageBoxAppender()
- {
- }
-
- public void AddMapping(LevelIcon mapping)
- {
- m_levelMapping.Add(mapping);
- }
-
- public PatternLayout TitleLayout
- {
- get { return m_titleLayout; }
- set { m_titleLayout = value; }
- }
-
- override protected void Append(LoggingEvent loggingEvent)
- {
- MessageBoxIcon messageBoxIcon = MessageBoxIcon.Information;
-
- LevelIcon levelIcon = m_levelMapping.Lookup(loggingEvent.Level) as LevelIcon;
- if (levelIcon != null)
- {
- // Prepend the Ansi Color code
- messageBoxIcon = levelIcon.Icon;
- }
-
- string message = RenderLoggingEvent(loggingEvent);
-
- string title = null;
- if (m_titleLayout == null)
- {
- title = "LoggingEvent: "+loggingEvent.Level.Name;
- }
- else
- {
- StringWriter titleWriter = new StringWriter(System.Globalization.CultureInfo.InvariantCulture);
- m_titleLayout.Format(titleWriter, loggingEvent);
- title = titleWriter.ToString();
- }
-
- MessageBox.Show(message, title, MessageBoxButtons.OK, messageBoxIcon);
- }
-
- public override void ActivateOptions()
- {
- base.ActivateOptions();
- m_levelMapping.ActivateOptions();
- }
-
- public class LevelIcon : LevelMappingEntry
- {
- private MessageBoxIcon m_icon;
-
- public MessageBoxIcon Icon
- {
- get { return m_icon; }
- set { m_icon = value; }
- }
- }
- }
-}
diff --git a/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/MessageObjectExpanderAppender.cs b/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/MessageObjectExpanderAppender.cs
deleted file mode 100644
index 56e5ddb..0000000
--- a/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/MessageObjectExpanderAppender.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System;
-using System.Reflection;
-
-using log4net.Core;
-
-namespace SampleAppendersApp.Appender
-{
- /// <summary>
- /// Forwarding Appender that introspects the <see cref="LoggingEvent.MessageObject"/>
- /// and extracts all public properties and fields and stores them in the
- /// <see cref="LoggingEvent.Properties"/>
- /// </summary>
- public class MessageObjectExpanderAppender : log4net.Appender.ForwardingAppender
- {
- private bool m_expandProperties = true;
- private bool m_expandFields = true;
-
- override protected void Append(LoggingEvent loggingEvent)
- {
- object messageObject = loggingEvent.MessageObject;
-
- if (messageObject != null && !(messageObject is string))
- {
- Type messageType = messageObject.GetType();
-
- if (m_expandProperties)
- {
- // Get all public instance properties
- foreach(PropertyInfo propertyInfo in messageType.GetProperties(BindingFlags.Instance | BindingFlags.Public))
- {
- if (propertyInfo.CanRead)
- {
- loggingEvent.Properties[propertyInfo.Name] = propertyInfo.GetValue(messageObject, null);
- }
- }
- }
-
- if (m_expandFields)
- {
- // Get all public instance fields
- foreach(FieldInfo fieldInfo in messageType.GetFields(BindingFlags.Instance | BindingFlags.Public))
- {
- loggingEvent.Properties[fieldInfo.Name] = fieldInfo.GetValue(messageObject);
- }
- }
- }
-
- // Delegate to base class which will forward
- base.Append(loggingEvent);
- }
-
- public bool ExpandProperties
- {
- get { return m_expandProperties; }
- set { m_expandProperties = value; }
- }
-
- public bool ExpandFields
- {
- get { return m_expandFields; }
- set { m_expandFields = value; }
- }
- }
-}
diff --git a/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/MsmqAppender.cs b/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/MsmqAppender.cs
deleted file mode 100644
index 4c12b55..0000000
--- a/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/MsmqAppender.cs
+++ /dev/null
@@ -1,104 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System;
-using System.Messaging;
-
-using log4net.Core;
-
-namespace SampleAppendersApp.Appender
-{
- /// <summary>
- /// Appender writes to a Microsoft Message Queue
- /// </summary>
- /// <remarks>
- /// This appender sends log events via a specified MSMQ queue.
- /// The queue specified in the QueueName (e.g. .\Private$\log-test) must already exist on
- /// the source machine.
- /// The message label and body are rendered using separate layouts.
- /// </remarks>
- public class MsmqAppender : log4net.Appender.AppenderSkeleton
- {
- private MessageQueue m_queue;
- private string m_queueName;
- private log4net.Layout.PatternLayout m_labelLayout;
-
- public MsmqAppender()
- {
- }
-
- public string QueueName
- {
- get { return m_queueName; }
- set { m_queueName = value; }
- }
-
- public log4net.Layout.PatternLayout LabelLayout
- {
- get { return m_labelLayout; }
- set { m_labelLayout = value; }
- }
-
- override protected void Append(LoggingEvent loggingEvent)
- {
- if (m_queue == null)
- {
- if (MessageQueue.Exists(m_queueName))
- {
- m_queue = new MessageQueue(m_queueName);
- }
- else
- {
- ErrorHandler.Error("Queue ["+m_queueName+"] not found");
- }
- }
-
- if (m_queue != null)
- {
- Message message = new Message();
-
- message.Label = RenderLabel(loggingEvent);
-
- using(System.IO.MemoryStream stream = new System.IO.MemoryStream())
- {
- System.IO.StreamWriter writer = new System.IO.StreamWriter(stream, new System.Text.UTF8Encoding(false, true));
- base.RenderLoggingEvent(writer, loggingEvent);
- writer.Flush();
- stream.Position = 0;
- message.BodyStream = stream;
-
- m_queue.Send(message);
- }
- }
- }
-
- private string RenderLabel(LoggingEvent loggingEvent)
- {
- if (m_labelLayout == null)
- {
- return null;
- }
-
- System.IO.StringWriter writer = new System.IO.StringWriter();
- m_labelLayout.Format(writer, loggingEvent);
-
- return writer.ToString();
- }
- }
-}
diff --git a/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/PatternFileAppender.cs b/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/PatternFileAppender.cs
deleted file mode 100644
index 6e6c3c0..0000000
--- a/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/PatternFileAppender.cs
+++ /dev/null
@@ -1,124 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System;
-using System.IO;
-using System.Text;
-using log4net.Appender;
-using log4net.Util;
-using log4net.Layout;
-using log4net.Core;
-
-namespace SampleAppendersApp.Appender
-{
- /// <summary>
- /// Appender that writes to a file named using a pattern
- /// </summary>
- /// <remarks>
- /// The file to write to is selected for each event using a
- /// PatternLayout specified in the File property. This allows
- /// each LoggingEvent to be written to a file based on properties
- /// of the event.
- /// The output file is opened to write each LoggingEvent as it arrives
- /// and closed afterwards.
- /// </remarks>
- public class PatternFileAppender : AppenderSkeleton
- {
- public PatternFileAppender()
- {
- }
-
- public PatternLayout File
- {
- get { return m_filePattern; }
- set { m_filePattern = value; }
- }
-
- public Encoding Encoding
- {
- get { return m_encoding; }
- set { m_encoding = value; }
- }
-
- public SecurityContext SecurityContext
- {
- get { return m_securityContext; }
- set { m_securityContext = value; }
- }
-
- override public void ActivateOptions()
- {
- base.ActivateOptions();
-
- if (m_securityContext == null)
- {
- m_securityContext = SecurityContextProvider.DefaultProvider.CreateSecurityContext(this);
- }
- }
-
- override protected void Append(LoggingEvent loggingEvent)
- {
- try
- {
- // Render the file name
- StringWriter stringWriter = new StringWriter();
- m_filePattern.Format(stringWriter, loggingEvent);
- string fileName = stringWriter.ToString();
-
- fileName = SystemInfo.ConvertToFullPath(fileName);
-
- FileStream fileStream = null;
-
- using(m_securityContext.Impersonate(this))
- {
- // Ensure that the directory structure exists
- string directoryFullName = Path.GetDirectoryName(fileName);
-
- // Only create the directory if it does not exist
- // doing this check here resolves some permissions failures
- if (!Directory.Exists(directoryFullName))
- {
- Directory.CreateDirectory(directoryFullName);
- }
-
- // Open file stream while impersonating
- fileStream = new FileStream(fileName, FileMode.Append, FileAccess.Write, FileShare.Read);
- }
-
- if (fileStream != null)
- {
- using(StreamWriter streamWriter = new StreamWriter(fileStream, m_encoding))
- {
- RenderLoggingEvent(streamWriter, loggingEvent);
- }
-
- fileStream.Close();
- }
- }
- catch(Exception ex)
- {
- ErrorHandler.Error("Failed to append to file", ex);
- }
- }
-
- private PatternLayout m_filePattern = null;
- private Encoding m_encoding = Encoding.Default;
- private SecurityContext m_securityContext;
- }
-}
diff --git a/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/PatternLayoutAdoNetAppender.cs b/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/PatternLayoutAdoNetAppender.cs
deleted file mode 100644
index 08f074b..0000000
--- a/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/PatternLayoutAdoNetAppender.cs
+++ /dev/null
@@ -1,86 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System.Collections;
-using log4net.Appender;
-using log4net.Layout;
-using log4net.Util;
-
-namespace SampleAppendersApp.Appender
-{
- /// <summary>
- ///
- /// </summary>
- /// <example>
- /// <code>
- /// <![CDATA[
- /// <appender name="PatternLayoutAdoNetAppender" type="ConsoleApplication1.PatternLayoutAdoNetAppender, ConsoleApplication1">
- /// <connectionType value="log4net.Tests.Appender.AdoNet.Log4NetConnection, log4net.Tests" />
- /// <connectionString value="..." />
- /// <commandText value="INSERT INTO Log4Net (CustomValue1, CustomValue2) VALUES (@CustomValue1, @CustsomValue2)" />
- /// <converter>
- /// <name value="echo" />
- /// <type value="ConsoleApplication1.EchoConverter, ConsoleApplication1" />
- /// </converter>
- /// <converter>
- /// <name value="reverse" />
- /// <type value="ConsoleApplication1.ReverseConverter, ConsoleApplication1" />
- /// </converter>
- /// <patternLayoutParameter>
- /// <parameterName value="@CustomValue1"/>
- /// <dbType value="String" />
- /// <conversionPattern value="%echo{Hello World}" />
- /// </patternLayoutParameter>
- /// <patternLayoutParameter>
- /// <parameterName value="@CustomValue2"/>
- /// <dbType value="String" />
- /// <conversionPattern value="%reverse{Goodbye}" />
- /// </patternLayoutParameter>
- /// </appender>
- /// ]]>
- /// </code>
- /// </example>
- public class PatternLayoutAdoNetAppender : AdoNetAppender
- {
- private readonly ArrayList m_converters = new ArrayList();
-
- public void AddConverter(ConverterInfo converterInfo)
- {
- m_converters.Add(converterInfo);
- }
-
- public void AddPatternLayoutParameter(PatternLayoutAdoNetAppenderParameter parameter)
- {
- PatternLayout patternLayout = new PatternLayout(parameter.ConversionPattern);
- addConveters(patternLayout);
- patternLayout.ActivateOptions();
-
- parameter.Layout = new Layout2RawLayoutAdapter(patternLayout);
- m_parameters.Add(parameter);
- }
-
- private void addConveters(PatternLayout patternLayout)
- {
- foreach (ConverterInfo conveterInfo in m_converters)
- {
- patternLayout.AddConverter(conveterInfo);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/PatternLayoutAdoNetAppenderParameter.cs b/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/PatternLayoutAdoNetAppenderParameter.cs
deleted file mode 100644
index 6cf95ff..0000000
--- a/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/PatternLayoutAdoNetAppenderParameter.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using log4net.Appender;
-
-namespace SampleAppendersApp.Appender
-{
- public class PatternLayoutAdoNetAppenderParameter : AdoNetAppenderParameter
- {
- private string conversionPattern;
-
- public string ConversionPattern
- {
- get { return conversionPattern; }
- set { conversionPattern = value; }
- }
- }
-}
diff --git a/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/SimpleSmtpAppender.cs b/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/SimpleSmtpAppender.cs
deleted file mode 100644
index 18235c0..0000000
--- a/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/SimpleSmtpAppender.cs
+++ /dev/null
@@ -1,132 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System;
-using System.IO;
-using System.Web.Mail;
-
-using log4net.Layout;
-using log4net.Core;
-using log4net.Appender;
-
-namespace SampleAppendersApp.Appender
-{
- /// <summary>
- /// Simple mail appender that sends individual messages
- /// </summary>
- /// <remarks>
- /// This SimpleSmtpAppender sends each LoggingEvent received as a
- /// separate mail message.
- /// The mail subject line can be specified using a pattern layout.
- /// </remarks>
- public class SimpleSmtpAppender : AppenderSkeleton
- {
- public SimpleSmtpAppender()
- {
- }
-
- public string To
- {
- get { return m_to; }
- set { m_to = value; }
- }
-
- public string From
- {
- get { return m_from; }
- set { m_from = value; }
- }
-
- public PatternLayout Subject
- {
- get { return m_subjectLayout; }
- set { m_subjectLayout = value; }
- }
-
- public string SmtpHost
- {
- get { return m_smtpHost; }
- set { m_smtpHost = value; }
- }
-
- #region Override implementation of AppenderSkeleton
-
- override protected void Append(LoggingEvent loggingEvent)
- {
- try
- {
- StringWriter writer = new StringWriter(System.Globalization.CultureInfo.InvariantCulture);
-
- string t = Layout.Header;
- if (t != null)
- {
- writer.Write(t);
- }
-
- // Render the event and append the text to the buffer
- RenderLoggingEvent(writer, loggingEvent);
-
- t = Layout.Footer;
- if (t != null)
- {
- writer.Write(t);
- }
-
- MailMessage mailMessage = new MailMessage();
- mailMessage.Body = writer.ToString();
- mailMessage.From = m_from;
- mailMessage.To = m_to;
-
- if (m_subjectLayout == null)
- {
- mailMessage.Subject = "Missing Subject Layout";
- }
- else
- {
- StringWriter subjectWriter = new StringWriter(System.Globalization.CultureInfo.InvariantCulture);
- m_subjectLayout.Format(subjectWriter, loggingEvent);
- mailMessage.Subject = subjectWriter.ToString();
- }
-
- if (m_smtpHost != null && m_smtpHost.Length > 0)
- {
- SmtpMail.SmtpServer = m_smtpHost;
- }
-
- SmtpMail.Send(mailMessage);
- }
- catch(Exception e)
- {
- ErrorHandler.Error("Error occurred while sending e-mail notification.", e);
- }
- }
-
- override protected bool RequiresLayout
- {
- get { return true; }
- }
-
- #endregion // Override implementation of AppenderSkeleton
-
- private string m_to;
- private string m_from;
- private PatternLayout m_subjectLayout;
- private string m_smtpHost;
- }
-}
\ No newline at end of file
diff --git a/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/AssemblyInfo.cs b/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/AssemblyInfo.cs
deleted file mode 100644
index 67b8653..0000000
--- a/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/AssemblyInfo.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// 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("log4net - SampleAppendersApp")]
-[assembly: AssemblyDescription("log4net SampleAppendersApp")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyProduct("log4net - SampleAppendersApp")]
-[assembly: AssemblyCulture("")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("")]
-[assembly: AssemblyKeyName("")]
diff --git a/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/LoggingExample.cs b/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/LoggingExample.cs
deleted file mode 100644
index 2b22711..0000000
--- a/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/LoggingExample.cs
+++ /dev/null
@@ -1,139 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System;
-
-using SampleAppendersApp.Appender;
-
-// Configure log4net using the .config file
-[assembly: log4net.Config.XmlConfigurator(Watch=true)]
-// This will cause log4net to look for a configuration file
-// called ConsoleApp.exe.config in the application base
-// directory (i.e. the directory containing SampleAppendersApp.exe)
-
-namespace SampleAppendersApp
-{
- /// <summary>
- /// Example of how to simply configure and use log4net
- /// </summary>
- public class LoggingExample
- {
- // Create a logger for use in this class
- private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
- // NOTE that using System.Reflection.MethodBase.GetCurrentMethod().DeclaringType
- // is equivalent to typeof(LoggingExample) but is more portable
- // i.e. you can copy the code directly into another class without
- // needing to edit the code.
-
- /// <summary>
- /// Application entry point
- /// </summary>
- /// <param name="args">command line arguments</param>
- public static void Main(string[] args)
- {
- log4net.ThreadContext.Properties["session"] = 21;
-
- // Hookup the FireEventAppender event
- if (FireEventAppender.Instance != null)
- {
- FireEventAppender.Instance.MessageLoggedEvent += new MessageLoggedEventHandler(FireEventAppender_MessageLoggedEventHandler);
- }
-
- // Log an info level message
- if (log.IsInfoEnabled) log.Info("Application [ConsoleApp] Start");
-
- // Log a debug message. Test if debug is enabled before
- // attempting to log the message. This is not required but
- // can make running without logging faster.
- if (log.IsDebugEnabled) log.Debug("This is a debug message");
-
- // Log a custom object as the log message
- log.Warn(new MsgObj(42, "So long and thanks for all the fish"));
-
- try
- {
- Bar();
- }
- catch(Exception ex)
- {
- // Log an error with an exception
- log.Error("Exception thrown from method Bar", ex);
- }
-
- log.Error("Hey this is an error!");
-
- // Log an info level message
- if (log.IsInfoEnabled) log.Info("Application [ConsoleApp] End");
-
- Console.Write("Press Enter to exit...");
- Console.ReadLine();
- }
-
- // Helper methods to demonstrate location information and nested exceptions
-
- private static void Bar()
- {
- Goo();
- }
-
- private static void Foo()
- {
- throw new Exception("This is an Exception");
- }
-
- private static void Goo()
- {
- try
- {
- Foo();
- }
- catch(Exception ex)
- {
- throw new ArithmeticException("Failed in Goo. Calling Foo. Inner Exception provided", ex);
- }
- }
-
- private static void FireEventAppender_MessageLoggedEventHandler(object sender, MessageLoggedEventArgs e)
- {
- System.Diagnostics.Trace.WriteLine("EVENT ****" + e.LoggingEvent.RenderedMessage + "****");
- }
-
- public class MsgObj
- {
- private readonly int _type;
- private readonly string _error;
-
- public MsgObj(int type, string error)
- {
- _type = type;
- _error = error;
- }
-
- public int MessageType
- {
- get { return _type; }
- }
-
- public string ErrorText
- {
- get { return _error; }
- }
- }
- }
-}
diff --git a/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/SampleAppendersApp.csproj b/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/SampleAppendersApp.csproj
deleted file mode 100644
index 291d513..0000000
--- a/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/SampleAppendersApp.csproj
+++ /dev/null
@@ -1,165 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <ProjectType>Local</ProjectType>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{9E715F72-7F70-421B-A2BF-E9CB42F88F5C}</ProjectGuid>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ApplicationIcon>
- </ApplicationIcon>
- <AssemblyKeyContainerName>
- </AssemblyKeyContainerName>
- <AssemblyName>SampleAppendersApp</AssemblyName>
- <AssemblyOriginatorKeyFile>
- </AssemblyOriginatorKeyFile>
- <DefaultClientScript>JScript</DefaultClientScript>
- <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
- <DefaultTargetSchema>IE50</DefaultTargetSchema>
- <DelaySign>false</DelaySign>
- <OutputType>Exe</OutputType>
- <RootNamespace>SampleAppendersApp</RootNamespace>
- <StartupObject>SampleAppendersApp.LoggingExample</StartupObject>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <OutputPath>..\build\debug\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <ConfigurationOverrideFile>
- </ConfigurationOverrideFile>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <DocumentationFile>
- </DocumentationFile>
- <DebugSymbols>true</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <Optimize>false</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>full</DebugType>
- <ErrorReport>prompt</ErrorReport>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <OutputPath>..\build\release\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <ConfigurationOverrideFile>
- </ConfigurationOverrideFile>
- <DefineConstants>TRACE</DefineConstants>
- <DocumentationFile>
- </DocumentationFile>
- <DebugSymbols>false</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <Optimize>true</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>none</DebugType>
- <ErrorReport>prompt</ErrorReport>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\..\..\..\..\bin\net\2.0\debug\log4net.dll</HintPath>
- </Reference>
- <Reference Include="System">
- <Name>System</Name>
- </Reference>
- <Reference Include="System.Data">
- <Name>System.Data</Name>
- </Reference>
- <Reference Include="System.Messaging">
- <Name>System.Messaging</Name>
- </Reference>
- <Reference Include="System.Web">
- <Name>System.Web</Name>
- </Reference>
- <Reference Include="System.Windows.Forms">
- <Name>System.Windows.Forms</Name>
- </Reference>
- <Reference Include="System.Xml">
- <Name>System.XML</Name>
- </Reference>
- <ProjectReference Include="..\..\..\WmiAppender\cs\src\WmiAppender.csproj">
- <Name>WmiAppender</Name>
- <Project>{BE56F892-37BA-489C-A91D-F2761FDB96EF}</Project>
- <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <None Include="App.config" />
- <Compile Include="..\..\..\..\..\..\..\src\AssemblyVersionInfo.cs">
- <Link>AssemblyVersionInfo.cs</Link>
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Appender\AsyncAppender.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Appender\FastDbAppender.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Appender\FireEventAppender.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Appender\MessageBoxAppender.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Appender\MessageObjectExpanderAppender.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Appender\MsmqAppender.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Appender\PatternFileAppender.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Appender\PatternLayoutAdoNetAppender.cs" />
- <Compile Include="Appender\PatternLayoutAdoNetAppenderParameter.cs" />
- <Compile Include="Appender\SimpleSmtpAppender.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="AssemblyInfo.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="LoggingExample.cs">
- <SubType>Code</SubType>
- </Compile>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <PropertyGroup>
- <PreBuildEvent>
- </PreBuildEvent>
- <PostBuildEvent>
- </PostBuildEvent>
- </PropertyGroup>
-</Project>
diff --git a/examples/net/2.0/Appenders/SampleAppendersApp/nant.build b/examples/net/2.0/Appenders/SampleAppendersApp/nant.build
deleted file mode 100644
index b9cce8d..0000000
--- a/examples/net/2.0/Appenders/SampleAppendersApp/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="sampleappendersapp-example" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile ConsoleApp example -->
- <target name="compile" description="Builds SampleAppendersApp example">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/net/2.0/Appenders/SampleAppendersApp/nant.config b/examples/net/2.0/Appenders/SampleAppendersApp/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/net/2.0/Appenders/SampleAppendersApp/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/net/2.0/Appenders/WmiAppender/cs/nant.build b/examples/net/2.0/Appenders/WmiAppender/cs/nant.build
deleted file mode 100644
index ead5d2e..0000000
--- a/examples/net/2.0/Appenders/WmiAppender/cs/nant.build
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="wmiappender-cs-example" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- copy log4net build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="${log4net.output.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- compile the example -->
- <csc noconfig="true" target="library" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.Appender.WmiAppender.dll">
- <sources>
- <include name="src/**/*.cs" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.cs" />
- </sources>
- <references basedir="${current.bin.dir}">
- <include name="log4net.dll" />
- <include name="System.dll" />
- <include name="System.Configuration.Install.dll" />
- <include name="System.Management.dll" />
- </references>
- </csc>
- </target>
-</project>
diff --git a/examples/net/2.0/Appenders/WmiAppender/cs/nant.config b/examples/net/2.0/Appenders/WmiAppender/cs/nant.config
deleted file mode 100644
index 52613e8..0000000
--- a/examples/net/2.0/Appenders/WmiAppender/cs/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/net/2.0/Appenders/WmiAppender/cs/src/AssemblyInfo.cs b/examples/net/2.0/Appenders/WmiAppender/cs/src/AssemblyInfo.cs
deleted file mode 100644
index 16c39de..0000000
--- a/examples/net/2.0/Appenders/WmiAppender/cs/src/AssemblyInfo.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// 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("log4net.Appender.WmiAppender")]
-[assembly: AssemblyDescription("The Apache Software Foundation log4net Logging Framework - WmiAppender")]
-
-#if DEBUG
-[assembly: AssemblyConfiguration("Debug")]
-#else
-[assembly: AssemblyConfiguration("Retail")]
-#endif
-
-[assembly: AssemblyProduct("log4net")]
-[assembly: AssemblyCulture("")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("")]
-[assembly: AssemblyKeyName("")]
diff --git a/examples/net/2.0/Appenders/WmiAppender/cs/src/IWmiBoundEvent.cs b/examples/net/2.0/Appenders/WmiAppender/cs/src/IWmiBoundEvent.cs
deleted file mode 100644
index 0ccd376..0000000
--- a/examples/net/2.0/Appenders/WmiAppender/cs/src/IWmiBoundEvent.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System;
-using log4net.Core;
-using System.Management.Instrumentation;
-
-namespace log4net.Appender
-{
- /// <summary>
- /// Subclass of <see cref="IEvent"/> for events that need to bind to a <see cref="LoggingEvent"/>
- /// </summary>
- /// <remarks>
- /// <para>
- /// If the <see cref="LoggingEvent"/>.<see cref="LoggingEvent.MessageObject"/> is
- /// a <see cref="IWmiBoundEvent"/> then the default behavior of the <see cref="WmiLayout"/>
- /// is to call the <see cref="Bind"/> method passing the <see cref="LoggingEvent"/>.
- /// This allows the event object to capture additional data from the <see cref="LoggingEvent"/>
- /// before it is fired.
- /// </para>
- /// </remarks>
- public interface IWmiBoundEvent : IEvent
- {
- /// <summary>
- /// This method is called before this instance is fired
- /// </summary>
- /// <param name="loggingEvent">the <see cref="LoggingEvent"/> containing the data</param>
- /// <remarks>
- /// <para>
- /// The <see cref="WmiLayout"/> calls this method passing the <see cref="LoggingEvent"/>
- /// object. Implementors should capture any required data from the <paramref name="loggingEvent"/>
- /// and store it in their instance prior to firing to WMI.
- /// </para>
- /// </remarks>
- void Bind(LoggingEvent loggingEvent);
- }
-}
diff --git a/examples/net/2.0/Appenders/WmiAppender/cs/src/WmiAppender.cs b/examples/net/2.0/Appenders/WmiAppender/cs/src/WmiAppender.cs
deleted file mode 100644
index a239883..0000000
--- a/examples/net/2.0/Appenders/WmiAppender/cs/src/WmiAppender.cs
+++ /dev/null
@@ -1,255 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System;
-using System.Threading;
-using log4net.Appender;
-using log4net.Core;
-using System.Management.Instrumentation;
-
-// This is the WMI namespace for event objects in this assembly
-[assembly: Instrumented("root/log4net")]
-
-namespace log4net.Appender
-{
- /// <summary>
- /// <see cref="WmiAppender"/> fires instrumented events for each <see cref="LoggingEvent"/>
- /// </summary>
- /// <remarks>
- /// <para>
- /// This appender fires Windows Management Instrumentation (WMI) events for
- /// each <see cref="LoggingEvent"/>.
- /// </para>
- /// <para>
- /// By default this appender fires <see cref="WmiLoggingEvent"/> objects, however
- /// this can be overridden by specifying a custom <see cref="Layout"/> or by setting
- /// the <see cref="LoggingEvent"/>.<see cref="LoggingEvent.MessageObject"/> to an
- /// <see cref="IEvent"/> instance.
- /// </para>
- /// <para>
- /// This assembly must be registered with WMI. Use the <c>InstallUtil</c> tool
- /// shipped with the .NET framework to install this assembly. This will register
- /// the <c>root/log4net</c> WMI namespace.
- /// </para>
- /// </remarks>
- public sealed class WmiAppender : IAppender, IOptionHandler
- {
- #region Private Instance Fields
-
- /// <summary>
- /// The layout of this appender.
- /// </summary>
- /// <remarks>
- /// See <see cref="Layout"/> for more information.
- /// </remarks>
- private WmiLayout m_layout;
-
- /// <summary>
- /// The name of this appender.
- /// </summary>
- /// <remarks>
- /// See <see cref="Name"/> for more information.
- /// </remarks>
- private string m_name;
-
- /// <summary>
- /// The level threshold of this appender.
- /// </summary>
- /// <remarks>
- /// <para>
- /// There is no level threshold filtering by default.
- /// </para>
- /// <para>
- /// See <see cref="Threshold"/> for more information.
- /// </para>
- /// </remarks>
- private Level m_threshold;
-
- /// <summary>
- /// It is assumed and enforced that errorHandler is never null.
- /// </summary>
- /// <remarks>
- /// <para>
- /// It is assumed and enforced that errorHandler is never null.
- /// </para>
- /// <para>
- /// See <see cref="ErrorHandler"/> for more information.
- /// </para>
- /// </remarks>
- private IErrorHandler m_errorHandler = new log4net.Util.OnlyOnceErrorHandler("WmiAppender");
-
- #endregion
-
- #region Public Instance Properties
-
- /// <summary>
- /// Gets or sets the name of this appender.
- /// </summary>
- /// <value>The name of the appender.</value>
- /// <remarks>
- /// <para>
- /// The name uniquely identifies the appender.
- /// </para>
- /// </remarks>
- public string Name
- {
- get { return m_name; }
- set { m_name = value; }
- }
-
- /// <summary>
- /// Gets or sets the threshold <see cref="Level"/> of this appender.
- /// </summary>
- /// <value>
- /// The threshold <see cref="Level"/> of the appender.
- /// </value>
- /// <remarks>
- /// <para>
- /// All log events with lower level than the threshold level are ignored
- /// by the appender.
- /// </para>
- /// <para>
- /// In configuration files this option is specified by setting the
- /// value of the <see cref="Threshold"/> option to a level
- /// string, such as "DEBUG", "INFO" and so on.
- /// </para>
- /// </remarks>
- public Level Threshold
- {
- get { return m_threshold; }
- set { m_threshold = value; }
- }
-
- /// <summary>
- /// Gets or sets the <see cref="WmiLayout"/> for this appender.
- /// </summary>
- /// <value>The layout of the appender.</value>
- /// <remarks>
- /// <para>
- /// The <see cref="WmiLayout"/> to use to format the
- /// <see cref="LoggingEvent"/> as an <see cref="IEvent"/>.
- /// </para>
- /// </remarks>
- public WmiLayout Layout
- {
- get { return m_layout; }
- set { m_layout = value; }
- }
-
- /// <summary>
- /// Gets or sets the <see cref="IErrorHandler"/> for this appender.
- /// </summary>
- /// <value>The <see cref="IErrorHandler"/> of the appender</value>
- /// <remarks>
- /// <para>
- /// The default value is a <see cref="OnlyOnceErrorHandler"/>.
- /// </para>
- /// </remarks>
- public IErrorHandler ErrorHandler
- {
- get { return m_errorHandler; }
- set
- {
- if (value == null)
- {
- // We do not throw exception here since the cause is probably a
- // bad config file.
- log4net.Util.LogLog.Warn(GetType(), "WmiAppender: You have tried to set a null error-handler.");
- }
- else
- {
- m_errorHandler = value;
- }
- }
- }
-
- #endregion Public Instance Properties
-
- /// <summary>
- /// Activate this appender
- /// </summary>
- /// <remarks>
- /// <para>
- /// If a <see cref="Layout"/> has not been specified then this
- /// method will create a default <see cref="WmiLayout"/> instance.
- /// </para>
- /// </remarks>
- public void ActivateOptions()
- {
- if (m_layout == null)
- {
- m_layout = new WmiLayout();
- }
- }
-
- /// <summary>
- /// Close this appender
- /// </summary>
- public void Close()
- {
- }
-
- /// <summary>
- /// Process a <see cref="LoggingEvent"/>
- /// </summary>
- /// <param name="loggingEvent">the <see cref="LoggingEvent"/> containing the data</param>
- /// <remarks>
- /// <para>
- /// Uses the <see cref="Layout"/> to format the <paramref name="loggingEvent"/>
- /// as an <see cref="IEvent"/>. This <see cref="IEvent"/> is then fired.
- /// </para>
- /// </remarks>
- public void DoAppend(LoggingEvent loggingEvent)
- {
- if (loggingEvent == null)
- {
- throw new ArgumentNullException("loggingEvent");
- }
-
- try
- {
- if (IsAsSevereAsThreshold(loggingEvent.Level))
- {
- IEvent instrumentationEvent = m_layout.Format(loggingEvent);
- if (instrumentationEvent != null)
- {
- instrumentationEvent.Fire();
- }
- }
- }
- catch(Exception ex)
- {
- ErrorHandler.Error("Failed in DoAppend", ex);
- }
- catch
- {
- // Catch handler for non System.Exception types
- ErrorHandler.Error("Failed in DoAppend (unknown exception)");
- }
- }
-
- /// <summary>
- /// Checks if the message level is below this appender's threshold.
- /// </summary>
- private bool IsAsSevereAsThreshold(Level level)
- {
- return ((m_threshold == null) || level >= m_threshold);
- }
- }
-}
diff --git a/examples/net/2.0/Appenders/WmiAppender/cs/src/WmiAppender.csproj b/examples/net/2.0/Appenders/WmiAppender/cs/src/WmiAppender.csproj
deleted file mode 100644
index 04b4480..0000000
--- a/examples/net/2.0/Appenders/WmiAppender/cs/src/WmiAppender.csproj
+++ /dev/null
@@ -1,134 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <ProjectType>Local</ProjectType>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{BE56F892-37BA-489C-A91D-F2761FDB96EF}</ProjectGuid>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ApplicationIcon>
- </ApplicationIcon>
- <AssemblyKeyContainerName>
- </AssemblyKeyContainerName>
- <AssemblyName>log4net.Appender.WmiAppender</AssemblyName>
- <AssemblyOriginatorKeyFile>
- </AssemblyOriginatorKeyFile>
- <DefaultClientScript>JScript</DefaultClientScript>
- <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
- <DefaultTargetSchema>IE50</DefaultTargetSchema>
- <DelaySign>false</DelaySign>
- <OutputType>Library</OutputType>
- <RootNamespace>log4net.Appender.WmiAppender</RootNamespace>
- <StartupObject>
- </StartupObject>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <OutputPath>..\bin\Debug\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <ConfigurationOverrideFile>
- </ConfigurationOverrideFile>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <DocumentationFile>
- </DocumentationFile>
- <DebugSymbols>true</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <Optimize>false</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>full</DebugType>
- <ErrorReport>prompt</ErrorReport>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <OutputPath>..\bin\Release\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <ConfigurationOverrideFile>
- </ConfigurationOverrideFile>
- <DefineConstants>TRACE</DefineConstants>
- <DocumentationFile>
- </DocumentationFile>
- <DebugSymbols>false</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <Optimize>true</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>none</DebugType>
- <ErrorReport>prompt</ErrorReport>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\..\..\..\..\bin\net\2.0\debug\log4net.dll</HintPath>
- </Reference>
- <Reference Include="System">
- <Name>System</Name>
- </Reference>
- <Reference Include="System.Configuration.Install">
- <Name>System.Configuration.Install</Name>
- </Reference>
- <Reference Include="System.Management">
- <Name>System.Management</Name>
- </Reference>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="..\..\..\..\..\..\..\src\AssemblyVersionInfo.cs">
- <Link>AssemblyVersionInfo.cs</Link>
- </Compile>
- <Compile Include="AssemblyInfo.cs" />
- <Compile Include="IWmiBoundEvent.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="WmiAppender.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="WmiInstaller.cs">
- <SubType>Component</SubType>
- </Compile>
- <Compile Include="WmiLayout.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="WmiLoggingEvent.cs">
- <SubType>Code</SubType>
- </Compile>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <PropertyGroup>
- <PreBuildEvent>
- </PreBuildEvent>
- <PostBuildEvent>
- </PostBuildEvent>
- </PropertyGroup>
-</Project>
diff --git a/examples/net/2.0/Appenders/WmiAppender/cs/src/WmiLayout.cs b/examples/net/2.0/Appenders/WmiAppender/cs/src/WmiLayout.cs
deleted file mode 100644
index eaf51d8..0000000
--- a/examples/net/2.0/Appenders/WmiAppender/cs/src/WmiLayout.cs
+++ /dev/null
@@ -1,100 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System;
-using log4net.Core;
-using System.Management.Instrumentation;
-
-namespace log4net.Appender
-{
- public class WmiLayout
- {
- /// <summary>
- /// Formats a <see cref="LoggingEvent"/> for instrumentation
- /// </summary>
- /// <param name="loggingEvent">the <see cref="LoggingEvent"/> containing the data</param>
- /// <returns>an instrumentation event that can be fired</returns>
- /// <remarks>
- /// <para>
- /// If the <see cref="LoggingEvent.MessageObject"/> of the
- /// <paramref name="loggingEvent" /> is an <see cref="IEvent"/> then
- /// that instance is returned. If the instance also implements the
- /// <see cref="IWmiBoundEvent"/> interface then the <see cref="IWmiBoundEvent.Bind"/>
- /// method will be called on the instance with the <paramref name="loggingEvent" />
- /// parameter.
- /// </para>
- /// <para>
- /// If the <see cref="LoggingEvent.MessageObject"/> of the
- /// <paramref name="loggingEvent" /> is not an <see cref="IEvent"/>
- /// then the <see cref="CreateEvent"/> method will be called
- /// to create an appropriate instrumentation event object.
- /// </para>
- /// </remarks>
- public virtual IEvent Format(LoggingEvent loggingEvent)
- {
- // See if the caller gave us an Instrumentation Event
- IEvent instrumentationEvent = loggingEvent.MessageObject as IEvent;
- if (instrumentationEvent != null)
- {
- // See if the caller gave us a Bound Instrumentation Event
- IWmiBoundEvent boundEvent = instrumentationEvent as IWmiBoundEvent;
- if (boundEvent != null)
- {
- // Attach the logging event to the bound instrumentation event
- boundEvent.Bind(loggingEvent);
- }
-
- return instrumentationEvent;
- }
-
- // We must create our own IEvent
- return CreateEvent(loggingEvent);
- }
-
- /// <summary>
- /// Create the <see cref="IEvent"/> instance that should be fired
- /// </summary>
- /// <param name="loggingEvent">the <see cref="LoggingEvent"/> containing the data</param>
- /// <returns>an instrumentation event that can be fired</returns>
- /// <remarks>
- /// <para>
- /// The default implementation of this method creates a <see cref="WmiLoggingEvent"/>
- /// instance using the data from the <paramref name="loggingEvent" />.
- /// </para>
- /// <para>
- /// Subclasses should override this method to return their own custom
- /// instrumentation event object.
- /// </para>
- /// </remarks>
- protected virtual IEvent CreateEvent(LoggingEvent loggingEvent)
- {
- WmiLoggingEvent wmiEvent = new WmiLoggingEvent();
-
- wmiEvent.TimeStamp = loggingEvent.TimeStamp;
- wmiEvent.LoggerName = loggingEvent.LoggerName;
- wmiEvent.Level = loggingEvent.Level.DisplayName;
- wmiEvent.Message = loggingEvent.RenderedMessage;
- wmiEvent.ThreadName = loggingEvent.ThreadName;
- wmiEvent.ExceptionString = loggingEvent.GetExceptionString();
- wmiEvent.Domain = loggingEvent.Domain;
-
- return wmiEvent;
- }
- }
-}
diff --git a/examples/net/2.0/Appenders/WmiAppender/cs/src/WmiLoggingEvent.cs b/examples/net/2.0/Appenders/WmiAppender/cs/src/WmiLoggingEvent.cs
deleted file mode 100644
index 72efdc8..0000000
--- a/examples/net/2.0/Appenders/WmiAppender/cs/src/WmiLoggingEvent.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System;
-using log4net.Core;
-using System.Management.Instrumentation;
-
-namespace log4net.Appender
-{
- /// <summary>
- /// The default instrumented event raised by the <see cref="WmiAppender"/>
- /// </summary>
- /// <remarks>
- /// <para>
- /// This is the default event fired by the <see cref="WmiAppender"/>.
- /// To fire a custom event set the <see cref="WmiAppender.Layout"/> to a
- /// subclass of <see cref="WmiLayout"/> that overrides the <see cref="WmiLayout.CreateEvent"/>
- /// method.
- /// </para>
- /// </remarks>
- public class WmiLoggingEvent : BaseEvent
- {
- public DateTime TimeStamp;
- public string LoggerName;
- public string Level;
- public string Message;
- public string ThreadName;
- public string ExceptionString;
- public string Domain;
- }
-}
diff --git a/examples/net/2.0/Appenders/WmiAppender/nant.build b/examples/net/2.0/Appenders/WmiAppender/nant.build
deleted file mode 100644
index 1088206..0000000
--- a/examples/net/2.0/Appenders/WmiAppender/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="wmiappender-example" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile ConsoleApp example -->
- <target name="compile" description="Builds WmiAppender example">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/net/2.0/Appenders/WmiAppender/nant.config b/examples/net/2.0/Appenders/WmiAppender/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/net/2.0/Appenders/WmiAppender/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/net/2.0/Appenders/nant.build b/examples/net/2.0/Appenders/nant.build
deleted file mode 100644
index 6c5062d..0000000
--- a/examples/net/2.0/Appenders/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="appender-examples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile Tutorials examples -->
- <target name="compile" description="Builds Appender examples">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/net/2.0/Appenders/nant.config b/examples/net/2.0/Appenders/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/net/2.0/Appenders/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/net/2.0/Extensibility/EventIDLogApp/cs/nant.build b/examples/net/2.0/Extensibility/EventIDLogApp/cs/nant.build
deleted file mode 100644
index 9fee4e0..0000000
--- a/examples/net/2.0/Extensibility/EventIDLogApp/cs/nant.build
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- copy log4net build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="${log4net.output.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- build EventID extension assembly -->
- <nant buildfile="${log4net.basedir}/extensions/${project.runtime.config}/${project.runtime.version}/log4net.Ext.EventID/cs/nant.build"
- target="compile" inheritall="true" />
- <!-- copy EventID extension build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="${log4net.basedir}/extensions/${project.runtime.config}/${project.runtime.version}/log4net.Ext.EventID/cs/${current.bin.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- compile the example -->
- <csc noconfig="true" target="exe" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.csc}" output="${current.bin.dir}/EventIDLogApp.exe">
- <sources>
- <include name="src/**/*.cs" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.cs" />
- </sources>
- <references basedir="${current.bin.dir}">
- <include name="log4net.Ext.EventID.dll" />
- <include name="log4net.dll" />
- </references>
- </csc>
- <!-- copy the EventIDLogApp application configuration file -->
- <copy file="src/App.config" tofile="${current.bin.dir}/EventIDLogApp.exe.config" />
- </target>
-</project>
diff --git a/examples/net/2.0/Extensibility/EventIDLogApp/cs/nant.config b/examples/net/2.0/Extensibility/EventIDLogApp/cs/nant.config
deleted file mode 100644
index 52613e8..0000000
--- a/examples/net/2.0/Extensibility/EventIDLogApp/cs/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/net/2.0/Extensibility/EventIDLogApp/cs/src/AssemblyInfo.cs b/examples/net/2.0/Extensibility/EventIDLogApp/cs/src/AssemblyInfo.cs
deleted file mode 100644
index 04c4115..0000000
--- a/examples/net/2.0/Extensibility/EventIDLogApp/cs/src/AssemblyInfo.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// 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("log4net - EventIDLogApp")]
-[assembly: AssemblyDescription("log4net extensibility test - EventIDLogApp")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyProduct("log4net - EventIDLogApp")]
-[assembly: AssemblyCulture("")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("")]
-[assembly: AssemblyKeyName("")]
diff --git a/examples/net/2.0/Extensibility/EventIDLogApp/cs/src/EventIDLogApp.cs b/examples/net/2.0/Extensibility/EventIDLogApp/cs/src/EventIDLogApp.cs
deleted file mode 100644
index 4406a90..0000000
--- a/examples/net/2.0/Extensibility/EventIDLogApp/cs/src/EventIDLogApp.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-// Configure this assembly using the 'EventIDLogApp.exe.config' config file
-[assembly: log4net.Config.XmlConfigurator(Watch=true)]
-
-namespace EventIDLogApp
-{
- using System;
-
- using log4net.Ext.EventID;
-
- class EventIDLogApp
- {
- // Create a logger for use in this class
- private static readonly IEventIDLog log = EventIDLogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
-
- /// <summary>
- /// The main entry point for the application.
- /// </summary>
- [STAThread]
- static void Main(string[] args)
- {
- log.Info(1, "Application ["+System.Reflection.Assembly.GetEntryAssembly().GetName().Name+"] Start");
-
- log.Warn(40, "This is a warn message ");
-
- log.Info(2, "Application ["+System.Reflection.Assembly.GetEntryAssembly().GetName().Name+"] Stop");
- }
- }
-}
diff --git a/examples/net/2.0/Extensibility/EventIDLogApp/cs/src/EventIDLogApp.csproj b/examples/net/2.0/Extensibility/EventIDLogApp/cs/src/EventIDLogApp.csproj
deleted file mode 100644
index 8c633d0..0000000
--- a/examples/net/2.0/Extensibility/EventIDLogApp/cs/src/EventIDLogApp.csproj
+++ /dev/null
@@ -1,138 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <ProjectType>Local</ProjectType>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{B3DCF964-EAC8-46F2-AA11-151713141536}</ProjectGuid>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ApplicationIcon>
- </ApplicationIcon>
- <AssemblyKeyContainerName>
- </AssemblyKeyContainerName>
- <AssemblyName>EventIDLogApp</AssemblyName>
- <AssemblyOriginatorKeyFile>
- </AssemblyOriginatorKeyFile>
- <DefaultClientScript>JScript</DefaultClientScript>
- <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
- <DefaultTargetSchema>IE50</DefaultTargetSchema>
- <DelaySign>false</DelaySign>
- <OutputType>Exe</OutputType>
- <RootNamespace>EventIDLogApp</RootNamespace>
- <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
- <StartupObject>
- </StartupObject>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <OutputPath>..\build\debug\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <ConfigurationOverrideFile>
- </ConfigurationOverrideFile>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <DocumentationFile>
- </DocumentationFile>
- <DebugSymbols>true</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <NoStdLib>false</NoStdLib>
- <NoWarn>
- </NoWarn>
- <Optimize>false</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>full</DebugType>
- <ErrorReport>prompt</ErrorReport>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <OutputPath>..\build\release\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <ConfigurationOverrideFile>
- </ConfigurationOverrideFile>
- <DefineConstants>TRACE</DefineConstants>
- <DocumentationFile>
- </DocumentationFile>
- <DebugSymbols>false</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <NoStdLib>false</NoStdLib>
- <NoWarn>
- </NoWarn>
- <Optimize>true</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>none</DebugType>
- <ErrorReport>prompt</ErrorReport>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\..\..\..\..\bin\net\2.0\debug\log4net.dll</HintPath>
- </Reference>
- <Reference Include="System">
- <Name>System</Name>
- </Reference>
- <Reference Include="System.Data">
- <Name>System.Data</Name>
- </Reference>
- <Reference Include="System.Xml">
- <Name>System.XML</Name>
- </Reference>
- <ProjectReference Include="..\..\..\..\..\..\..\extensions\net\1.0\log4net.Ext.EventID\cs\src\log4net.Ext.EventID.csproj">
- <Name>log4net.Ext.EventID</Name>
- <Project>{CB985027-C009-4C0F-88C1-8CF11912EE4C}</Project>
- <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <None Include="App.config" />
- <Compile Include="..\..\..\..\..\..\..\src\AssemblyVersionInfo.cs">
- <Link>AssemblyVersionInfo.cs</Link>
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="AssemblyInfo.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="EventIDLogApp.cs">
- <SubType>Code</SubType>
- </Compile>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <PropertyGroup>
- <PreBuildEvent>
- </PreBuildEvent>
- <PostBuildEvent>
- </PostBuildEvent>
- </PropertyGroup>
-</Project>
diff --git a/examples/net/2.0/Extensibility/EventIDLogApp/nant.build b/examples/net/2.0/Extensibility/EventIDLogApp/nant.build
deleted file mode 100644
index e1f84fe..0000000
--- a/examples/net/2.0/Extensibility/EventIDLogApp/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="eventidlogapp-example" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile EventIDLogApp example -->
- <target name="compile" description="Builds EventIDLogApp example">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/net/2.0/Extensibility/EventIDLogApp/nant.config b/examples/net/2.0/Extensibility/EventIDLogApp/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/net/2.0/Extensibility/EventIDLogApp/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/net/2.0/Extensibility/TraceLogApp/cs/nant.build b/examples/net/2.0/Extensibility/TraceLogApp/cs/nant.build
deleted file mode 100644
index c872deb..0000000
--- a/examples/net/2.0/Extensibility/TraceLogApp/cs/nant.build
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- copy log4net build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="${log4net.output.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- build Trace extension assembly -->
- <nant buildfile="${log4net.basedir}/extensions/${project.runtime.config}/${project.runtime.version}/log4net.Ext.Trace/cs/nant.build"
- target="compile" inheritall="true" />
- <!-- copy Trace extension build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="${log4net.basedir}/extensions/${project.runtime.config}/${project.runtime.version}/log4net.Ext.Trace/cs/${current.bin.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- compile the example -->
- <csc noconfig="true" target="exe" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.csc}" output="${current.bin.dir}/TraceLogApp.exe">
- <sources>
- <include name="src/**/*.cs" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.cs" />
- </sources>
- <references basedir="${current.bin.dir}">
- <include name="log4net.Ext.Trace.dll" />
- <include name="log4net.dll" />
- </references>
- </csc>
- <!-- copy the Trace log4net configuration file -->
- <copy file="src/TraceLogApp.exe.log4net" todir="${current.bin.dir}" />
- </target>
-</project>
diff --git a/examples/net/2.0/Extensibility/TraceLogApp/cs/nant.config b/examples/net/2.0/Extensibility/TraceLogApp/cs/nant.config
deleted file mode 100644
index 1bfdb0a..0000000
--- a/examples/net/2.0/Extensibility/TraceLogApp/cs/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" readonly="false" />
-</project>
diff --git a/examples/net/2.0/Extensibility/TraceLogApp/cs/src/AssemblyInfo.cs b/examples/net/2.0/Extensibility/TraceLogApp/cs/src/AssemblyInfo.cs
deleted file mode 100644
index f0acd13..0000000
--- a/examples/net/2.0/Extensibility/TraceLogApp/cs/src/AssemblyInfo.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// 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("log4net - TraceLogApp")]
-[assembly: AssemblyDescription("log4net extensibility test - TraceLogApp")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyProduct("log4net - TraceLogApp")]
-[assembly: AssemblyCulture("")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("")]
-[assembly: AssemblyKeyName("")]
diff --git a/examples/net/2.0/Extensibility/TraceLogApp/cs/src/TraceLogApp.cs b/examples/net/2.0/Extensibility/TraceLogApp/cs/src/TraceLogApp.cs
deleted file mode 100644
index 633343f..0000000
--- a/examples/net/2.0/Extensibility/TraceLogApp/cs/src/TraceLogApp.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-// Configure this assembly using the 'TraceLogApp.exe.log4net' config file
-[assembly: log4net.Config.XmlConfigurator(ConfigFileExtension="log4net", Watch=true)]
-
-namespace TraceLogApp
-{
- using System;
-
- using log4net.Ext.Trace;
-
- class TraceLogApp
- {
- // Create a logger for use in this class
- private static readonly ITraceLog log = TraceLogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
-
- /// <summary>
- /// The main entry point for the application.
- /// </summary>
- [STAThread]
- static void Main(string[] args)
- {
- for (int i=0; i<10; i++)
- {
- log.Trace("This is a trace message "+i);
- System.Threading.Thread.Sleep(new TimeSpan(0, 0, 2));
- }
- }
- }
-}
diff --git a/examples/net/2.0/Extensibility/TraceLogApp/cs/src/TraceLogApp.csproj b/examples/net/2.0/Extensibility/TraceLogApp/cs/src/TraceLogApp.csproj
deleted file mode 100644
index 4648085..0000000
--- a/examples/net/2.0/Extensibility/TraceLogApp/cs/src/TraceLogApp.csproj
+++ /dev/null
@@ -1,136 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <ProjectType>Local</ProjectType>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{EB508341-D73A-4165-846D-E7E317E12518}</ProjectGuid>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ApplicationIcon>
- </ApplicationIcon>
- <AssemblyKeyContainerName>
- </AssemblyKeyContainerName>
- <AssemblyName>TraceLogApp</AssemblyName>
- <AssemblyOriginatorKeyFile>
- </AssemblyOriginatorKeyFile>
- <DefaultClientScript>JScript</DefaultClientScript>
- <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
- <DefaultTargetSchema>IE50</DefaultTargetSchema>
- <DelaySign>false</DelaySign>
- <OutputType>Exe</OutputType>
- <RootNamespace>TraceLogApp</RootNamespace>
- <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
- <StartupObject>TraceLogApp.TraceLogApp</StartupObject>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <OutputPath>..\build\debug\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <ConfigurationOverrideFile>
- </ConfigurationOverrideFile>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <DocumentationFile>
- </DocumentationFile>
- <DebugSymbols>true</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <NoStdLib>false</NoStdLib>
- <NoWarn>
- </NoWarn>
- <Optimize>false</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>full</DebugType>
- <ErrorReport>prompt</ErrorReport>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <OutputPath>..\build\release\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <ConfigurationOverrideFile>
- </ConfigurationOverrideFile>
- <DefineConstants>TRACE</DefineConstants>
- <DocumentationFile>
- </DocumentationFile>
- <DebugSymbols>false</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <NoStdLib>false</NoStdLib>
- <NoWarn>
- </NoWarn>
- <Optimize>true</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>none</DebugType>
- <ErrorReport>prompt</ErrorReport>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\..\..\..\..\bin\net\2.0\debug\log4net.dll</HintPath>
- </Reference>
- <Reference Include="System">
- <Name>System</Name>
- </Reference>
- <Reference Include="System.Data">
- <Name>System.Data</Name>
- </Reference>
- <Reference Include="System.Xml">
- <Name>System.XML</Name>
- </Reference>
- <ProjectReference Include="..\..\..\..\..\..\..\extensions\net\1.0\log4net.Ext.Trace\cs\src\log4net.Ext.Trace.csproj">
- <Name>log4net.Ext.Trace</Name>
- <Project>{8C73DF1C-AB2B-4309-A3EC-1ED594239E15}</Project>
- <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="..\..\..\..\..\..\..\src\AssemblyVersionInfo.cs">
- <Link>AssemblyVersionInfo.cs</Link>
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="AssemblyInfo.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="TraceLogApp.cs">
- <SubType>Code</SubType>
- </Compile>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <PropertyGroup>
- <PreBuildEvent>
- </PreBuildEvent>
- <PostBuildEvent>
- </PostBuildEvent>
- </PropertyGroup>
-</Project>
diff --git a/examples/net/2.0/Extensibility/TraceLogApp/cs/src/TraceLogApp.exe.log4net b/examples/net/2.0/Extensibility/TraceLogApp/cs/src/TraceLogApp.exe.log4net
deleted file mode 100644
index 069394a..0000000
--- a/examples/net/2.0/Extensibility/TraceLogApp/cs/src/TraceLogApp.exe.log4net
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!-- This section contains the log4net configuration settings -->
-<log4net debug="false" threshold="TRACE">
- <!-- Define some output appenders -->
- <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
- </layout>
- </appender>
-
- <!-- Setup the root category, add the appenders and set the default priority -->
- <root>
- <level value="TRACE" />
- <appender-ref ref="ConsoleAppender" />
- </root>
-</log4net>
-
-
diff --git a/examples/net/2.0/Extensibility/TraceLogApp/nant.build b/examples/net/2.0/Extensibility/TraceLogApp/nant.build
deleted file mode 100644
index 6b881eb..0000000
--- a/examples/net/2.0/Extensibility/TraceLogApp/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="tracelogapp-example" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile TraceLogApp example -->
- <target name="compile" description="Builds TraceLogApp example">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/net/2.0/Extensibility/TraceLogApp/nant.config b/examples/net/2.0/Extensibility/TraceLogApp/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/net/2.0/Extensibility/TraceLogApp/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/net/2.0/Extensibility/nant.build b/examples/net/2.0/Extensibility/nant.build
deleted file mode 100644
index 7c9185c..0000000
--- a/examples/net/2.0/Extensibility/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="extensibility-examples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile Extensibility examples -->
- <target name="compile" description="Builds Extensibility examples">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/net/2.0/Extensibility/nant.config b/examples/net/2.0/Extensibility/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/net/2.0/Extensibility/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/net/2.0/Layouts/SampleLayoutsApp/cs/nant.build b/examples/net/2.0/Layouts/SampleLayoutsApp/cs/nant.build
deleted file mode 100644
index 1bdd463..0000000
--- a/examples/net/2.0/Layouts/SampleLayoutsApp/cs/nant.build
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="samplelayoutssapp-cs-example" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- copy log4net build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="${log4net.output.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- compile the example -->
- <csc noconfig="true" target="exe" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.csc}" output="${current.bin.dir}/SampleLayoutssApp.exe">
- <sources>
- <include name="src/**/*.cs" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.cs" />
- </sources>
- <references basedir="${current.bin.dir}">
- <include name="log4net.dll" />
- <include name="System.dll" />
- <include name="System.Web.dll" />
- <include name="System.Windows.Forms.dll" />
- </references>
- </csc>
- <!-- copy the ConsoleApp application configuration file -->
- <copy file="src/App.config" tofile="${current.bin.dir}/SampleLayoutsApp.exe.config" />
- </target>
-</project>
diff --git a/examples/net/2.0/Layouts/SampleLayoutsApp/cs/nant.config b/examples/net/2.0/Layouts/SampleLayoutsApp/cs/nant.config
deleted file mode 100644
index 52613e8..0000000
--- a/examples/net/2.0/Layouts/SampleLayoutsApp/cs/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/net/2.0/Layouts/SampleLayoutsApp/cs/src/App.config b/examples/net/2.0/Layouts/SampleLayoutsApp/cs/src/App.config
deleted file mode 100644
index d5b8562..0000000
--- a/examples/net/2.0/Layouts/SampleLayoutsApp/cs/src/App.config
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<!--
- .NET application configuration file
- This file must have the exact same name as your application with .config appended to it.
-
- For example if your application is ConsoleApp.exe then the config file must be ConsoleApp.exe.config.
- It must also be in the same directory as the application.
- -->
-<configuration>
- <!-- Register a section handler for the log4net section -->
- <configSections>
- <section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
- </configSections>
-
- <appSettings>
- <!-- To enable internal log4net logging specify the following appSettings key -->
- <!-- <add key="log4net.Internal.Debug" value="true"/> -->
- </appSettings>
-
- <!-- This section contains the log4net configuration settings -->
- <log4net>
-
- <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
- <layout type="SampleLayoutsApp.Layout.LineWrappingLayout,SampleLayoutsApp">
- <indent value="8" />
- <layout type="log4net.Layout.PatternLayout" value="%date [%thread] %-5level %logger - %message%newline" />
- </layout>
- </appender>
-
- <!-- Setup the root category, add the appenders and set the default level -->
- <root>
- <level value="ALL" />
-
- <appender-ref ref="ConsoleAppender" />
- </root>
-
- </log4net>
-</configuration>
diff --git a/examples/net/2.0/Layouts/SampleLayoutsApp/cs/src/AssemblyInfo.cs b/examples/net/2.0/Layouts/SampleLayoutsApp/cs/src/AssemblyInfo.cs
deleted file mode 100644
index 441569d..0000000
--- a/examples/net/2.0/Layouts/SampleLayoutsApp/cs/src/AssemblyInfo.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// 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("log4net - SampleLayoutsApp")]
-[assembly: AssemblyDescription("log4net SampleLayoutsApp")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyProduct("log4net - SampleLayoutsApp")]
-[assembly: AssemblyCulture("")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("")]
-[assembly: AssemblyKeyName("")]
diff --git a/examples/net/2.0/Layouts/SampleLayoutsApp/cs/src/Layout/ForwardingLayout.cs b/examples/net/2.0/Layouts/SampleLayoutsApp/cs/src/Layout/ForwardingLayout.cs
deleted file mode 100644
index 1727bae..0000000
--- a/examples/net/2.0/Layouts/SampleLayoutsApp/cs/src/Layout/ForwardingLayout.cs
+++ /dev/null
@@ -1,202 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System;
-using System.IO;
-using log4net.Layout;
-using log4net.Core;
-using log4net.Util;
-
-namespace SampleLayoutsApp.Layout
-{
- /// <summary>
- /// The ForwardingLayout forwards to a nested <see cref="ILayout"/>
- /// </summary>
- /// <remarks>
- /// The ForwardingLayout base class is used by layouts that want
- /// to decorate other <see cref="ILayout"/> objects.
- /// </remarks>
- public abstract class ForwardingLayout : ILayout, IOptionHandler
- {
- private ILayout m_nestedLayout;
-
- protected ForwardingLayout()
- {
- }
-
- public ILayout Layout
- {
- get { return m_nestedLayout; }
- set { m_nestedLayout = value; }
- }
-
- #region Implementation of IOptionHandler
-
- /// <summary>
- /// Activate component options
- /// </summary>
- /// <remarks>
- /// <para>
- /// This is part of the <see cref="IOptionHandler"/> delayed object
- /// activation scheme. The <see cref="ActivateOptions"/> method must
- /// be called on this object after the configuration properties have
- /// been set. Until <see cref="ActivateOptions"/> is called this
- /// object is in an undefined state and must not be used.
- /// </para>
- /// <para>
- /// If any of the configuration properties are modified then
- /// <see cref="ActivateOptions"/> must be called again.
- /// </para>
- /// <para>
- /// This method must be implemented by the subclass.
- /// </para>
- /// </remarks>
- public virtual void ActivateOptions()
- {
- IOptionHandler optionHandler = m_nestedLayout as IOptionHandler;
- if (optionHandler != null)
- {
- optionHandler.ActivateOptions();
- }
- }
-
- #endregion
-
- #region Implementation of ILayout
-
- /// <summary>
- /// Implement this method to create your own layout format.
- /// </summary>
- /// <param name="writer">The TextWriter to write the formatted event to</param>
- /// <param name="loggingEvent">The event to format</param>
- /// <remarks>
- /// <para>
- /// This method is called by an appender to format
- /// the <paramref name="loggingEvent"/> as text.
- /// </para>
- /// </remarks>
- virtual public void Format(TextWriter writer, LoggingEvent loggingEvent)
- {
- if (m_nestedLayout != null)
- {
- m_nestedLayout.Format(writer, loggingEvent);
- }
- }
-
- /// <summary>
- /// The content type output by this layout.
- /// </summary>
- /// <value>The content type is <c>"text/plain"</c></value>
- /// <remarks>
- /// <para>
- /// The content type output by this layout.
- /// </para>
- /// <para>
- /// This base class uses the value <c>"text/plain"</c>.
- /// To change this value a subclass must override this
- /// property.
- /// </para>
- /// </remarks>
- virtual public string ContentType
- {
- get
- {
- if (m_nestedLayout != null)
- {
- return m_nestedLayout.ContentType;
- }
- return "text/plain";
- }
- }
-
- /// <summary>
- /// The header for the layout format.
- /// </summary>
- /// <value>the layout header</value>
- /// <remarks>
- /// <para>
- /// The Header text will be appended before any logging events
- /// are formatted and appended.
- /// </para>
- /// </remarks>
- virtual public string Header
- {
- get
- {
- if (m_nestedLayout != null)
- {
- return m_nestedLayout.Header;
- }
- return null;
- }
- }
-
- /// <summary>
- /// The footer for the layout format.
- /// </summary>
- /// <value>the layout footer</value>
- /// <remarks>
- /// <para>
- /// The Footer text will be appended after all the logging events
- /// have been formatted and appended.
- /// </para>
- /// </remarks>
- virtual public string Footer
- {
- get
- {
- if (m_nestedLayout != null)
- {
- return m_nestedLayout.Footer;
- }
- return null;
- }
- }
-
- /// <summary>
- /// Flag indicating if this layout handles exceptions
- /// </summary>
- /// <value><c>false</c> if this layout handles exceptions</value>
- /// <remarks>
- /// <para>
- /// If this layout handles the exception object contained within
- /// <see cref="LoggingEvent"/>, then the layout should return
- /// <c>false</c>. Otherwise, if the layout ignores the exception
- /// object, then the layout should return <c>true</c>.
- /// </para>
- /// <para>
- /// Set this value to override a this default setting. The default
- /// value is <c>true</c>, this layout does not handle the exception.
- /// </para>
- /// </remarks>
- virtual public bool IgnoresException
- {
- get
- {
- if (m_nestedLayout != null)
- {
- return m_nestedLayout.IgnoresException;
- }
- return true;
- }
- }
-
- #endregion
- }
-}
diff --git a/examples/net/2.0/Layouts/SampleLayoutsApp/cs/src/Layout/LevelConversionPattern.cs b/examples/net/2.0/Layouts/SampleLayoutsApp/cs/src/Layout/LevelConversionPattern.cs
deleted file mode 100644
index d4d729d..0000000
--- a/examples/net/2.0/Layouts/SampleLayoutsApp/cs/src/Layout/LevelConversionPattern.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using log4net.Core;
-
-namespace SampleLayoutsApp.Layout
-{
- public class LevelConversionPattern
- {
- private Level level;
- private string conversionPattern;
-
- public Level Level
- {
- get { return level; }
- set { level = value; }
- }
-
- public string ConversionPattern
- {
- get { return conversionPattern; }
- set { conversionPattern = value; }
- }
- }
-}
\ No newline at end of file
diff --git a/examples/net/2.0/Layouts/SampleLayoutsApp/cs/src/Layout/LevelPatternLayout.cs b/examples/net/2.0/Layouts/SampleLayoutsApp/cs/src/Layout/LevelPatternLayout.cs
deleted file mode 100644
index 2176b91..0000000
--- a/examples/net/2.0/Layouts/SampleLayoutsApp/cs/src/Layout/LevelPatternLayout.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System.Collections;
-using System.IO;
-using log4net.Core;
-using log4net.Layout;
-
-namespace SampleLayoutsApp.Layout
-{
- public class LevelPatternLayout : PatternLayout
- {
- private readonly Hashtable m_levelToPatternLayout = new Hashtable();
-
- public override void Format(TextWriter writer, LoggingEvent loggingEvent)
- {
- PatternLayout patternLayout = m_levelToPatternLayout[loggingEvent.Level] as PatternLayout;
-
- if (patternLayout == null)
- {
- base.Format(writer, loggingEvent);
- }
- else
- {
- patternLayout.Format(writer, loggingEvent);
- }
- }
-
- public void AddLevelConversionPattern(LevelConversionPattern levelLayout)
- {
- m_levelToPatternLayout[levelLayout.Level] = new PatternLayout(levelLayout.ConversionPattern);
- }
- }
-}
diff --git a/examples/net/2.0/Layouts/SampleLayoutsApp/cs/src/Layout/LineWrappingLayout.cs b/examples/net/2.0/Layouts/SampleLayoutsApp/cs/src/Layout/LineWrappingLayout.cs
deleted file mode 100644
index de4f3f1..0000000
--- a/examples/net/2.0/Layouts/SampleLayoutsApp/cs/src/Layout/LineWrappingLayout.cs
+++ /dev/null
@@ -1,102 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System;
-using System.IO;
-using System.Text;
-using log4net.Layout;
-using log4net.Core;
-using log4net.Util;
-
-namespace SampleLayoutsApp.Layout
-{
- /// <summary>
- /// The LineWrappingLayout wraps the output of a nested layout
- /// </summary>
- /// <remarks>
- /// The output of the nested layout is wrapped at
- /// <see cref="LineWidth"/>. Each of the continuation lines
- /// is prefixed with a number of spaces specified by <see cref="Indent"/>.
- /// </remarks>
- public class LineWrappingLayout : ForwardingLayout
- {
- private int m_lineWidth = 76;
- private int m_indent = 4;
-
- public LineWrappingLayout()
- {
- }
-
- public int LineWidth
- {
- get { return m_lineWidth; }
- set { m_lineWidth = value; }
- }
- public int Indent
- {
- get { return m_indent; }
- set { m_indent = value; }
- }
-
- override public void Format(TextWriter writer, LoggingEvent loggingEvent)
- {
- StringWriter stringWriter = new StringWriter();
-
- base.Format(stringWriter, loggingEvent);
-
- string formattedString = stringWriter.ToString();
-
- WrapText(writer, formattedString);
- }
-
- private void WrapText(TextWriter writer, string text)
- {
- if (text.Length <= m_lineWidth)
- {
- writer.Write(text);
- }
- else
- {
- // Do the first line
- writer.WriteLine(text.Substring(0, m_lineWidth));
- string rest = text.Substring(m_lineWidth);
-
- string indentString = new String(' ', m_indent);
- int continuationLineWidth = m_lineWidth - m_indent;
-
- // Do the continuation lines
- while(true)
- {
- writer.Write(indentString);
-
- if (rest.Length > continuationLineWidth)
- {
- writer.WriteLine(rest.Substring(0, continuationLineWidth));
- rest = rest.Substring(continuationLineWidth);
- }
- else
- {
- writer.Write(rest);
- break;
- }
- }
- }
- }
- }
-}
diff --git a/examples/net/2.0/Layouts/SampleLayoutsApp/cs/src/LoggingExample.cs b/examples/net/2.0/Layouts/SampleLayoutsApp/cs/src/LoggingExample.cs
deleted file mode 100644
index c0df309..0000000
--- a/examples/net/2.0/Layouts/SampleLayoutsApp/cs/src/LoggingExample.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System;
-
-// Configure log4net using the .config file
-[assembly: log4net.Config.XmlConfigurator(Watch=true)]
-// This will cause log4net to look for a configuration file
-// called ConsoleApp.exe.config in the application base
-// directory (i.e. the directory containing SampleAppendersApp.exe)
-
-namespace SampleLayoutsApp
-{
- /// <summary>
- /// Example of how to simply configure and use log4net
- /// </summary>
- public class LoggingExample
- {
- // Create a logger for use in this class
- private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
- // NOTE that using System.Reflection.MethodBase.GetCurrentMethod().DeclaringType
- // is equivalent to typeof(LoggingExample) but is more portable
- // i.e. you can copy the code directly into another class without
- // needing to edit the code.
-
- /// <summary>
- /// Application entry point
- /// </summary>
- /// <param name="args">command line arguments</param>
- public static void Main(string[] args)
- {
- // Log an info level message
- if (log.IsInfoEnabled) log.Info("Application [SampleLayoutsApp] Start");
-
- // Log a debug message. Test if debug is enabled before
- // attempting to log the message. This is not required but
- // can make running without logging faster.
- if (log.IsDebugEnabled) log.Debug("This is a debug message");
-
- log.Info("This is a long line of logging text. This should test if the LineWrappingLayout works. This text should be wrapped over multiple lines of output. Could you get a log message longer than this?");
-
- log.Error("Hey this is an error!");
-
- // Log an info level message
- if (log.IsInfoEnabled) log.Info("Application [SampleLayoutsApp] End");
-
- Console.Write("Press Enter to exit...");
- Console.ReadLine();
- }
- }
-}
diff --git a/examples/net/2.0/Layouts/SampleLayoutsApp/cs/src/SampleLayoutsApp.csproj b/examples/net/2.0/Layouts/SampleLayoutsApp/cs/src/SampleLayoutsApp.csproj
deleted file mode 100644
index a93ac94..0000000
--- a/examples/net/2.0/Layouts/SampleLayoutsApp/cs/src/SampleLayoutsApp.csproj
+++ /dev/null
@@ -1,142 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <ProjectType>Local</ProjectType>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{CD7A8094-D383-46BC-A75D-9F65F746E24F}</ProjectGuid>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ApplicationIcon>
- </ApplicationIcon>
- <AssemblyKeyContainerName>
- </AssemblyKeyContainerName>
- <AssemblyName>SampleLayoutsApp</AssemblyName>
- <AssemblyOriginatorKeyFile>
- </AssemblyOriginatorKeyFile>
- <DefaultClientScript>JScript</DefaultClientScript>
- <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
- <DefaultTargetSchema>IE50</DefaultTargetSchema>
- <DelaySign>false</DelaySign>
- <OutputType>Exe</OutputType>
- <RootNamespace>SampleLayoutsApp</RootNamespace>
- <StartupObject>SampleLayoutsApp.LoggingExample</StartupObject>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <OutputPath>..\build\debug\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <ConfigurationOverrideFile>
- </ConfigurationOverrideFile>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <DocumentationFile>
- </DocumentationFile>
- <DebugSymbols>true</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <Optimize>false</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>full</DebugType>
- <ErrorReport>prompt</ErrorReport>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <OutputPath>..\build\release\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <ConfigurationOverrideFile>
- </ConfigurationOverrideFile>
- <DefineConstants>TRACE</DefineConstants>
- <DocumentationFile>
- </DocumentationFile>
- <DebugSymbols>false</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <Optimize>true</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>none</DebugType>
- <ErrorReport>prompt</ErrorReport>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\..\..\..\..\bin\net\2.0\debug\log4net.dll</HintPath>
- </Reference>
- <Reference Include="System">
- <Name>System</Name>
- </Reference>
- <Reference Include="System.Data">
- <Name>System.Data</Name>
- </Reference>
- <Reference Include="System.Messaging">
- <Name>System.Messaging</Name>
- </Reference>
- <Reference Include="System.Web">
- <Name>System.Web</Name>
- </Reference>
- <Reference Include="System.Windows.Forms">
- <Name>System.Windows.Forms</Name>
- </Reference>
- <Reference Include="System.Xml">
- <Name>System.XML</Name>
- </Reference>
- </ItemGroup>
- <ItemGroup>
- <None Include="App.config" />
- <Compile Include="..\..\..\..\..\..\..\src\AssemblyVersionInfo.cs">
- <Link>AssemblyVersionInfo.cs</Link>
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="AssemblyInfo.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Layout\ForwardingLayout.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Layout\LevelConversionPattern.cs" />
- <Compile Include="Layout\LevelPatternLayout.cs" />
- <Compile Include="Layout\LineWrappingLayout.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="LoggingExample.cs">
- <SubType>Code</SubType>
- </Compile>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <PropertyGroup>
- <PreBuildEvent>
- </PreBuildEvent>
- <PostBuildEvent>
- </PostBuildEvent>
- </PropertyGroup>
-</Project>
diff --git a/examples/net/2.0/Layouts/SampleLayoutsApp/nant.build b/examples/net/2.0/Layouts/SampleLayoutsApp/nant.build
deleted file mode 100644
index b39fc61..0000000
--- a/examples/net/2.0/Layouts/SampleLayoutsApp/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="samplelayoutssapp-example" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile ConsoleApp example -->
- <target name="compile" description="Builds SampleLayoutsApp example">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/net/2.0/Layouts/SampleLayoutsApp/nant.config b/examples/net/2.0/Layouts/SampleLayoutsApp/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/net/2.0/Layouts/SampleLayoutsApp/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/net/2.0/Layouts/nant.build b/examples/net/2.0/Layouts/nant.build
deleted file mode 100644
index c245137..0000000
--- a/examples/net/2.0/Layouts/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="layout-examples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile Tutorials examples -->
- <target name="compile" description="Builds Layout examples">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/net/2.0/Layouts/nant.config b/examples/net/2.0/Layouts/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/net/2.0/Layouts/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/net/2.0/Performance/NotLogging/cs/nant.build b/examples/net/2.0/Performance/NotLogging/cs/nant.build
deleted file mode 100644
index 42f8712..0000000
--- a/examples/net/2.0/Performance/NotLogging/cs/nant.build
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- copy log4net build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="${log4net.output.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- compile the example -->
- <csc noconfig="true" target="exe" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.csc}" output="${current.bin.dir}/NotLogging.exe">
- <sources>
- <include name="src/**/*.cs" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.cs" />
- </sources>
- <references basedir="${current.bin.dir}">
- <include name="log4net.dll" />
- </references>
- </csc>
- </target>
-</project>
diff --git a/examples/net/2.0/Performance/NotLogging/cs/nant.config b/examples/net/2.0/Performance/NotLogging/cs/nant.config
deleted file mode 100644
index 52613e8..0000000
--- a/examples/net/2.0/Performance/NotLogging/cs/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/net/2.0/Performance/NotLogging/cs/src/AssemblyInfo.cs b/examples/net/2.0/Performance/NotLogging/cs/src/AssemblyInfo.cs
deleted file mode 100644
index b278ed8..0000000
--- a/examples/net/2.0/Performance/NotLogging/cs/src/AssemblyInfo.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// 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("log4net - NotLogging")]
-[assembly: AssemblyDescription("log4net performance test - NotLogging")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyProduct("log4net - NotLogging")]
-[assembly: AssemblyCulture("")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("")]
-[assembly: AssemblyKeyName("")]
diff --git a/examples/net/2.0/Performance/NotLogging/cs/src/NotLogging.cs b/examples/net/2.0/Performance/NotLogging/cs/src/NotLogging.cs
deleted file mode 100644
index 8b51d80..0000000
--- a/examples/net/2.0/Performance/NotLogging/cs/src/NotLogging.cs
+++ /dev/null
@@ -1,437 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-namespace NotLogging
-{
- using System;
- using System.Collections;
-
- using log4net;
- using log4net.Appender;
- using log4net.Layout;
- using log4net.Repository;
- using log4net.Repository.Hierarchy;
-
- public class NotLogging
- {
- #region Init Code
-
- private static int WARM_UP_CYCLES = 10000;
-
- static readonly ILog SHORT_LOG = LogManager.GetLogger("A0123456789");
- static readonly ILog MEDIUM_LOG= LogManager.GetLogger("A0123456789.B0123456789");
- static readonly ILog LONG_LOG = LogManager.GetLogger("A0123456789.B0123456789.C0123456789");
-
- static readonly ILog INEXISTENT_SHORT_LOG = LogManager.GetLogger("I0123456789");
- static readonly ILog INEXISTENT_MEDIUM_LOG= LogManager.GetLogger("I0123456789.B0123456789");
- static readonly ILog INEXISTENT_LONG_LOG = LogManager.GetLogger("I0123456789.B0123456789.C0123456789");
-
-
- static readonly ILog[] LOG_ARRAY = new ILog[] {
- SHORT_LOG,
- MEDIUM_LOG,
- LONG_LOG,
- INEXISTENT_SHORT_LOG,
- INEXISTENT_MEDIUM_LOG,
- INEXISTENT_LONG_LOG};
-
- static readonly TimedTest[] TIMED_TESTS = new TimedTest[] {
- new SimpleMessage_Bare(),
- new SimpleMessage_Array(),
- new SimpleMessage_MethodGuard_Bare(),
- new SimpleMessage_LocalGuard_Bare(),
- new ComplexMessage_Bare(),
- new ComplexMessage_Array(),
- new ComplexMessage_MethodGuard_Bare(),
- new ComplexMessage_MethodGuard_Array(),
- new ComplexMessage_MemberGuard_Bare(),
- new ComplexMessage_LocalGuard_Bare()};
-
- private static void Usage()
- {
- System.Console.WriteLine(
- "Usage: NotLogging <true|false> <runLength>" + Environment.NewLine +
- "\t true indicates shipped code" + Environment.NewLine +
- "\t false indicates code in development" + Environment.NewLine +
- "\t runLength is an int representing the run length of loops" + Environment.NewLine +
- "\t We suggest that runLength be at least 1000000 (1 million).");
- Environment.Exit(1);
- }
-
-
- /// <summary>
- /// Program wide initialization method
- /// </summary>
- /// <param name="args"></param>
- private static int ProgramInit(String[] args)
- {
- int runLength = 0;
-
- try
- {
- runLength = int.Parse(args[1]);
- }
- catch(Exception e)
- {
- System.Console.Error.WriteLine(e);
- Usage();
- }
-
- ConsoleAppender appender = new ConsoleAppender();
- appender.Layout = new SimpleLayout();
- ((SimpleLayout)appender.Layout).ActivateOptions();
- appender.ActivateOptions();
-
- if("false" == args[0])
- {
- // nothing to do
- }
- else if ("true" == args[0])
- {
- System.Console.WriteLine("Flagging as shipped code.");
- ((Hierarchy)LogManager.GetRepository()).Threshold = log4net.Core.Level.Warn;
- }
- else
- {
- Usage();
- }
-
- ((Logger)SHORT_LOG.Logger).Level = log4net.Core.Level.Info;
- ((Hierarchy)LogManager.GetRepository()).Root.Level = log4net.Core.Level.Info;
- ((Hierarchy)LogManager.GetRepository()).Root.AddAppender(appender);
-
- return runLength;
- }
-
- #endregion
-
- /// <summary>
- /// The main entry point for the application.
- /// </summary>
- [STAThread]
- static void Main(string[] argv)
- {
- if (System.Diagnostics.Debugger.IsAttached)
- {
- WARM_UP_CYCLES = 0;
- argv = new string[] { "false", "2" };
- }
- if(argv.Length != 2)
- {
- Usage();
- }
-
- int runLength = ProgramInit(argv);
-
- System.Console.WriteLine();
- System.Console.Write("Warming Up...");
-
- if (WARM_UP_CYCLES > 0)
- {
- foreach(ILog logger in LOG_ARRAY)
- {
- foreach(TimedTest timedTest in TIMED_TESTS)
- {
- timedTest.Run(logger, WARM_UP_CYCLES);
- }
- }
- }
- System.Console.WriteLine("Done");
- System.Console.WriteLine();
-
- // Calculate maximum description length
- int maxDescLen = 0;
- foreach(TimedTest timedTest in TIMED_TESTS)
- {
- maxDescLen = Math.Max(maxDescLen, timedTest.Description.Length);
- }
-
- string formatString = "{0,-"+(maxDescLen+1)+"} {1,9:G} ticks. Log: {2}";
- double delta;
-
- ArrayList averageData = new ArrayList();
-
- foreach(TimedTest timedTest in TIMED_TESTS)
- {
- double total = 0;
- foreach(ILog logger in LOG_ARRAY)
- {
- delta = timedTest.Run(logger, runLength);
- System.Console.WriteLine(string.Format(formatString, timedTest.Description, delta, ((Logger)logger.Logger).Name));
-
- total += delta;
- }
- System.Console.WriteLine();
-
- averageData.Add(new object[] { timedTest, total/((double)LOG_ARRAY.Length) });
- }
- System.Console.WriteLine();
- System.Console.WriteLine("Averages:");
- System.Console.WriteLine();
-
- foreach(object[] pair in averageData)
- {
- string avgFormatString = "{0,-"+(maxDescLen+1)+"} {1,9:G} ticks.";
- System.Console.WriteLine(string.Format(avgFormatString, ((TimedTest)pair[0]).Description, ((double)pair[1])));
- }
- }
- }
-
- abstract class TimedTest
- {
- abstract public double Run(ILog log, long runLength);
- abstract public string Description {get;}
- }
-
- #region Tests calling Debug(string)
-
- class SimpleMessage_Bare : TimedTest
- {
- override public double Run(ILog log, long runLength)
- {
- DateTime before = DateTime.Now;
- for(int i = 0; i < runLength; i++)
- {
- log.Debug("msg");
- }
- DateTime after = DateTime.Now;
- TimeSpan diff = after - before;
- return ((double)diff.Ticks)/((double)runLength);
- }
-
- override public string Description
- {
- get { return "log.Debug(\"msg\");"; }
- }
- }
- class ComplexMessage_MethodGuard_Bare : TimedTest
- {
- override public double Run(ILog log, long runLength)
- {
- DateTime before = DateTime.Now;
- for(int i = 0; i < runLength; i++)
- {
- if(log.IsDebugEnabled)
- {
- log.Debug("msg" + i + "msg");
- }
- }
- DateTime after = DateTime.Now;
- TimeSpan diff = after - before;
- return ((double)diff.Ticks)/((double)runLength);
- }
-
- override public string Description
- {
- get { return "if(log.IsDebugEnabled) log.Debug(\"msg\" + i + \"msg\");"; }
- }
- }
- class ComplexMessage_Bare : TimedTest
- {
- override public double Run(ILog log, long runLength)
- {
- DateTime before = DateTime.Now;
- for(int i = 0; i < runLength; i++)
- {
- log.Debug("msg" + i + "msg");
- }
- DateTime after = DateTime.Now;
- TimeSpan diff = after - before;
- return ((double)diff.Ticks)/((double)runLength);
- }
-
- override public string Description
- {
- get { return "log.Debug(\"msg\" + i + \"msg\");"; }
- }
- }
-
- #endregion
-
- #region Tests calling Debug(new object[] { ... })
-
- class SimpleMessage_Array : TimedTest
- {
- override public double Run(ILog log, long runLength)
- {
- DateTime before = DateTime.Now;
- for(int i = 0; i < runLength; i++)
- {
- log.Debug(new object[] { "msg" });
- }
- DateTime after = DateTime.Now;
- TimeSpan diff = after - before;
- return ((double)diff.Ticks)/((double)runLength);
- }
-
- override public string Description
- {
- get { return "log.Debug(new object[] { \"msg\" });"; }
- }
- }
- class ComplexMessage_MethodGuard_Array : TimedTest
- {
- override public double Run(ILog log, long runLength)
- {
- DateTime before = DateTime.Now;
- for(int i = 0; i < runLength; i++)
- {
- if(log.IsDebugEnabled)
- {
- log.Debug(new object[] { "msg" , i , "msg" });
- }
- }
- DateTime after = DateTime.Now;
- TimeSpan diff = after - before;
- return ((double)diff.Ticks)/((double)runLength);
- }
-
- override public string Description
- {
- get { return "if(log.IsDebugEnabled) log.Debug(new object[] { \"msg\" , i , \"msg\" });"; }
- }
- }
- class ComplexMessage_Array : TimedTest
- {
- override public double Run(ILog log, long runLength)
- {
- DateTime before = DateTime.Now;
- for(int i = 0; i < runLength; i++)
- {
- log.Debug(new object[] { "msg" , i , "msg" });
- }
- DateTime after = DateTime.Now;
- TimeSpan diff = after - before;
- return ((double)diff.Ticks)/((double)runLength);
- }
-
- override public string Description
- {
- get { return "log.Debug(new object[] { \"msg\" , i , \"msg\" });"; }
- }
- }
-
- #endregion
-
- #region Tests calling Debug(string) (using class members)
-
- class ComplexMessage_MemberGuard_Bare : TimedTest
- {
- override public double Run(ILog log, long runLength)
- {
- return (new Impl(log)).Run(runLength);
- }
-
- override public string Description
- {
- get { return "if(m_isEnabled) m_log.Debug(\"msg\" + i + \"msg\");"; }
- }
-
- class Impl
- {
- private readonly ILog m_log;
- private readonly bool m_isEnabled;
-
- public Impl(ILog log)
- {
- m_log = log;
- m_isEnabled = m_log.IsDebugEnabled;
- }
-
- public double Run(long runLength)
- {
-
- DateTime before = DateTime.Now;
- for(int i = 0; i < runLength; i++)
- {
- if(m_isEnabled)
- {
- m_log.Debug("msg" + i + "msg");
- }
- }
- DateTime after = DateTime.Now;
- TimeSpan diff = after - before;
- return ((double)diff.Ticks)/((double)runLength);
- }
- }
- }
- class SimpleMessage_LocalGuard_Bare : TimedTest
- {
- override public double Run(ILog log, long runLength)
- {
- bool isEnabled = log.IsDebugEnabled;
-
- DateTime before = DateTime.Now;
- for(int i = 0; i < runLength; i++)
- {
- if (isEnabled) log.Debug("msg");
- }
- DateTime after = DateTime.Now;
- TimeSpan diff = after - before;
- return ((double)diff.Ticks)/((double)runLength);
- }
-
- override public string Description
- {
- get { return "if (isEnabled) log.Debug(\"msg\");"; }
- }
- }
- class SimpleMessage_MethodGuard_Bare : TimedTest
- {
- override public double Run(ILog log, long runLength)
- {
- DateTime before = DateTime.Now;
- for(int i = 0; i < runLength; i++)
- {
- if (log.IsDebugEnabled) log.Debug("msg");
- }
- DateTime after = DateTime.Now;
- TimeSpan diff = after - before;
- return ((double)diff.Ticks)/((double)runLength);
- }
-
- override public string Description
- {
- get { return "if (log.IsDebugEnabled) log.Debug(\"msg\");"; }
- }
- }
- class ComplexMessage_LocalGuard_Bare : TimedTest
- {
- override public double Run(ILog log, long runLength)
- {
- bool isEnabled = log.IsDebugEnabled;
-
- DateTime before = DateTime.Now;
- for(int i = 0; i < runLength; i++)
- {
- if(isEnabled) log.Debug("msg" + i + "msg");
- }
- DateTime after = DateTime.Now;
- TimeSpan diff = after - before;
- return ((double)diff.Ticks)/((double)runLength);
- }
-
- override public string Description
- {
- get { return "if (isEnabled) log.Debug(\"msg\" + i + \"msg\");"; }
- }
- }
- #endregion
-
-}
diff --git a/examples/net/2.0/Performance/NotLogging/cs/src/NotLogging.csproj b/examples/net/2.0/Performance/NotLogging/cs/src/NotLogging.csproj
deleted file mode 100644
index f13c2bf..0000000
--- a/examples/net/2.0/Performance/NotLogging/cs/src/NotLogging.csproj
+++ /dev/null
@@ -1,131 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <ProjectType>Local</ProjectType>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{79B1930A-63AE-4640-B130-084687B3EDD7}</ProjectGuid>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ApplicationIcon>
- </ApplicationIcon>
- <AssemblyKeyContainerName>
- </AssemblyKeyContainerName>
- <AssemblyName>NotLogging</AssemblyName>
- <AssemblyOriginatorKeyFile>
- </AssemblyOriginatorKeyFile>
- <DefaultClientScript>JScript</DefaultClientScript>
- <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
- <DefaultTargetSchema>IE50</DefaultTargetSchema>
- <DelaySign>false</DelaySign>
- <OutputType>Exe</OutputType>
- <RootNamespace>NotLogging</RootNamespace>
- <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
- <StartupObject>NotLogging.NotLogging</StartupObject>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <OutputPath>..\build\debug\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <ConfigurationOverrideFile>
- </ConfigurationOverrideFile>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <DocumentationFile>
- </DocumentationFile>
- <DebugSymbols>true</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <NoStdLib>false</NoStdLib>
- <NoWarn>
- </NoWarn>
- <Optimize>false</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>full</DebugType>
- <ErrorReport>prompt</ErrorReport>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <OutputPath>..\build\release\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <ConfigurationOverrideFile>
- </ConfigurationOverrideFile>
- <DefineConstants>TRACE</DefineConstants>
- <DocumentationFile>
- </DocumentationFile>
- <DebugSymbols>false</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <NoStdLib>false</NoStdLib>
- <NoWarn>
- </NoWarn>
- <Optimize>true</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>none</DebugType>
- <ErrorReport>prompt</ErrorReport>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\..\..\..\..\bin\net\2.0\debug\log4net.dll</HintPath>
- </Reference>
- <Reference Include="System">
- <Name>System</Name>
- </Reference>
- <Reference Include="System.Data">
- <Name>System.Data</Name>
- </Reference>
- <Reference Include="System.Xml">
- <Name>System.XML</Name>
- </Reference>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="..\..\..\..\..\..\..\src\AssemblyVersionInfo.cs">
- <Link>AssemblyVersionInfo.cs</Link>
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="AssemblyInfo.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="NotLogging.cs">
- <SubType>Code</SubType>
- </Compile>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <PropertyGroup>
- <PreBuildEvent>
- </PreBuildEvent>
- <PostBuildEvent>
- </PostBuildEvent>
- </PropertyGroup>
-</Project>
diff --git a/examples/net/2.0/Performance/NotLogging/nant.build b/examples/net/2.0/Performance/NotLogging/nant.build
deleted file mode 100644
index 5917924..0000000
--- a/examples/net/2.0/Performance/NotLogging/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="notlogging-example" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile NotLogging example -->
- <target name="compile" description="Builds NotLogging example">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/net/2.0/Performance/NotLogging/nant.config b/examples/net/2.0/Performance/NotLogging/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/net/2.0/Performance/NotLogging/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/net/2.0/Performance/NotLogging/vb/nant.build b/examples/net/2.0/Performance/NotLogging/vb/nant.build
deleted file mode 100644
index e437cff..0000000
--- a/examples/net/2.0/Performance/NotLogging/vb/nant.build
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- copy log4net build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="${log4net.output.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- compile the example -->
- <vbc target="exe" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.vbc}" output="${current.bin.dir}/NotLogging.exe">
- <sources>
- <include name="src/**/*.vb" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.vb" />
- </sources>
- <references basedir="${current.bin.dir}">
- <include name="log4net.dll" />
- </references>
- </vbc>
- </target>
-</project>
diff --git a/examples/net/2.0/Performance/NotLogging/vb/nant.config b/examples/net/2.0/Performance/NotLogging/vb/nant.config
deleted file mode 100644
index 52613e8..0000000
--- a/examples/net/2.0/Performance/NotLogging/vb/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/net/2.0/Performance/NotLogging/vb/src/AssemblyInfo.vb b/examples/net/2.0/Performance/NotLogging/vb/src/AssemblyInfo.vb
deleted file mode 100644
index 9a4ba4d..0000000
--- a/examples/net/2.0/Performance/NotLogging/vb/src/AssemblyInfo.vb
+++ /dev/null
@@ -1,61 +0,0 @@
-#Region "Apache License"
-'
-' Licensed to the Apache Software Foundation (ASF) under one or more
-' contributor license agreements. See the NOTICE file distributed with
-' this work for additional information regarding copyright ownership.
-' The ASF licenses this file to you 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.
-'
-#End Region
-
-Imports System.Reflection
-Imports System.Runtime.CompilerServices
-
-'
-' 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("log4net - NotLogging")>
-<Assembly:AssemblyDescription("log4net NotLogging")>
-<Assembly:AssemblyConfiguration("")>
-<Assembly:AssemblyProduct("log4net - NotLogging")>
-<Assembly:AssemblyCulture("")>
-
-'
-' In order to sign your assembly you must specify a key to use. Refer to the
-' Microsoft .NET Framework documentation for more information on assembly signing.
-'
-' Use the attributes below to control which key is used for signing.
-'
-' Notes:
-' (*) If no key is specified, the assembly is not signed.
-' (*) KeyName refers to a key that has been installed in the Crypto Service
-' Provider (CSP) on your machine. KeyFile refers to a file which contains
-' a key.
-' (*) If the KeyFile and the KeyName values are both specified, the
-' following processing occurs:
-' (1) If the KeyName can be found in the CSP, that key is used.
-' (2) If the KeyName does not exist and the KeyFile does exist, the key
-' in the KeyFile is installed into the CSP and used.
-' (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-' When specifying the KeyFile, the location of the KeyFile should be
-' relative to the project output directory which is
-' %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-' located in the project directory, you would specify the AssemblyKeyFile
-' attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-' (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-' documentation for more information on this.
-'
-<Assembly:AssemblyDelaySign(false)>
-<Assembly:AssemblyKeyFile("")>
-<Assembly:AssemblyKeyName("")>
diff --git a/examples/net/2.0/Performance/NotLogging/vb/src/NotLogging.vb b/examples/net/2.0/Performance/NotLogging/vb/src/NotLogging.vb
deleted file mode 100644
index 6d79c08..0000000
--- a/examples/net/2.0/Performance/NotLogging/vb/src/NotLogging.vb
+++ /dev/null
@@ -1,417 +0,0 @@
-#Region "Apache License"
-'
-' Licensed to the Apache Software Foundation (ASF) under one or more
-' contributor license agreements. See the NOTICE file distributed with
-' this work for additional information regarding copyright ownership.
-' The ASF licenses this file to you 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.
-'
-#End Region
-
-Imports System
-Imports System.Collections
-
-Imports Microsoft.VisualBasic
-
-Imports log4net
-Imports log4net.Appender
-Imports log4net.Layout
-Imports log4net.Repository
-Imports log4net.Repository.Hierarchy
-
-Namespace NotLogging
- Public Class NotLogging
- #Region "Init Code"
-
- Private Shared WARM_UP_CYCLES As Integer = 10000
-
- Shared ReadOnly SHORT_LOG As ILog = LogManager.GetLogger("A0123456789")
- Shared ReadOnly MEDIUM_LOG As ILog = LogManager.GetLogger("A0123456789.B0123456789")
- Shared ReadOnly LONG_LOG As ILog = LogManager.GetLogger("A0123456789.B0123456789.C0123456789")
-
- Shared ReadOnly INEXISTENT_SHORT_LOG As ILog = LogManager.GetLogger("I0123456789")
- Shared ReadOnly INEXISTENT_MEDIUM_LOG As ILog = LogManager.GetLogger("I0123456789.B0123456789")
- Shared ReadOnly INEXISTENT_LONG_LOG As ILog = LogManager.GetLogger("I0123456789.B0123456789.C0123456789")
-
- Shared ReadOnly LOG_ARRAY As ILog() = New ILog() { _
- SHORT_LOG, _
- MEDIUM_LOG, _
- LONG_LOG, _
- INEXISTENT_SHORT_LOG, _
- INEXISTENT_MEDIUM_LOG, _
- INEXISTENT_LONG_LOG}
-
- Shared ReadOnly TIMED_TESTS As TimedTest() = New TimedTest() { _
- New SimpleMessage_Bare(), _
- New SimpleMessage_Array(), _
- New SimpleMessage_MethodGuard_Bare(), _
- New SimpleMessage_LocalGuard_Bare(), _
- New ComplexMessage_Bare(), _
- New ComplexMessage_Array(), _
- New ComplexMessage_MethodGuard_Bare(), _
- New ComplexMessage_MethodGuard_Array(), _
- New ComplexMessage_MemberGuard_Bare(), _
- New ComplexMessage_LocalGuard_Bare()}
-
- Private Shared Sub Usage()
- System.Console.WriteLine( _
- "Usage: NotLogging <true|false> <runLength>" & Environment.NewLine & _
- vbTab & " true indicates shipped code" & Environment.NewLine & _
- vbTab & " false indicates code in development" & Environment.NewLine & _
- vbTab & " runLength is an int representing the run length of loops" & Environment.NewLine & _
- vbTab & " We suggest that runLength be at least 1000000 (1 million).")
- Environment.Exit(1)
- End Sub
-
-
- ' Program wide initialization method
- Private Shared Function ProgramInit(Byval args As String()) As Integer
- Dim runLength As Integer = 0
-
- Try
- runLength = Integer.Parse(args(1))
- Catch e As Exception
- System.Console.Error.WriteLine(e)
- Usage()
- End Try
-
- Dim layout As SimpleLayout = new SimpleLayout()
- layout.ActivateOptions
- Dim appender As ConsoleAppender = new ConsoleAppender()
- appender.Layout = layout
- appender.ActivateOptions
-
- If "false" = args(0) Then
- ' nothing to do
- Else If "true" = args(0) Then
- System.Console.WriteLine("Flagging as shipped code.")
- CType(LogManager.GetRepository(), log4net.Repository.Hierarchy.Hierarchy).Threshold = log4net.Core.Level.Warn
- Else
- Usage()
- End If
-
- CType(SHORT_LOG.Logger, Logger).Level = log4net.Core.Level.Info
- CType(LogManager.GetRepository(), log4net.Repository.Hierarchy.Hierarchy).Root.Level = log4net.Core.Level.Info
- CType(LogManager.GetRepository(), log4net.Repository.Hierarchy.Hierarchy).Root.AddAppender(appender)
-
- Return runLength
- End Function
-
- #End Region
-
- ' The main entry point for the application.
- <STAThread()> Public Shared Sub Main(Byval argv As String())
- Dim loggerInstance As ILog
- Dim timedTestInstance As TimedTest
-
- If System.Diagnostics.Debugger.IsAttached Then
- WARM_UP_CYCLES = 0
- argv = New String() {"false", "2"}
- End If
- If argv.Length <> 2 Then
- Usage()
- End If
-
- Dim runLength As Integer = ProgramInit(argv)
-
- System.Console.WriteLine()
- System.Console.Write("Warming Up...")
-
- If WARM_UP_CYCLES > 0 Then
- For Each loggerInstance In LOG_ARRAY
- For Each timedTestInstance In TIMED_TESTS
- timedTestInstance.Run(loggerInstance, WARM_UP_CYCLES)
- Next
- Next
- End If
- System.Console.WriteLine("Done")
- System.Console.WriteLine()
-
- ' Calculate maximum description length
- Dim maxDescLen As Integer = 0
- For Each timedTestInstance In TIMED_TESTS
- maxDescLen = Math.Max(maxDescLen, timedTestInstance.Description.Length)
- Next
-
- Dim formatString As String = "{0,-" & (maxDescLen + 1) & "} {1,9:G} ticks. Log: {2}"
- Dim delta As Double
-
- Dim averageData As ArrayList = new ArrayList()
-
- For Each timedTestInstance In TIMED_TESTS
- Dim total As Double = 0
- For Each loggerInstance In LOG_ARRAY
- delta = timedTestInstance.Run(loggerInstance, runLength)
- System.Console.WriteLine(string.Format(formatString, timedTestInstance.Description, delta, CType(loggerInstance.Logger, Logger).Name))
-
- total = total + delta
- Next
- System.Console.WriteLine()
-
- averageData.Add(New Object() {timedTestInstance, total / Ctype(LOG_ARRAY.Length, Double)})
- Next
- System.Console.WriteLine()
- System.Console.WriteLine("Averages:")
- System.Console.WriteLine()
-
- Dim pair As Object()
- For Each pair In averageData
- Dim avgFormatString As String = "{0,-" & (maxDescLen + 1) & "} {1,9:G} ticks."
- System.Console.WriteLine(string.Format(avgFormatString, CType(pair(0), TimedTest).Description, CType(pair(1), Double)))
- Next
- End Sub
- End Class
-
- MustInherit Class TimedTest
- Public MustOverride Function Run(log As ILog, runLength As Long) As Double
- Public MustOverride ReadOnly Property Description() As String
- End Class
-
- #Region "Tests calling Debug(string)"
-
- Class SimpleMessage_Bare
- Inherits TimedTest
-
- Public Overrides Function Run(log As ILog, runLength As Long) As Double
- Dim before As DateTime = DateTime.Now
- Dim i as Integer
- For i = 0 To runLength - 1 Step 1
- log.Debug("msg")
- Next i
- Dim after As DateTime = DateTime.Now
- Dim diff As TimeSpan = after.Subtract(before)
- Return CType(diff.Ticks, Double) / CType(runLength, Double)
- End Function
-
- Public Overrides ReadOnly Property Description() As String
- Get
- Return "log.Debug(""msg"")"
- End Get
- End Property
- End Class
- Class ComplexMessage_MethodGuard_Bare
- Inherits TimedTest
-
- Public Overrides Function Run(log As ILog, runLength As Long) As Double
- Dim before As DateTime = DateTime.Now
- Dim i as Integer
- For i = 0 To runLength - 1 Step 1
- If log.IsDebugEnabled Then
- log.Debug("msg" & i & "msg")
- End If
- Next i
- Dim after As DateTime = DateTime.Now
- Dim diff As TimeSpan = after.Subtract(before)
- Return CType(diff.Ticks, Double) / CType(runLength, Double)
- End Function
-
- Public Overrides ReadOnly Property Description() As String
- Get
- Return "If log.IsDebugEnabled Then log.Debug(""msg"" & i & ""msg"")"
- End Get
- End Property
- End Class
- class ComplexMessage_Bare
- Inherits TimedTest
-
- Public Overrides Function Run(log As ILog, runLength As Long) As Double
- Dim before As DateTime = DateTime.Now
- Dim i as Integer
- For i = 0 To runLength - 1 Step 1
- log.Debug("msg" & i & "msg")
- Next i
- Dim after As DateTime = DateTime.Now
- Dim diff As TimeSpan = after.Subtract(before)
- Return CType(diff.Ticks, Double) / CType(runLength, Double)
- End Function
-
- Public Overrides ReadOnly Property Description() As String
- Get
- Return "log.Debug(""msg"" & i & ""msg"")"
- End Get
- End Property
- End Class
-
- #End Region
-
- #Region "Tests calling Debug(new object[] { ... })"
-
- Class SimpleMessage_Array
- Inherits TimedTest
-
- Public Overrides Function Run(log As ILog, runLength As Long) As Double
- Dim before As DateTime = DateTime.Now
- Dim i as Integer
- For i = 0 To runLength - 1 Step 1
- log.Debug(New Object() {"msg"})
- Next i
- Dim after As DateTime = DateTime.Now
- Dim diff As TimeSpan = after.Subtract(before)
- Return CType(diff.Ticks, Double) / CType(runLength, Double)
- End Function
-
- Public Overrides ReadOnly Property Description() As String
- Get
- Return "log.Debug(New Object() {""msg""})"
- End Get
- End Property
- End Class
- Class ComplexMessage_MethodGuard_Array
- Inherits TimedTest
-
- Public Overrides Function Run(log As ILog, runLength As Long) As Double
- Dim before As DateTime = DateTime.Now
- Dim i as Integer
- For i = 0 To runLength - 1 Step 1
- If log.IsDebugEnabled Then
- log.Debug(New Object() {"msg", i, "msg"})
- End If
- Next i
- Dim after As DateTime = DateTime.Now
- Dim diff As TimeSpan = after.Subtract(before)
- Return CType(diff.Ticks, Double) / CType(runLength, Double)
- End Function
-
- Public Overrides ReadOnly Property Description() As String
- Get
- Return "If log.IsDebugEnabled Then log.Debug(New Object() {""msg"", i, ""msg""})"
- End Get
- End Property
- End Class
- Class ComplexMessage_Array
- Inherits TimedTest
-
- Public Overrides Function Run(log As ILog, runLength As Long) As Double
- Dim before As DateTime = DateTime.Now
- Dim i as Integer
- For i = 0 To runLength - 1 Step 1
- log.Debug(New Object() {"msg", i, "msg"})
- Next i
- Dim after As DateTime = DateTime.Now
- Dim diff As TimeSpan = after.Subtract(before)
- Return CType(diff.Ticks, Double) / CType(runLength, Double)
- End Function
-
- Public Overrides ReadOnly Property Description() As String
- Get
- Return "log.Debug(New Object() {""msg"", i, ""msg""})"
- End Get
- End Property
- End Class
-
- #End Region
-
- #Region "Tests calling Debug(string) (using class members)"
-
- Class ComplexMessage_MemberGuard_Bare
- Inherits TimedTest
-
- Public Overrides Function Run(log As ILog, runLength As Long) As Double
- Return (New Impl(log)).Run(runLength)
- End Function
-
- Public Overrides ReadOnly Property Description() As String
- Get
- Return "If m_isEnabled Then m_log.Debug(""msg"" & i & ""msg"")"
- End Get
- End Property
-
- Class Impl
- Private Readonly m_log As ILog
- Private Readonly m_isEnabled As Boolean
-
- Public Sub New(log As ILog)
- m_log = log
- m_isEnabled = m_log.IsDebugEnabled
- End Sub
-
- Public Function Run(runLength As Long) As Double
- Dim before As DateTime = DateTime.Now
- Dim i as Integer
- For i = 0 To runLength - 1 Step 1
- If m_isEnabled Then
- m_log.Debug("msg" & i & "msg")
- End If
- Next i
- Dim after As DateTime = DateTime.Now
- Dim diff As TimeSpan = after.Subtract(before)
- Return CType(diff.Ticks, Double) / CType(runLength, Double)
- End Function
- End Class
- End Class
- Class SimpleMessage_LocalGuard_Bare
- Inherits TimedTest
-
- Public Overrides Function Run(log As ILog, runLength As Long) As Double
- Dim isEnabled As Boolean = log.IsDebugEnabled
-
- Dim before As DateTime = DateTime.Now
- Dim i as Integer
- For i = 0 To runLength - 1 Step 1
- If isEnabled Then log.Debug("msg")
- Next i
- Dim after As DateTime = DateTime.Now
- Dim diff As TimeSpan = after.Subtract(before)
- Return CType(diff.Ticks, Double) / CType(runLength, Double)
- End Function
-
- Public Overrides ReadOnly Property Description() As String
- Get
- Return "If isEnabled Then log.Debug(""msg"")"
- End Get
- End Property
- End Class
- Class SimpleMessage_MethodGuard_Bare
- Inherits TimedTest
-
- Public Overrides Function Run(log As ILog, runLength As Long) As Double
- Dim before As DateTime = DateTime.Now
- Dim i as Integer
- For i = 0 To runLength - 1 Step 1
- If log.IsDebugEnabled Then log.Debug("msg")
- Next i
- Dim after As DateTime = DateTime.Now
- Dim diff As TimeSpan = after.Subtract(before)
- Return CType(diff.Ticks, Double) / CType(runLength, Double)
- End Function
-
- Public Overrides ReadOnly Property Description() As String
- Get
- Return "If log.IsDebugEnabled Then log.Debug(""msg"")"
- End Get
- End Property
- End Class
- Class ComplexMessage_LocalGuard_Bare
- Inherits TimedTest
-
- Public Overrides Function Run(log As ILog, runLength As Long) As Double
- Dim isEnabled As Boolean = log.IsDebugEnabled
-
- Dim before As DateTime = DateTime.Now
- Dim i as Integer
- For i = 0 To runLength - 1 Step 1
- If isEnabled Then log.Debug("msg" & i & "msg")
- Next i
- Dim after As DateTime = DateTime.Now
- Dim diff As TimeSpan = after.Subtract(before)
- Return CType(diff.Ticks, Double) / CType(runLength, Double)
- End Function
-
- Public Overrides ReadOnly Property Description() As String
- Get
- Return "If isEnabled Then log.Debug(""msg"" & i & ""msg"")"
- End Get
- End Property
- End Class
-
- #End Region
-End Namespace
diff --git a/examples/net/2.0/Performance/NotLogging/vb/src/NotLogging.vbproj b/examples/net/2.0/Performance/NotLogging/vb/src/NotLogging.vbproj
deleted file mode 100644
index 8124f71..0000000
--- a/examples/net/2.0/Performance/NotLogging/vb/src/NotLogging.vbproj
+++ /dev/null
@@ -1,130 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<VisualStudioProject>
- <VisualBasic
- ProjectType = "Local"
- ProductVersion = "7.0.9466"
- SchemaVersion = "1.0"
- ProjectGuid = "{4ED8A816-5051-4494-AEE5-C54E18F59FD8}"
- >
- <Build>
- <Settings
- ApplicationIcon = ""
- AssemblyKeyContainerName = ""
- AssemblyName = "NotLogging"
- AssemblyOriginatorKeyFile = ""
- AssemblyOriginatorKeyMode = "None"
- DefaultClientScript = "JScript"
- DefaultHTMLPageLayout = "Grid"
- DefaultTargetSchema = "IE50"
- DelaySign = "false"
- OutputType = "Exe"
- OptionCompare = "Binary"
- OptionExplicit = "On"
- OptionStrict = "Off"
- RootNamespace = ""
- StartupObject = "NotLogging.NotLogging"
- >
- <Config
- Name = "Debug"
- BaseAddress = "285212672"
- ConfigurationOverrideFile = ""
- DefineConstants = ""
- DefineDebug = "true"
- DefineTrace = "true"
- DebugSymbols = "true"
- IncrementalBuild = "true"
- Optimize = "false"
- OutputPath = "..\build\debug\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "1"
- />
- <Config
- Name = "Release"
- BaseAddress = "285212672"
- ConfigurationOverrideFile = ""
- DefineConstants = ""
- DefineDebug = "false"
- DefineTrace = "true"
- DebugSymbols = "false"
- IncrementalBuild = "false"
- Optimize = "true"
- OutputPath = "..\build\release\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "1"
- />
- </Settings>
- <References>
- <Reference
- Name = "System"
- AssemblyName = "System"
- />
- <Reference
- Name = "System.Data"
- AssemblyName = "System.Data"
- />
- <Reference
- Name = "System.XML"
- AssemblyName = "System.Xml"
- />
- <Reference
- Name = "log4net"
- AssemblyName = "log4net"
- HintPath = "..\..\..\..\..\..\..\bin\net\1.0\release\log4net.dll"
- />
- </References>
- <Imports>
- <Import Namespace = "Microsoft.VisualBasic" />
- <Import Namespace = "System" />
- <Import Namespace = "System.Collections" />
- <Import Namespace = "System.Data" />
- <Import Namespace = "System.Diagnostics" />
- </Imports>
- </Build>
- <Files>
- <Include>
- <File
- RelPath = "AssemblyInfo.vb"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "AssemblyVersionInfo.vb"
- Link = "..\..\..\..\..\..\..\src\AssemblyVersionInfo.vb"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "NotLogging.vb"
- SubType = "Code"
- BuildAction = "Compile"
- />
- </Include>
- </Files>
- </VisualBasic>
-</VisualStudioProject>
-
diff --git a/examples/net/2.0/Performance/nant.build b/examples/net/2.0/Performance/nant.build
deleted file mode 100644
index 50cad4a..0000000
--- a/examples/net/2.0/Performance/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="performance-examples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile Performance examples -->
- <target name="compile" description="Builds Performance examples">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/net/2.0/Performance/nant.config b/examples/net/2.0/Performance/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/net/2.0/Performance/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/net/2.0/Remoting/RemotingClient/cs/nant.build b/examples/net/2.0/Remoting/RemotingClient/cs/nant.build
deleted file mode 100644
index df4035e..0000000
--- a/examples/net/2.0/Remoting/RemotingClient/cs/nant.build
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- copy log4net build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="${log4net.output.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- compile the example -->
- <csc noconfig="true" target="exe" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.csc}" output="${current.bin.dir}/RemotingClient.exe">
- <sources>
- <include name="src/**/*.cs" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.cs" />
- </sources>
- <references basedir="${current.bin.dir}">
- <include name="log4net.dll" />
- </references>
- </csc>
- <!-- copy the RemotingClient application configuration file -->
- <copy file="src/App.config" tofile="${current.bin.dir}/RemotingClient.exe.config" />
- </target>
-</project>
diff --git a/examples/net/2.0/Remoting/RemotingClient/cs/nant.config b/examples/net/2.0/Remoting/RemotingClient/cs/nant.config
deleted file mode 100644
index 52613e8..0000000
--- a/examples/net/2.0/Remoting/RemotingClient/cs/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/net/2.0/Remoting/RemotingClient/cs/src/App.config b/examples/net/2.0/Remoting/RemotingClient/cs/src/App.config
deleted file mode 100644
index 66cf766..0000000
--- a/examples/net/2.0/Remoting/RemotingClient/cs/src/App.config
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<!--
- .NET application configuration file
-
- This file must have the exact same name as your application with
- .config appended to it. For example if your application is testApp.exe
- then the config file must be testApp.exe.config it mut also be in the
- same directory as the application.
--->
-<configuration>
- <!-- Register a section handler for the log4net section -->
- <configSections>
- <section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
- </configSections>
- <!-- This section contains the log4net configuration settings -->
- <log4net debug="false">
- <!-- Define some output appenders -->
- <!-- Use the remoting appender -->
- <appender name="RemotingAppender" type="log4net.Appender.RemotingAppender" >
- <!-- The remoting URL to the remoting server object -->
- <sink value="tcp://localhost:8085/LoggingSink" />
- <!-- Send all events, do not discard events when the buffer is full -->
- <lossy value="false" />
- <!-- The number of events to buffer before sending -->
- <bufferSize value="95" />
- <!-- Do not store event data that is slow to generate -->
- <onlyFixPartialEventData value="true" />
- <!-- Specify an evaluator to send the events immediatly under
- certain conditions, e.g. when an error event ocurrs -->
- <!--
- <evaluator type="log4net.Core.LevelEvaluator">
- <threshold value="ERROR"/>
- </evaluator>
- -->
- </appender>
- <!-- Setup the root category, add the appenders and set the default priority -->
- <root>
- <level value="DEBUG" />
- <appender-ref ref="RemotingAppender" />
- </root>
- </log4net>
-</configuration>
diff --git a/examples/net/2.0/Remoting/RemotingClient/cs/src/AssemblyInfo.cs b/examples/net/2.0/Remoting/RemotingClient/cs/src/AssemblyInfo.cs
deleted file mode 100644
index 32ade26..0000000
--- a/examples/net/2.0/Remoting/RemotingClient/cs/src/AssemblyInfo.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// 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("log4net - RemotingClient")]
-[assembly: AssemblyDescription("log4net RemotingClient")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyProduct("log4net - RemotingClient")]
-[assembly: AssemblyCulture("")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("")]
-[assembly: AssemblyKeyName("")]
diff --git a/examples/net/2.0/Remoting/RemotingClient/cs/src/RemotingClient.cs b/examples/net/2.0/Remoting/RemotingClient/cs/src/RemotingClient.cs
deleted file mode 100644
index c98ed39..0000000
--- a/examples/net/2.0/Remoting/RemotingClient/cs/src/RemotingClient.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-// Configure log4net using the .config file
-[assembly: log4net.Config.XmlConfigurator()]
-
-namespace RemotingClient
-{
- using System;
- using System.Runtime.Remoting;
-
- /// <summary>
- /// Example of how to simply configure and use log4net
- /// </summary>
- public class RemotingClient
- {
- // Create a logger for use in this class
- private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
-
- /// <summary>
- /// Application entry point
- /// </summary>
- /// <param name="args">command line arguments</param>
- static void Main(string[] args)
- {
- // Log an info level message
- if (log.IsInfoEnabled) log.Info("Application [RemotingClient] Start");
-
- log.Fatal("First Fatal message");
-
- for(int i=0; i<8; i++)
- {
- log.Debug("Hello");
- }
-
- // Log a message with an exception and nested exception
- log.Error("An exception has occured", new Exception("Some exception", new Exception("Some nested exception")));
-
- for(int i=0; i<8; i++)
- {
- log.Debug("There");
- }
-
- // Stress test can be called here
- //StessTest();
-
- // Log an info level message
- if (log.IsInfoEnabled) log.Info("Application [RemotingClient] End");
- }
-
- // Example stress test.
- static void StessTest()
- {
- int milliStart = Environment.TickCount;
- for (int i=0; i<10000; i++)
- {
- log.Error("["+i+"] This is an error message");
- }
- int milliEnd = Environment.TickCount;
-
- Console.WriteLine("Test Run Time: "+TimeSpan.FromMilliseconds(milliEnd - milliStart).ToString());
- }
- }
-}
diff --git a/examples/net/2.0/Remoting/RemotingClient/cs/src/RemotingClient.csproj b/examples/net/2.0/Remoting/RemotingClient/cs/src/RemotingClient.csproj
deleted file mode 100644
index cc3b7e7..0000000
--- a/examples/net/2.0/Remoting/RemotingClient/cs/src/RemotingClient.csproj
+++ /dev/null
@@ -1,126 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <ProjectType>Local</ProjectType>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{F4CE6810-1C1B-4178-B637-4B05E3F6DE3C}</ProjectGuid>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ApplicationIcon>
- </ApplicationIcon>
- <AssemblyKeyContainerName>
- </AssemblyKeyContainerName>
- <AssemblyName>RemotingClient</AssemblyName>
- <AssemblyOriginatorKeyFile>
- </AssemblyOriginatorKeyFile>
- <DefaultClientScript>JScript</DefaultClientScript>
- <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
- <DefaultTargetSchema>IE50</DefaultTargetSchema>
- <DelaySign>false</DelaySign>
- <OutputType>Exe</OutputType>
- <RootNamespace>RemotingClient</RootNamespace>
- <StartupObject>
- </StartupObject>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <OutputPath>..\build\debug\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <ConfigurationOverrideFile>
- </ConfigurationOverrideFile>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <DocumentationFile>
- </DocumentationFile>
- <DebugSymbols>true</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <Optimize>false</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>full</DebugType>
- <ErrorReport>prompt</ErrorReport>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <OutputPath>..\build\release\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <ConfigurationOverrideFile>
- </ConfigurationOverrideFile>
- <DefineConstants>TRACE</DefineConstants>
- <DocumentationFile>
- </DocumentationFile>
- <DebugSymbols>false</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <Optimize>true</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>none</DebugType>
- <ErrorReport>prompt</ErrorReport>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\..\..\..\..\bin\net\2.0\debug\log4net.dll</HintPath>
- </Reference>
- <Reference Include="System">
- <Name>System</Name>
- </Reference>
- <Reference Include="System.Data">
- <Name>System.Data</Name>
- </Reference>
- <Reference Include="System.Xml">
- <Name>System.XML</Name>
- </Reference>
- </ItemGroup>
- <ItemGroup>
- <None Include="App.config" />
- <Compile Include="..\..\..\..\..\..\..\src\AssemblyVersionInfo.cs">
- <Link>AssemblyVersionInfo.cs</Link>
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="AssemblyInfo.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="RemotingClient.cs">
- <SubType>Code</SubType>
- </Compile>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <PropertyGroup>
- <PreBuildEvent>
- </PreBuildEvent>
- <PostBuildEvent>
- </PostBuildEvent>
- </PropertyGroup>
-</Project>
diff --git a/examples/net/2.0/Remoting/RemotingClient/nant.build b/examples/net/2.0/Remoting/RemotingClient/nant.build
deleted file mode 100644
index 3bdf4e3..0000000
--- a/examples/net/2.0/Remoting/RemotingClient/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="remotingclient-example" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile RemotingClient example -->
- <target name="compile" description="Builds RemotingClient example">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/net/2.0/Remoting/RemotingClient/nant.config b/examples/net/2.0/Remoting/RemotingClient/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/net/2.0/Remoting/RemotingClient/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/net/2.0/Remoting/RemotingServer/cs/nant.build b/examples/net/2.0/Remoting/RemotingServer/cs/nant.build
deleted file mode 100644
index 85267ae..0000000
--- a/examples/net/2.0/Remoting/RemotingServer/cs/nant.build
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- copy log4net build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="${log4net.output.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- compile the example -->
- <csc noconfig="true" target="exe" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.csc}" output="${current.bin.dir}/RemotingServer.exe">
- <sources>
- <include name="src/**/*.cs" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.cs" />
- </sources>
- <references basedir="${current.bin.dir}">
- <include name="log4net.dll" />
- </references>
- </csc>
- <!-- copy the RemotingServer application configuration file -->
- <copy file="src/App.config" tofile="${current.bin.dir}/RemotingServer.exe.config" />
- </target>
-</project>
diff --git a/examples/net/2.0/Remoting/RemotingServer/cs/nant.config b/examples/net/2.0/Remoting/RemotingServer/cs/nant.config
deleted file mode 100644
index 52613e8..0000000
--- a/examples/net/2.0/Remoting/RemotingServer/cs/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/net/2.0/Remoting/RemotingServer/cs/src/App.config b/examples/net/2.0/Remoting/RemotingServer/cs/src/App.config
deleted file mode 100644
index 9a8b391..0000000
--- a/examples/net/2.0/Remoting/RemotingServer/cs/src/App.config
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<configuration>
- <!-- Register a section handler for the log4net section -->
- <configSections>
- <section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
- </configSections>
- <!-- This section contains the log4net configuration settings -->
- <log4net>
- <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date [%thread] %-5level %logger (%property{log4net:HostName}) [%ndc] - %message%newline" />
- </layout>
- </appender>
- <appender name="LogFileAppender" type="log4net.Appender.FileAppender">
- <file value="log-file.txt" />
- <appendToFile value="true" />
- <layout type="log4net.Layout.PatternLayout">
- <header value="FILE HEADER " />
- <footer value="FILE FOOTER " />
- <conversionPattern value="%date [%thread] %-5level %logger (%property{log4net:HostName}) [%ndc] - %message%newline" />
- </layout>
- </appender>
- <root>
- <level value="DEBUG" />
- <appender-ref ref="ConsoleAppender" />
- <appender-ref ref="LogFileAppender" />
- </root>
- </log4net>
- <system.runtime.remoting>
- <application name="Log4netRemotingServer">
- <!-- We need to define the remoting channels on which we will publish
- the remote logging sink. -->
- <channels>
- <channel displayName="Server Channel" ref="tcp server" port="8085" />
- </channels>
- </application>
- </system.runtime.remoting>
-</configuration>
diff --git a/examples/net/2.0/Remoting/RemotingServer/cs/src/AssemblyInfo.cs b/examples/net/2.0/Remoting/RemotingServer/cs/src/AssemblyInfo.cs
deleted file mode 100644
index 56c2d00..0000000
--- a/examples/net/2.0/Remoting/RemotingServer/cs/src/AssemblyInfo.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// 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("log4net - RemotingServer")]
-[assembly: AssemblyDescription("log4net RemotingServer")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyProduct("log4net - RemotingServer")]
-[assembly: AssemblyCulture("")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("")]
-[assembly: AssemblyKeyName("")]
diff --git a/examples/net/2.0/Remoting/RemotingServer/cs/src/RemotingServer.cs b/examples/net/2.0/Remoting/RemotingServer/cs/src/RemotingServer.cs
deleted file mode 100644
index c5203f9..0000000
--- a/examples/net/2.0/Remoting/RemotingServer/cs/src/RemotingServer.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-// Configure log4net using the .config file
-[assembly: log4net.Config.XmlConfigurator()]
-
-namespace RemotingServer
-{
- using System;
- using System.Runtime.Remoting;
-
- /// <summary>
- /// Example of how to simply configure and use log4net
- /// </summary>
- public class RemotingServer
- {
- // Create a logger for use in this class
- private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
-
- /// <summary>
- /// Application entry point
- /// </summary>
- /// <param name="args">command line arguments</param>
- static void Main(string[] args)
- {
- // Log an info level message
- if (log.IsInfoEnabled) log.Info("Application [RemotingServer] Start");
-
- // Configure remoting. This loads the TCP channel as specified in the .config file.
- RemotingConfiguration.Configure(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile);
-
- // Publish the remote logging server. This is done using the log4net plugin.
- log4net.LogManager.GetRepository().PluginMap.Add(new log4net.Plugin.RemoteLoggingServerPlugin("LoggingSink"));
-
- // Wait for the user to exit
- Console.WriteLine("Press 0 and ENTER to Exit");
- String keyState = "";
- while (String.Compare(keyState,"0", true) != 0)
- {
- keyState = Console.ReadLine();
- }
-
- // Log an info level message
- if (log.IsInfoEnabled) log.Info("Application [RemotingServer] End");
- }
- }
-}
diff --git a/examples/net/2.0/Remoting/RemotingServer/cs/src/RemotingServer.csproj b/examples/net/2.0/Remoting/RemotingServer/cs/src/RemotingServer.csproj
deleted file mode 100644
index 6a172cc..0000000
--- a/examples/net/2.0/Remoting/RemotingServer/cs/src/RemotingServer.csproj
+++ /dev/null
@@ -1,125 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <ProjectType>Local</ProjectType>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{3A9BCF6F-FA1B-409A-93E9-7028F9A2A91F}</ProjectGuid>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ApplicationIcon>
- </ApplicationIcon>
- <AssemblyKeyContainerName>
- </AssemblyKeyContainerName>
- <AssemblyName>RemotingServer</AssemblyName>
- <AssemblyOriginatorKeyFile>
- </AssemblyOriginatorKeyFile>
- <DefaultClientScript>JScript</DefaultClientScript>
- <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
- <DefaultTargetSchema>IE50</DefaultTargetSchema>
- <DelaySign>false</DelaySign>
- <OutputType>Exe</OutputType>
- <RootNamespace>RemotingServer</RootNamespace>
- <StartupObject>RemotingServer.RemotingServer</StartupObject>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <OutputPath>..\build\debug\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <ConfigurationOverrideFile>
- </ConfigurationOverrideFile>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <DocumentationFile>
- </DocumentationFile>
- <DebugSymbols>true</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <Optimize>false</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>full</DebugType>
- <ErrorReport>prompt</ErrorReport>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <OutputPath>..\build\release\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <ConfigurationOverrideFile>
- </ConfigurationOverrideFile>
- <DefineConstants>TRACE</DefineConstants>
- <DocumentationFile>
- </DocumentationFile>
- <DebugSymbols>false</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <Optimize>true</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>none</DebugType>
- <ErrorReport>prompt</ErrorReport>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\..\..\..\..\bin\net\2.0\debug\log4net.dll</HintPath>
- </Reference>
- <Reference Include="System">
- <Name>System</Name>
- </Reference>
- <Reference Include="System.Data">
- <Name>System.Data</Name>
- </Reference>
- <Reference Include="System.Xml">
- <Name>System.XML</Name>
- </Reference>
- </ItemGroup>
- <ItemGroup>
- <None Include="App.config" />
- <Compile Include="..\..\..\..\..\..\..\src\AssemblyVersionInfo.cs">
- <Link>AssemblyVersionInfo.cs</Link>
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="AssemblyInfo.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="RemotingServer.cs">
- <SubType>Code</SubType>
- </Compile>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <PropertyGroup>
- <PreBuildEvent>
- </PreBuildEvent>
- <PostBuildEvent>
- </PostBuildEvent>
- </PropertyGroup>
-</Project>
diff --git a/examples/net/2.0/Remoting/RemotingServer/nant.build b/examples/net/2.0/Remoting/RemotingServer/nant.build
deleted file mode 100644
index 71c4c23..0000000
--- a/examples/net/2.0/Remoting/RemotingServer/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="remotingserver-example" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile RemotingServer example -->
- <target name="compile" description="Builds RemotingServer example">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/net/2.0/Remoting/RemotingServer/nant.config b/examples/net/2.0/Remoting/RemotingServer/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/net/2.0/Remoting/RemotingServer/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/net/2.0/Remoting/nant.build b/examples/net/2.0/Remoting/nant.build
deleted file mode 100644
index bd433cf..0000000
--- a/examples/net/2.0/Remoting/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="remoting-examples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile Remoting examples -->
- <target name="compile" description="Builds Remoting examples">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/net/2.0/Remoting/nant.config b/examples/net/2.0/Remoting/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/net/2.0/Remoting/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/net/2.0/Repository/SharedModule/cs/nant.build b/examples/net/2.0/Repository/SharedModule/cs/nant.build
deleted file mode 100644
index ff299dc..0000000
--- a/examples/net/2.0/Repository/SharedModule/cs/nant.build
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- compile the example -->
- <csc noconfig="true" target="library" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.csc}" output="${current.bin.dir}/SharedModule.dll">
- <sources>
- <include name="src/**/*.cs" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.cs" />
- </sources>
- <references basedir="${log4net.output.dir}">
- <include name="log4net.dll" />
- </references>
- </csc>
- </target>
-</project>
diff --git a/examples/net/2.0/Repository/SharedModule/cs/nant.config b/examples/net/2.0/Repository/SharedModule/cs/nant.config
deleted file mode 100644
index 52613e8..0000000
--- a/examples/net/2.0/Repository/SharedModule/cs/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/net/2.0/Repository/SharedModule/cs/src/AssemblyInfo.cs b/examples/net/2.0/Repository/SharedModule/cs/src/AssemblyInfo.cs
deleted file mode 100644
index ee75642..0000000
--- a/examples/net/2.0/Repository/SharedModule/cs/src/AssemblyInfo.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// 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("log4net - SharedModule")]
-[assembly: AssemblyDescription("log4net SharedModule")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyProduct("log4net - SharedModule")]
-[assembly: AssemblyCulture("")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("")]
-[assembly: AssemblyKeyName("")]
diff --git a/examples/net/2.0/Repository/SharedModule/cs/src/Math.cs b/examples/net/2.0/Repository/SharedModule/cs/src/Math.cs
deleted file mode 100644
index 12586b9..0000000
--- a/examples/net/2.0/Repository/SharedModule/cs/src/Math.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-namespace SharedModule
-{
- /// <summary>
- /// Summary description for Math.
- /// </summary>
- public class Math
- {
- // Create a logger for use in this class
- private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
-
- public Math()
- {
- if (log.IsDebugEnabled) log.Debug("Constructor");
- }
-
- public int Subtract(int left, int right)
- {
- int result = left - right;
- if (log.IsInfoEnabled) log.Info("" + left + " - " + right + " = " + result);
- return result;
- }
- }
-}
diff --git a/examples/net/2.0/Repository/SharedModule/cs/src/SharedModule.csproj b/examples/net/2.0/Repository/SharedModule/cs/src/SharedModule.csproj
deleted file mode 100644
index 1dfb7c9..0000000
--- a/examples/net/2.0/Repository/SharedModule/cs/src/SharedModule.csproj
+++ /dev/null
@@ -1,132 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <ProjectType>Local</ProjectType>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{9AACDC1A-84FB-4042-85A5-7095C66AD973}</ProjectGuid>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ApplicationIcon>
- </ApplicationIcon>
- <AssemblyKeyContainerName>
- </AssemblyKeyContainerName>
- <AssemblyName>SharedModule</AssemblyName>
- <AssemblyOriginatorKeyFile>
- </AssemblyOriginatorKeyFile>
- <DefaultClientScript>JScript</DefaultClientScript>
- <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
- <DefaultTargetSchema>IE50</DefaultTargetSchema>
- <DelaySign>false</DelaySign>
- <OutputType>Library</OutputType>
- <RootNamespace>SharedModule</RootNamespace>
- <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
- <StartupObject>
- </StartupObject>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <OutputPath>..\build\debug\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <ConfigurationOverrideFile>
- </ConfigurationOverrideFile>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <DocumentationFile>
- </DocumentationFile>
- <DebugSymbols>true</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <NoStdLib>false</NoStdLib>
- <NoWarn>
- </NoWarn>
- <Optimize>false</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>full</DebugType>
- <ErrorReport>prompt</ErrorReport>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <OutputPath>..\build\release\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <ConfigurationOverrideFile>
- </ConfigurationOverrideFile>
- <DefineConstants>TRACE</DefineConstants>
- <DocumentationFile>
- </DocumentationFile>
- <DebugSymbols>false</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <NoStdLib>false</NoStdLib>
- <NoWarn>
- </NoWarn>
- <Optimize>true</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>none</DebugType>
- <ErrorReport>prompt</ErrorReport>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\..\..\..\..\bin\net\2.0\debug\log4net.dll</HintPath>
- </Reference>
- <Reference Include="System">
- <Name>System</Name>
- </Reference>
- <Reference Include="System.Data">
- <Name>System.Data</Name>
- </Reference>
- <Reference Include="System.Xml">
- <Name>System.XML</Name>
- </Reference>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="..\..\..\..\..\..\..\src\AssemblyVersionInfo.cs">
- <Link>AssemblyVersionInfo.cs</Link>
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="AssemblyInfo.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Math.cs">
- <SubType>Code</SubType>
- </Compile>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <PropertyGroup>
- <PreBuildEvent>
- </PreBuildEvent>
- <PostBuildEvent>
- </PostBuildEvent>
- </PropertyGroup>
-</Project>
diff --git a/examples/net/2.0/Repository/SharedModule/nant.build b/examples/net/2.0/Repository/SharedModule/nant.build
deleted file mode 100644
index a11e9cd..0000000
--- a/examples/net/2.0/Repository/SharedModule/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="sharedmodule-example" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile SharedModule example -->
- <target name="compile" description="Builds SharedModule example">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/net/2.0/Repository/SharedModule/nant.config b/examples/net/2.0/Repository/SharedModule/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/net/2.0/Repository/SharedModule/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/net/2.0/Repository/SharedModule/vb/nant.build b/examples/net/2.0/Repository/SharedModule/vb/nant.build
deleted file mode 100644
index dd77029..0000000
--- a/examples/net/2.0/Repository/SharedModule/vb/nant.build
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the examples" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- compile the example -->
- <vbc target="library" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.vbc}" output="${current.bin.dir}/SharedModule.dll">
- <sources>
- <include name="src/**/*.vb" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.vb" />
- </sources>
- <references basedir="${log4net.output.dir}">
- <include name="log4net.dll" />
- </references>
- </vbc>
- </target>
-</project>
diff --git a/examples/net/2.0/Repository/SharedModule/vb/nant.config b/examples/net/2.0/Repository/SharedModule/vb/nant.config
deleted file mode 100644
index 7247b88..0000000
--- a/examples/net/2.0/Repository/SharedModule/vb/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../../../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/net/2.0/Repository/SharedModule/vb/src/AssemblyInfo.vb b/examples/net/2.0/Repository/SharedModule/vb/src/AssemblyInfo.vb
deleted file mode 100644
index e98e89d..0000000
--- a/examples/net/2.0/Repository/SharedModule/vb/src/AssemblyInfo.vb
+++ /dev/null
@@ -1,61 +0,0 @@
-#Region "Apache License"
-'
-' Licensed to the Apache Software Foundation (ASF) under one or more
-' contributor license agreements. See the NOTICE file distributed with
-' this work for additional information regarding copyright ownership.
-' The ASF licenses this file to you 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.
-'
-#End Region
-
-Imports System.Reflection
-Imports System.Runtime.CompilerServices
-
-'
-' 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("log4net - SharedModule")>
-<Assembly:AssemblyDescription("log4net SharedModule")>
-<Assembly:AssemblyConfiguration("")>
-<Assembly:AssemblyProduct("log4net - SharedModule")>
-<Assembly:AssemblyCulture("")>
-
-'
-' In order to sign your assembly you must specify a key to use. Refer to the
-' Microsoft .NET Framework documentation for more information on assembly signing.
-'
-' Use the attributes below to control which key is used for signing.
-'
-' Notes:
-' (*) If no key is specified, the assembly is not signed.
-' (*) KeyName refers to a key that has been installed in the Crypto Service
-' Provider (CSP) on your machine. KeyFile refers to a file which contains
-' a key.
-' (*) If the KeyFile and the KeyName values are both specified, the
-' following processing occurs:
-' (1) If the KeyName can be found in the CSP, that key is used.
-' (2) If the KeyName does not exist and the KeyFile does exist, the key
-' in the KeyFile is installed into the CSP and used.
-' (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-' When specifying the KeyFile, the location of the KeyFile should be
-' relative to the project output directory which is
-' %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-' located in the project directory, you would specify the AssemblyKeyFile
-' attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-' (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-' documentation for more information on this.
-'
-<Assembly:AssemblyDelaySign(false)>
-<Assembly:AssemblyKeyFile("")>
-<Assembly:AssemblyKeyName("")>
diff --git a/examples/net/2.0/Repository/SharedModule/vb/src/Math.vb b/examples/net/2.0/Repository/SharedModule/vb/src/Math.vb
deleted file mode 100644
index 1dde517..0000000
--- a/examples/net/2.0/Repository/SharedModule/vb/src/Math.vb
+++ /dev/null
@@ -1,35 +0,0 @@
-#Region "Apache License"
-'
-' Licensed to the Apache Software Foundation (ASF) under one or more
-' contributor license agreements. See the NOTICE file distributed with
-' this work for additional information regarding copyright ownership.
-' The ASF licenses this file to you 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.
-'
-#End Region
-
-Namespace SharedModule
- Public Class Math
- ' Create a logger for use in this class
- Private Shared ReadOnly log As log4net.ILog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)
-
- Public Sub New()
- If log.IsDebugEnabled Then log.Debug("Constructor")
- End Sub
-
- Public Function Subtract(Byval left As Integer, Byval right As Integer) As Integer
- Dim result As Integer = left - right
- If log.IsInfoEnabled Then log.Info("" & left & " - " & right & " = " & result)
- Return result
- End Function
- End Class
-End Namespace
diff --git a/examples/net/2.0/Repository/SharedModule/vb/src/SharedModule.vbproj b/examples/net/2.0/Repository/SharedModule/vb/src/SharedModule.vbproj
deleted file mode 100644
index 6079c28..0000000
--- a/examples/net/2.0/Repository/SharedModule/vb/src/SharedModule.vbproj
+++ /dev/null
@@ -1,130 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<VisualStudioProject>
- <VisualBasic
- ProjectType = "Local"
- ProductVersion = "7.0.9466"
- SchemaVersion = "1.0"
- ProjectGuid = "{8F84B3EA-34F7-40ED-8A04-895EFC37C38D}"
- >
- <Build>
- <Settings
- ApplicationIcon = ""
- AssemblyKeyContainerName = ""
- AssemblyName = "SharedModule"
- AssemblyOriginatorKeyFile = ""
- AssemblyOriginatorKeyMode = "None"
- DefaultClientScript = "JScript"
- DefaultHTMLPageLayout = "Grid"
- DefaultTargetSchema = "IE50"
- DelaySign = "false"
- OutputType = "Library"
- OptionCompare = "Binary"
- OptionExplicit = "On"
- OptionStrict = "Off"
- RootNamespace = ""
- StartupObject = ""
- >
- <Config
- Name = "Debug"
- BaseAddress = "285212672"
- ConfigurationOverrideFile = ""
- DefineConstants = ""
- DefineDebug = "true"
- DefineTrace = "true"
- DebugSymbols = "true"
- IncrementalBuild = "true"
- Optimize = "false"
- OutputPath = "..\build\debug\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "1"
- />
- <Config
- Name = "Release"
- BaseAddress = "285212672"
- ConfigurationOverrideFile = ""
- DefineConstants = ""
- DefineDebug = "false"
- DefineTrace = "true"
- DebugSymbols = "false"
- IncrementalBuild = "false"
- Optimize = "true"
- OutputPath = "..\build\release\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "1"
- />
- </Settings>
- <References>
- <Reference
- Name = "System"
- AssemblyName = "System"
- />
- <Reference
- Name = "System.Data"
- AssemblyName = "System.Data"
- />
- <Reference
- Name = "System.XML"
- AssemblyName = "System.Xml"
- />
- <Reference
- Name = "log4net"
- AssemblyName = "log4net"
- HintPath = "..\..\..\..\..\..\..\bin\net\1.0\release\log4net.dll"
- />
- </References>
- <Imports>
- <Import Namespace = "Microsoft.VisualBasic" />
- <Import Namespace = "System" />
- <Import Namespace = "System.Collections" />
- <Import Namespace = "System.Data" />
- <Import Namespace = "System.Diagnostics" />
- </Imports>
- </Build>
- <Files>
- <Include>
- <File
- RelPath = "AssemblyInfo.vb"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "AssemblyVersionInfo.vb"
- Link = "..\..\..\..\..\..\..\src\AssemblyVersionInfo.vb"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "Math.vb"
- SubType = "Code"
- BuildAction = "Compile"
- />
- </Include>
- </Files>
- </VisualBasic>
-</VisualStudioProject>
-
diff --git a/examples/net/2.0/Repository/SimpleApp/cs/nant.build b/examples/net/2.0/Repository/SimpleApp/cs/nant.build
deleted file mode 100644
index fed7e38..0000000
--- a/examples/net/2.0/Repository/SimpleApp/cs/nant.build
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- copy log4net build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="${log4net.output.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- build SharedModule assembly -->
- <nant buildfile="../../SharedModule/cs/nant.build" target="compile" inheritall="true" />
- <!-- build SimpleModule assembly -->
- <nant buildfile="../../SimpleModule/cs/nant.build" target="compile" inheritall="true" />
- <!-- copy SharedModule build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="../../SharedModule/cs/${current.bin.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- copy SimpleModule build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="../../SimpleModule/cs/${current.bin.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- compile the example -->
- <csc noconfig="true" target="exe" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.csc}" output="${current.bin.dir}/SimpleApp.exe">
- <sources>
- <include name="src/**/*.cs" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.cs" />
- </sources>
- <references basedir="${current.bin.dir}" >
- <include name="SharedModule.dll" />
- <include name="SimpleModule.dll" />
- <include name="log4net.dll" />
- </references>
- </csc>
- <!-- copy the SimpleApp log4net configuration file -->
- <copy file="src/SimpleApp.exe.log4net" todir="${current.bin.dir}" />
- <!-- copy the SimpleApp application configuration file -->
- <copy file="src/App.config" tofile="${current.bin.dir}/SimpleApp.exe.config" />
- </target>
-</project>
diff --git a/examples/net/2.0/Repository/SimpleApp/cs/nant.config b/examples/net/2.0/Repository/SimpleApp/cs/nant.config
deleted file mode 100644
index 52613e8..0000000
--- a/examples/net/2.0/Repository/SimpleApp/cs/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/net/2.0/Repository/SimpleApp/cs/src/App.config b/examples/net/2.0/Repository/SimpleApp/cs/src/App.config
deleted file mode 100644
index c37efd0..0000000
--- a/examples/net/2.0/Repository/SimpleApp/cs/src/App.config
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<configuration>
- <appSettings>
- <!-- To enable internal log4net logging specify the
- following appSettings key -->
- <!-- <add key="log4net.Internal.Debug" value="true"/> -->
- </appSettings>
-</configuration>
diff --git a/examples/net/2.0/Repository/SimpleApp/cs/src/AssemblyInfo.cs b/examples/net/2.0/Repository/SimpleApp/cs/src/AssemblyInfo.cs
deleted file mode 100644
index cc3415d..0000000
--- a/examples/net/2.0/Repository/SimpleApp/cs/src/AssemblyInfo.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// 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("log4net - SimpleApp")]
-[assembly: AssemblyDescription("log4net SimpleApp")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyProduct("log4net - SimpleApp")]
-[assembly: AssemblyCulture("")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("")]
-[assembly: AssemblyKeyName("")]
diff --git a/examples/net/2.0/Repository/SimpleApp/cs/src/EntryPoint.cs b/examples/net/2.0/Repository/SimpleApp/cs/src/EntryPoint.cs
deleted file mode 100644
index 8e55eef..0000000
--- a/examples/net/2.0/Repository/SimpleApp/cs/src/EntryPoint.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-// Configure logging for this assembly using the 'SimpleApp.exe.log4net' file
-[assembly: log4net.Config.XmlConfigurator(ConfigFileExtension="log4net", Watch=true)]
-
-// The following alias attribute can be used to capture the logging
-// repository for the 'SimpleModule' assembly. Without specifying this
-// attribute the logging configuration for the 'SimpleModule' assembly
-// will be read from the 'SimpleModule.dll.log4net' file. When this
-// attribute is specified the configuration will be shared with this
-// assemby's configuration.
-//[assembly: log4net.Config.AliasRepository("SimpleModule")]
-
-namespace SimpleApp
-{
- using System;
-
- /// <summary>
- /// Summary description for Class1.
- /// </summary>
- public class EntryPoint
- {
- // Create a logger for use in this class
- private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
-
- /// <summary>
- /// The main entry point for the application.
- /// </summary>
- [STAThread]
- public static void Main(string[] args)
- {
- if (log.IsInfoEnabled) log.Info(args);
-
- if (args.Length != 2)
- {
- log.Error("Must supply 2 command line arguments");
- }
- else
- {
- int left = int.Parse(args[0]);
- int right = int.Parse(args[1]);
- int result = 0;
-
- if (log.IsDebugEnabled) log.Debug("Adding [" + left + "] to [" + right + "]");
-
- result = (new SimpleModule.Math()).Add(left, right);
-
- if (log.IsDebugEnabled) log.Debug("Result [" + result + "]");
-
- Console.Out.WriteLine(result);
-
-
- if (log.IsDebugEnabled) log.Debug("Subtracting [" + right + "] from [" + left + "]");
-
- result = (new SharedModule.Math()).Subtract(left, right);
-
- if (log.IsDebugEnabled) log.Debug("Result [" + result + "]");
-
- Console.Out.WriteLine(result);
- }
- }
- }
-}
diff --git a/examples/net/2.0/Repository/SimpleApp/cs/src/SimpleApp.csproj b/examples/net/2.0/Repository/SimpleApp/cs/src/SimpleApp.csproj
deleted file mode 100644
index fa3a91b..0000000
--- a/examples/net/2.0/Repository/SimpleApp/cs/src/SimpleApp.csproj
+++ /dev/null
@@ -1,143 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <ProjectType>Local</ProjectType>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{D49EB32C-B25F-4E25-BF6D-62EE38FC1A1F}</ProjectGuid>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ApplicationIcon>
- </ApplicationIcon>
- <AssemblyKeyContainerName>
- </AssemblyKeyContainerName>
- <AssemblyName>SimpleApp</AssemblyName>
- <AssemblyOriginatorKeyFile>
- </AssemblyOriginatorKeyFile>
- <DefaultClientScript>JScript</DefaultClientScript>
- <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
- <DefaultTargetSchema>IE50</DefaultTargetSchema>
- <DelaySign>false</DelaySign>
- <OutputType>Exe</OutputType>
- <RootNamespace>SimpleApp</RootNamespace>
- <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
- <StartupObject>SimpleApp.EntryPoint</StartupObject>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <OutputPath>..\build\debug\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <ConfigurationOverrideFile>
- </ConfigurationOverrideFile>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <DocumentationFile>
- </DocumentationFile>
- <DebugSymbols>true</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <NoStdLib>false</NoStdLib>
- <NoWarn>
- </NoWarn>
- <Optimize>false</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>full</DebugType>
- <ErrorReport>prompt</ErrorReport>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <OutputPath>..\build\release\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <ConfigurationOverrideFile>
- </ConfigurationOverrideFile>
- <DefineConstants>TRACE</DefineConstants>
- <DocumentationFile>
- </DocumentationFile>
- <DebugSymbols>false</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <NoStdLib>false</NoStdLib>
- <NoWarn>
- </NoWarn>
- <Optimize>true</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>none</DebugType>
- <ErrorReport>prompt</ErrorReport>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\..\..\..\..\bin\net\2.0\debug\log4net.dll</HintPath>
- </Reference>
- <Reference Include="System">
- <Name>System</Name>
- </Reference>
- <Reference Include="System.Data">
- <Name>System.Data</Name>
- </Reference>
- <Reference Include="System.Xml">
- <Name>System.XML</Name>
- </Reference>
- <ProjectReference Include="..\..\..\SharedModule\cs\src\SharedModule.csproj">
- <Name>SharedModule</Name>
- <Project>{9AACDC1A-84FB-4042-85A5-7095C66AD973}</Project>
- <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
- </ProjectReference>
- <ProjectReference Include="..\..\..\SimpleModule\cs\src\SimpleModule.csproj">
- <Name>SimpleModule</Name>
- <Project>{F82AA1D9-5B52-4890-8838-7AAAF7D8F0EE}</Project>
- <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <None Include="App.config" />
- <Compile Include="..\..\..\..\..\..\..\src\AssemblyVersionInfo.cs">
- <Link>AssemblyVersionInfo.cs</Link>
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="AssemblyInfo.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="EntryPoint.cs">
- <SubType>Code</SubType>
- </Compile>
- <Content Include="SimpleApp.exe.log4net" />
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <PropertyGroup>
- <PreBuildEvent>
- </PreBuildEvent>
- <PostBuildEvent>
- </PostBuildEvent>
- </PropertyGroup>
-</Project>
diff --git a/examples/net/2.0/Repository/SimpleApp/cs/src/SimpleApp.exe.log4net b/examples/net/2.0/Repository/SimpleApp/cs/src/SimpleApp.exe.log4net
deleted file mode 100644
index 4c14df1..0000000
--- a/examples/net/2.0/Repository/SimpleApp/cs/src/SimpleApp.exe.log4net
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!-- This section contains the log4net configuration settings -->
-<log4net>
- <!-- Define some output appenders -->
- <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="[SimpleAppConfig] %date [%thread] %-5level %logger - %message%newline" />
- </layout>
- </appender>
- <!-- Setup the root category, add the appenders and set the default level -->
- <root>
- <level value="DEBUG" />
- <appender-ref ref="ConsoleAppender" />
- </root>
-
-</log4net>
diff --git a/examples/net/2.0/Repository/SimpleApp/nant.build b/examples/net/2.0/Repository/SimpleApp/nant.build
deleted file mode 100644
index d92e4c5..0000000
--- a/examples/net/2.0/Repository/SimpleApp/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="simpleapp-example" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile SimpleApp example -->
- <target name="compile" description="Builds SimpleApp example">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/net/2.0/Repository/SimpleApp/nant.config b/examples/net/2.0/Repository/SimpleApp/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/net/2.0/Repository/SimpleApp/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/net/2.0/Repository/SimpleApp/vb/nant.build b/examples/net/2.0/Repository/SimpleApp/vb/nant.build
deleted file mode 100644
index 05138e2..0000000
--- a/examples/net/2.0/Repository/SimpleApp/vb/nant.build
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- copy log4net build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="${log4net.output.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- build SharedModule assembly -->
- <nant buildfile="../../SharedModule/vb/nant.build" target="compile" inheritall="true" />
- <!-- build SimpleModule assembly -->
- <nant buildfile="../../SimpleModule/vb/nant.build" target="compile" inheritall="true" />
- <!-- copy SharedModule build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="../../SharedModule/vb/${current.bin.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- copy SimpleModule build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="../../SimpleModule/vb/${current.bin.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- compile the example -->
- <vbc target="exe" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.vbc}" output="${current.bin.dir}/SimpleApp.exe">
- <sources>
- <include name="src/**/*.vb" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.vb" />
- </sources>
- <references basedir="${current.bin.dir}">
- <include name="SharedModule.dll" />
- <include name="SimpleModule.dll" />
- <include name="log4net.dll" />
- </references>
- </vbc>
- <!-- copy the SimpleApp log4net configuration file -->
- <copy file="src/SimpleApp.exe.log4net" todir="${current.bin.dir}" />
- <!-- copy the SimpleApp application configuration file -->
- <copy file="src/App.config" tofile="${current.bin.dir}/SimpleApp.exe.config" />
- </target>
-</project>
diff --git a/examples/net/2.0/Repository/SimpleApp/vb/nant.config b/examples/net/2.0/Repository/SimpleApp/vb/nant.config
deleted file mode 100644
index 52613e8..0000000
--- a/examples/net/2.0/Repository/SimpleApp/vb/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/net/2.0/Repository/SimpleApp/vb/src/App.config b/examples/net/2.0/Repository/SimpleApp/vb/src/App.config
deleted file mode 100644
index c37efd0..0000000
--- a/examples/net/2.0/Repository/SimpleApp/vb/src/App.config
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<configuration>
- <appSettings>
- <!-- To enable internal log4net logging specify the
- following appSettings key -->
- <!-- <add key="log4net.Internal.Debug" value="true"/> -->
- </appSettings>
-</configuration>
diff --git a/examples/net/2.0/Repository/SimpleApp/vb/src/AssemblyInfo.vb b/examples/net/2.0/Repository/SimpleApp/vb/src/AssemblyInfo.vb
deleted file mode 100644
index 1c5d1be..0000000
--- a/examples/net/2.0/Repository/SimpleApp/vb/src/AssemblyInfo.vb
+++ /dev/null
@@ -1,61 +0,0 @@
-#Region "Apache License"
-'
-' Licensed to the Apache Software Foundation (ASF) under one or more
-' contributor license agreements. See the NOTICE file distributed with
-' this work for additional information regarding copyright ownership.
-' The ASF licenses this file to you 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.
-'
-#End Region
-
-Imports System.Reflection
-Imports System.Runtime.CompilerServices
-
-'
-' 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("log4net - SimpleApp")>
-<Assembly:AssemblyDescription("log4net SimpleApp")>
-<Assembly:AssemblyConfiguration("")>
-<Assembly:AssemblyProduct("log4net - SimpleApp")>
-<Assembly:AssemblyCulture("")>
-
-'
-' In order to sign your assembly you must specify a key to use. Refer to the
-' Microsoft .NET Framework documentation for more information on assembly signing.
-'
-' Use the attributes below to control which key is used for signing.
-'
-' Notes:
-' (*) If no key is specified, the assembly is not signed.
-' (*) KeyName refers to a key that has been installed in the Crypto Service
-' Provider (CSP) on your machine. KeyFile refers to a file which contains
-' a key.
-' (*) If the KeyFile and the KeyName values are both specified, the
-' following processing occurs:
-' (1) If the KeyName can be found in the CSP, that key is used.
-' (2) If the KeyName does not exist and the KeyFile does exist, the key
-' in the KeyFile is installed into the CSP and used.
-' (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-' When specifying the KeyFile, the location of the KeyFile should be
-' relative to the project output directory which is
-' %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-' located in the project directory, you would specify the AssemblyKeyFile
-' attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-' (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-' documentation for more information on this.
-'
-<Assembly:AssemblyDelaySign(false)>
-<Assembly:AssemblyKeyFile("")>
-<Assembly:AssemblyKeyName("")>
diff --git a/examples/net/2.0/Repository/SimpleApp/vb/src/EntryPoint.vb b/examples/net/2.0/Repository/SimpleApp/vb/src/EntryPoint.vb
deleted file mode 100644
index ebb18e1..0000000
--- a/examples/net/2.0/Repository/SimpleApp/vb/src/EntryPoint.vb
+++ /dev/null
@@ -1,69 +0,0 @@
-#Region "Apache License"
-'
-' Licensed to the Apache Software Foundation (ASF) under one or more
-' contributor license agreements. See the NOTICE file distributed with
-' this work for additional information regarding copyright ownership.
-' The ASF licenses this file to you 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.
-'
-#End Region
-
-Imports System
-
-' Configure logging for this assembly using the 'SimpleApp.exe.log4net' file
-<Assembly: log4net.Config.XmlConfigurator(ConfigFileExtension:="log4net", Watch:=True)>
-
-' The following alias attribute can be used to capture the logging
-' repository for the 'SimpleModule' assembly. Without specifying this
-' attribute the logging configuration for the 'SimpleModule' assembly
-' will be read from the 'SimpleModule.dll.log4net' file. When this
-' attribute is specified the configuration will be shared with this
-' assemby's configuration.
-'<Assembly:log4net.Config.AliasRepository("SimpleModule")>
-
-Namespace SimpleApp
- Public Class EntryPoint
- ' Create a logger for use in this class
- Private Shared ReadOnly log As log4net.ILog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)
-
- ' The main entry point for the application.
-
- <STAThread()> Public Shared Sub Main(Byval args() As String)
- If log.IsInfoEnabled Then log.Info(args)
-
- If args.Length <> 2 Then
- log.Error("Must supply 2 command line arguments")
- Else
- Dim left As Integer = Integer.Parse(args(0))
- Dim right As Integer = Integer.Parse(args(1))
- Dim result As Integer = 0
-
- If log.IsDebugEnabled Then log.Debug("Adding [" & left & "] to [" & right & "]")
-
- result = (new SimpleModule.Math()).Add(left, right)
-
- If log.IsDebugEnabled Then log.Debug("Result [" & result & "]")
-
- Console.Out.WriteLine(result)
-
-
- If log.IsDebugEnabled Then log.Debug("Subtracting [" & right & "] from [" & left & "]")
-
- result = (new SharedModule.Math()).Subtract(left, right)
-
- If log.IsDebugEnabled Then log.Debug("Result [" & result & "]")
-
- Console.Out.WriteLine(result)
- End If
- End Sub
- End Class
-End Namespace
diff --git a/examples/net/2.0/Repository/SimpleApp/vb/src/SimpleApp.exe.log4net b/examples/net/2.0/Repository/SimpleApp/vb/src/SimpleApp.exe.log4net
deleted file mode 100644
index 4c14df1..0000000
--- a/examples/net/2.0/Repository/SimpleApp/vb/src/SimpleApp.exe.log4net
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!-- This section contains the log4net configuration settings -->
-<log4net>
- <!-- Define some output appenders -->
- <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="[SimpleAppConfig] %date [%thread] %-5level %logger - %message%newline" />
- </layout>
- </appender>
- <!-- Setup the root category, add the appenders and set the default level -->
- <root>
- <level value="DEBUG" />
- <appender-ref ref="ConsoleAppender" />
- </root>
-
-</log4net>
diff --git a/examples/net/2.0/Repository/SimpleApp/vb/src/SimpleApp.vbproj b/examples/net/2.0/Repository/SimpleApp/vb/src/SimpleApp.vbproj
deleted file mode 100644
index f1bedee..0000000
--- a/examples/net/2.0/Repository/SimpleApp/vb/src/SimpleApp.vbproj
+++ /dev/null
@@ -1,144 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<VisualStudioProject>
- <VisualBasic
- ProjectType = "Local"
- ProductVersion = "7.0.9466"
- SchemaVersion = "1.0"
- ProjectGuid = "{912A9564-F435-444B-905F-1FD8B69C48D7}"
- >
- <Build>
- <Settings
- ApplicationIcon = ""
- AssemblyKeyContainerName = ""
- AssemblyName = "SimpleApp"
- AssemblyOriginatorKeyFile = ""
- AssemblyOriginatorKeyMode = "None"
- DefaultClientScript = "JScript"
- DefaultHTMLPageLayout = "Grid"
- DefaultTargetSchema = "IE50"
- DelaySign = "false"
- OutputType = "Exe"
- OptionCompare = "Binary"
- OptionExplicit = "On"
- OptionStrict = "Off"
- RootNamespace = ""
- StartupObject = "SimpleApp.EntryPoint"
- >
- <Config
- Name = "Debug"
- BaseAddress = "285212672"
- ConfigurationOverrideFile = ""
- DefineConstants = ""
- DefineDebug = "true"
- DefineTrace = "true"
- DebugSymbols = "true"
- IncrementalBuild = "true"
- Optimize = "false"
- OutputPath = "..\build\debug\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "1"
- />
- <Config
- Name = "Release"
- BaseAddress = "285212672"
- ConfigurationOverrideFile = ""
- DefineConstants = ""
- DefineDebug = "false"
- DefineTrace = "true"
- DebugSymbols = "false"
- IncrementalBuild = "false"
- Optimize = "true"
- OutputPath = "..\build\release\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "1"
- />
- </Settings>
- <References>
- <Reference
- Name = "System"
- AssemblyName = "System"
- />
- <Reference
- Name = "System.Data"
- AssemblyName = "System.Data"
- />
- <Reference
- Name = "System.XML"
- AssemblyName = "System.Xml"
- />
- <Reference
- Name = "log4net"
- AssemblyName = "log4net"
- HintPath = "..\..\..\..\..\..\..\bin\net\1.0\release\log4net.dll"
- />
- <Reference
- Name = "SharedModule"
- Project = "{8F84B3EA-34F7-40ED-8A04-895EFC37C38D}"
- Package = "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}"
- />
- <Reference
- Name = "SimpleModule"
- Project = "{2BDB262A-3B90-418E-9C6A-322A4B0C287A}"
- Package = "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}"
- />
- </References>
- <Imports>
- <Import Namespace = "Microsoft.VisualBasic" />
- <Import Namespace = "System" />
- <Import Namespace = "System.Collections" />
- <Import Namespace = "System.Data" />
- <Import Namespace = "System.Diagnostics" />
- </Imports>
- </Build>
- <Files>
- <Include>
- <File
- RelPath = "AssemblyInfo.vb"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "AssemblyVersionInfo.vb"
- Link = "..\..\..\..\..\..\..\src\AssemblyVersionInfo.vb"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "EntryPoint.vb"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "SimpleApp.exe.log4net"
- BuildAction = "Content"
- />
- </Include>
- </Files>
- </VisualBasic>
-</VisualStudioProject>
-
diff --git a/examples/net/2.0/Repository/SimpleModule/cs/nant.build b/examples/net/2.0/Repository/SimpleModule/cs/nant.build
deleted file mode 100644
index 34f2ae0..0000000
--- a/examples/net/2.0/Repository/SimpleModule/cs/nant.build
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- compile the example -->
- <csc noconfig="true" target="library" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.csc}" output="${current.bin.dir}/SimpleModule.dll">
- <sources>
- <include name="src/**/*.cs" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.cs" />
- </sources>
- <references basedir="${log4net.output.dir}">
- <include name="log4net.dll" />
- </references>
- </csc>
- <!-- copy the log4net configuration file to the output directory -->
- <copy file="src/SimpleModule.dll.log4net" todir="${current.bin.dir}" />
- </target>
-</project>
diff --git a/examples/net/2.0/Repository/SimpleModule/cs/nant.config b/examples/net/2.0/Repository/SimpleModule/cs/nant.config
deleted file mode 100644
index 52613e8..0000000
--- a/examples/net/2.0/Repository/SimpleModule/cs/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/net/2.0/Repository/SimpleModule/cs/src/AssemblyInfo.cs b/examples/net/2.0/Repository/SimpleModule/cs/src/AssemblyInfo.cs
deleted file mode 100644
index 1c32a35..0000000
--- a/examples/net/2.0/Repository/SimpleModule/cs/src/AssemblyInfo.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// 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("log4net - SimpleModule")]
-[assembly: AssemblyDescription("log4net SimpleModule")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyProduct("log4net - SimpleModule")]
-[assembly: AssemblyCulture("")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("")]
-[assembly: AssemblyKeyName("")]
diff --git a/examples/net/2.0/Repository/SimpleModule/cs/src/Math.cs b/examples/net/2.0/Repository/SimpleModule/cs/src/Math.cs
deleted file mode 100644
index 1ac71d1..0000000
--- a/examples/net/2.0/Repository/SimpleModule/cs/src/Math.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-// We want this assembly to have a seperate logging repository to the
-// rest of the application. We will configure this repository seperatly.
-[assembly: log4net.Config.Repository("SimpleModule")]
-
-// Configure logging for this assembly using the 'SimpleModule.dll.log4net' file
-[assembly: log4net.Config.XmlConfigurator(ConfigFileExtension="log4net", Watch=true)]
-
-namespace SimpleModule
-{
- /// <summary>
- /// Summary description for Math.
- /// </summary>
- public class Math
- {
- // Create a logger for use in this class
- private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
-
- public Math()
- {
- if (log.IsDebugEnabled) log.Debug("Constructor");
- }
-
- public int Add(int left, int right)
- {
- int result = left + right;
- if (log.IsInfoEnabled) log.Info("" + left + " + " + right + " = " + result);
- return result;
- }
- }
-}
diff --git a/examples/net/2.0/Repository/SimpleModule/cs/src/SimpleModule.csproj b/examples/net/2.0/Repository/SimpleModule/cs/src/SimpleModule.csproj
deleted file mode 100644
index 54796f5..0000000
--- a/examples/net/2.0/Repository/SimpleModule/cs/src/SimpleModule.csproj
+++ /dev/null
@@ -1,133 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <ProjectType>Local</ProjectType>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{F82AA1D9-5B52-4890-8838-7AAAF7D8F0EE}</ProjectGuid>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ApplicationIcon>
- </ApplicationIcon>
- <AssemblyKeyContainerName>
- </AssemblyKeyContainerName>
- <AssemblyName>SimpleModule</AssemblyName>
- <AssemblyOriginatorKeyFile>
- </AssemblyOriginatorKeyFile>
- <DefaultClientScript>JScript</DefaultClientScript>
- <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
- <DefaultTargetSchema>IE50</DefaultTargetSchema>
- <DelaySign>false</DelaySign>
- <OutputType>Library</OutputType>
- <RootNamespace>SimpleModule</RootNamespace>
- <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
- <StartupObject>
- </StartupObject>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <OutputPath>..\build\debug\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <ConfigurationOverrideFile>
- </ConfigurationOverrideFile>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <DocumentationFile>
- </DocumentationFile>
- <DebugSymbols>true</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <NoStdLib>false</NoStdLib>
- <NoWarn>
- </NoWarn>
- <Optimize>false</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>full</DebugType>
- <ErrorReport>prompt</ErrorReport>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <OutputPath>..\build\release\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <ConfigurationOverrideFile>
- </ConfigurationOverrideFile>
- <DefineConstants>TRACE</DefineConstants>
- <DocumentationFile>
- </DocumentationFile>
- <DebugSymbols>false</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <NoStdLib>false</NoStdLib>
- <NoWarn>
- </NoWarn>
- <Optimize>true</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>none</DebugType>
- <ErrorReport>prompt</ErrorReport>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\..\..\..\..\bin\net\2.0\debug\log4net.dll</HintPath>
- </Reference>
- <Reference Include="System">
- <Name>System</Name>
- </Reference>
- <Reference Include="System.Data">
- <Name>System.Data</Name>
- </Reference>
- <Reference Include="System.Xml">
- <Name>System.XML</Name>
- </Reference>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="..\..\..\..\..\..\..\src\AssemblyVersionInfo.cs">
- <Link>AssemblyVersionInfo.cs</Link>
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="AssemblyInfo.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Math.cs">
- <SubType>Code</SubType>
- </Compile>
- <Content Include="SimpleModule.dll.log4net" />
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <PropertyGroup>
- <PreBuildEvent>
- </PreBuildEvent>
- <PostBuildEvent>
- </PostBuildEvent>
- </PropertyGroup>
-</Project>
diff --git a/examples/net/2.0/Repository/SimpleModule/cs/src/SimpleModule.dll.log4net b/examples/net/2.0/Repository/SimpleModule/cs/src/SimpleModule.dll.log4net
deleted file mode 100644
index e3ca4e3..0000000
--- a/examples/net/2.0/Repository/SimpleModule/cs/src/SimpleModule.dll.log4net
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-
-<!-- This section contains the log4net configuration settings -->
-<log4net>
-
- <!-- Define some output appenders -->
-
- <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="[SimpleModuleConfig] %date [%thread] %-5level %logger - %message%newline" />
- </layout>
- </appender>
-
- <!-- Setup the root category, add the appenders and set the default priority -->
-
- <root>
- <level value="DEBUG" />
- <appender-ref ref="ConsoleAppender" />
- </root>
-
-</log4net>
diff --git a/examples/net/2.0/Repository/SimpleModule/nant.build b/examples/net/2.0/Repository/SimpleModule/nant.build
deleted file mode 100644
index 614f891..0000000
--- a/examples/net/2.0/Repository/SimpleModule/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="simplemodule-example" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile SimpleModule example -->
- <target name="compile" description="Builds SimpleModule example">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/net/2.0/Repository/SimpleModule/nant.config b/examples/net/2.0/Repository/SimpleModule/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/net/2.0/Repository/SimpleModule/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/net/2.0/Repository/SimpleModule/vb/nant.build b/examples/net/2.0/Repository/SimpleModule/vb/nant.build
deleted file mode 100644
index c793829..0000000
--- a/examples/net/2.0/Repository/SimpleModule/vb/nant.build
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- compile the example -->
- <vbc target="library" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.vbc}" output="${current.bin.dir}/SimpleModule.dll">
- <sources>
- <include name="src/**/*.vb" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.vb" />
- </sources>
- <references basedir="${log4net.output.dir}">
- <include name="log4net.dll" />
- </references>
- </vbc>
- <!-- copy the log4net configuration file to the output directory -->
- <copy file="src/SimpleModule.dll.log4net" todir="${current.bin.dir}" />
- </target>
-</project>
diff --git a/examples/net/2.0/Repository/SimpleModule/vb/nant.config b/examples/net/2.0/Repository/SimpleModule/vb/nant.config
deleted file mode 100644
index 52613e8..0000000
--- a/examples/net/2.0/Repository/SimpleModule/vb/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/net/2.0/Repository/SimpleModule/vb/src/AssemblyInfo.vb b/examples/net/2.0/Repository/SimpleModule/vb/src/AssemblyInfo.vb
deleted file mode 100644
index 8a1a3ed..0000000
--- a/examples/net/2.0/Repository/SimpleModule/vb/src/AssemblyInfo.vb
+++ /dev/null
@@ -1,61 +0,0 @@
-#Region "Apache License"
-'
-' Licensed to the Apache Software Foundation (ASF) under one or more
-' contributor license agreements. See the NOTICE file distributed with
-' this work for additional information regarding copyright ownership.
-' The ASF licenses this file to you 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.
-'
-#End Region
-
-Imports System.Reflection
-Imports System.Runtime.CompilerServices
-
-'
-' 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("log4net - SimpleModule")>
-<Assembly:AssemblyDescription("log4net SimpleModule")>
-<Assembly:AssemblyConfiguration("")>
-<Assembly:AssemblyProduct("log4net - SimpleModule")>
-<Assembly:AssemblyCulture("")>
-
-'
-' In order to sign your assembly you must specify a key to use. Refer to the
-' Microsoft .NET Framework documentation for more information on assembly signing.
-'
-' Use the attributes below to control which key is used for signing.
-'
-' Notes:
-' (*) If no key is specified, the assembly is not signed.
-' (*) KeyName refers to a key that has been installed in the Crypto Service
-' Provider (CSP) on your machine. KeyFile refers to a file which contains
-' a key.
-' (*) If the KeyFile and the KeyName values are both specified, the
-' following processing occurs:
-' (1) If the KeyName can be found in the CSP, that key is used.
-' (2) If the KeyName does not exist and the KeyFile does exist, the key
-' in the KeyFile is installed into the CSP and used.
-' (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-' When specifying the KeyFile, the location of the KeyFile should be
-' relative to the project output directory which is
-' %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-' located in the project directory, you would specify the AssemblyKeyFile
-' attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-' (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-' documentation for more information on this.
-'
-<Assembly:AssemblyDelaySign(false)>
-<Assembly:AssemblyKeyFile("")>
-<Assembly:AssemblyKeyName("")>
diff --git a/examples/net/2.0/Repository/SimpleModule/vb/src/Math.vb b/examples/net/2.0/Repository/SimpleModule/vb/src/Math.vb
deleted file mode 100644
index 5ae27d3..0000000
--- a/examples/net/2.0/Repository/SimpleModule/vb/src/Math.vb
+++ /dev/null
@@ -1,42 +0,0 @@
-#Region "Apache License"
-'
-' Licensed to the Apache Software Foundation (ASF) under one or more
-' contributor license agreements. See the NOTICE file distributed with
-' this work for additional information regarding copyright ownership.
-' The ASF licenses this file to you 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.
-'
-#End Region
-
-' We want this assembly to have a seperate logging repository to the
-' rest of the application. We will configure this repository seperatly.
-<Assembly: log4net.Config.Repository("SimpleModule")>
-
-' Configure logging for this assembly using the 'SimpleModule.dll.log4net' file
-<Assembly: log4net.Config.XmlConfigurator(ConfigFileExtension:="log4net", Watch:=True)>
-
-Namespace SimpleModule
- Public Class Math
- ' Create a logger for use in this class
- Private Shared ReadOnly log As log4net.ILog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)
-
- Public Sub New()
- If log.IsDebugEnabled Then log.Debug("Constructor")
- End Sub
-
- Public Function Add(Byval left As Integer, Byval right As Integer) As Integer
- Dim result As Integer = left + right
- If log.IsInfoEnabled Then log.Info("" & left & " + " & right & " = " & result)
- Return result
- End Function
- End Class
-End Namespace
diff --git a/examples/net/2.0/Repository/SimpleModule/vb/src/SimpleModule.dll.log4net b/examples/net/2.0/Repository/SimpleModule/vb/src/SimpleModule.dll.log4net
deleted file mode 100644
index e3ca4e3..0000000
--- a/examples/net/2.0/Repository/SimpleModule/vb/src/SimpleModule.dll.log4net
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-
-<!-- This section contains the log4net configuration settings -->
-<log4net>
-
- <!-- Define some output appenders -->
-
- <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="[SimpleModuleConfig] %date [%thread] %-5level %logger - %message%newline" />
- </layout>
- </appender>
-
- <!-- Setup the root category, add the appenders and set the default priority -->
-
- <root>
- <level value="DEBUG" />
- <appender-ref ref="ConsoleAppender" />
- </root>
-
-</log4net>
diff --git a/examples/net/2.0/Repository/SimpleModule/vb/src/SimpleModule.vbproj b/examples/net/2.0/Repository/SimpleModule/vb/src/SimpleModule.vbproj
deleted file mode 100644
index 25b3313..0000000
--- a/examples/net/2.0/Repository/SimpleModule/vb/src/SimpleModule.vbproj
+++ /dev/null
@@ -1,134 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<VisualStudioProject>
- <VisualBasic
- ProjectType = "Local"
- ProductVersion = "7.0.9466"
- SchemaVersion = "1.0"
- ProjectGuid = "{2BDB262A-3B90-418E-9C6A-322A4B0C287A}"
- >
- <Build>
- <Settings
- ApplicationIcon = ""
- AssemblyKeyContainerName = ""
- AssemblyName = "SimpleModule"
- AssemblyOriginatorKeyFile = ""
- AssemblyOriginatorKeyMode = "None"
- DefaultClientScript = "JScript"
- DefaultHTMLPageLayout = "Grid"
- DefaultTargetSchema = "IE50"
- DelaySign = "false"
- OutputType = "Library"
- OptionCompare = "Binary"
- OptionExplicit = "On"
- OptionStrict = "Off"
- RootNamespace = ""
- StartupObject = ""
- >
- <Config
- Name = "Debug"
- BaseAddress = "285212672"
- ConfigurationOverrideFile = ""
- DefineConstants = ""
- DefineDebug = "true"
- DefineTrace = "true"
- DebugSymbols = "true"
- IncrementalBuild = "true"
- Optimize = "false"
- OutputPath = "..\build\debug\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "1"
- />
- <Config
- Name = "Release"
- BaseAddress = "285212672"
- ConfigurationOverrideFile = ""
- DefineConstants = ""
- DefineDebug = "false"
- DefineTrace = "true"
- DebugSymbols = "false"
- IncrementalBuild = "false"
- Optimize = "true"
- OutputPath = "..\build\release\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "1"
- />
- </Settings>
- <References>
- <Reference
- Name = "System"
- AssemblyName = "System"
- />
- <Reference
- Name = "System.Data"
- AssemblyName = "System.Data"
- />
- <Reference
- Name = "System.XML"
- AssemblyName = "System.Xml"
- />
- <Reference
- Name = "log4net"
- AssemblyName = "log4net"
- HintPath = "..\..\..\..\..\..\..\bin\net\1.0\release\log4net.dll"
- />
- </References>
- <Imports>
- <Import Namespace = "Microsoft.VisualBasic" />
- <Import Namespace = "System" />
- <Import Namespace = "System.Collections" />
- <Import Namespace = "System.Data" />
- <Import Namespace = "System.Diagnostics" />
- </Imports>
- </Build>
- <Files>
- <Include>
- <File
- RelPath = "AssemblyInfo.vb"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "AssemblyVersionInfo.vb"
- Link = "..\..\..\..\..\..\..\src\AssemblyVersionInfo.vb"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "Math.vb"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "SimpleModule.dll.log4net"
- BuildAction = "Content"
- />
- </Include>
- </Files>
- </VisualBasic>
-</VisualStudioProject>
-
diff --git a/examples/net/2.0/Repository/nant.build b/examples/net/2.0/Repository/nant.build
deleted file mode 100644
index 27c3394..0000000
--- a/examples/net/2.0/Repository/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="repository-examples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile Domain examples -->
- <target name="compile" description="Builds Repository examples">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/net/2.0/Repository/nant.config b/examples/net/2.0/Repository/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/net/2.0/Repository/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/net/2.0/Tutorials/ConsoleApp/cs/nant.build b/examples/net/2.0/Tutorials/ConsoleApp/cs/nant.build
deleted file mode 100644
index 8464a9b..0000000
--- a/examples/net/2.0/Tutorials/ConsoleApp/cs/nant.build
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- copy log4net build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="${log4net.output.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- compile the example -->
- <csc noconfig="true" target="exe" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.csc}" output="${current.bin.dir}/ConsoleApp.exe">
- <sources>
- <include name="src/**/*.cs" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.cs" />
- </sources>
- <references basedir="${current.bin.dir}">
- <include name="log4net.dll" />
- </references>
- </csc>
- <!-- copy the ConsoleApp application configuration file -->
- <copy file="src/App.config" tofile="${current.bin.dir}/ConsoleApp.exe.config" />
- </target>
-</project>
diff --git a/examples/net/2.0/Tutorials/ConsoleApp/cs/nant.config b/examples/net/2.0/Tutorials/ConsoleApp/cs/nant.config
deleted file mode 100644
index 52613e8..0000000
--- a/examples/net/2.0/Tutorials/ConsoleApp/cs/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/net/2.0/Tutorials/ConsoleApp/cs/src/App.config b/examples/net/2.0/Tutorials/ConsoleApp/cs/src/App.config
deleted file mode 100644
index a96ed7c..0000000
--- a/examples/net/2.0/Tutorials/ConsoleApp/cs/src/App.config
+++ /dev/null
@@ -1,214 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<!--
- .NET application configuration file
- This file must have the exact same name as your application with .config appended to it.
-
- For example if your application is ConsoleApp.exe then the config file must be ConsoleApp.exe.config.
- It must also be in the same directory as the application.
- -->
-<configuration>
- <!-- Register a section handler for the log4net section -->
- <configSections>
- <section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
- </configSections>
- <appSettings>
- <!-- To enable internal log4net logging specify the following appSettings key -->
- <!-- <add key="log4net.Internal.Debug" value="true"/> -->
- </appSettings>
- <!-- This section contains the log4net configuration settings -->
- <log4net>
- <!-- Define some output appenders -->
- <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
- <file value="rolling-log.txt" />
- <appendToFile value="true" />
- <maxSizeRollBackups value="10" />
- <maximumFileSize value="100" />
- <rollingStyle value="Size" />
- <staticLogFileName value="true" />
- <layout type="log4net.Layout.PatternLayout">
- <header value="[Header] " />
- <footer value="[Footer] " />
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
- </layout>
- </appender>
- <appender name="LogFileAppender" type="log4net.Appender.FileAppender">
- <file value="log-file.txt" />
- <!-- Example using environment variables in params -->
- <!-- <file value="${TMP}\log-file.txt" /> -->
- <appendToFile value="true" />
- <!-- An alternate output encoding can be specified -->
- <!-- <encoding value="unicodeFFFE" /> -->
- <layout type="log4net.Layout.PatternLayout">
- <header value="[Header] " />
- <footer value="[Footer] " />
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] <%property{auth}> - %message%newline" />
- </layout>
- <!-- Alternate layout using XML
- <layout type="log4net.Layout.XMLLayout" /> -->
- </appender>
- <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] <%property{auth}> - %message%newline" />
- </layout>
- </appender>
- <appender name="NetSendAppender" type="log4net.Appender.NetSendAppender">
- <threshold value="ERROR" />
- <server value="SQUARE" />
- <recipient value="nicko" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
- </layout>
- </appender>
- <!-- Example of how to configure the AdoNetAppender
- <appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender" >
- <connectionString value="Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Work\cvs_root\log4net-1.2\access.mdb;UID=;PWD=;" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message]) VALUES ('%date','%thread','%level','%logger','%message')" />
- </layout>
- </appender>
- -->
- <!--
- <appender name="A" type="log4net.Appender.ForwardingAppender" >
- <threshold value="WARN"/>
- <appender-ref ref="ConsoleAppender" />
- </appender>
- <appender name="B" type="log4net.Appender.ForwardingAppender" >
- <filter type="log4net.Filter.LevelRangeFilter">
- <levelMin value="DEBUG"/>
- <levelMax value="INFO"/>
- </filter>
- <appender-ref ref="ConsoleAppender" />
- </appender>
- -->
- <!-- Example of how to configure the AdoNetAppender to connect to MS Access -->
- <appender name="ADONetAppender_Access" type="log4net.Appender.AdoNetAppender">
- <connectionString value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Work\cvs_root\log4net-1.2\access.mdb;User Id=;Password=;" />
- <commandText value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message]) VALUES (@log_date, @thread, @log_level, @logger, @message)" />
- <parameter>
- <parameterName value="@log_date" />
- <dbType value="String" />
- <size value="255" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date" />
- </layout>
- </parameter>
- <parameter>
- <parameterName value="@thread" />
- <dbType value="String" />
- <size value="255" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%thread" />
- </layout>
- </parameter>
- <parameter>
- <parameterName value="@log_level" />
- <dbType value="String" />
- <size value="50" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%level" />
- </layout>
- </parameter>
- <parameter>
- <parameterName value="@logger" />
- <dbType value="String" />
- <size value="255" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%logger" />
- </layout>
- </parameter>
- <parameter>
- <parameterName value="@message" />
- <dbType value="String" />
- <size value="1024" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%message" />
- </layout>
- </parameter>
- </appender>
- <!-- Example of how to configure the AdoNetAppender to connect to MS SQL Server -->
- <appender name="ADONetAppender_SqlServer" type="log4net.Appender.AdoNetAppender">
- <bufferSize value="1" />
- <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
- <connectionString value="data source=SQLSVR;initial catalog=test_log4net;integrated security=false;persist security info=True;" />
- <commandText value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message]) VALUES (@log_date, @thread, @log_level, @logger, @message)" />
- <parameter>
- <parameterName value="@log_date" />
- <dbType value="DateTime" />
- <!--
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date{yyyy'-'MM'-'dd HH':'mm':'ss'.'fff}" />
- </layout>
- -->
- <layout type="log4net.Layout.RawTimeStampLayout" />
- </parameter>
- <parameter>
- <parameterName value="@thread" />
- <dbType value="String" />
- <size value="255" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%thread" />
- </layout>
- </parameter>
- <parameter>
- <parameterName value="@log_level" />
- <dbType value="String" />
- <size value="50" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%level" />
- </layout>
- </parameter>
- <parameter>
- <parameterName value="@logger" />
- <dbType value="String" />
- <size value="255" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%logger" />
- </layout>
- </parameter>
- <parameter>
- <parameterName value="@message" />
- <dbType value="String" />
- <size value="4000" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%message" />
- </layout>
- </parameter>
- </appender>
- <!-- Setup the root category, add the appenders and set the default level -->
- <root>
- <level value="WARN" />
- <appender-ref ref="LogFileAppender" />
- <appender-ref ref="ConsoleAppender" />
- <!-- <appender-ref ref="ADONetAppender_SqlServer" /> -->
- <appender-ref ref="NetSendAppender" />
- <!-- <appender-ref ref="A" /> -->
- </root>
- <!-- Specify the level for some specific categories -->
- <logger name="ConsoleApp.LoggingExample">
- <!-- <appender-ref ref="B" /> -->
- <level value="ALL" />
- <appender-ref ref="RollingLogFileAppender" />
- </logger>
- </log4net>
-</configuration>
diff --git a/examples/net/2.0/Tutorials/ConsoleApp/cs/src/AssemblyInfo.cs b/examples/net/2.0/Tutorials/ConsoleApp/cs/src/AssemblyInfo.cs
deleted file mode 100644
index d54589c..0000000
--- a/examples/net/2.0/Tutorials/ConsoleApp/cs/src/AssemblyInfo.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// 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("log4net - ConsoleApp")]
-[assembly: AssemblyDescription("log4net ConsoleApp")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyProduct("log4net - ConsoleApp")]
-[assembly: AssemblyCulture("")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("")]
-[assembly: AssemblyKeyName("")]
diff --git a/examples/net/2.0/Tutorials/ConsoleApp/cs/src/ConsoleApp.csproj b/examples/net/2.0/Tutorials/ConsoleApp/cs/src/ConsoleApp.csproj
deleted file mode 100644
index 7d5ff9d..0000000
--- a/examples/net/2.0/Tutorials/ConsoleApp/cs/src/ConsoleApp.csproj
+++ /dev/null
@@ -1,132 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <ProjectType>Local</ProjectType>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{933969DF-2BC5-44E6-8B1A-400FC276A23F}</ProjectGuid>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ApplicationIcon>
- </ApplicationIcon>
- <AssemblyKeyContainerName>
- </AssemblyKeyContainerName>
- <AssemblyName>ConsoleApp</AssemblyName>
- <AssemblyOriginatorKeyFile>
- </AssemblyOriginatorKeyFile>
- <DefaultClientScript>JScript</DefaultClientScript>
- <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
- <DefaultTargetSchema>IE50</DefaultTargetSchema>
- <DelaySign>false</DelaySign>
- <OutputType>Exe</OutputType>
- <RootNamespace>ConsoleApp</RootNamespace>
- <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
- <StartupObject>ConsoleApp.LoggingExample</StartupObject>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <OutputPath>..\build\debug\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <ConfigurationOverrideFile>
- </ConfigurationOverrideFile>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <DocumentationFile>
- </DocumentationFile>
- <DebugSymbols>true</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <NoStdLib>false</NoStdLib>
- <NoWarn>
- </NoWarn>
- <Optimize>false</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>full</DebugType>
- <ErrorReport>prompt</ErrorReport>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <OutputPath>..\build\release\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <ConfigurationOverrideFile>
- </ConfigurationOverrideFile>
- <DefineConstants>TRACE</DefineConstants>
- <DocumentationFile>
- </DocumentationFile>
- <DebugSymbols>false</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <NoStdLib>false</NoStdLib>
- <NoWarn>
- </NoWarn>
- <Optimize>true</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>none</DebugType>
- <ErrorReport>prompt</ErrorReport>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\..\..\..\..\bin\net\2.0\debug\log4net.dll</HintPath>
- </Reference>
- <Reference Include="System">
- <Name>System</Name>
- </Reference>
- <Reference Include="System.Data">
- <Name>System.Data</Name>
- </Reference>
- <Reference Include="System.Xml">
- <Name>System.XML</Name>
- </Reference>
- </ItemGroup>
- <ItemGroup>
- <None Include="App.config" />
- <Compile Include="..\..\..\..\..\..\..\src\AssemblyVersionInfo.cs">
- <Link>AssemblyVersionInfo.cs</Link>
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="AssemblyInfo.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="LoggingExample.cs">
- <SubType>Code</SubType>
- </Compile>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <PropertyGroup>
- <PreBuildEvent>
- </PreBuildEvent>
- <PostBuildEvent>
- </PostBuildEvent>
- </PropertyGroup>
-</Project>
diff --git a/examples/net/2.0/Tutorials/ConsoleApp/cs/src/LoggingExample.cs b/examples/net/2.0/Tutorials/ConsoleApp/cs/src/LoggingExample.cs
deleted file mode 100644
index d1c53d1..0000000
--- a/examples/net/2.0/Tutorials/ConsoleApp/cs/src/LoggingExample.cs
+++ /dev/null
@@ -1,112 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-// Configure log4net using the .config file
-[assembly: log4net.Config.XmlConfigurator(Watch=true)]
-// This will cause log4net to look for a configuration file
-// called ConsoleApp.exe.config in the application base
-// directory (i.e. the directory containing ConsoleApp.exe)
-
-namespace ConsoleApp
-{
- using System;
-
- /// <summary>
- /// Example of how to simply configure and use log4net
- /// </summary>
- public class LoggingExample
- {
- // Create a logger for use in this class
- private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
- // NOTE that using System.Reflection.MethodBase.GetCurrentMethod().DeclaringType
- // is equivalent to typeof(LoggingExample) but is more portable
- // i.e. you can copy the code directly into another class without
- // needing to edit the code.
-
- /// <summary>
- /// Application entry point
- /// </summary>
- /// <param name="args">command line arguments</param>
- public static void Main(string[] args)
- {
- // Log an info level message
- if (log.IsInfoEnabled) log.Info("Application [ConsoleApp] Start");
-
- // Log a debug message. Test if debug is enabled before
- // attempting to log the message. This is not required but
- // can make running without logging faster.
- if (log.IsDebugEnabled) log.Debug("This is a debug message");
-
- try
- {
- Bar();
- }
- catch(Exception ex)
- {
- // Log an error with an exception
- log.Error("Exception thrown from method Bar", ex);
- }
-
- log.Error("Hey this is an error!");
-
- // Push a message on to the Nested Diagnostic Context stack
- using(log4net.NDC.Push("NDC_Message"))
- {
- log.Warn("This should have an NDC message");
-
- // Set a Mapped Diagnostic Context value
- log4net.MDC.Set("auth", "auth-none");
- log.Warn("This should have an MDC message for the key 'auth'");
-
- } // The NDC message is popped off the stack at the end of the using {} block
-
- log.Warn("See the NDC has been popped of! The MDC 'auth' key is still with us.");
-
- // Log an info level message
- if (log.IsInfoEnabled) log.Info("Application [ConsoleApp] End");
-
- Console.Write("Press Enter to exit...");
- Console.ReadLine();
- }
-
- // Helper methods to demonstrate location information and nested exceptions
-
- private static void Bar()
- {
- Goo();
- }
-
- private static void Foo()
- {
- throw new Exception("This is an Exception");
- }
-
- private static void Goo()
- {
- try
- {
- Foo();
- }
- catch(Exception ex)
- {
- throw new ArithmeticException("Failed in Goo. Calling Foo. Inner Exception provided", ex);
- }
- }
- }
-}
diff --git a/examples/net/2.0/Tutorials/ConsoleApp/nant.build b/examples/net/2.0/Tutorials/ConsoleApp/nant.build
deleted file mode 100644
index d729828..0000000
--- a/examples/net/2.0/Tutorials/ConsoleApp/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="consoleapp-example" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile ConsoleApp example -->
- <target name="compile" description="Builds ConsoleApp example">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/net/2.0/Tutorials/ConsoleApp/nant.config b/examples/net/2.0/Tutorials/ConsoleApp/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/net/2.0/Tutorials/ConsoleApp/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/net/2.0/Tutorials/ConsoleApp/vb/nant.build b/examples/net/2.0/Tutorials/ConsoleApp/vb/nant.build
deleted file mode 100644
index 9d569e7..0000000
--- a/examples/net/2.0/Tutorials/ConsoleApp/vb/nant.build
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- copy log4net build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="${log4net.output.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- compile the example -->
- <vbc target="exe" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.vbc}" output="${current.bin.dir}/ConsoleApp.exe">
- <sources>
- <include name="src/**/*.vb" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.vb" />
- </sources>
- <references basedir="${current.bin.dir}">
- <include name="log4net.dll" />
- </references>
- </vbc>
- <!-- copy the ConsoleApp application configuration file -->
- <copy file="src/App.config" tofile="${current.bin.dir}/ConsoleApp.exe.config" />
- </target>
-</project>
diff --git a/examples/net/2.0/Tutorials/ConsoleApp/vb/nant.config b/examples/net/2.0/Tutorials/ConsoleApp/vb/nant.config
deleted file mode 100644
index 52613e8..0000000
--- a/examples/net/2.0/Tutorials/ConsoleApp/vb/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/net/2.0/Tutorials/ConsoleApp/vb/src/App.config b/examples/net/2.0/Tutorials/ConsoleApp/vb/src/App.config
deleted file mode 100644
index a96ed7c..0000000
--- a/examples/net/2.0/Tutorials/ConsoleApp/vb/src/App.config
+++ /dev/null
@@ -1,214 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<!--
- .NET application configuration file
- This file must have the exact same name as your application with .config appended to it.
-
- For example if your application is ConsoleApp.exe then the config file must be ConsoleApp.exe.config.
- It must also be in the same directory as the application.
- -->
-<configuration>
- <!-- Register a section handler for the log4net section -->
- <configSections>
- <section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
- </configSections>
- <appSettings>
- <!-- To enable internal log4net logging specify the following appSettings key -->
- <!-- <add key="log4net.Internal.Debug" value="true"/> -->
- </appSettings>
- <!-- This section contains the log4net configuration settings -->
- <log4net>
- <!-- Define some output appenders -->
- <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
- <file value="rolling-log.txt" />
- <appendToFile value="true" />
- <maxSizeRollBackups value="10" />
- <maximumFileSize value="100" />
- <rollingStyle value="Size" />
- <staticLogFileName value="true" />
- <layout type="log4net.Layout.PatternLayout">
- <header value="[Header] " />
- <footer value="[Footer] " />
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
- </layout>
- </appender>
- <appender name="LogFileAppender" type="log4net.Appender.FileAppender">
- <file value="log-file.txt" />
- <!-- Example using environment variables in params -->
- <!-- <file value="${TMP}\log-file.txt" /> -->
- <appendToFile value="true" />
- <!-- An alternate output encoding can be specified -->
- <!-- <encoding value="unicodeFFFE" /> -->
- <layout type="log4net.Layout.PatternLayout">
- <header value="[Header] " />
- <footer value="[Footer] " />
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] <%property{auth}> - %message%newline" />
- </layout>
- <!-- Alternate layout using XML
- <layout type="log4net.Layout.XMLLayout" /> -->
- </appender>
- <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] <%property{auth}> - %message%newline" />
- </layout>
- </appender>
- <appender name="NetSendAppender" type="log4net.Appender.NetSendAppender">
- <threshold value="ERROR" />
- <server value="SQUARE" />
- <recipient value="nicko" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
- </layout>
- </appender>
- <!-- Example of how to configure the AdoNetAppender
- <appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender" >
- <connectionString value="Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Work\cvs_root\log4net-1.2\access.mdb;UID=;PWD=;" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message]) VALUES ('%date','%thread','%level','%logger','%message')" />
- </layout>
- </appender>
- -->
- <!--
- <appender name="A" type="log4net.Appender.ForwardingAppender" >
- <threshold value="WARN"/>
- <appender-ref ref="ConsoleAppender" />
- </appender>
- <appender name="B" type="log4net.Appender.ForwardingAppender" >
- <filter type="log4net.Filter.LevelRangeFilter">
- <levelMin value="DEBUG"/>
- <levelMax value="INFO"/>
- </filter>
- <appender-ref ref="ConsoleAppender" />
- </appender>
- -->
- <!-- Example of how to configure the AdoNetAppender to connect to MS Access -->
- <appender name="ADONetAppender_Access" type="log4net.Appender.AdoNetAppender">
- <connectionString value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Work\cvs_root\log4net-1.2\access.mdb;User Id=;Password=;" />
- <commandText value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message]) VALUES (@log_date, @thread, @log_level, @logger, @message)" />
- <parameter>
- <parameterName value="@log_date" />
- <dbType value="String" />
- <size value="255" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date" />
- </layout>
- </parameter>
- <parameter>
- <parameterName value="@thread" />
- <dbType value="String" />
- <size value="255" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%thread" />
- </layout>
- </parameter>
- <parameter>
- <parameterName value="@log_level" />
- <dbType value="String" />
- <size value="50" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%level" />
- </layout>
- </parameter>
- <parameter>
- <parameterName value="@logger" />
- <dbType value="String" />
- <size value="255" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%logger" />
- </layout>
- </parameter>
- <parameter>
- <parameterName value="@message" />
- <dbType value="String" />
- <size value="1024" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%message" />
- </layout>
- </parameter>
- </appender>
- <!-- Example of how to configure the AdoNetAppender to connect to MS SQL Server -->
- <appender name="ADONetAppender_SqlServer" type="log4net.Appender.AdoNetAppender">
- <bufferSize value="1" />
- <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
- <connectionString value="data source=SQLSVR;initial catalog=test_log4net;integrated security=false;persist security info=True;" />
- <commandText value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message]) VALUES (@log_date, @thread, @log_level, @logger, @message)" />
- <parameter>
- <parameterName value="@log_date" />
- <dbType value="DateTime" />
- <!--
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date{yyyy'-'MM'-'dd HH':'mm':'ss'.'fff}" />
- </layout>
- -->
- <layout type="log4net.Layout.RawTimeStampLayout" />
- </parameter>
- <parameter>
- <parameterName value="@thread" />
- <dbType value="String" />
- <size value="255" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%thread" />
- </layout>
- </parameter>
- <parameter>
- <parameterName value="@log_level" />
- <dbType value="String" />
- <size value="50" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%level" />
- </layout>
- </parameter>
- <parameter>
- <parameterName value="@logger" />
- <dbType value="String" />
- <size value="255" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%logger" />
- </layout>
- </parameter>
- <parameter>
- <parameterName value="@message" />
- <dbType value="String" />
- <size value="4000" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%message" />
- </layout>
- </parameter>
- </appender>
- <!-- Setup the root category, add the appenders and set the default level -->
- <root>
- <level value="WARN" />
- <appender-ref ref="LogFileAppender" />
- <appender-ref ref="ConsoleAppender" />
- <!-- <appender-ref ref="ADONetAppender_SqlServer" /> -->
- <appender-ref ref="NetSendAppender" />
- <!-- <appender-ref ref="A" /> -->
- </root>
- <!-- Specify the level for some specific categories -->
- <logger name="ConsoleApp.LoggingExample">
- <!-- <appender-ref ref="B" /> -->
- <level value="ALL" />
- <appender-ref ref="RollingLogFileAppender" />
- </logger>
- </log4net>
-</configuration>
diff --git a/examples/net/2.0/Tutorials/ConsoleApp/vb/src/AssemblyInfo.vb b/examples/net/2.0/Tutorials/ConsoleApp/vb/src/AssemblyInfo.vb
deleted file mode 100644
index cbb6827..0000000
--- a/examples/net/2.0/Tutorials/ConsoleApp/vb/src/AssemblyInfo.vb
+++ /dev/null
@@ -1,61 +0,0 @@
-#Region "Apache License"
-'
-' Licensed to the Apache Software Foundation (ASF) under one or more
-' contributor license agreements. See the NOTICE file distributed with
-' this work for additional information regarding copyright ownership.
-' The ASF licenses this file to you 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.
-'
-#End Region
-
-Imports System.Reflection
-Imports System.Runtime.CompilerServices
-
-'
-' 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("log4net - ConsoleApp")>
-<Assembly:AssemblyDescription("log4net ConsoleApp")>
-<Assembly:AssemblyConfiguration("")>
-<Assembly:AssemblyProduct("log4net - ConsoleApp")>
-<Assembly:AssemblyCulture("")>
-
-'
-' In order to sign your assembly you must specify a key to use. Refer to the
-' Microsoft .NET Framework documentation for more information on assembly signing.
-'
-' Use the attributes below to control which key is used for signing.
-'
-' Notes:
-' (*) If no key is specified, the assembly is not signed.
-' (*) KeyName refers to a key that has been installed in the Crypto Service
-' Provider (CSP) on your machine. KeyFile refers to a file which contains
-' a key.
-' (*) If the KeyFile and the KeyName values are both specified, the
-' following processing occurs:
-' (1) If the KeyName can be found in the CSP, that key is used.
-' (2) If the KeyName does not exist and the KeyFile does exist, the key
-' in the KeyFile is installed into the CSP and used.
-' (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-' When specifying the KeyFile, the location of the KeyFile should be
-' relative to the project output directory which is
-' %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-' located in the project directory, you would specify the AssemblyKeyFile
-' attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-' (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-' documentation for more information on this.
-'
-<Assembly:AssemblyDelaySign(false)>
-<Assembly:AssemblyKeyFile("")>
-<Assembly:AssemblyKeyName("")>
diff --git a/examples/net/2.0/Tutorials/ConsoleApp/vb/src/ConsoleApp.vbproj b/examples/net/2.0/Tutorials/ConsoleApp/vb/src/ConsoleApp.vbproj
deleted file mode 100644
index 9938df1..0000000
--- a/examples/net/2.0/Tutorials/ConsoleApp/vb/src/ConsoleApp.vbproj
+++ /dev/null
@@ -1,134 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<VisualStudioProject>
- <VisualBasic
- ProjectType = "Local"
- ProductVersion = "7.0.9466"
- SchemaVersion = "1.0"
- ProjectGuid = "{41B855A4-F3BF-43F8-BE6F-2ABD5E5C8D42}"
- >
- <Build>
- <Settings
- ApplicationIcon = ""
- AssemblyKeyContainerName = ""
- AssemblyName = "ConsoleApp"
- AssemblyOriginatorKeyFile = ""
- AssemblyOriginatorKeyMode = "None"
- DefaultClientScript = "JScript"
- DefaultHTMLPageLayout = "Grid"
- DefaultTargetSchema = "IE50"
- DelaySign = "false"
- OutputType = "Exe"
- OptionCompare = "Binary"
- OptionExplicit = "On"
- OptionStrict = "On"
- RootNamespace = ""
- StartupObject = "ConsoleApp.LoggingExample"
- >
- <Config
- Name = "Debug"
- BaseAddress = "285212672"
- ConfigurationOverrideFile = ""
- DefineConstants = ""
- DefineDebug = "true"
- DefineTrace = "true"
- DebugSymbols = "true"
- IncrementalBuild = "true"
- Optimize = "false"
- OutputPath = "..\build\debug\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "1"
- />
- <Config
- Name = "Release"
- BaseAddress = "285212672"
- ConfigurationOverrideFile = ""
- DefineConstants = ""
- DefineDebug = "false"
- DefineTrace = "true"
- DebugSymbols = "false"
- IncrementalBuild = "false"
- Optimize = "true"
- OutputPath = "..\build\release\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "1"
- />
- </Settings>
- <References>
- <Reference
- Name = "System"
- AssemblyName = "System"
- />
- <Reference
- Name = "System.Data"
- AssemblyName = "System.Data"
- />
- <Reference
- Name = "System.XML"
- AssemblyName = "System.Xml"
- />
- <Reference
- Name = "log4net"
- AssemblyName = "log4net"
- HintPath = "..\..\..\..\..\..\..\bin\net\1.0\release\log4net.dll"
- />
- </References>
- <Imports>
- <Import Namespace = "Microsoft.VisualBasic" />
- <Import Namespace = "System" />
- <Import Namespace = "System.Collections" />
- <Import Namespace = "System.Data" />
- <Import Namespace = "System.Diagnostics" />
- </Imports>
- </Build>
- <Files>
- <Include>
- <File
- RelPath = "App.config"
- BuildAction = "None"
- />
- <File
- RelPath = "AssemblyInfo.vb"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "AssemblyVersionInfo.vb"
- Link = "..\..\..\..\..\..\..\src\AssemblyVersionInfo.vb"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "LoggingExample.vb"
- SubType = "Code"
- BuildAction = "Compile"
- />
- </Include>
- </Files>
- </VisualBasic>
-</VisualStudioProject>
-
diff --git a/examples/net/2.0/Tutorials/ConsoleApp/vb/src/LoggingExample.vb b/examples/net/2.0/Tutorials/ConsoleApp/vb/src/LoggingExample.vb
deleted file mode 100644
index 191d741..0000000
--- a/examples/net/2.0/Tutorials/ConsoleApp/vb/src/LoggingExample.vb
+++ /dev/null
@@ -1,100 +0,0 @@
-#Region "Apache License"
-'
-' Licensed to the Apache Software Foundation (ASF) under one or more
-' contributor license agreements. See the NOTICE file distributed with
-' this work for additional information regarding copyright ownership.
-' The ASF licenses this file to you 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.
-'
-#End Region
-
-Imports System
-
-' Configure log4net using the .config file
-<Assembly: log4net.Config.XmlConfigurator(Watch:=True)>
-' This will cause log4net to look for a configuration file
-' called ConsoleApp.exe.config in the application base
-' directory (i.e. the directory containing ConsoleApp.exe)
-
-Namespace ConsoleApp
- ' Example of how to simply configure and use log4net
- Public Class LoggingExample
- ' Create a logger for use in this class
- Private Shared ReadOnly log As log4net.ILog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)
- ' NOTE that using System.Reflection.MethodBase.GetCurrentMethod().DeclaringType
- ' is equivalent to typeof(LoggingExample) but is more portable
- ' i.e. you can copy the code directly into another class without
- ' needing to edit the code.
-
- ' Application entry point
- Public Shared Sub Main(Byval args As String())
- ' Log an info level message
- If log.IsInfoEnabled Then log.Info("Application [ConsoleApp] Start")
-
- ' Log a debug message. Test if debug is enabled before
- ' attempting to log the message. This is not required but
- ' can make running without logging faster.
- If log.IsDebugEnabled Then log.Debug("This is a debug message")
-
- Try
- Bar()
- Catch ex As Exception
- ' Log an error with an exception
- log.Error("Exception thrown from method Bar", ex)
- End Try
-
- log.Error("Hey this is an error!")
-
- Dim disposableFrame As IDisposable
-
- Try
- ' Push a message on to the Nested Diagnostic Context stack
- disposableFrame = log4net.NDC.Push("NDC_Message")
-
- log.Warn("This should have an NDC message")
-
- ' Set a Mapped Diagnostic Context value
- log4net.MDC.Set("auth", "auth-none")
- log.Warn("This should have an MDC message for the key 'auth'")
- Finally
- ' The NDC message is popped off the stack by using the Dispose method
- If (Not disposableFrame is Nothing) Then disposableFrame.Dispose()
- End Try
-
- log.Warn("See the NDC has been popped of! The MDC 'auth' key is still with us.")
-
- ' Log an info level message
- If log.IsInfoEnabled Then log.Info("Application [ConsoleApp] End")
-
- Console.Write("Press Enter to exit...")
- Console.ReadLine()
- End Sub
-
- ' Helper methods to demonstrate location information and nested exceptions
-
- Private Shared Sub Bar()
- Goo()
- End Sub
-
- Private Shared Sub Foo()
- Throw new Exception("This is an Exception")
- End Sub
-
- Private Shared Sub Goo()
- Try
- Foo()
- Catch ex As Exception
- Throw New ArithmeticException("Failed in Goo. Calling Foo. Inner Exception provided", ex)
- End Try
- End Sub
- End Class
-End Namespace
diff --git a/examples/net/2.0/Tutorials/WebApp/cs/nant.build b/examples/net/2.0/Tutorials/WebApp/cs/nant.build
deleted file mode 100644
index c8c2eb9..0000000
--- a/examples/net/2.0/Tutorials/WebApp/cs/nant.build
+++ /dev/null
@@ -1,73 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- make sure the binaries directory for the WebApp exists and is cleaned -->
- <delete dir="src/bin" if="${directory::exists('src/bin')}" />
- <mkdir dir="src/bin" />
- <!-- copy log4net build output -->
- <copy todir="src/bin">
- <fileset basedir="${log4net.output.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- build SharedModule assembly -->
- <nant buildfile="../../../Repository/SharedModule/cs/nant.build" target="compile" inheritall="true" />
- <!-- build SimpleModule assembly -->
- <nant buildfile="../../../Repository/SimpleModule/cs/nant.build" target="compile" inheritall="true" />
- <!-- copy SharedModule build output -->
- <copy todir="src/bin">
- <fileset basedir="../../../Repository/SharedModule/cs/${current.bin.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- copy SimpleModule build output -->
- <copy todir="src/bin">
- <fileset basedir="../../../Repository/SimpleModule/cs/${current.bin.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- compile the example -->
- <csc noconfig="true" target="library" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.csc}" output="src/bin/WebApp.dll">
- <sources>
- <include name="src/**/*.cs" />
- </sources>
- <references>
- <include name="src/bin/SharedModule.dll" />
- <include name="src/bin/SimpleModule.dll" />
- <include name="src/bin/log4net.dll" />
- <include name="System.dll" />
- <include name="System.Data.dll" />
- <include name="System.Drawing.dll" />
- <include name="System.Web.dll" />
- </references>
- </csc>
- </target>
- <!-- Target for updating the AssemblyVersionInfo -->
- <target name="update-version-info" depends="check-log4net-basedir">
- <copy file="${log4net.basedir}/src/AssemblyVersionInfo.cs" todir="src" overwrite="true" />
- </target>
-</project>
diff --git a/examples/net/2.0/Tutorials/WebApp/cs/nant.config b/examples/net/2.0/Tutorials/WebApp/cs/nant.config
deleted file mode 100644
index 52613e8..0000000
--- a/examples/net/2.0/Tutorials/WebApp/cs/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/net/2.0/Tutorials/WebApp/cs/src/AssemblyInfo.cs b/examples/net/2.0/Tutorials/WebApp/cs/src/AssemblyInfo.cs
deleted file mode 100644
index 3880373..0000000
--- a/examples/net/2.0/Tutorials/WebApp/cs/src/AssemblyInfo.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// 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("log4net - WebApp")]
-[assembly: AssemblyDescription("log4net WebApp")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyProduct("log4net - WebApp")]
-[assembly: AssemblyCulture("")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the "project output directory". The location of the project output
-// directory is dependent on whether you are working with a local or web project.
-// For local projects, the project output directory is defined as
-// <Project Directory>\obj\<Configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// For web projects, the project output directory is defined as
-// %HOMEPATH%\VSWebCache\<Machine Name>\<Project Directory>\obj\<Configuration>.
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("")]
-[assembly: AssemblyKeyName("")]
diff --git a/examples/net/2.0/Tutorials/WebApp/cs/src/AssemblyVersionInfo.cs b/examples/net/2.0/Tutorials/WebApp/cs/src/AssemblyVersionInfo.cs
deleted file mode 100644
index 2c98bcf..0000000
--- a/examples/net/2.0/Tutorials/WebApp/cs/src/AssemblyVersionInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-//
-// 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: System.Reflection.AssemblyVersion("1.2.0.30714")]
-
-
-[assembly: System.Reflection.AssemblyCompany("The Apache Software Foundation")]
-[assembly: System.Reflection.AssemblyCopyright("Copyright 2004-2011 The Apache Software Foundation.")]
-[assembly: System.Reflection.AssemblyTrademark("Copyright 2004-2011 The Apache Software Foundation.")]
diff --git a/examples/net/2.0/Tutorials/WebApp/cs/src/Global.asax b/examples/net/2.0/Tutorials/WebApp/cs/src/Global.asax
deleted file mode 100644
index 79f74fc..0000000
--- a/examples/net/2.0/Tutorials/WebApp/cs/src/Global.asax
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<%@ Application Codebehind="Global.asax.cs" Inherits="WebApp.Global" %>
diff --git a/examples/net/2.0/Tutorials/WebApp/cs/src/Global.asax.cs b/examples/net/2.0/Tutorials/WebApp/cs/src/Global.asax.cs
deleted file mode 100644
index b3d9384..0000000
--- a/examples/net/2.0/Tutorials/WebApp/cs/src/Global.asax.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System;
-using System.Collections;
-using System.ComponentModel;
-using System.Web;
-using System.Web.SessionState;
-
-// Load the configuration from the 'WebApp.dll.log4net' file
-[assembly: log4net.Config.XmlConfigurator(ConfigFileExtension="log4net", Watch=true)]
-
-namespace WebApp
-{
- /// <summary>
- /// Summary description for Global.
- /// </summary>
- public class Global : System.Web.HttpApplication
- {
- public Global()
- {
- InitializeComponent();
- }
-
- #region Web Form Designer generated code
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- }
- #endregion
- }
-}
-
diff --git a/examples/net/2.0/Tutorials/WebApp/cs/src/Global.asax.resx b/examples/net/2.0/Tutorials/WebApp/cs/src/Global.asax.resx
deleted file mode 100644
index c8e3ce7..0000000
--- a/examples/net/2.0/Tutorials/WebApp/cs/src/Global.asax.resx
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<root>
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="ResMimeType">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="Version">
- <value>1.0.0.0</value>
- </resheader>
- <resheader name="Reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3102.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="Writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3102.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
-</root>
diff --git a/examples/net/2.0/Tutorials/WebApp/cs/src/SimpleModule.dll.log4net b/examples/net/2.0/Tutorials/WebApp/cs/src/SimpleModule.dll.log4net
deleted file mode 100644
index a8adb51..0000000
--- a/examples/net/2.0/Tutorials/WebApp/cs/src/SimpleModule.dll.log4net
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-
-<!-- This section contains the log4net configuration settings -->
-<log4net>
-
- <!-- Define some output appenders -->
-
- <appender name="LogFileAppender" type="log4net.Appender.FileAppender" >
- <file value="simple-module-log.txt" />
- <appendToFile value="true" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
- </layout>
- </appender>
-
- <!-- Setup the root category, add the appenders and set the default level -->
-
- <root>
- <level value="DEBUG" />
- <appender-ref ref="LogFileAppender" />
- </root>
-
-</log4net>
diff --git a/examples/net/2.0/Tutorials/WebApp/cs/src/Web.config b/examples/net/2.0/Tutorials/WebApp/cs/src/Web.config
deleted file mode 100644
index 8389366..0000000
--- a/examples/net/2.0/Tutorials/WebApp/cs/src/Web.config
+++ /dev/null
@@ -1,107 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<configuration>
-
- <!-- Enable internal debugging in log4net -->
- <appSettings>
- <!-- To enable internal log4net logging specify the
- following appSettings key -->
-
- <!-- <add key="log4net.Internal.Debug" value="true"/> -->
- </appSettings>
-
- <system.web>
-
- <!-- DYNAMIC DEBUG COMPILATION
- Set compilation debug="true" to enable ASPX debugging. Otherwise, setting this value to
- false will improve runtime performance of this application.
- Set compilation debug="true" to insert debugging symbols (.pdb information)
- into the compiled page. Because this creates a larger file that executes
- more slowly, you should set this value to true only when debugging and to
- false at all other times. For more information, refer to the documentation about
- debugging ASP .NET files.
- -->
- <compilation
- defaultLanguage="c#"
- debug="true"
- />
-
- <!-- CUSTOM ERROR MESSAGES
- Set customError mode values to control the display of user-friendly
- error messages to users instead of error details (including a stack trace):
-
- "On" Always display custom (friendly) messages
- "Off" Always display detailed ASP.NET error information.
- "RemoteOnly" Display custom (friendly) messages only to users not running
- on the local Web server. This setting is recommended for security purposes, so
- that you do not display application detail information to remote clients.
- -->
- <customErrors
- mode="RemoteOnly"
- />
-
- <!-- AUTHENTICATION
- This section sets the authentication policies of the application. Possible modes are "Windows", "Forms",
- "Passport" and "None"
- -->
- <authentication mode="Windows" />
-
- <!-- APPLICATION-LEVEL TRACE LOGGING
- Application-level tracing enables trace log output for every page within an application.
- Set trace enabled="true" to enable application trace logging. If pageOutput="true", the
- trace information will be displayed at the bottom of each page. Otherwise, you can view the
- application trace log by browsing the "trace.axd" page from your web application
- root.
- -->
- <trace
- enabled="true"
- requestLimit="10"
- pageOutput="false"
- traceMode="SortByTime"
- localOnly="true"
- />
-
- <!-- SESSION STATE SETTINGS
- By default ASP .NET uses cookies to identify which requests belong to a particular session.
- If cookies are not available, a session can be tracked by adding a session identifier to the URL.
- To disable cookies, set sessionState cookieless="true".
- -->
- <sessionState
- mode="InProc"
- stateConnectionString="tcpip=127.0.0.1:42424"
- sqlConnectionString="data source=127.0.0.1;user id=sa;password="
- cookieless="false"
- timeout="20"
- />
-
- <!-- GLOBALIZATION
- This section sets the globalization settings of the application.
- -->
- <globalization
- requestEncoding="utf-8"
- responseEncoding="utf-8"
- />
-
- </system.web>
-
-</configuration>
diff --git a/examples/net/2.0/Tutorials/WebApp/cs/src/WebApp.csproj b/examples/net/2.0/Tutorials/WebApp/cs/src/WebApp.csproj
deleted file mode 100644
index 105bfdb..0000000
--- a/examples/net/2.0/Tutorials/WebApp/cs/src/WebApp.csproj
+++ /dev/null
@@ -1,191 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<VisualStudioProject>
- <CSHARP
- ProjectType = "Web"
- ProductVersion = "7.0.9466"
- SchemaVersion = "1.0"
- ProjectGuid = "{F19ACB50-EFA8-4B72-BABC-25EDCE729E90}"
- >
- <Build>
- <Settings
- ApplicationIcon = ""
- AssemblyKeyContainerName = ""
- AssemblyName = "WebApp"
- AssemblyOriginatorKeyFile = ""
- DefaultClientScript = "JScript"
- DefaultHTMLPageLayout = "Grid"
- DefaultTargetSchema = "IE50"
- DelaySign = "false"
- OutputType = "Library"
- PreBuildEvent = ""
- PostBuildEvent = ""
- RootNamespace = "WebApp"
- RunPostBuildEvent = "OnBuildSuccess"
- StartupObject = ""
- >
- <Config
- Name = "Debug"
- AllowUnsafeBlocks = "false"
- BaseAddress = "285212672"
- CheckForOverflowUnderflow = "false"
- ConfigurationOverrideFile = ""
- DefineConstants = "DEBUG;TRACE"
- DocumentationFile = ""
- DebugSymbols = "true"
- FileAlignment = "4096"
- IncrementalBuild = "true"
- NoStdLib = "false"
- NoWarn = ""
- Optimize = "false"
- OutputPath = "bin\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "4"
- />
- <Config
- Name = "Release"
- AllowUnsafeBlocks = "false"
- BaseAddress = "285212672"
- CheckForOverflowUnderflow = "false"
- ConfigurationOverrideFile = ""
- DefineConstants = "TRACE"
- DocumentationFile = ""
- DebugSymbols = "false"
- FileAlignment = "4096"
- IncrementalBuild = "false"
- NoStdLib = "false"
- NoWarn = ""
- Optimize = "true"
- OutputPath = "bin\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "4"
- />
- </Settings>
- <References>
- <Reference
- Name = "System"
- AssemblyName = "System"
- HintPath = "..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
- />
- <Reference
- Name = "System.Drawing"
- AssemblyName = "System.Drawing"
- HintPath = "..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Drawing.dll"
- />
- <Reference
- Name = "System.Data"
- AssemblyName = "System.Data"
- HintPath = "..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
- />
- <Reference
- Name = "System.Web"
- AssemblyName = "System.Web"
- HintPath = "..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Web.dll"
- />
- <Reference
- Name = "System.XML"
- AssemblyName = "System.Xml"
- HintPath = "..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
- />
- <Reference
- Name = "SharedModule"
- Project = "{9AACDC1A-84FB-4042-85A5-7095C66AD973}"
- Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
- />
- <Reference
- Name = "SimpleModule"
- Project = "{F82AA1D9-5B52-4890-8838-7AAAF7D8F0EE}"
- Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
- />
- <Reference
- Name = "log4net"
- AssemblyName = "log4net-net-1.0"
- HintPath = "..\..\..\..\..\..\..\bin\net\1.0\release\log4net.dll"
- />
- </References>
- </Build>
- <Files>
- <Include>
- <File
- RelPath = "AssemblyInfo.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "AssemblyVersionInfo.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "Global.asax"
- SubType = "Component"
- BuildAction = "Content"
- />
- <File
- RelPath = "Global.asax.cs"
- DependentUpon = "Global.asax"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "Global.asax.resx"
- DependentUpon = "Global.asax.cs"
- BuildAction = "EmbeddedResource"
- />
- <File
- RelPath = "Web.config"
- BuildAction = "Content"
- />
- <File
- RelPath = "WebApp.dll.log4net"
- BuildAction = "Content"
- />
- <File
- RelPath = "WebApp.vsdisco"
- BuildAction = "None"
- />
- <File
- RelPath = "WebForm1.aspx"
- SubType = "Form"
- BuildAction = "Content"
- />
- <File
- RelPath = "WebForm1.aspx.cs"
- DependentUpon = "WebForm1.aspx"
- SubType = "ASPXCodeBehind"
- BuildAction = "Compile"
- />
- <File
- RelPath = "WebForm1.aspx.resx"
- DependentUpon = "WebForm1.aspx.cs"
- BuildAction = "EmbeddedResource"
- />
- </Include>
- </Files>
- </CSHARP>
-</VisualStudioProject>
-
diff --git a/examples/net/2.0/Tutorials/WebApp/cs/src/WebApp.csproj.webinfo b/examples/net/2.0/Tutorials/WebApp/cs/src/WebApp.csproj.webinfo
deleted file mode 100644
index edb09e9..0000000
--- a/examples/net/2.0/Tutorials/WebApp/cs/src/WebApp.csproj.webinfo
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<VisualStudioUNCWeb>
- <Web URLPath = "http://localhost/WebAppCS/WebApp.csproj" />
-</VisualStudioUNCWeb>
-
diff --git a/examples/net/2.0/Tutorials/WebApp/cs/src/WebApp.dll.log4net b/examples/net/2.0/Tutorials/WebApp/cs/src/WebApp.dll.log4net
deleted file mode 100644
index 63b0c69..0000000
--- a/examples/net/2.0/Tutorials/WebApp/cs/src/WebApp.dll.log4net
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<log4net debug="false">
- <appender name="LogFileAppender" type="log4net.Appender.FileAppender" >
- <file value="webapp-log.txt" />
- <appendToFile value="true" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
- </layout>
- </appender>
- <appender name="HttpTraceAppender" type="log4net.Appender.AspNetTraceAppender" >
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
- </layout>
- </appender>
- <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
- <file value="log-data\rolling-log.txt" />
- <appendToFile value="true" />
- <maxSizeRollBackups value="10" />
- <maximumFileSize value="5MB" />
- <rollingStyle value="Size" />
- <staticLogFileName value="true" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
- </layout>
- </appender>
- <root>
- <level value="DEBUG" />
- <appender-ref ref="LogFileAppender" />
- <appender-ref ref="HttpTraceAppender" />
- <!-- <appender-ref ref="RollingLogFileAppender" /> -->
- </root>
-</log4net>
diff --git a/examples/net/2.0/Tutorials/WebApp/cs/src/WebApp.vsdisco b/examples/net/2.0/Tutorials/WebApp/cs/src/WebApp.vsdisco
deleted file mode 100644
index 639642e..0000000
--- a/examples/net/2.0/Tutorials/WebApp/cs/src/WebApp.vsdisco
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<dynamicDiscovery xmlns="urn:schemas-dynamicdiscovery:disco.2000-03-17">
-<exclude path="_vti_cnf" />
-<exclude path="_vti_pvt" />
-<exclude path="_vti_log" />
-<exclude path="_vti_script" />
-<exclude path="_vti_txt" />
-<exclude path="Web References" />
-</dynamicDiscovery>
diff --git a/examples/net/2.0/Tutorials/WebApp/cs/src/WebForm1.aspx b/examples/net/2.0/Tutorials/WebApp/cs/src/WebForm1.aspx
deleted file mode 100644
index 7de9890..0000000
--- a/examples/net/2.0/Tutorials/WebApp/cs/src/WebForm1.aspx
+++ /dev/null
@@ -1,48 +0,0 @@
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApp.WebForm1" %>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
-<HTML>
- <HEAD>
- <title>WebForm1</title>
- <meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
- <meta name="CODE_LANGUAGE" Content="C#">
- <meta name="vs_defaultClientScript" content="JavaScript">
- <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
- </HEAD>
- <body MS_POSITIONING="GridLayout">
- <form id="Form1" method="post" runat="server">
- <asp:TextBox id="txtAdd1" style="Z-INDEX: 100; LEFT: 88px; POSITION: absolute; TOP: 80px" runat="server" Width="25px"></asp:TextBox>
- <asp:TextBox id="txtAdd2" style="Z-INDEX: 105; LEFT: 144px; POSITION: absolute; TOP: 80px" runat="server" Width="25px"></asp:TextBox>
- <asp:TextBox id="txtAdd3" style="Z-INDEX: 106; LEFT: 216px; POSITION: absolute; TOP: 80px" runat="server" Width="25px"></asp:TextBox>
- <asp:Label id="Label1" style="Z-INDEX: 101; LEFT: 126px; POSITION: absolute; TOP: 80px" runat="server" Width="18px" Height="2px">+</asp:Label>
- <asp:Label id="Label2" style="Z-INDEX: 102; LEFT: 184px; POSITION: absolute; TOP: 80px" runat="server" Width="8px" Height="20px">=</asp:Label>
- <asp:Button id="btnCalcAdd" style="Z-INDEX: 103; LEFT: 272px; POSITION: absolute; TOP: 80px" runat="server" Width="63px" Height="29px" Text="Calc"></asp:Button>
- <asp:TextBox id="txtSub1" style="Z-INDEX: 100; LEFT: 88px; POSITION: absolute; TOP: 160px" runat="server" Width="25px"></asp:TextBox>
- <asp:TextBox id="txtSub2" style="Z-INDEX: 105; LEFT: 144px; POSITION: absolute; TOP: 160px" runat="server" Width="25px"></asp:TextBox>
- <asp:TextBox id="txtSub3" style="Z-INDEX: 106; LEFT: 216px; POSITION: absolute; TOP: 160px" runat="server" Width="25px"></asp:TextBox>
- <asp:Label id="Label3" style="Z-INDEX: 101; LEFT: 126px; POSITION: absolute; TOP: 160px" runat="server" Width="18px" Height="2px">-</asp:Label>
- <asp:Label id="Label4" style="Z-INDEX: 102; LEFT: 184px; POSITION: absolute; TOP: 160px" runat="server" Width="8px" Height="20px">=</asp:Label>
- <asp:Button id="btnCalcSub" style="Z-INDEX: 103; LEFT: 272px; POSITION: absolute; TOP: 160px" runat="server" Width="63px" Height="29px" Text="Calc"></asp:Button>
- </form>
- </body>
-</HTML>
diff --git a/examples/net/2.0/Tutorials/WebApp/cs/src/WebForm1.aspx.cs b/examples/net/2.0/Tutorials/WebApp/cs/src/WebForm1.aspx.cs
deleted file mode 100644
index a4908f3..0000000
--- a/examples/net/2.0/Tutorials/WebApp/cs/src/WebForm1.aspx.cs
+++ /dev/null
@@ -1,119 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System;
-using System.Collections;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Web;
-using System.Web.SessionState;
-using System.Web.UI;
-using System.Web.UI.WebControls;
-using System.Web.UI.HtmlControls;
-
-using log4net;
-
-namespace WebApp
-{
- /// <summary>
- /// Summary description for WebForm1.
- /// </summary>
- public class WebForm1 : System.Web.UI.Page
- {
- private static readonly ILog log = LogManager.GetLogger(typeof(WebForm1));
-
- protected System.Web.UI.WebControls.Label Label1;
- protected System.Web.UI.WebControls.Label Label2;
- protected System.Web.UI.WebControls.Label Label3;
- protected System.Web.UI.WebControls.Label Label4;
-
- protected System.Web.UI.WebControls.TextBox txtAdd1;
- protected System.Web.UI.WebControls.TextBox txtAdd2;
- protected System.Web.UI.WebControls.TextBox txtAdd3;
- protected System.Web.UI.WebControls.Button btnCalcAdd;
-
- protected System.Web.UI.WebControls.TextBox txtSub1;
- protected System.Web.UI.WebControls.TextBox txtSub2;
- protected System.Web.UI.WebControls.TextBox txtSub3;
- protected System.Web.UI.WebControls.Button btnCalcSub;
-
- protected SimpleModule.Math m_MathAdd = new SimpleModule.Math();
- protected SharedModule.Math m_MathSub = new SharedModule.Math();
-
- private void Page_Load(object sender, System.EventArgs e)
- {
- // Put user code to initialize the page here
- }
-
- #region Web Form Designer generated code
- override protected void OnInit(EventArgs e)
- {
- AppDomain appDom = AppDomain.CurrentDomain;
- HttpContext context = HttpContext.Current;
- //
- // CODEGEN: This call is required by the ASP.NET Web Form Designer.
- //
- InitializeComponent();
- base.OnInit(e);
-
- txtAdd1.Text = "0";
- txtAdd2.Text = "0";
- txtAdd3.Text = "0";
-
- txtSub1.Text = "0";
- txtSub2.Text = "0";
- txtSub3.Text = "0";
- }
-
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.btnCalcAdd.Click += new System.EventHandler(this.btnCalcAdd_Click);
- this.btnCalcSub.Click += new System.EventHandler(this.btnCalcSub_Click);
- this.Load += new System.EventHandler(this.Page_Load);
- }
- #endregion
-
- private void btnCalcAdd_Click(object sender, System.EventArgs e)
- {
- if (log.IsDebugEnabled) log.Debug("txtAdd1=[" + txtAdd1.Text + "] txtAdd2=[" + txtAdd2.Text + "]");
-
- int result = m_MathAdd.Add(int.Parse(txtAdd1.Text), int.Parse(txtAdd2.Text));
-
- if (log.IsInfoEnabled) log.Info("result=[" + result + "]");
-
- txtAdd3.Text = result.ToString();
- }
-
- private void btnCalcSub_Click(object sender, System.EventArgs e)
- {
- if (log.IsDebugEnabled) log.Debug("txtSub1=[" + txtSub1.Text + "] txtSub2=[" + txtSub2.Text + "]");
-
- int result = m_MathSub.Subtract(int.Parse(txtSub1.Text), int.Parse(txtSub2.Text));
-
- if (log.IsInfoEnabled) log.Info("result=[" + result + "]");
-
- txtSub3.Text = result.ToString();
- }
- }
-}
diff --git a/examples/net/2.0/Tutorials/WebApp/cs/src/WebForm1.aspx.resx b/examples/net/2.0/Tutorials/WebApp/cs/src/WebForm1.aspx.resx
deleted file mode 100644
index c8e3ce7..0000000
--- a/examples/net/2.0/Tutorials/WebApp/cs/src/WebForm1.aspx.resx
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<root>
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="ResMimeType">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="Version">
- <value>1.0.0.0</value>
- </resheader>
- <resheader name="Reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3102.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="Writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3102.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
-</root>
diff --git a/examples/net/2.0/Tutorials/WebApp/nant.build b/examples/net/2.0/Tutorials/WebApp/nant.build
deleted file mode 100644
index b35bcd8..0000000
--- a/examples/net/2.0/Tutorials/WebApp/nant.build
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="consoleapp-example" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile WebApp example -->
- <target name="compile" description="Builds WebApp example">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
- <!-- update the version of WebApp example -->
- <target name="update-version-info" description="Update AssemblyVersionInfo of WebApp example">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/net/2.0/Tutorials/WebApp/nant.config b/examples/net/2.0/Tutorials/WebApp/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/net/2.0/Tutorials/WebApp/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/net/2.0/Tutorials/WebApp/readme.txt b/examples/net/2.0/Tutorials/WebApp/readme.txt
deleted file mode 100644
index 3f2db3d..0000000
--- a/examples/net/2.0/Tutorials/WebApp/readme.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-WebApp
-======
-
-Example web application using log4net.
-
-To setup IIS to run this web application:
-
- - In IIS create a new Virtual Directory
- in the root of the default web site.
- - Set the alias to 'WebApp<code language>', where <code language>
- can be either CS (for the C# version of this tutorial) or
- VB (for the VB.NET version of this tutorial)
- (e.g. WebAppCS)
- - Set the directory to an underlying 'src' directory
- (e.g. 'C:\log4net\examples\net\1.0\Tutorials\WebApp\cs\src')
- - Set the access permissions to Read & Run scripts
-
-To run the test application
-
- - Visit: http://localhost/WebAppCS/WebForm1.aspx or http://localhost/WebAppVB/WebForm1.aspx
- - Calculate some sums
-
-To setup logging
-
- - Examine the WebApp.dll.log4net file.
- - The ASPNET user account must be given permissions
- to write to logfiles
- - Once you have set the permissions try rerunning
- the test application.
diff --git a/examples/net/2.0/Tutorials/WebApp/vb/nant.build b/examples/net/2.0/Tutorials/WebApp/vb/nant.build
deleted file mode 100644
index 97ec557..0000000
--- a/examples/net/2.0/Tutorials/WebApp/vb/nant.build
+++ /dev/null
@@ -1,73 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- make sure the binaries directory for the WebApp exists and is cleaned -->
- <delete dir="src/bin" if="${directory::exists('src/bin')}" />
- <mkdir dir="src/bin" />
- <!-- copy log4net build output -->
- <copy todir="src/bin">
- <fileset basedir="${log4net.output.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- build SharedModule assembly -->
- <nant buildfile="../../../Repository/SharedModule/vb/nant.build" target="compile" inheritall="true" />
- <!-- build SimpleModule assembly -->
- <nant buildfile="../../../Repository/SimpleModule/vb/nant.build" target="compile" inheritall="true" />
- <!-- copy SharedModule build output -->
- <copy todir="src/bin">
- <fileset basedir="../../../Repository/SharedModule/vb/${current.bin.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- copy SimpleModule build output -->
- <copy todir="src/bin">
- <fileset basedir="../../../Repository/SimpleModule/vb/${current.bin.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- compile the example -->
- <vbc target="library" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.vbc}" output="src/bin/WebApp.dll">
- <sources basedir="src">
- <include name="**/*.vb" />
- </sources>
- <references>
- <include name="src/bin/SharedModule.dll" />
- <include name="src/bin/SimpleModule.dll" />
- <include name="src/bin/log4net.dll" />
- <include name="System.dll" />
- <include name="System.Data.dll" />
- <include name="System.Drawing.dll" />
- <include name="System.Web.dll" />
- </references>
- </vbc>
- </target>
- <!-- Target for updating the AssemblyVersionInfo -->
- <target name="update-version-info" depends="check-log4net-basedir">
- <copy file="${log4net.basedir}/src/AssemblyVersionInfo.vb" todir="src" overwrite="true" />
- </target>
-</project>
diff --git a/examples/net/2.0/Tutorials/WebApp/vb/nant.config b/examples/net/2.0/Tutorials/WebApp/vb/nant.config
deleted file mode 100644
index 36ee85d..0000000
--- a/examples/net/2.0/Tutorials/WebApp/vb/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" readonly="false" />
-</project>
diff --git a/examples/net/2.0/Tutorials/WebApp/vb/src/AssemblyInfo.vb b/examples/net/2.0/Tutorials/WebApp/vb/src/AssemblyInfo.vb
deleted file mode 100644
index 98d3aa9..0000000
--- a/examples/net/2.0/Tutorials/WebApp/vb/src/AssemblyInfo.vb
+++ /dev/null
@@ -1,61 +0,0 @@
-#Region "Apache License"
-'
-' Licensed to the Apache Software Foundation (ASF) under one or more
-' contributor license agreements. See the NOTICE file distributed with
-' this work for additional information regarding copyright ownership.
-' The ASF licenses this file to you 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.
-'
-#End Region
-
-Imports System.Reflection
-Imports System.Runtime.CompilerServices
-
-'
-' 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("log4net - WebApp")>
-<Assembly:AssemblyDescription("log4net WebApp")>
-<Assembly:AssemblyConfiguration("")>
-<Assembly:AssemblyProduct("log4net - WebApp")>
-<Assembly:AssemblyCulture("")>
-
-'
-' In order to sign your assembly you must specify a key to use. Refer to the
-' Microsoft .NET Framework documentation for more information on assembly signing.
-'
-' Use the attributes below to control which key is used for signing.
-'
-' Notes:
-' (*) If no key is specified, the assembly is not signed.
-' (*) KeyName refers to a key that has been installed in the Crypto Service
-' Provider (CSP) on your machine. KeyFile refers to a file which contains
-' a key.
-' (*) If the KeyFile and the KeyName values are both specified, the
-' following processing occurs:
-' (1) If the KeyName can be found in the CSP, that key is used.
-' (2) If the KeyName does not exist and the KeyFile does exist, the key
-' in the KeyFile is installed into the CSP and used.
-' (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-' When specifying the KeyFile, the location of the KeyFile should be
-' relative to the project output directory which is
-' %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-' located in the project directory, you would specify the AssemblyKeyFile
-' attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-' (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-' documentation for more information on this.
-'
-<Assembly:AssemblyDelaySign(false)>
-<Assembly:AssemblyKeyFile("")>
-<Assembly:AssemblyKeyName("")>
diff --git a/examples/net/2.0/Tutorials/WebApp/vb/src/AssemblyVersionInfo.vb b/examples/net/2.0/Tutorials/WebApp/vb/src/AssemblyVersionInfo.vb
deleted file mode 100644
index 124d1a6..0000000
--- a/examples/net/2.0/Tutorials/WebApp/vb/src/AssemblyVersionInfo.vb
+++ /dev/null
@@ -1,36 +0,0 @@
-#Region "Apache License"
-'
-' Licensed to the Apache Software Foundation (ASF) under one or more
-' contributor license agreements. See the NOTICE file distributed with
-' this work for additional information regarding copyright ownership.
-' The ASF licenses this file to you 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.
-'
-#End Region
-
-'
-' 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: System.Reflection.AssemblyVersion("1.2.0.30714")>
-
-
-<Assembly: System.Reflection.AssemblyCompany("The Apache Software Foundation")>
-<Assembly: System.Reflection.AssemblyCopyright("Copyright 2004-2011 The Apache Software Foundation.")>
-<Assembly: System.Reflection.AssemblyTrademark("Copyright 2004-2011 The Apache Software Foundation.")>
diff --git a/examples/net/2.0/Tutorials/WebApp/vb/src/Global.asax b/examples/net/2.0/Tutorials/WebApp/vb/src/Global.asax
deleted file mode 100644
index 93c16a4..0000000
--- a/examples/net/2.0/Tutorials/WebApp/vb/src/Global.asax
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<%@ Application Codebehind="Global.asax.vb" Inherits="WebApp.Global" %>
diff --git a/examples/net/2.0/Tutorials/WebApp/vb/src/Global.asax.resx b/examples/net/2.0/Tutorials/WebApp/vb/src/Global.asax.resx
deleted file mode 100644
index c8e3ce7..0000000
--- a/examples/net/2.0/Tutorials/WebApp/vb/src/Global.asax.resx
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<root>
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="ResMimeType">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="Version">
- <value>1.0.0.0</value>
- </resheader>
- <resheader name="Reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3102.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="Writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3102.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
-</root>
diff --git a/examples/net/2.0/Tutorials/WebApp/vb/src/Global.asax.vb b/examples/net/2.0/Tutorials/WebApp/vb/src/Global.asax.vb
deleted file mode 100644
index b950cf3..0000000
--- a/examples/net/2.0/Tutorials/WebApp/vb/src/Global.asax.vb
+++ /dev/null
@@ -1,43 +0,0 @@
-#Region "Apache License"
-'
-' Licensed to the Apache Software Foundation (ASF) under one or more
-' contributor license agreements. See the NOTICE file distributed with
-' this work for additional information regarding copyright ownership.
-' The ASF licenses this file to you 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.
-'
-#End Region
-
-Imports System
-Imports System.Collections
-Imports System.ComponentModel
-Imports System.Web
-Imports System.Web.SessionState
-
-' Load the configuration from the 'WebApp.dll.log4net' file
-<Assembly:log4net.Config.XmlConfigurator(ConfigFileExtension:="log4net", Watch:=true)>
-
-Namespace WebApp
- Public Class Global
- Inherits System.Web.HttpApplication
-
- Public Sub New()
- InitializeComponent()
- End Sub
-
- ' Required method for Designer support - do not modify
- ' the contents of this method with the code editor.
- Private Sub InitializeComponent()
- End Sub
- End Class
-End Namespace
-
diff --git a/examples/net/2.0/Tutorials/WebApp/vb/src/SimpleModule.dll.log4net b/examples/net/2.0/Tutorials/WebApp/vb/src/SimpleModule.dll.log4net
deleted file mode 100644
index a8adb51..0000000
--- a/examples/net/2.0/Tutorials/WebApp/vb/src/SimpleModule.dll.log4net
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-
-<!-- This section contains the log4net configuration settings -->
-<log4net>
-
- <!-- Define some output appenders -->
-
- <appender name="LogFileAppender" type="log4net.Appender.FileAppender" >
- <file value="simple-module-log.txt" />
- <appendToFile value="true" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
- </layout>
- </appender>
-
- <!-- Setup the root category, add the appenders and set the default level -->
-
- <root>
- <level value="DEBUG" />
- <appender-ref ref="LogFileAppender" />
- </root>
-
-</log4net>
diff --git a/examples/net/2.0/Tutorials/WebApp/vb/src/Web.config b/examples/net/2.0/Tutorials/WebApp/vb/src/Web.config
deleted file mode 100644
index fe90304..0000000
--- a/examples/net/2.0/Tutorials/WebApp/vb/src/Web.config
+++ /dev/null
@@ -1,107 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<configuration>
-
- <!-- Enable internal debugging in log4net -->
- <appSettings>
- <!-- To enable internal log4net logging specify the
- following appSettings key -->
-
- <!-- <add key="log4net.Internal.Debug" value="true"/> -->
- </appSettings>
-
- <system.web>
-
- <!-- DYNAMIC DEBUG COMPILATION
- Set compilation debug="true" to enable ASPX debugging. Otherwise, setting this value to
- false will improve runtime performance of this application.
- Set compilation debug="true" to insert debugging symbols (.pdb information)
- into the compiled page. Because this creates a larger file that executes
- more slowly, you should set this value to true only when debugging and to
- false at all other times. For more information, refer to the documentation about
- debugging ASP .NET files.
- -->
- <compilation
- defaultLanguage="VB"
- debug="true"
- />
-
- <!-- CUSTOM ERROR MESSAGES
- Set customError mode values to control the display of user-friendly
- error messages to users instead of error details (including a stack trace):
-
- "On" Always display custom (friendly) messages
- "Off" Always display detailed ASP.NET error information.
- "RemoteOnly" Display custom (friendly) messages only to users not running
- on the local Web server. This setting is recommended for security purposes, so
- that you do not display application detail information to remote clients.
- -->
- <customErrors
- mode="RemoteOnly"
- />
-
- <!-- AUTHENTICATION
- This section sets the authentication policies of the application. Possible modes are "Windows", "Forms",
- "Passport" and "None"
- -->
- <authentication mode="Windows" />
-
- <!-- APPLICATION-LEVEL TRACE LOGGING
- Application-level tracing enables trace log output for every page within an application.
- Set trace enabled="true" to enable application trace logging. If pageOutput="true", the
- trace information will be displayed at the bottom of each page. Otherwise, you can view the
- application trace log by browsing the "trace.axd" page from your web application
- root.
- -->
- <trace
- enabled="true"
- requestLimit="10"
- pageOutput="false"
- traceMode="SortByTime"
- localOnly="true"
- />
-
- <!-- SESSION STATE SETTINGS
- By default ASP .NET uses cookies to identify which requests belong to a particular session.
- If cookies are not available, a session can be tracked by adding a session identifier to the URL.
- To disable cookies, set sessionState cookieless="true".
- -->
- <sessionState
- mode="InProc"
- stateConnectionString="tcpip=127.0.0.1:42424"
- sqlConnectionString="data source=127.0.0.1;user id=sa;password="
- cookieless="false"
- timeout="20"
- />
-
- <!-- GLOBALIZATION
- This section sets the globalization settings of the application.
- -->
- <globalization
- requestEncoding="utf-8"
- responseEncoding="utf-8"
- />
-
- </system.web>
-
-</configuration>
diff --git a/examples/net/2.0/Tutorials/WebApp/vb/src/WebApp.dll.log4net b/examples/net/2.0/Tutorials/WebApp/vb/src/WebApp.dll.log4net
deleted file mode 100644
index 63b0c69..0000000
--- a/examples/net/2.0/Tutorials/WebApp/vb/src/WebApp.dll.log4net
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<log4net debug="false">
- <appender name="LogFileAppender" type="log4net.Appender.FileAppender" >
- <file value="webapp-log.txt" />
- <appendToFile value="true" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
- </layout>
- </appender>
- <appender name="HttpTraceAppender" type="log4net.Appender.AspNetTraceAppender" >
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
- </layout>
- </appender>
- <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
- <file value="log-data\rolling-log.txt" />
- <appendToFile value="true" />
- <maxSizeRollBackups value="10" />
- <maximumFileSize value="5MB" />
- <rollingStyle value="Size" />
- <staticLogFileName value="true" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
- </layout>
- </appender>
- <root>
- <level value="DEBUG" />
- <appender-ref ref="LogFileAppender" />
- <appender-ref ref="HttpTraceAppender" />
- <!-- <appender-ref ref="RollingLogFileAppender" /> -->
- </root>
-</log4net>
diff --git a/examples/net/2.0/Tutorials/WebApp/vb/src/WebApp.vbproj b/examples/net/2.0/Tutorials/WebApp/vb/src/WebApp.vbproj
deleted file mode 100644
index 42d33e5..0000000
--- a/examples/net/2.0/Tutorials/WebApp/vb/src/WebApp.vbproj
+++ /dev/null
@@ -1,193 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<VisualStudioProject>
- <VisualBasic
- ProjectType = "Web"
- ProductVersion = "7.0.9466"
- SchemaVersion = "1.0"
- ProjectGuid = "{4CEA8E96-BF74-488D-9967-EAB779EF430A}"
- >
- <Build>
- <Settings
- ApplicationIcon = ""
- AssemblyKeyContainerName = ""
- AssemblyName = "WebApp"
- AssemblyOriginatorKeyFile = ""
- AssemblyOriginatorKeyMode = "None"
- DefaultClientScript = "JScript"
- DefaultHTMLPageLayout = "Grid"
- DefaultTargetSchema = "IE50"
- DelaySign = "false"
- OutputType = "Library"
- OptionCompare = "Binary"
- OptionExplicit = "On"
- OptionStrict = "Off"
- RootNamespace = ""
- StartupObject = ""
- >
- <Config
- Name = "Debug"
- BaseAddress = "285212672"
- ConfigurationOverrideFile = ""
- DefineConstants = ""
- DefineDebug = "true"
- DefineTrace = "true"
- DebugSymbols = "true"
- IncrementalBuild = "true"
- Optimize = "false"
- OutputPath = "bin\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "1"
- />
- <Config
- Name = "Release"
- BaseAddress = "285212672"
- ConfigurationOverrideFile = ""
- DefineConstants = ""
- DefineDebug = "false"
- DefineTrace = "true"
- DebugSymbols = "false"
- IncrementalBuild = "false"
- Optimize = "true"
- OutputPath = "bin\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "1"
- />
- </Settings>
- <References>
- <Reference
- Name = "System"
- AssemblyName = "System"
- />
- <Reference
- Name = "System.Data"
- AssemblyName = "System.Data"
- />
- <Reference
- Name = "System.Drawing"
- AssemblyName = "System.Drawing"
- />
- <Reference
- Name = "System.Web"
- AssemblyName = "System.Web"
- />
- <Reference
- Name = "System.XML"
- AssemblyName = "System.Xml"
- />
- <Reference
- Name = "log4net"
- AssemblyName = "log4net"
- HintPath = "..\..\..\..\..\..\..\bin\net\1.0\release\log4net.dll"
- />
- <Reference
- Name = "SharedModule"
- Project = "{8F84B3EA-34F7-40ED-8A04-895EFC37C38D}"
- Package = "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}"
- />
- <Reference
- Name = "SimpleModule"
- Project = "{2BDB262A-3B90-418E-9C6A-322A4B0C287A}"
- Package = "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}"
- />
- </References>
- <Imports>
- <Import Namespace = "Microsoft.VisualBasic" />
- <Import Namespace = "System" />
- <Import Namespace = "System.Collections" />
- <Import Namespace = "System.Configuration" />
- <Import Namespace = "System.Data" />
- <Import Namespace = "System.Drawing" />
- <Import Namespace = "System.Web" />
- <Import Namespace = "System.Web.UI" />
- <Import Namespace = "System.Web.UI.HtmlControls" />
- <Import Namespace = "System.Web.UI.WebControls" />
- </Imports>
- </Build>
- <Files>
- <Include>
- <File
- RelPath = "AssemblyInfo.vb"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "AssemblyVersionInfo.vb"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "Global.asax"
- BuildAction = "Content"
- />
- <File
- RelPath = "Global.asax.vb"
- DependentUpon = "Global.asax"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "Global.asax.resx"
- DependentUpon = "Global.asax.vb"
- BuildAction = "EmbeddedResource"
- />
- <File
- RelPath = "SimpleModule.dll.log4net"
- BuildAction = "Content"
- />
- <File
- RelPath = "Web.config"
- BuildAction = "Content"
- />
- <File
- RelPath = "WebApp.dll.log4net"
- BuildAction = "Content"
- />
- <File
- RelPath = "WebApp.vsdisco"
- BuildAction = "None"
- />
- <File
- RelPath = "WebForm1.aspx"
- BuildAction = "Content"
- />
- <File
- RelPath = "WebForm1.aspx.vb"
- DependentUpon = "WebForm1.aspx"
- SubType = "ASPXCodeBehind"
- BuildAction = "Compile"
- />
- <File
- RelPath = "WebForm1.aspx.resx"
- DependentUpon = "WebForm1.aspx.vb"
- BuildAction = "EmbeddedResource"
- />
- </Include>
- </Files>
- </VisualBasic>
-</VisualStudioProject>
-
diff --git a/examples/net/2.0/Tutorials/WebApp/vb/src/WebApp.vbproj.webinfo b/examples/net/2.0/Tutorials/WebApp/vb/src/WebApp.vbproj.webinfo
deleted file mode 100644
index defb9b0..0000000
--- a/examples/net/2.0/Tutorials/WebApp/vb/src/WebApp.vbproj.webinfo
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<VisualStudioUNCWeb>
- <Web URLPath = "http://localhost/WebAppVB/WebApp.vbproj" />
-</VisualStudioUNCWeb>
-
diff --git a/examples/net/2.0/Tutorials/WebApp/vb/src/WebApp.vsdisco b/examples/net/2.0/Tutorials/WebApp/vb/src/WebApp.vsdisco
deleted file mode 100644
index 639642e..0000000
--- a/examples/net/2.0/Tutorials/WebApp/vb/src/WebApp.vsdisco
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<dynamicDiscovery xmlns="urn:schemas-dynamicdiscovery:disco.2000-03-17">
-<exclude path="_vti_cnf" />
-<exclude path="_vti_pvt" />
-<exclude path="_vti_log" />
-<exclude path="_vti_script" />
-<exclude path="_vti_txt" />
-<exclude path="Web References" />
-</dynamicDiscovery>
diff --git a/examples/net/2.0/Tutorials/WebApp/vb/src/WebForm1.aspx b/examples/net/2.0/Tutorials/WebApp/vb/src/WebForm1.aspx
deleted file mode 100644
index 5b8c849..0000000
--- a/examples/net/2.0/Tutorials/WebApp/vb/src/WebForm1.aspx
+++ /dev/null
@@ -1,48 +0,0 @@
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<%@ Page language="vb" Codebehind="WebForm1.aspx.vb" AutoEventWireup="false" Inherits="WebApp.WebForm1" %>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
-<HTML>
- <HEAD>
- <title>WebForm1</title>
- <meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
- <meta name="CODE_LANGUAGE" Content="VB">
- <meta name="vs_defaultClientScript" content="JavaScript">
- <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
- </HEAD>
- <body MS_POSITIONING="GridLayout">
- <form id="Form1" method="post" runat="server">
- <asp:TextBox id="txtAdd1" style="Z-INDEX: 100; LEFT: 88px; POSITION: absolute; TOP: 80px" runat="server" Width="25px"></asp:TextBox>
- <asp:TextBox id="txtAdd2" style="Z-INDEX: 105; LEFT: 144px; POSITION: absolute; TOP: 80px" runat="server" Width="25px"></asp:TextBox>
- <asp:TextBox id="txtAdd3" style="Z-INDEX: 106; LEFT: 216px; POSITION: absolute; TOP: 80px" runat="server" Width="25px"></asp:TextBox>
- <asp:Label id="Label1" style="Z-INDEX: 101; LEFT: 126px; POSITION: absolute; TOP: 80px" runat="server" Width="18px" Height="2px">+</asp:Label>
- <asp:Label id="Label2" style="Z-INDEX: 102; LEFT: 184px; POSITION: absolute; TOP: 80px" runat="server" Width="8px" Height="20px">=</asp:Label>
- <asp:Button id="btnCalcAdd" style="Z-INDEX: 103; LEFT: 272px; POSITION: absolute; TOP: 80px" runat="server" Width="63px" Height="29px" Text="Calc"></asp:Button>
- <asp:TextBox id="txtSub1" style="Z-INDEX: 100; LEFT: 88px; POSITION: absolute; TOP: 160px" runat="server" Width="25px"></asp:TextBox>
- <asp:TextBox id="txtSub2" style="Z-INDEX: 105; LEFT: 144px; POSITION: absolute; TOP: 160px" runat="server" Width="25px"></asp:TextBox>
- <asp:TextBox id="txtSub3" style="Z-INDEX: 106; LEFT: 216px; POSITION: absolute; TOP: 160px" runat="server" Width="25px"></asp:TextBox>
- <asp:Label id="Label3" style="Z-INDEX: 101; LEFT: 126px; POSITION: absolute; TOP: 160px" runat="server" Width="18px" Height="2px">-</asp:Label>
- <asp:Label id="Label4" style="Z-INDEX: 102; LEFT: 184px; POSITION: absolute; TOP: 160px" runat="server" Width="8px" Height="20px">=</asp:Label>
- <asp:Button id="btnCalcSub" style="Z-INDEX: 103; LEFT: 272px; POSITION: absolute; TOP: 160px" runat="server" Width="63px" Height="29px" Text="Calc"></asp:Button>
- </form>
- </body>
-</HTML>
diff --git a/examples/net/2.0/Tutorials/WebApp/vb/src/WebForm1.aspx.resx b/examples/net/2.0/Tutorials/WebApp/vb/src/WebForm1.aspx.resx
deleted file mode 100644
index c8e3ce7..0000000
--- a/examples/net/2.0/Tutorials/WebApp/vb/src/WebForm1.aspx.resx
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<root>
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="ResMimeType">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="Version">
- <value>1.0.0.0</value>
- </resheader>
- <resheader name="Reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3102.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="Writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3102.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
-</root>
diff --git a/examples/net/2.0/Tutorials/WebApp/vb/src/WebForm1.aspx.vb b/examples/net/2.0/Tutorials/WebApp/vb/src/WebForm1.aspx.vb
deleted file mode 100644
index 7f95f5d..0000000
--- a/examples/net/2.0/Tutorials/WebApp/vb/src/WebForm1.aspx.vb
+++ /dev/null
@@ -1,108 +0,0 @@
-#Region "Apache License"
-'
-' Licensed to the Apache Software Foundation (ASF) under one or more
-' contributor license agreements. See the NOTICE file distributed with
-' this work for additional information regarding copyright ownership.
-' The ASF licenses this file to you 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.
-'
-#End Region
-
-Imports System
-Imports System.Collections
-Imports System.ComponentModel
-Imports System.Data
-Imports System.Drawing
-Imports System.Web
-Imports System.Web.SessionState
-Imports System.Web.UI
-Imports System.Web.UI.WebControls
-Imports System.Web.UI.HtmlControls
-
-Imports log4net
-
-Namespace WebApp
- Public Class WebForm1
- Inherits System.Web.UI.Page
-
- Private Shared ReadOnly log As ILog = LogManager.GetLogger(GetType(WebForm1))
-
- Protected Label1 As System.Web.UI.WebControls.Label
- Protected Label2 As System.Web.UI.WebControls.Label
- Protected Label3 As System.Web.UI.WebControls.Label
- Protected Label4 As System.Web.UI.WebControls.Label
-
- Protected txtAdd1 As System.Web.UI.WebControls.TextBox
- Protected txtAdd2 As System.Web.UI.WebControls.TextBox
- Protected txtAdd3 As System.Web.UI.WebControls.TextBox
- Protected WithEvents btnCalcAdd As System.Web.UI.WebControls.Button
-
- Protected txtSub1 As System.Web.UI.WebControls.TextBox
- Protected txtSub2 As System.Web.UI.WebControls.TextBox
- Protected txtSub3 As System.Web.UI.WebControls.TextBox
- Protected WithEvents btnCalcSub As System.Web.UI.WebControls.Button
-
- Protected m_MathAdd As SimpleModule.Math = new SimpleModule.Math()
- Protected m_MathSub As SharedModule.Math = new SharedModule.Math()
-
- Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- ' Put user code to initialize the page here
- End Sub
-
- #Region " Web Form Designer Generated Code "
-
- Protected Overrides Sub OnInit(e As EventArgs)
- Dim appDom As AppDomain = AppDomain.CurrentDomain
- Dim context As HttpContext= HttpContext.Current
- '
- ' CODEGEN: This call is required by the ASP.NET Web Form Designer.
- '
- InitializeComponent()
- MyBase.OnInit(e)
-
- txtAdd1.Text = "0"
- txtAdd2.Text = "0"
- txtAdd3.Text = "0"
-
- txtSub1.Text = "0"
- txtSub2.Text = "0"
- txtSub3.Text = "0"
- End Sub
-
- ' Required method for Designer support - do not modify
- ' the contents of this method with the code editor.
- Private Sub InitializeComponent()
- End Sub
-
- #End Region
-
- Private Sub btnCalcAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalcAdd.Click
- If log.IsDebugEnabled Then log.Debug("txtAdd1=[" & txtAdd1.Text & "] txtAdd2=[" & txtAdd2.Text & "]")
-
- Dim result As Integer = m_MathAdd.Add(Integer.Parse(txtAdd1.Text), Integer.Parse(txtAdd2.Text))
-
- If log.IsInfoEnabled Then log.Info("result=[" & result & "]")
-
- txtAdd3.Text = result.ToString()
- End Sub
-
- Private Sub btnCalcSub_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalcSub.Click
- If log.IsDebugEnabled Then log.Debug("txtSub1=[" & txtSub1.Text & "] txtSub2=[" & txtSub2.Text & "]")
-
- Dim result As Integer = m_MathSub.Subtract(Integer.Parse(txtSub1.Text), Integer.Parse(txtSub2.Text))
-
- If log.IsInfoEnabled Then log.Info("result=[" & result & "]")
-
- txtSub3.Text = result.ToString()
- End Sub
- End Class
-End Namespace
diff --git a/examples/net/2.0/Tutorials/nant.build b/examples/net/2.0/Tutorials/nant.build
deleted file mode 100644
index ea6d455..0000000
--- a/examples/net/2.0/Tutorials/nant.build
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="tutorials-examples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile Tutorials examples -->
- <target name="compile" description="Builds Tutorials examples">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
- <!-- update the version of Tutorials examples -->
- <target name="update-version-info" description="Update AssemblyVersionInfo of Tutorials examples">
- <nant buildfile="WebApp/nant.build" target="update-version-info" />
- </target>
-</project>
diff --git a/examples/net/2.0/Tutorials/nant.config b/examples/net/2.0/Tutorials/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/net/2.0/Tutorials/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/net/2.0/cs-examples.sln b/examples/net/2.0/cs-examples.sln
deleted file mode 100644
index 7b5e2b2..0000000
--- a/examples/net/2.0/cs-examples.sln
+++ /dev/null
@@ -1,173 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual Studio 2005
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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.
-#
-#
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp", "Tutorials\ConsoleApp\cs\src\ConsoleApp.csproj", "{933969DF-2BC5-44E6-8B1A-400FC276A23F}"
- ProjectSection(WebsiteProperties) = preProject
- Debug.AspNetCompiler.Debug = "True"
- Release.AspNetCompiler.Debug = "False"
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotLogging", "Performance\NotLogging\cs\src\NotLogging.csproj", "{79B1930A-63AE-4640-B130-084687B3EDD7}"
- ProjectSection(WebsiteProperties) = preProject
- Debug.AspNetCompiler.Debug = "True"
- Release.AspNetCompiler.Debug = "False"
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemotingClient", "Remoting\RemotingClient\cs\src\RemotingClient.csproj", "{F4CE6810-1C1B-4178-B637-4B05E3F6DE3C}"
- ProjectSection(WebsiteProperties) = preProject
- Debug.AspNetCompiler.Debug = "True"
- Release.AspNetCompiler.Debug = "False"
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemotingServer", "Remoting\RemotingServer\cs\src\RemotingServer.csproj", "{3A9BCF6F-FA1B-409A-93E9-7028F9A2A91F}"
- ProjectSection(WebsiteProperties) = preProject
- Debug.AspNetCompiler.Debug = "True"
- Release.AspNetCompiler.Debug = "False"
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleModule", "Repository\SimpleModule\cs\src\SimpleModule.csproj", "{F82AA1D9-5B52-4890-8838-7AAAF7D8F0EE}"
- ProjectSection(WebsiteProperties) = preProject
- Debug.AspNetCompiler.Debug = "True"
- Release.AspNetCompiler.Debug = "False"
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleApp", "Repository\SimpleApp\cs\src\SimpleApp.csproj", "{D49EB32C-B25F-4E25-BF6D-62EE38FC1A1F}"
- ProjectSection(WebsiteProperties) = preProject
- Debug.AspNetCompiler.Debug = "True"
- Release.AspNetCompiler.Debug = "False"
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TraceLogApp", "Extensibility\TraceLogApp\cs\src\TraceLogApp.csproj", "{EB508341-D73A-4165-846D-E7E317E12518}"
- ProjectSection(WebsiteProperties) = preProject
- Debug.AspNetCompiler.Debug = "True"
- Release.AspNetCompiler.Debug = "False"
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharedModule", "Repository\SharedModule\cs\src\SharedModule.csproj", "{9AACDC1A-84FB-4042-85A5-7095C66AD973}"
- ProjectSection(WebsiteProperties) = preProject
- Debug.AspNetCompiler.Debug = "True"
- Release.AspNetCompiler.Debug = "False"
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "log4net.Ext.Trace", "..\..\..\extensions\net\1.0\log4net.Ext.Trace\cs\src\log4net.Ext.Trace.csproj", "{8C73DF1C-AB2B-4309-A3EC-1ED594239E15}"
- ProjectSection(WebsiteProperties) = preProject
- Debug.AspNetCompiler.Debug = "True"
- Release.AspNetCompiler.Debug = "False"
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "log4net.Ext.EventID", "..\..\..\extensions\net\1.0\log4net.Ext.EventID\cs\src\log4net.Ext.EventID.csproj", "{CB985027-C009-4C0F-88C1-8CF11912EE4C}"
- ProjectSection(WebsiteProperties) = preProject
- Debug.AspNetCompiler.Debug = "True"
- Release.AspNetCompiler.Debug = "False"
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventIDLogApp", "Extensibility\EventIDLogApp\cs\src\EventIDLogApp.csproj", "{B3DCF964-EAC8-46F2-AA11-151713141536}"
- ProjectSection(WebsiteProperties) = preProject
- Debug.AspNetCompiler.Debug = "True"
- Release.AspNetCompiler.Debug = "False"
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleAppendersApp", "Appenders\SampleAppendersApp\cs\src\SampleAppendersApp.csproj", "{9E715F72-7F70-421B-A2BF-E9CB42F88F5C}"
- ProjectSection(WebsiteProperties) = preProject
- Debug.AspNetCompiler.Debug = "True"
- Release.AspNetCompiler.Debug = "False"
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleLayoutsApp", "Layouts\SampleLayoutsApp\cs\src\SampleLayoutsApp.csproj", "{CD7A8094-D383-46BC-A75D-9F65F746E24F}"
- ProjectSection(WebsiteProperties) = preProject
- Debug.AspNetCompiler.Debug = "True"
- Release.AspNetCompiler.Debug = "False"
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WmiAppender", "Appenders\WmiAppender\cs\src\WmiAppender.csproj", "{BE56F892-37BA-489C-A91D-F2761FDB96EF}"
- ProjectSection(WebsiteProperties) = preProject
- Debug.AspNetCompiler.Debug = "True"
- Release.AspNetCompiler.Debug = "False"
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {933969DF-2BC5-44E6-8B1A-400FC276A23F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {933969DF-2BC5-44E6-8B1A-400FC276A23F}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {933969DF-2BC5-44E6-8B1A-400FC276A23F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {933969DF-2BC5-44E6-8B1A-400FC276A23F}.Release|Any CPU.Build.0 = Release|Any CPU
- {79B1930A-63AE-4640-B130-084687B3EDD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {79B1930A-63AE-4640-B130-084687B3EDD7}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {79B1930A-63AE-4640-B130-084687B3EDD7}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {79B1930A-63AE-4640-B130-084687B3EDD7}.Release|Any CPU.Build.0 = Release|Any CPU
- {F4CE6810-1C1B-4178-B637-4B05E3F6DE3C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F4CE6810-1C1B-4178-B637-4B05E3F6DE3C}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F4CE6810-1C1B-4178-B637-4B05E3F6DE3C}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F4CE6810-1C1B-4178-B637-4B05E3F6DE3C}.Release|Any CPU.Build.0 = Release|Any CPU
- {3A9BCF6F-FA1B-409A-93E9-7028F9A2A91F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {3A9BCF6F-FA1B-409A-93E9-7028F9A2A91F}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {3A9BCF6F-FA1B-409A-93E9-7028F9A2A91F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {3A9BCF6F-FA1B-409A-93E9-7028F9A2A91F}.Release|Any CPU.Build.0 = Release|Any CPU
- {F82AA1D9-5B52-4890-8838-7AAAF7D8F0EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F82AA1D9-5B52-4890-8838-7AAAF7D8F0EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F82AA1D9-5B52-4890-8838-7AAAF7D8F0EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F82AA1D9-5B52-4890-8838-7AAAF7D8F0EE}.Release|Any CPU.Build.0 = Release|Any CPU
- {D49EB32C-B25F-4E25-BF6D-62EE38FC1A1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {D49EB32C-B25F-4E25-BF6D-62EE38FC1A1F}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {D49EB32C-B25F-4E25-BF6D-62EE38FC1A1F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {D49EB32C-B25F-4E25-BF6D-62EE38FC1A1F}.Release|Any CPU.Build.0 = Release|Any CPU
- {EB508341-D73A-4165-846D-E7E317E12518}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {EB508341-D73A-4165-846D-E7E317E12518}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {EB508341-D73A-4165-846D-E7E317E12518}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {EB508341-D73A-4165-846D-E7E317E12518}.Release|Any CPU.Build.0 = Release|Any CPU
- {9AACDC1A-84FB-4042-85A5-7095C66AD973}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {9AACDC1A-84FB-4042-85A5-7095C66AD973}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {9AACDC1A-84FB-4042-85A5-7095C66AD973}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {9AACDC1A-84FB-4042-85A5-7095C66AD973}.Release|Any CPU.Build.0 = Release|Any CPU
- {8C73DF1C-AB2B-4309-A3EC-1ED594239E15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {8C73DF1C-AB2B-4309-A3EC-1ED594239E15}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {8C73DF1C-AB2B-4309-A3EC-1ED594239E15}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {8C73DF1C-AB2B-4309-A3EC-1ED594239E15}.Release|Any CPU.Build.0 = Release|Any CPU
- {CB985027-C009-4C0F-88C1-8CF11912EE4C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {CB985027-C009-4C0F-88C1-8CF11912EE4C}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {CB985027-C009-4C0F-88C1-8CF11912EE4C}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {CB985027-C009-4C0F-88C1-8CF11912EE4C}.Release|Any CPU.Build.0 = Release|Any CPU
- {B3DCF964-EAC8-46F2-AA11-151713141536}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B3DCF964-EAC8-46F2-AA11-151713141536}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B3DCF964-EAC8-46F2-AA11-151713141536}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {B3DCF964-EAC8-46F2-AA11-151713141536}.Release|Any CPU.Build.0 = Release|Any CPU
- {9E715F72-7F70-421B-A2BF-E9CB42F88F5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {9E715F72-7F70-421B-A2BF-E9CB42F88F5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {9E715F72-7F70-421B-A2BF-E9CB42F88F5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {9E715F72-7F70-421B-A2BF-E9CB42F88F5C}.Release|Any CPU.Build.0 = Release|Any CPU
- {CD7A8094-D383-46BC-A75D-9F65F746E24F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {CD7A8094-D383-46BC-A75D-9F65F746E24F}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {CD7A8094-D383-46BC-A75D-9F65F746E24F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {CD7A8094-D383-46BC-A75D-9F65F746E24F}.Release|Any CPU.Build.0 = Release|Any CPU
- {BE56F892-37BA-489C-A91D-F2761FDB96EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {BE56F892-37BA-489C-A91D-F2761FDB96EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {BE56F892-37BA-489C-A91D-F2761FDB96EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {BE56F892-37BA-489C-A91D-F2761FDB96EF}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/examples/net/2.0/nant.build b/examples/net/2.0/nant.build
deleted file mode 100644
index a1835a6..0000000
--- a/examples/net/2.0/nant.build
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="net-1.0-examples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- include configuration file -->
- <include buildfile="nant.config" />
- <!-- compile all .NET Framework 1.0 examples -->
- <target name="compile" description="Builds .NET Framework 1.0 examples">
- <if test="${framework::exists(project.runtime.config + '-' + project.runtime.version)}">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </if>
- <if test="${not framework::exists(project.runtime.config + '-' + project.runtime.version)}">
- <if test="${property::exists('project.build.package') and project.build.package}">
- <fail message="${project.runtime.description} is not available." />
- </if>
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo message="${project.runtime.description} is not available. Examples skipped." />
- </if>
- </if>
- </target>
- <!-- update the version of all .NET Framework 1.0 examples -->
- <target name="update-version-info" description="Update AssemblyVersionInfo of .NET Framework 1.0 examples">
- <nant buildfile="Tutorials/nant.build" target="update-version-info" />
- </target>
-</project>
diff --git a/examples/net/2.0/nant.config b/examples/net/2.0/nant.config
deleted file mode 100644
index 2119550..0000000
--- a/examples/net/2.0/nant.config
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set runtime version -->
- <property name="project.runtime.version" value="1.0" />
- <!-- Set runtime description -->
- <property name="project.runtime.description" value=".NET Framework 1.0" />
-</project>
diff --git a/examples/net/2.0/vb-examples.sln b/examples/net/2.0/vb-examples.sln
deleted file mode 100644
index c5afc46..0000000
--- a/examples/net/2.0/vb-examples.sln
+++ /dev/null
@@ -1,71 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 7.00
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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.
-#
-#
-Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ConsoleApp", "Tutorials\ConsoleApp\vb\src\ConsoleApp.vbproj", "{41B855A4-F3BF-43F8-BE6F-2ABD5E5C8D42}"
-EndProject
-Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "WebApp", "http://localhost/WebAppVB/WebApp.vbproj", "{4CEA8E96-BF74-488D-9967-EAB779EF430A}"
-EndProject
-Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "SharedModule", "Repository\SharedModule\vb\src\SharedModule.vbproj", "{8F84B3EA-34F7-40ED-8A04-895EFC37C38D}"
-EndProject
-Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "SimpleApp", "Repository\SimpleApp\vb\src\SimpleApp.vbproj", "{912A9564-F435-444B-905F-1FD8B69C48D7}"
-EndProject
-Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "SimpleModule", "Repository\SimpleModule\vb\src\SimpleModule.vbproj", "{2BDB262A-3B90-418E-9C6A-322A4B0C287A}"
-EndProject
-Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "NotLogging", "Performance\NotLogging\vb\src\NotLogging.vbproj", "{4ED8A816-5051-4494-AEE5-C54E18F59FD8}"
-EndProject
-Global
- GlobalSection(SolutionConfiguration) = preSolution
- ConfigName.0 = Debug
- ConfigName.1 = Release
- EndGlobalSection
- GlobalSection(ProjectDependencies) = postSolution
- EndGlobalSection
- GlobalSection(ProjectConfiguration) = postSolution
- {41B855A4-F3BF-43F8-BE6F-2ABD5E5C8D42}.Debug.ActiveCfg = Debug|.NET
- {41B855A4-F3BF-43F8-BE6F-2ABD5E5C8D42}.Debug.Build.0 = Debug|.NET
- {41B855A4-F3BF-43F8-BE6F-2ABD5E5C8D42}.Release.ActiveCfg = Release|.NET
- {41B855A4-F3BF-43F8-BE6F-2ABD5E5C8D42}.Release.Build.0 = Release|.NET
- {4CEA8E96-BF74-488D-9967-EAB779EF430A}.Debug.ActiveCfg = Debug|.NET
- {4CEA8E96-BF74-488D-9967-EAB779EF430A}.Debug.Build.0 = Debug|.NET
- {4CEA8E96-BF74-488D-9967-EAB779EF430A}.Release.ActiveCfg = Release|.NET
- {4CEA8E96-BF74-488D-9967-EAB779EF430A}.Release.Build.0 = Release|.NET
- {8F84B3EA-34F7-40ED-8A04-895EFC37C38D}.Debug.ActiveCfg = Debug|.NET
- {8F84B3EA-34F7-40ED-8A04-895EFC37C38D}.Debug.Build.0 = Debug|.NET
- {8F84B3EA-34F7-40ED-8A04-895EFC37C38D}.Release.ActiveCfg = Release|.NET
- {8F84B3EA-34F7-40ED-8A04-895EFC37C38D}.Release.Build.0 = Release|.NET
- {912A9564-F435-444B-905F-1FD8B69C48D7}.Debug.ActiveCfg = Debug|.NET
- {912A9564-F435-444B-905F-1FD8B69C48D7}.Debug.Build.0 = Debug|.NET
- {912A9564-F435-444B-905F-1FD8B69C48D7}.Release.ActiveCfg = Release|.NET
- {912A9564-F435-444B-905F-1FD8B69C48D7}.Release.Build.0 = Release|.NET
- {2BDB262A-3B90-418E-9C6A-322A4B0C287A}.Debug.ActiveCfg = Debug|.NET
- {2BDB262A-3B90-418E-9C6A-322A4B0C287A}.Debug.Build.0 = Debug|.NET
- {2BDB262A-3B90-418E-9C6A-322A4B0C287A}.Release.ActiveCfg = Release|.NET
- {2BDB262A-3B90-418E-9C6A-322A4B0C287A}.Release.Build.0 = Release|.NET
- {4ED8A816-5051-4494-AEE5-C54E18F59FD8}.Debug.ActiveCfg = Debug|.NET
- {4ED8A816-5051-4494-AEE5-C54E18F59FD8}.Debug.Build.0 = Debug|.NET
- {4ED8A816-5051-4494-AEE5-C54E18F59FD8}.Release.ActiveCfg = Release|.NET
- {4ED8A816-5051-4494-AEE5-C54E18F59FD8}.Release.Build.0 = Release|.NET
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- EndGlobalSection
- GlobalSection(ExtensibilityAddIns) = postSolution
- EndGlobalSection
-EndGlobal
diff --git a/examples/net/nant.build b/examples/net/nant.build
deleted file mode 100644
index 7c70d57..0000000
--- a/examples/net/nant.build
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="net-examples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile .NET Framework examples -->
- <target name="compile" description="Builds .NET Framework examples">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
- <!-- update the version of .NET Framework examples -->
- <target name="update-version-info" description="Update AssemblyVersionInfo of .NET Framework examples">
- <nant buildfile="1.0/nant.build" target="update-version-info" />
- </target>
-</project>
diff --git a/examples/net/nant.config b/examples/net/nant.config
deleted file mode 100644
index 4298bc9..0000000
--- a/examples/net/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="net-configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set runtime configuration -->
- <property name="project.runtime.config" value="net" readonly="false" />
-</project>
diff --git a/examples/netcf/1.0/Tutorials/ConsoleApp/cs/nant.build b/examples/netcf/1.0/Tutorials/ConsoleApp/cs/nant.build
deleted file mode 100644
index 1943907..0000000
--- a/examples/netcf/1.0/Tutorials/ConsoleApp/cs/nant.build
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- copy log4net build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="${log4net.output.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- compile the example -->
- <csc target="exe" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.csc}" output="${current.bin.dir}/ConsoleApp.exe">
- <sources>
- <include name="src/**/*.cs" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.cs" />
- </sources>
- <references>
- <include name="mscorlib.dll" />
- <include name="System.dll" />
- <include name="${current.bin.dir}/log4net.dll" />
- </references>
- </csc>
- <!-- copy the ConsoleApp application configuration file -->
- <copy file="src/ConsoleApp.exe.config" todir="${current.bin.dir}" />
- </target>
-</project>
diff --git a/examples/netcf/1.0/Tutorials/ConsoleApp/cs/nant.config b/examples/netcf/1.0/Tutorials/ConsoleApp/cs/nant.config
deleted file mode 100644
index 52613e8..0000000
--- a/examples/netcf/1.0/Tutorials/ConsoleApp/cs/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/netcf/1.0/Tutorials/ConsoleApp/cs/src/AssemblyInfo.cs b/examples/netcf/1.0/Tutorials/ConsoleApp/cs/src/AssemblyInfo.cs
deleted file mode 100644
index 5d78024..0000000
--- a/examples/netcf/1.0/Tutorials/ConsoleApp/cs/src/AssemblyInfo.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// 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("log4net - ConsoleApp")]
-[assembly: AssemblyDescription("log4net ConsoleApp")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyProduct("log4net - TestApp")]
-[assembly: AssemblyCulture("")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("")]
-[assembly: AssemblyKeyName("")]
diff --git a/examples/netcf/1.0/Tutorials/ConsoleApp/cs/src/ConsoleApp.csdproj b/examples/netcf/1.0/Tutorials/ConsoleApp/cs/src/ConsoleApp.csdproj
deleted file mode 100644
index 49693d2..0000000
--- a/examples/netcf/1.0/Tutorials/ConsoleApp/cs/src/ConsoleApp.csdproj
+++ /dev/null
@@ -1,155 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<VisualStudioProject>
- <ECSHARP
- ProjectType = "Local"
- ProductVersion = "7.10.3077"
- SchemaVersion = "1.0"
- ProjectGuid = "{06757B10-BBC2-4858-AB65-26F92D0D6A5D}"
- >
- <Build>
- <Settings
- ApplicationIcon = ""
- AssemblyKeyContainerName = ""
- AssemblyName = "ConsoleApp"
- AssemblyOriginatorKeyFile = ""
- DelaySign = "false"
- OutputType = "Exe"
- OutputFileFolder = "\Program Files\ConsoleAppCS"
- RootNamespace = "ConsoleApp"
- StartupObject = ""
- >
- <Platform Name = "Windows CE" />
- <Config
- Name = "Debug|Windows CE"
- AllowUnsafeBlocks = "false"
- BaseAddress = "0"
- CheckForOverflowUnderflow = "false"
- ConfigurationOverrideFile = ""
- DefineConstants = "DEBUG;TRACE"
- DocumentationFile = ""
- DebugSymbols = "true"
- FileAlignment = "4096"
- IncrementalBuild = "false"
- Optimize = "false"
- OutputPath = "..\build\netcf\1.0\debug\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "4"
- />
- <Config
- Name = "Release|Windows CE"
- AllowUnsafeBlocks = "false"
- BaseAddress = "0"
- CheckForOverflowUnderflow = "false"
- ConfigurationOverrideFile = ""
- DefineConstants = "TRACE"
- DocumentationFile = ""
- DebugSymbols = "false"
- FileAlignment = "4096"
- IncrementalBuild = "false"
- Optimize = "true"
- OutputPath = "..\build\netcf\1.0\release\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "4"
- />
- </Settings>
- <References>
- <Reference
- Platform = "Windows CE"
- Name = "MSCorLib"
- AssemblyName = "mscorlib"
- Private = "False"
- />
- <Reference
- Platform = "Windows CE"
- Name = "log4net"
- AssemblyName = "log4net"
- />
- <Reference
- Platform = "Windows CE-Designer"
- Name = "System.CF.Design"
- AssemblyName = "System.CF.Design"
- Private = "False"
- />
- <Reference
- Platform = "Windows CE-Designer"
- Name = "System.CF.Design.UI"
- AssemblyName = "System.CF.Design.UI"
- Private = "False"
- />
- <Reference
- Platform = "Windows CE-Designer"
- Name = "System.CF.Windows.Forms"
- AssemblyName = "System.CF.Windows.Forms"
- Private = "False"
- />
- <Reference
- Platform = "Windows CE-Designer"
- Name = "System.CF.Drawing"
- AssemblyName = "System.CF.Drawing"
- Private = "False"
- />
- <Reference
- Platform = "Windows CE-Designer"
- Name = "System"
- AssemblyName = "System"
- Private = "False"
- />
- </References>
- </Build>
- <Files>
- <Include>
- <File
- RelPath = "AssemblyInfo.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "AssemblyVersionInfo.cs"
- Link = "..\..\..\..\..\..\..\src\AssemblyVersionInfo.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "ConsoleApp.exe.config"
- BuildAction = "Content"
- />
- <File
- RelPath = "EntryPoint.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "LoggingExample.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- </Include>
- </Files>
- </ECSHARP>
-</VisualStudioProject>
-
diff --git a/examples/netcf/1.0/Tutorials/ConsoleApp/cs/src/ConsoleApp.exe.config b/examples/netcf/1.0/Tutorials/ConsoleApp/cs/src/ConsoleApp.exe.config
deleted file mode 100644
index d113223..0000000
--- a/examples/netcf/1.0/Tutorials/ConsoleApp/cs/src/ConsoleApp.exe.config
+++ /dev/null
@@ -1,124 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-
-<!-- .NET application configuration file
-
- The .NET Compact Framework does not support application configuration files,
- but log4net supports using configuration files with similar names and structure,
- to store the log4net configuration.
- -->
-
-<configuration>
- <!-- This section contains the log4net configuration settings -->
- <log4net>
-
- <!-- Define some output appenders -->
-
- <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
- <file value="rolling-log.txt" />
- <appendToFile value="true" />
-
- <maxSizeRollBackups value="10" />
- <maximumFileSize value="100" />
- <rollingStyle value="Size" />
- <staticLogFileName value="true" />
-
- <layout type="log4net.Layout.PatternLayout">
- <header value="[Header] "/>
- <footer value="[Footer] "/>
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
- </layout>
- </appender>
-
- <appender name="LogFileAppender" type="log4net.Appender.FileAppender" >
- <file value="log-file.txt" />
-
- <!-- Example using environment variables in params -->
- <!-- <file value="${TMP}\log-file.txt" /> -->
- <appendToFile value="true" />
-
- <!-- An alternate output encoding can be specified -->
- <!-- <encoding value="unicodeFFFE" /> -->
-
- <layout type="log4net.Layout.PatternLayout">
- <header value="[Header] "/>
- <footer value="[Footer] "/>
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] <%property{auth}> - %message%newline" />
- </layout>
- <!-- Alternate layout using XML
- <layout type="log4net.Layout.XMLLayout" /> -->
- </appender>
-
- <appender name="MulticastAppender" type="log4net.Appender.UdpAppender" >
- <threshold value="WARN" />
- <remoteAddress value="224.0.0.1" />
- <remotePort value="8080" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
- </layout>
- </appender>
-
- <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] <%property{auth}> - %message%newline" />
- </layout>
- </appender>
-
- <!--
-
- <appender name="A" type="log4net.Appender.ForwardingAppender" >
- <threshold value="WARN"/>
- <appender-ref ref="ConsoleAppender" />
- </appender>
-
- <appender name="B" type="log4net.Appender.ForwardingAppender" >
- <filter type="log4net.Filter.LevelRangeFilter">
- <levelMin value="DEBUG"/>
- <levelMax value="INFO"/>
- </filter>
- <appender-ref ref="ConsoleAppender" />
- </appender>
-
- -->
-
- <!-- Setup the root category, add the appenders and set the default level -->
-
- <root>
- <level value="INFO" />
- <appender-ref ref="LogFileAppender" />
- <appender-ref ref="ConsoleAppender" />
- <appender-ref ref="MulticastAppender" />
- <!-- <appender-ref ref="A" /> -->
- </root>
-
- <!-- Specify the level for some specific categories -->
-
- <logger name="ConsoleApp.LoggingExample">
- <!-- <appender-ref ref="B" /> -->
- <level value="ALL" />
- <appender-ref ref="RollingLogFileAppender" />
- </logger>
-
- </log4net>
-
-</configuration>
diff --git a/examples/netcf/1.0/Tutorials/ConsoleApp/cs/src/EntryPoint.cs b/examples/netcf/1.0/Tutorials/ConsoleApp/cs/src/EntryPoint.cs
deleted file mode 100644
index d4d8b20..0000000
--- a/examples/netcf/1.0/Tutorials/ConsoleApp/cs/src/EntryPoint.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-namespace ConsoleApp
-{
- using System;
-
- using log4net;
-
- /// <summary>
- /// Example of how to simply configure and use log4net in a .NET Compact Framework
- /// application.
- /// </summary>
- /// <remarks>
- /// <para>
- /// The .NET Compact Framework does not support retrieving assembly-level
- /// attributes, therefor log4net must be configured by code.
- /// </para>
- /// <para>
- /// The .NET Compact Framework does not support hooking up the <c>AppDomain.ProcessExit</c>
- /// and <c>AppDomain.DomainUnload</c> events, so log4net must be shutdown manually to
- /// free all resources.
- /// </para>
- /// </remarks>
- public class EntryPoint
- {
- /// <summary>
- /// Application entry point.
- /// </summary>
- public static void Main()
- {
- // Uncomment the next line to enable log4net internal debugging
- // log4net.helpers.LogLog.InternalDebugging = true;
-
- // This will instruct log4net to look for a configuration file
- // called ConsoleApp.exe.config in the application base
- // directory (i.e. the directory containing ConsoleApp.exe)
- log4net.Config.XmlConfigurator.Configure();
-
- // Create a logger
- ILog log = LogManager.GetLogger(typeof(EntryPoint));
-
- // Log an info level message
- if (log.IsInfoEnabled) log.Info("Application [ConsoleApp] Start");
-
- // Invoke static LogEvents method on LoggingExample class
- LoggingExample.LogEvents();
-
- Console.Write("Press Enter to exit...");
- Console.ReadLine();
-
- if (log.IsInfoEnabled) log.Info("Application [ConsoleApp] Stop");
-
- // It's not possible to use shutdown hooks in the .NET Compact Framework,
- // so you have manually shutdown log4net to free all resoures.
- LogManager.Shutdown();
- }
- }
-}
diff --git a/examples/netcf/1.0/Tutorials/ConsoleApp/cs/src/LoggingExample.cs b/examples/netcf/1.0/Tutorials/ConsoleApp/cs/src/LoggingExample.cs
deleted file mode 100644
index 16acb08..0000000
--- a/examples/netcf/1.0/Tutorials/ConsoleApp/cs/src/LoggingExample.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-namespace ConsoleApp
-{
- using System;
-
- /// <summary>
- /// Illustrates using log4net to conditionally log events, and
- /// using log4net to log exceptions, ...
- /// </summary>
- public class LoggingExample
- {
- // Create a logger for use in this class
- private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(LoggingExample));
-
- /// <summary>
- /// Logs events.
- /// </summary>
- public static void LogEvents()
- {
- // Log a debug message. Test if debug is enabled before
- // attempting to log the message. This is not required but
- // can make running without logging faster.
- if (log.IsDebugEnabled) log.Debug("This is a debug message");
-
- try
- {
- Bar();
- }
- catch(Exception ex)
- {
- // Log an error with an exception
- log.Error("Exception thrown from method Bar", ex);
- }
-
- log.Error("Hey this is an error!");
-
- // Push a message on to the Nested Diagnostic Context stack
- using(log4net.NDC.Push("NDC_Message"))
- {
- log.Warn("This should have an NDC message");
-
- // Set a Mapped Diagnostic Context value
- log4net.MDC.Set("auth", "auth-none");
- log.Warn("This should have an MDC message for the key 'auth'");
-
- } // The NDC message is popped off the stack at the end of the using {} block
-
- log.Warn("See the NDC has been popped of! The MDC 'auth' key is still with us.");
- }
-
- // Helper methods to demonstrate location information and nested exceptions
-
- private static void Bar()
- {
- Goo();
- }
-
- private static void Foo()
- {
- throw new Exception("This is an Exception");
- }
-
- private static void Goo()
- {
- try
- {
- Foo();
- }
- catch(Exception ex)
- {
- throw new ArithmeticException("Failed in Goo. Calling Foo. Inner Exception provided", ex);
- }
- }
- }
-}
diff --git a/examples/netcf/1.0/Tutorials/ConsoleApp/nant.build b/examples/netcf/1.0/Tutorials/ConsoleApp/nant.build
deleted file mode 100644
index d729828..0000000
--- a/examples/netcf/1.0/Tutorials/ConsoleApp/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="consoleapp-example" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile ConsoleApp example -->
- <target name="compile" description="Builds ConsoleApp example">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/netcf/1.0/Tutorials/ConsoleApp/nant.config b/examples/netcf/1.0/Tutorials/ConsoleApp/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/netcf/1.0/Tutorials/ConsoleApp/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/netcf/1.0/Tutorials/ConsoleApp/vb/nant.build b/examples/netcf/1.0/Tutorials/ConsoleApp/vb/nant.build
deleted file mode 100644
index 0badfdd..0000000
--- a/examples/netcf/1.0/Tutorials/ConsoleApp/vb/nant.build
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- copy log4net build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="${log4net.output.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- compile the example -->
- <vbc target="exe" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.vbc}" output="${current.bin.dir}/ConsoleApp.exe">
- <sources>
- <include name="src/**/*.vb" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.vb" />
- </sources>
- <references>
- <include name="System.dll" />
- <include name="${current.bin.dir}/log4net.dll" />
- </references>
- </vbc>
- <!-- copy the ConsoleApp application configuration file -->
- <copy file="src/ConsoleApp.exe.config" todir="${current.bin.dir}" />
- </target>
-</project>
diff --git a/examples/netcf/1.0/Tutorials/ConsoleApp/vb/nant.config b/examples/netcf/1.0/Tutorials/ConsoleApp/vb/nant.config
deleted file mode 100644
index 52613e8..0000000
--- a/examples/netcf/1.0/Tutorials/ConsoleApp/vb/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/netcf/1.0/Tutorials/ConsoleApp/vb/src/AssemblyInfo.vb b/examples/netcf/1.0/Tutorials/ConsoleApp/vb/src/AssemblyInfo.vb
deleted file mode 100644
index cbb6827..0000000
--- a/examples/netcf/1.0/Tutorials/ConsoleApp/vb/src/AssemblyInfo.vb
+++ /dev/null
@@ -1,61 +0,0 @@
-#Region "Apache License"
-'
-' Licensed to the Apache Software Foundation (ASF) under one or more
-' contributor license agreements. See the NOTICE file distributed with
-' this work for additional information regarding copyright ownership.
-' The ASF licenses this file to you 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.
-'
-#End Region
-
-Imports System.Reflection
-Imports System.Runtime.CompilerServices
-
-'
-' 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("log4net - ConsoleApp")>
-<Assembly:AssemblyDescription("log4net ConsoleApp")>
-<Assembly:AssemblyConfiguration("")>
-<Assembly:AssemblyProduct("log4net - ConsoleApp")>
-<Assembly:AssemblyCulture("")>
-
-'
-' In order to sign your assembly you must specify a key to use. Refer to the
-' Microsoft .NET Framework documentation for more information on assembly signing.
-'
-' Use the attributes below to control which key is used for signing.
-'
-' Notes:
-' (*) If no key is specified, the assembly is not signed.
-' (*) KeyName refers to a key that has been installed in the Crypto Service
-' Provider (CSP) on your machine. KeyFile refers to a file which contains
-' a key.
-' (*) If the KeyFile and the KeyName values are both specified, the
-' following processing occurs:
-' (1) If the KeyName can be found in the CSP, that key is used.
-' (2) If the KeyName does not exist and the KeyFile does exist, the key
-' in the KeyFile is installed into the CSP and used.
-' (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-' When specifying the KeyFile, the location of the KeyFile should be
-' relative to the project output directory which is
-' %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-' located in the project directory, you would specify the AssemblyKeyFile
-' attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-' (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-' documentation for more information on this.
-'
-<Assembly:AssemblyDelaySign(false)>
-<Assembly:AssemblyKeyFile("")>
-<Assembly:AssemblyKeyName("")>
diff --git a/examples/netcf/1.0/Tutorials/ConsoleApp/vb/src/ConsoleApp.exe.config b/examples/netcf/1.0/Tutorials/ConsoleApp/vb/src/ConsoleApp.exe.config
deleted file mode 100644
index d113223..0000000
--- a/examples/netcf/1.0/Tutorials/ConsoleApp/vb/src/ConsoleApp.exe.config
+++ /dev/null
@@ -1,124 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-
-<!-- .NET application configuration file
-
- The .NET Compact Framework does not support application configuration files,
- but log4net supports using configuration files with similar names and structure,
- to store the log4net configuration.
- -->
-
-<configuration>
- <!-- This section contains the log4net configuration settings -->
- <log4net>
-
- <!-- Define some output appenders -->
-
- <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
- <file value="rolling-log.txt" />
- <appendToFile value="true" />
-
- <maxSizeRollBackups value="10" />
- <maximumFileSize value="100" />
- <rollingStyle value="Size" />
- <staticLogFileName value="true" />
-
- <layout type="log4net.Layout.PatternLayout">
- <header value="[Header] "/>
- <footer value="[Footer] "/>
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
- </layout>
- </appender>
-
- <appender name="LogFileAppender" type="log4net.Appender.FileAppender" >
- <file value="log-file.txt" />
-
- <!-- Example using environment variables in params -->
- <!-- <file value="${TMP}\log-file.txt" /> -->
- <appendToFile value="true" />
-
- <!-- An alternate output encoding can be specified -->
- <!-- <encoding value="unicodeFFFE" /> -->
-
- <layout type="log4net.Layout.PatternLayout">
- <header value="[Header] "/>
- <footer value="[Footer] "/>
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] <%property{auth}> - %message%newline" />
- </layout>
- <!-- Alternate layout using XML
- <layout type="log4net.Layout.XMLLayout" /> -->
- </appender>
-
- <appender name="MulticastAppender" type="log4net.Appender.UdpAppender" >
- <threshold value="WARN" />
- <remoteAddress value="224.0.0.1" />
- <remotePort value="8080" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
- </layout>
- </appender>
-
- <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] <%property{auth}> - %message%newline" />
- </layout>
- </appender>
-
- <!--
-
- <appender name="A" type="log4net.Appender.ForwardingAppender" >
- <threshold value="WARN"/>
- <appender-ref ref="ConsoleAppender" />
- </appender>
-
- <appender name="B" type="log4net.Appender.ForwardingAppender" >
- <filter type="log4net.Filter.LevelRangeFilter">
- <levelMin value="DEBUG"/>
- <levelMax value="INFO"/>
- </filter>
- <appender-ref ref="ConsoleAppender" />
- </appender>
-
- -->
-
- <!-- Setup the root category, add the appenders and set the default level -->
-
- <root>
- <level value="INFO" />
- <appender-ref ref="LogFileAppender" />
- <appender-ref ref="ConsoleAppender" />
- <appender-ref ref="MulticastAppender" />
- <!-- <appender-ref ref="A" /> -->
- </root>
-
- <!-- Specify the level for some specific categories -->
-
- <logger name="ConsoleApp.LoggingExample">
- <!-- <appender-ref ref="B" /> -->
- <level value="ALL" />
- <appender-ref ref="RollingLogFileAppender" />
- </logger>
-
- </log4net>
-
-</configuration>
diff --git a/examples/netcf/1.0/Tutorials/ConsoleApp/vb/src/ConsoleApp.vbdproj b/examples/netcf/1.0/Tutorials/ConsoleApp/vb/src/ConsoleApp.vbdproj
deleted file mode 100644
index e16e9cc..0000000
--- a/examples/netcf/1.0/Tutorials/ConsoleApp/vb/src/ConsoleApp.vbdproj
+++ /dev/null
@@ -1,156 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<VisualStudioProject>
- <EVisualBasic
- ProjectType = "Local"
- ProductVersion = "7.10.3077"
- SchemaVersion = "1.0"
- ProjectGuid = "{E923C49B-5C5F-49A3-AFE1-7DDB2EC31757}"
- >
- <Build>
- <Settings
- ApplicationIcon = ""
- AssemblyKeyContainerName = ""
- AssemblyName = "ConsoleApp"
- AssemblyOriginatorKeyFile = ""
- AssemblyOriginatorKeyMode = "None"
- DelaySign = "false"
- OutputType = "Exe"
- OptionCompare = "Binary"
- OptionExplicit = "On"
- OptionStrict = "Off"
- OutputFileFolder = "\Program Files\ConsoleAppVB"
- RootNamespace = "ConsoleApp"
- StartupObject = ""
- >
- <Platform Name = "Windows CE" />
- <Config
- Name = "Debug|Windows CE"
- BaseAddress = "0"
- ConfigurationOverrideFile = ""
- DefineConstants = ""
- DefineDebug = "true"
- DefineTrace = "true"
- DebugSymbols = "true"
- IncrementalBuild = "false"
- Optimize = "false"
- OutputPath = "..\build\netcf\1.0\debug\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "1"
- />
- <Config
- Name = "Release|Windows CE"
- BaseAddress = "0"
- ConfigurationOverrideFile = ""
- DefineConstants = ""
- DefineDebug = "false"
- DefineTrace = "true"
- DebugSymbols = "false"
- IncrementalBuild = "false"
- Optimize = "false"
- OutputPath = "..\build\netcf\1.0\release\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "1"
- />
- </Settings>
- <References>
- <Reference
- Platform = "Windows CE"
- Name = "log4net"
- AssemblyName = "log4net"
- />
- <Reference
- Platform = "Windows CE-Designer"
- Name = "System.CF.Design"
- AssemblyName = "System.CF.Design"
- Private = "False"
- />
- <Reference
- Platform = "Windows CE-Designer"
- Name = "System.CF.Design.UI"
- AssemblyName = "System.CF.Design.UI"
- Private = "False"
- />
- <Reference
- Platform = "Windows CE-Designer"
- Name = "System.CF.Windows.Forms"
- AssemblyName = "System.CF.Windows.Forms"
- Private = "False"
- />
- <Reference
- Platform = "Windows CE-Designer"
- Name = "System.CF.Drawing"
- AssemblyName = "System.CF.Drawing"
- Private = "False"
- />
- <Reference
- Platform = "Windows CE-Designer"
- Name = "System"
- AssemblyName = "System"
- Private = "False"
- />
- </References>
- <Imports>
- <Import Namespace = "Microsoft.VisualBasic" />
- <Import Namespace = "System" />
- <Import Namespace = "System.Collections" />
- <Import Namespace = "System.Configuration" />
- <Import Namespace = "System.Diagnostics" />
- </Imports>
- </Build>
- <Files>
- <Include>
- <File
- RelPath = "AssemblyInfo.vb"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "AssemblyVersionInfo.vb"
- Link = "..\..\..\..\..\..\..\src\AssemblyVersionInfo.vb"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "ConsoleApp.exe.config"
- BuildAction = "Content"
- />
- <File
- RelPath = "EntryPoint.vb"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "LoggingExample.vb"
- SubType = "Code"
- BuildAction = "Compile"
- />
- </Include>
- </Files>
- </EVisualBasic>
-</VisualStudioProject>
-
diff --git a/examples/netcf/1.0/Tutorials/ConsoleApp/vb/src/EntryPoint.vb b/examples/netcf/1.0/Tutorials/ConsoleApp/vb/src/EntryPoint.vb
deleted file mode 100644
index 8c9c89f..0000000
--- a/examples/netcf/1.0/Tutorials/ConsoleApp/vb/src/EntryPoint.vb
+++ /dev/null
@@ -1,64 +0,0 @@
-#Region "Apache License"
-'
-' Licensed to the Apache Software Foundation (ASF) under one or more
-' contributor license agreements. See the NOTICE file distributed with
-' this work for additional information regarding copyright ownership.
-' The ASF licenses this file to you 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.
-'
-#End Region
-
-Imports System
-
-Imports log4net
-
-Namespace ConsoleApp
- ' Example of how to simply configure and use log4net in a .NET Compact Framework
- ' application.
- '
- ' The .NET Compact Framework does not support retrieving assembly-level
- ' attributes, therefor log4net must be configured by code.
- '
- ' The .NET Compact Framework does not support hooking up the <c>AppDomain.ProcessExit</c>
- ' and <c>AppDomain.DomainUnload</c> events, so log4net must be shutdown manually to
- ' free all resources.
- Public Class EntryPoint
- ' Application entry point.
- Public Shared Sub Main()
- ' Uncomment the next line to enable log4net internal debugging
- ' log4net.helpers.LogLog.InternalDebugging = true;
-
- ' This will instruct log4net to look for a configuration file
- ' called ConsoleApp.exe.config in the application base
- ' directory (i.e. the directory containing ConsoleApp.exe)
- log4net.Config.XmlConfigurator.Configure()
-
- ' Create a logger
- Dim log As ILog = LogManager.GetLogger(GetType(EntryPoint))
-
- ' Log an info level message
- If log.IsInfoEnabled Then log.Info("Application [ConsoleApp] Start")
-
- ' Invoke shared LogEvents method on LoggingExample class
- LoggingExample.LogEvents()
-
- Console.Write("Press Enter to exit...")
- Console.ReadLine()
-
- If log.IsInfoEnabled Then log.Info("Application [ConsoleApp] Stop")
-
- ' It's not possible to use shutdown hooks in the .NET Compact Framework,
- ' so you have manually shutdown log4net to free all resoures.
- LogManager.Shutdown()
- End Sub
- End Class
-End Namespace
diff --git a/examples/netcf/1.0/Tutorials/ConsoleApp/vb/src/LoggingExample.vb b/examples/netcf/1.0/Tutorials/ConsoleApp/vb/src/LoggingExample.vb
deleted file mode 100644
index 8276367..0000000
--- a/examples/netcf/1.0/Tutorials/ConsoleApp/vb/src/LoggingExample.vb
+++ /dev/null
@@ -1,82 +0,0 @@
-#Region "Apache License"
-'
-' Licensed to the Apache Software Foundation (ASF) under one or more
-' contributor license agreements. See the NOTICE file distributed with
-' this work for additional information regarding copyright ownership.
-' The ASF licenses this file to you 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.
-'
-#End Region
-
-Imports System
-
-Namespace ConsoleApp
- ' Illustrates using log4net to conditionally log events, and
- ' using log4net to log exceptions, ...
- Public Class LoggingExample
- ' Create a logger for use in this class
- Private Shared ReadOnly log As log4net.ILog = log4net.LogManager.GetLogger(GetType(LoggingExample))
-
- ' Logs events.
- Public Shared Sub LogEvents()
- ' Log a debug message. Test if debug is enabled before
- ' attempting to log the message. This is not required but
- ' can make running without logging faster.
- If log.IsDebugEnabled Then log.Debug("This is a debug message")
-
- Try
- Bar()
- Catch ex As Exception
- ' Log an error with an exception
- log.Error("Exception thrown from method Bar", ex)
- End Try
-
- log.Error("Hey this is an error!")
-
- Dim disposableFrame As IDisposable
-
- Try
- ' Push a message on to the Nested Diagnostic Context stack
- log4net.NDC.Push("NDC_Message")
-
- log.Warn("This should have an NDC message")
-
- ' Set a Mapped Diagnostic Context value
- log4net.MDC.Set("auth", "auth-none")
- log.Warn("This should have an MDC message for the key 'auth'")
- Finally
- ' The NDC message is popped off the stack by using the Dispose method
- If (Not disposableFrame is Nothing) Then disposableFrame.Dispose()
- End Try
-
- log.Warn("See the NDC has been popped of! The MDC 'auth' key is still with us.")
- End Sub
-
- ' Helper methods to demonstrate location information and nested exceptions
-
- Private Shared Sub Bar()
- Goo()
- End Sub
-
- Private Shared Sub Foo()
- Throw New Exception("This is an Exception")
- End Sub
-
- Private Shared Sub Goo()
- Try
- Foo()
- Catch ex As Exception
- Throw New ArithmeticException("Failed in Goo. Calling Foo. Inner Exception provided", ex)
- End Try
- End Sub
- End Class
-End Namespace
diff --git a/examples/netcf/1.0/Tutorials/nant.build b/examples/netcf/1.0/Tutorials/nant.build
deleted file mode 100644
index 7867e77..0000000
--- a/examples/netcf/1.0/Tutorials/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="tutorials-examples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile Tutorials examples -->
- <target name="compile" description="Builds Tutorials examples">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/netcf/1.0/Tutorials/nant.config b/examples/netcf/1.0/Tutorials/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/netcf/1.0/Tutorials/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/netcf/1.0/cs-examples.sln b/examples/netcf/1.0/cs-examples.sln
deleted file mode 100644
index d0c36b5..0000000
--- a/examples/netcf/1.0/cs-examples.sln
+++ /dev/null
@@ -1,43 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 8.00
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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.
-#
-#
-Project("{20D4826A-C6FA-45DB-90F4-C717570B9F32}") = "ConsoleApp", "Tutorials\ConsoleApp\cs\src\ConsoleApp.csdproj", "{06757B10-BBC2-4858-AB65-26F92D0D6A5D}"
- ProjectSection(ProjectDependencies) = postProject
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfiguration) = preSolution
- Debug = Debug
- Release = Release
- EndGlobalSection
- GlobalSection(ProjectConfiguration) = postSolution
- {06757B10-BBC2-4858-AB65-26F92D0D6A5D}.Debug.ActiveCfg = Debug|Windows CE
- {06757B10-BBC2-4858-AB65-26F92D0D6A5D}.Debug.Build.0 = Debug|Windows CE
- {06757B10-BBC2-4858-AB65-26F92D0D6A5D}.Debug.Deploy.0 = Debug|Windows CE
- {06757B10-BBC2-4858-AB65-26F92D0D6A5D}.Release.ActiveCfg = Release|Windows CE
- {06757B10-BBC2-4858-AB65-26F92D0D6A5D}.Release.Build.0 = Release|Windows CE
- {06757B10-BBC2-4858-AB65-26F92D0D6A5D}.Release.Deploy.0 = Release|Windows CE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- EndGlobalSection
- GlobalSection(ExtensibilityAddIns) = postSolution
- EndGlobalSection
-EndGlobal
diff --git a/examples/netcf/1.0/nant.build b/examples/netcf/1.0/nant.build
deleted file mode 100644
index 20d231d..0000000
--- a/examples/netcf/1.0/nant.build
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="netcf-1.0-examples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- include configuration file -->
- <include buildfile="nant.config" />
- <!-- compile all .NET Compact Framework 1.0 examples -->
- <target name="compile" description="Builds .NET Compact Framework 1.0 examples">
- <if test="${framework::exists(project.runtime.config + '-' + project.runtime.version)}">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </if>
- <if test="${not framework::exists(project.runtime.config + '-' + project.runtime.version)}">
- <if test="${property::exists('project.build.package') and project.build.package}">
- <fail message="${project.runtime.description} is not available." />
- </if>
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo message="${project.runtime.description} is not available. Examples skipped." />
- </if>
- </if>
- </target>
-</project>
diff --git a/examples/netcf/1.0/nant.config b/examples/netcf/1.0/nant.config
deleted file mode 100644
index e156f49..0000000
--- a/examples/netcf/1.0/nant.config
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set runtime version -->
- <property name="project.runtime.version" value="1.0" />
- <!-- Set runtime description -->
- <property name="project.runtime.description" value=".NET Compact Framework 1.0" />
-</project>
diff --git a/examples/netcf/1.0/vb-examples.sln b/examples/netcf/1.0/vb-examples.sln
deleted file mode 100644
index c655d51..0000000
--- a/examples/netcf/1.0/vb-examples.sln
+++ /dev/null
@@ -1,43 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 8.00
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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.
-#
-#
-Project("{CB4CE8C6-1BDB-4DC7-A4D3-65A1999772F8}") = "ConsoleApp", "Tutorials\ConsoleApp\vb\src\ConsoleApp.vbdproj", "{E923C49B-5C5F-49A3-AFE1-7DDB2EC31757}"
- ProjectSection(ProjectDependencies) = postProject
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfiguration) = preSolution
- Debug = Debug
- Release = Release
- EndGlobalSection
- GlobalSection(ProjectConfiguration) = postSolution
- {E923C49B-5C5F-49A3-AFE1-7DDB2EC31757}.Debug.ActiveCfg = Debug|Windows CE
- {E923C49B-5C5F-49A3-AFE1-7DDB2EC31757}.Debug.Build.0 = Debug|Windows CE
- {E923C49B-5C5F-49A3-AFE1-7DDB2EC31757}.Debug.Deploy.0 = Debug|Windows CE
- {E923C49B-5C5F-49A3-AFE1-7DDB2EC31757}.Release.ActiveCfg = Release|Windows CE
- {E923C49B-5C5F-49A3-AFE1-7DDB2EC31757}.Release.Build.0 = Release|Windows CE
- {E923C49B-5C5F-49A3-AFE1-7DDB2EC31757}.Release.Deploy.0 = Release|Windows CE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- EndGlobalSection
- GlobalSection(ExtensibilityAddIns) = postSolution
- EndGlobalSection
-EndGlobal
diff --git a/examples/netcf/nant.build b/examples/netcf/nant.build
deleted file mode 100644
index 2121e9e..0000000
--- a/examples/netcf/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="netcf-examples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile .NET Compact Framework examples -->
- <target name="compile" description="Builds .NET Compact Framework examples">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/netcf/nant.config b/examples/netcf/nant.config
deleted file mode 100644
index fa05af0..0000000
--- a/examples/netcf/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="netcf-configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set runtime configuration -->
- <property name="project.runtime.config" value="netcf" />
-</project>
diff --git a/examples/sscli/1.0/Repository/SharedModule/cs/nant.build b/examples/sscli/1.0/Repository/SharedModule/cs/nant.build
deleted file mode 100644
index 36fce7f..0000000
--- a/examples/sscli/1.0/Repository/SharedModule/cs/nant.build
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- compile the example -->
- <csc noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" define="${current.build.defines.csc}" output="${current.bin.dir}/SharedModule.dll">
- <sources>
- <include name="src/**/*.cs" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.cs" />
- </sources>
- <references basedir="${log4net.output.dir}">
- <include name="log4net.dll" />
- </references>
- </csc>
- </target>
-</project>
diff --git a/examples/sscli/1.0/Repository/SharedModule/cs/nant.config b/examples/sscli/1.0/Repository/SharedModule/cs/nant.config
deleted file mode 100644
index 52613e8..0000000
--- a/examples/sscli/1.0/Repository/SharedModule/cs/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/sscli/1.0/Repository/SharedModule/cs/src/AssemblyInfo.cs b/examples/sscli/1.0/Repository/SharedModule/cs/src/AssemblyInfo.cs
deleted file mode 100644
index 9c40818..0000000
--- a/examples/sscli/1.0/Repository/SharedModule/cs/src/AssemblyInfo.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// 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("log4net - SharedModule")]
-[assembly: AssemblyDescription("log4net SharedModule")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyProduct("log4net - SharedModule")]
-[assembly: AssemblyCulture("")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("")]
diff --git a/examples/sscli/1.0/Repository/SharedModule/cs/src/Math.cs b/examples/sscli/1.0/Repository/SharedModule/cs/src/Math.cs
deleted file mode 100644
index 64211dc..0000000
--- a/examples/sscli/1.0/Repository/SharedModule/cs/src/Math.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-namespace SharedModule
-{
- /// <summary>
- /// Summary description for Math.
- /// </summary>
- public class Math
- {
- // Create a logger for use in this class
- private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
-
- public Math()
- {
- if (log.IsDebugEnabled) log.Debug("Constructor");
- }
-
- public int Subtract(int left, int right)
- {
- int result = left - right;
- if (log.IsInfoEnabled) log.Info(""+left+" - "+right+" = "+result);
- return result;
- }
- }
-}
diff --git a/examples/sscli/1.0/Repository/SharedModule/nant.build b/examples/sscli/1.0/Repository/SharedModule/nant.build
deleted file mode 100644
index a11e9cd..0000000
--- a/examples/sscli/1.0/Repository/SharedModule/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="sharedmodule-example" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile SharedModule example -->
- <target name="compile" description="Builds SharedModule example">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/sscli/1.0/Repository/SharedModule/nant.config b/examples/sscli/1.0/Repository/SharedModule/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/sscli/1.0/Repository/SharedModule/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/sscli/1.0/Repository/SimpleApp/cs/nant.build b/examples/sscli/1.0/Repository/SimpleApp/cs/nant.build
deleted file mode 100644
index 77cc68b..0000000
--- a/examples/sscli/1.0/Repository/SimpleApp/cs/nant.build
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- copy log4net build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="${log4net.output.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- build SharedModule assembly -->
- <nant buildfile="../../SharedModule/cs/nant.build" target="compile" inheritall="true" />
- <!-- build SimpleModule assembly -->
- <nant buildfile="../../SimpleModule/cs/nant.build" target="compile" inheritall="true" />
- <!-- copy SharedModule build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="../../SharedModule/cs/${current.bin.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- copy SimpleModule build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="../../SimpleModule/cs/${current.bin.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- compile the example -->
- <csc noconfig="true" warnaserror="true" target="exe" debug="${current.build.debug}" define="${current.build.defines.csc}" output="${current.bin.dir}/SimpleApp.exe">
- <sources>
- <include name="src/**/*.cs" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.cs" />
- </sources>
- <references basedir="${current.bin.dir}">
- <include name="SimpleModule.dll" />
- <include name="SharedModule.dll" />
- <include name="log4net.dll" />
- </references>
- </csc>
- <!-- copy the SimpleApp log4net configuration file -->
- <copy file="src/SimpleApp.exe.log4net" todir="${current.bin.dir}" />
- <!-- copy the SimpleApp application configuration file -->
- <copy file="src/App.config" tofile="${current.bin.dir}/SimpleApp.exe.config" />
- </target>
-</project>
diff --git a/examples/sscli/1.0/Repository/SimpleApp/cs/nant.config b/examples/sscli/1.0/Repository/SimpleApp/cs/nant.config
deleted file mode 100644
index 1be4478..0000000
--- a/examples/sscli/1.0/Repository/SimpleApp/cs/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/sscli/1.0/Repository/SimpleApp/cs/src/App.config b/examples/sscli/1.0/Repository/SimpleApp/cs/src/App.config
deleted file mode 100644
index bec3f2e..0000000
--- a/examples/sscli/1.0/Repository/SimpleApp/cs/src/App.config
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<configuration>
- <appSettings>
- <!-- To enable internal log4net logging specify the
- following appSettings key -->
-
- <!-- <add key="log4net.Internal.Debug" value="true"/> -->
- </appSettings>
-</configuration>
diff --git a/examples/sscli/1.0/Repository/SimpleApp/cs/src/AssemblyInfo.cs b/examples/sscli/1.0/Repository/SimpleApp/cs/src/AssemblyInfo.cs
deleted file mode 100644
index 6dbb861..0000000
--- a/examples/sscli/1.0/Repository/SimpleApp/cs/src/AssemblyInfo.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// 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("log4net - SimpleApp")]
-[assembly: AssemblyDescription("log4net SimpleApp")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyProduct("log4net - SimpleApp")]
-[assembly: AssemblyCulture("")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("")]
diff --git a/examples/sscli/1.0/Repository/SimpleApp/cs/src/EntryPoint.cs b/examples/sscli/1.0/Repository/SimpleApp/cs/src/EntryPoint.cs
deleted file mode 100644
index a0b5acf..0000000
--- a/examples/sscli/1.0/Repository/SimpleApp/cs/src/EntryPoint.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-// Configure logging for this assembly using the 'SimpleApp.exe.log4net' file
-[assembly: log4net.Config.XmlConfigurator(ConfigFileExtension="log4net")]
-
-// The following alias attribute can be used to capture the logging
-// repository for the 'SimpleModule' assembly. Without specifying this
-// attribute the logging configuration for the 'SimpleModule' assembly
-// will be read from the 'SimpleModule.dll.log4net' file. When this
-// attribute is specified the configuration will be shared with this
-// assemby's configuration.
-//[assembly: log4net.Config.AliasRepository("SimpleModule")]
-
-namespace SimpleApp
-{
- using System;
-
- /// <summary>
- /// Summary description for Class1.
- /// </summary>
- class EntryPoint
- {
- // Create a logger for use in this class
- private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
-
- /// <summary>
- /// The main entry point for the application.
- /// </summary>
- static void Main(string[] args)
- {
- if (log.IsInfoEnabled) log.Info(args);
-
- if (args.Length != 2)
- {
- log.Error("Must supply 2 command line arguments");
- }
- else
- {
- int left = int.Parse(args[0]);
- int right = int.Parse(args[1]);
- int result = 0;
-
- if (log.IsDebugEnabled) log.Debug("Adding ["+left+"] to ["+right+"]");
-
- result = (new SimpleModule.Math()).Add(left, right);
-
- if (log.IsDebugEnabled) log.Debug("Result ["+result+"]");
-
- Console.Out.WriteLine(result);
-
-
- if (log.IsDebugEnabled) log.Debug("Subtracting ["+right+"] from ["+left+"]");
-
- result = (new SharedModule.Math()).Subtract(left, right);
-
- if (log.IsDebugEnabled) log.Debug("Result ["+result+"]");
-
- Console.Out.WriteLine(result);
- }
- }
- }
-}
diff --git a/examples/sscli/1.0/Repository/SimpleApp/cs/src/SimpleApp.exe.log4net b/examples/sscli/1.0/Repository/SimpleApp/cs/src/SimpleApp.exe.log4net
deleted file mode 100644
index d8543c4..0000000
--- a/examples/sscli/1.0/Repository/SimpleApp/cs/src/SimpleApp.exe.log4net
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-
-<!-- This section contains the log4net configuration settings -->
-<log4net>
-
- <!-- Define some output appenders -->
-
- <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="[SimpleAppConfig] %date [%thread] %-5level %logger [%ndc] - %message%newline" />
- </layout>
- </appender>
-
- <!-- Setup the root category, add the appenders and set the default priority -->
-
- <root>
- <level value="DEBUG" />
- <appender-ref ref="ConsoleAppender" />
- </root>
-
-</log4net>
diff --git a/examples/sscli/1.0/Repository/SimpleApp/nant.build b/examples/sscli/1.0/Repository/SimpleApp/nant.build
deleted file mode 100644
index d92e4c5..0000000
--- a/examples/sscli/1.0/Repository/SimpleApp/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="simpleapp-example" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile SimpleApp example -->
- <target name="compile" description="Builds SimpleApp example">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/sscli/1.0/Repository/SimpleApp/nant.config b/examples/sscli/1.0/Repository/SimpleApp/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/sscli/1.0/Repository/SimpleApp/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/sscli/1.0/Repository/SimpleModule/cs/nant.build b/examples/sscli/1.0/Repository/SimpleModule/cs/nant.build
deleted file mode 100644
index 9ee2cbe..0000000
--- a/examples/sscli/1.0/Repository/SimpleModule/cs/nant.build
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- compile the example -->
- <csc noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" define="${current.build.defines.csc}" output="${current.bin.dir}/SimpleModule.dll">
- <sources>
- <include name="src/**/*.cs" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.cs" />
- </sources>
- <references basedir="${log4net.output.dir}">
- <include name="log4net.dll" />
- </references>
- </csc>
- <!-- copy the log4net configuration file to the output directory -->
- <copy file="src/SimpleModule.dll.log4net" todir="${current.bin.dir}" />
- </target>
-</project>
diff --git a/examples/sscli/1.0/Repository/SimpleModule/cs/nant.config b/examples/sscli/1.0/Repository/SimpleModule/cs/nant.config
deleted file mode 100644
index 52613e8..0000000
--- a/examples/sscli/1.0/Repository/SimpleModule/cs/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" />
-</project>
diff --git a/examples/sscli/1.0/Repository/SimpleModule/cs/src/AssemblyInfo.cs b/examples/sscli/1.0/Repository/SimpleModule/cs/src/AssemblyInfo.cs
deleted file mode 100644
index 62cdc65..0000000
--- a/examples/sscli/1.0/Repository/SimpleModule/cs/src/AssemblyInfo.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// 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("log4net - SimpleModule")]
-[assembly: AssemblyDescription("log4net SimpleModule")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyProduct("log4net - SimpleModule")]
-[assembly: AssemblyCulture("")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("")]
diff --git a/examples/sscli/1.0/Repository/SimpleModule/cs/src/Math.cs b/examples/sscli/1.0/Repository/SimpleModule/cs/src/Math.cs
deleted file mode 100644
index c199bc6..0000000
--- a/examples/sscli/1.0/Repository/SimpleModule/cs/src/Math.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-// We want this assembly to have a seperate logging repository to the
-// rest of the application. We will configure this repository seperatly.
-[assembly: log4net.Config.Repository("SimpleModule")]
-
-// Configure logging for this assembly using the 'SimpleModule.dll.log4net' file
-[assembly: log4net.Config.XmlConfigurator(ConfigFileExtension="log4net")]
-
-namespace SimpleModule
-{
- /// <summary>
- /// Summary description for Math.
- /// </summary>
- public class Math
- {
- // Create a logger for use in this class
- private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
-
- public Math()
- {
- if (log.IsDebugEnabled) log.Debug("Constructor");
- }
-
- public int Add(int left, int right)
- {
- int result = left + right;
- if (log.IsInfoEnabled) log.Info(""+left+" + "+right+" = "+result);
- return result;
- }
- }
-}
diff --git a/examples/sscli/1.0/Repository/SimpleModule/cs/src/SimpleModule.dll.log4net b/examples/sscli/1.0/Repository/SimpleModule/cs/src/SimpleModule.dll.log4net
deleted file mode 100644
index 431ee95..0000000
--- a/examples/sscli/1.0/Repository/SimpleModule/cs/src/SimpleModule.dll.log4net
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-
-<!-- This section contains the log4net configuration settings -->
-<log4net>
-
- <!-- Define some output appenders -->
-
- <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="[SimpleModuleConfig] %date [%thread] %-5level %logger [%ndc] - %message%newline" />
- </layout>
- </appender>
-
- <!-- Setup the root category, add the appenders and set the default priority -->
-
- <root>
- <level value="DEBUG" />
- <appender-ref ref="ConsoleAppender" />
- </root>
-
-</log4net>
diff --git a/examples/sscli/1.0/Repository/SimpleModule/nant.build b/examples/sscli/1.0/Repository/SimpleModule/nant.build
deleted file mode 100644
index 614f891..0000000
--- a/examples/sscli/1.0/Repository/SimpleModule/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="simplemodule-example" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile SimpleModule example -->
- <target name="compile" description="Builds SimpleModule example">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/sscli/1.0/Repository/SimpleModule/nant.config b/examples/sscli/1.0/Repository/SimpleModule/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/sscli/1.0/Repository/SimpleModule/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/sscli/1.0/Repository/nant.build b/examples/sscli/1.0/Repository/nant.build
deleted file mode 100644
index 27c3394..0000000
--- a/examples/sscli/1.0/Repository/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="repository-examples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile Domain examples -->
- <target name="compile" description="Builds Repository examples">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/sscli/1.0/Repository/nant.config b/examples/sscli/1.0/Repository/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/sscli/1.0/Repository/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/sscli/1.0/Tutorials/ConsoleApp/js/nant.build b/examples/sscli/1.0/Tutorials/ConsoleApp/js/nant.build
deleted file mode 100644
index 6dcc4d4..0000000
--- a/examples/sscli/1.0/Tutorials/ConsoleApp/js/nant.build
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- copy log4net build output -->
- <copy todir="${current.bin.dir}">
- <fileset basedir="${log4net.output.dir}">
- <include name="*.*" />
- </fileset>
- </copy>
- <!-- compile the example -->
- <jsc target="exe" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.jsc}" output="${current.bin.dir}/ConsoleApp.exe">
- <sources>
- <include name="src/**/*.js" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.js" />
- </sources>
- <references basedir="${current.bin.dir}">
- <include name="log4net.dll" />
- </references>
- </jsc>
- <!-- copy the ConsoleApp application configuration file -->
- <copy file="src/App.config" tofile="${current.bin.dir}/ConsoleApp.exe.config" />
- </target>
-</project>
diff --git a/examples/sscli/1.0/Tutorials/ConsoleApp/js/nant.config b/examples/sscli/1.0/Tutorials/ConsoleApp/js/nant.config
deleted file mode 100644
index 1bfdb0a..0000000
--- a/examples/sscli/1.0/Tutorials/ConsoleApp/js/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../../" readonly="false" />
-</project>
diff --git a/examples/sscli/1.0/Tutorials/ConsoleApp/js/src/App.config b/examples/sscli/1.0/Tutorials/ConsoleApp/js/src/App.config
deleted file mode 100644
index 12c4fef..0000000
--- a/examples/sscli/1.0/Tutorials/ConsoleApp/js/src/App.config
+++ /dev/null
@@ -1,87 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<!--
- .NET application configuration file
- This file must have the exact same name as your application with .config appended to it.
-
- For example if your application is ConsoleApp.exe then the config file must be ConsoleApp.exe.config.
- It must also be in the same directory as the application.
- -->
-<configuration>
- <!-- Register the section handler for the log4net section -->
- <configSections>
- <section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
- </configSections>
- <appSettings>
- <!-- To enable internal log4net logging specify the following appSettings key -->
- <!-- <add key="log4net.Internal.Debug" value="true"/> -->
- </appSettings>
- <!-- This section contains the log4net configuration settings -->
- <log4net>
- <!-- Define some output appenders -->
- <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
- <file value="rolling-log.txt" />
- <appendToFile value="true" />
- <maxSizeRollBackups value="10" />
- <maximumFileSize value="100" />
- <rollingStyle value="Size" />
- <staticLogFileName value="true" />
- <layout type="log4net.Layout.PatternLayout">
- <header value="[Header] " />
- <footer value="[Footer] " />
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
- </layout>
- </appender>
- <appender name="LogFileAppender" type="log4net.Appender.FileAppender">
- <file value="log-file.txt" />
- <!-- Example using environment variables in params -->
- <!-- <file value="${TMP}\log-file.txt" /> -->
- <sppendToFile value="true" />
- <!-- An alternate output encoding can be specified -->
- <!-- <encoding value="unicodeFFFE" /> -->
- <layout type="log4net.Layout.PatternLayout">
- <header value="[Header] " />
- <footer value="[Footer] " />
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] <%property{auth}> - %message%newline" />
- </layout>
- <!-- Alternate layout using XML
- <layout type="log4net.Layout.XMLLayout" /> -->
- </appender>
- <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date [%thread] %-5level %logger [%ndc] <%property{auth}> - %message%newline" />
- </layout>
- </appender>
- <!-- Setup the root category, add the appenders and set the default level -->
- <root>
- <level value="WARN" />
- <appender-ref ref="LogFileAppender" />
- <appender-ref ref="ConsoleAppender" />
- </root>
- <!-- Specify the level for some specific categories -->
- <logger name="ConsoleApp.LoggingExample">
- <level value="ALL" />
- <appender-ref ref="RollingLogFileAppender" />
- </logger>
- </log4net>
-</configuration>
diff --git a/examples/sscli/1.0/Tutorials/ConsoleApp/js/src/AssemblyInfo.js b/examples/sscli/1.0/Tutorials/ConsoleApp/js/src/AssemblyInfo.js
deleted file mode 100644
index ef508ec..0000000
--- a/examples/sscli/1.0/Tutorials/ConsoleApp/js/src/AssemblyInfo.js
+++ /dev/null
@@ -1,62 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-
-import System.Reflection;
-import System.Runtime.CompilerServices;
-
-[assembly: System.CLSCompliant(true)]
-
-//
-// 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("log4net - ConsoleApp")]
-[assembly:AssemblyDescription("log4net ConsoleApp")]
-[assembly:AssemblyConfiguration("")]
-[assembly:AssemblyProduct("log4net - ConsoleApp")]
-[assembly:AssemblyCulture("")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly:AssemblyDelaySign(false)]
-[assembly:AssemblyKeyFile("")]
-// We do not use a CSP key for strong naming
-// [assembly: AssemblyKeyName("")]
diff --git a/examples/sscli/1.0/Tutorials/ConsoleApp/js/src/LoggingExample.js b/examples/sscli/1.0/Tutorials/ConsoleApp/js/src/LoggingExample.js
deleted file mode 100644
index 9d80ad9..0000000
--- a/examples/sscli/1.0/Tutorials/ConsoleApp/js/src/LoggingExample.js
+++ /dev/null
@@ -1,104 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-
-// JScript.NET does not support application entry points (like vb.Net and C#),
-// instead it supports global code.
-ConsoleApp.LoggingExample.Main();
-
-import System;
-
-import log4net;
-
-// Configure log4net using the .config file
-[assembly:log4net.Config.XmlConfigurator()]
-// This will cause log4net to look for a configuration file
-// called ConsoleApp.exe.config in the application base
-// directory (i.e. the directory containing ConsoleApp.exe)
-
-package ConsoleApp {
- // Example of how to simply configure and use log4net
- public class LoggingExample {
- // Create a logger for use in this class
- private static var log : log4net.ILog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
- // NOTE that using System.Reflection.MethodBase.GetCurrentMethod().DeclaringType
- // is equivalent to typeof(LoggingExample) but is more portable
- // i.e. you can copy the code directly into another class without
- // needing to edit the code.
-
- // Application entry point
- public static function Main() {
- // Log an info level message
- if (log.IsInfoEnabled) log.Info("Application [ConsoleApp] Start");
-
- // Log a debug message. Test if debug is enabled before
- // attempting to log the message. This is not required but
- // can make running without logging faster.
- if (log.IsDebugEnabled) log.Debug("This is a debug message");
-
- try {
- Bar();
- } catch (ex : Exception) {
- // Log an error with an exception
- log.Error("Exception thrown from method Bar", ex);
- }
-
- log.Error("Hey this is an error!");
-
- var disposableFrame : IDisposable;
-
- try {
- // Push a message on to the Nested Diagnostic Context stack
- disposableFrame = log4net.NDC.Push("NDC_Message");
-
- log.Warn("This should have an NDC message");
-
- // Set a Mapped Diagnostic Context value
- log4net.MDC.Set("auth", "auth-none");
- log.Warn("This should have an MDC message for the key 'auth'");
- } finally {
- // The NDC message is popped off the stack by using the Dispose method
- if (disposableFrame != null) disposableFrame.Dispose();
- }
-
- log.Warn("See the NDC has been popped of! The MDC 'auth' key is still with us.");
-
- // Log an info level message
- if (log.IsInfoEnabled) log.Info("Application [ConsoleApp] End");
-
- Console.Write("Press Enter to exit...");
- Console.ReadLine();
- }
-
- // Helper methods to demonstrate location information and nested exceptions
-
- private static function Bar() {
- Goo();
- }
-
- private static function Foo() {
- throw new Exception("This is an Exception");
- }
-
- private static function Goo() {
- try {
- Foo();
- } catch (ex : Exception) {
- throw new ArithmeticException("Failed in Goo. Calling Foo. Inner Exception provided", ex);
- }
- }
- }
-}
diff --git a/examples/sscli/1.0/Tutorials/ConsoleApp/nant.build b/examples/sscli/1.0/Tutorials/ConsoleApp/nant.build
deleted file mode 100644
index d729828..0000000
--- a/examples/sscli/1.0/Tutorials/ConsoleApp/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="consoleapp-example" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile ConsoleApp example -->
- <target name="compile" description="Builds ConsoleApp example">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/sscli/1.0/Tutorials/ConsoleApp/nant.config b/examples/sscli/1.0/Tutorials/ConsoleApp/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/sscli/1.0/Tutorials/ConsoleApp/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/sscli/1.0/Tutorials/nant.build b/examples/sscli/1.0/Tutorials/nant.build
deleted file mode 100644
index 7867e77..0000000
--- a/examples/sscli/1.0/Tutorials/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="tutorials-examples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile Tutorials examples -->
- <target name="compile" description="Builds Tutorials examples">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/sscli/1.0/Tutorials/nant.config b/examples/sscli/1.0/Tutorials/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/examples/sscli/1.0/Tutorials/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/examples/sscli/1.0/nant.build b/examples/sscli/1.0/nant.build
deleted file mode 100644
index 3778cda..0000000
--- a/examples/sscli/1.0/nant.build
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="sscli-examples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- include configuration file -->
- <include buildfile="nant.config" />
- <!-- compile all examples -->
- <target name="compile" description="Builds Shared Source CLI examples">
- <if test="${framework::exists(project.runtime.config + '-' + project.runtime.version)}">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </if>
- <if test="${not framework::exists(project.runtime.config + '-' + project.runtime.version)}">
- <if test="${property::exists('project.build.package') and project.build.package}">
- <fail message="${project.runtime.description} is not available." />
- </if>
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo message="${project.runtime.description} is not available. Examples skipped." />
- </if>
- </if>
- </target>
-</project>
diff --git a/examples/sscli/1.0/nant.config b/examples/sscli/1.0/nant.config
deleted file mode 100644
index 4f54705..0000000
--- a/examples/sscli/1.0/nant.config
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set runtime version -->
- <property name="project.runtime.version" value="1.0" />
- <!-- Set runtime description -->
- <property name="project.runtime.description" value="Shared Source CLI 1.0" />
-</project>
diff --git a/examples/sscli/nant.build b/examples/sscli/nant.build
deleted file mode 100644
index 4fc9dc2..0000000
--- a/examples/sscli/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="netcf-examples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile Shared Source CLI examples -->
- <target name="compile" description="Builds Shared Source CLI examples">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/examples/sscli/nant.config b/examples/sscli/nant.config
deleted file mode 100644
index d8dc8f1..0000000
--- a/examples/sscli/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="sscli-configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set runtime configuration -->
- <property name="project.runtime.config" value="sscli" />
-</project>
diff --git a/extensions/nant.build b/extensions/nant.build
deleted file mode 100644
index bc2a3df..0000000
--- a/extensions/nant.build
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="extensions" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <target name="compile" description="Builds extensions">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/extensions/nant.config b/extensions/nant.config
deleted file mode 100644
index dad7979..0000000
--- a/extensions/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="extensions-configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Set build configuration -->
- <property name="project.build.config" value="debug" />
-</project>
diff --git a/extensions/net/1.0/cs-extensions.sln b/extensions/net/1.0/cs-extensions.sln
deleted file mode 100644
index 3fd997c..0000000
--- a/extensions/net/1.0/cs-extensions.sln
+++ /dev/null
@@ -1,63 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 7.00
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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.
-#
-#
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "log4net.Ext.Trace", "log4net.Ext.Trace\cs\src\log4net.Ext.Trace.csproj", "{8C73DF1C-AB2B-4309-A3EC-1ED594239E15}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "log4net.Ext.EventID", "log4net.Ext.EventID\cs\src\log4net.Ext.EventID.csproj", "{CB985027-C009-4C0F-88C1-8CF11912EE4C}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "log4net.Ext.MarshalByRef", "log4net.Ext.MarshalByRef\cs\src\log4net.Ext.MarshalByRef.csproj", "{CB985027-C009-4C0F-88C1-8CF11912AE4C}"
-EndProject
-Global
- GlobalSection(DPCodeReviewSolutionGUID) = preSolution
- DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
- EndGlobalSection
- GlobalSection(SolutionConfiguration) = preSolution
- ConfigName.0 = Debug
- ConfigName.1 = Release
- ConfigName.2 = ReleaseStrong
- EndGlobalSection
- GlobalSection(ProjectDependencies) = postSolution
- EndGlobalSection
- GlobalSection(ProjectConfiguration) = postSolution
- {8C73DF1C-AB2B-4309-A3EC-1ED594239E15}.Debug.ActiveCfg = Debug|.NET
- {8C73DF1C-AB2B-4309-A3EC-1ED594239E15}.Debug.Build.0 = Debug|.NET
- {8C73DF1C-AB2B-4309-A3EC-1ED594239E15}.Release.ActiveCfg = Release|.NET
- {8C73DF1C-AB2B-4309-A3EC-1ED594239E15}.Release.Build.0 = Release|.NET
- {8C73DF1C-AB2B-4309-A3EC-1ED594239E15}.ReleaseStrong.ActiveCfg = ReleaseStrong|.NET
- {8C73DF1C-AB2B-4309-A3EC-1ED594239E15}.ReleaseStrong.Build.0 = ReleaseStrong|.NET
- {CB985027-C009-4C0F-88C1-8CF11912EE4C}.Debug.ActiveCfg = Debug|.NET
- {CB985027-C009-4C0F-88C1-8CF11912EE4C}.Debug.Build.0 = Debug|.NET
- {CB985027-C009-4C0F-88C1-8CF11912EE4C}.Release.ActiveCfg = Release|.NET
- {CB985027-C009-4C0F-88C1-8CF11912EE4C}.Release.Build.0 = Release|.NET
- {CB985027-C009-4C0F-88C1-8CF11912EE4C}.ReleaseStrong.ActiveCfg = ReleaseStrong|.NET
- {CB985027-C009-4C0F-88C1-8CF11912EE4C}.ReleaseStrong.Build.0 = ReleaseStrong|.NET
- {CB985027-C009-4C0F-88C1-8CF11912AE4C}.Debug.ActiveCfg = Debug|.NET
- {CB985027-C009-4C0F-88C1-8CF11912AE4C}.Debug.Build.0 = Debug|.NET
- {CB985027-C009-4C0F-88C1-8CF11912AE4C}.Release.ActiveCfg = Release|.NET
- {CB985027-C009-4C0F-88C1-8CF11912AE4C}.Release.Build.0 = Release|.NET
- {CB985027-C009-4C0F-88C1-8CF11912AE4C}.ReleaseStrong.ActiveCfg = Release|.NET
- {CB985027-C009-4C0F-88C1-8CF11912AE4C}.ReleaseStrong.Build.0 = Release|.NET
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- EndGlobalSection
- GlobalSection(ExtensibilityAddIns) = postSolution
- EndGlobalSection
-EndGlobal
diff --git a/extensions/net/1.0/log4net.Ext.EventID/cs/nant.build b/extensions/net/1.0/log4net.Ext.EventID/cs/nant.build
deleted file mode 100644
index af02a35..0000000
--- a/extensions/net/1.0/log4net.Ext.EventID/cs/nant.build
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- make sure the log4net key file is available to the compiler in a release build -->
- <if test="${current.build.config.release}">
- <!-- check if the log4net key file is available -->
- <if test="${not file::exists(log4net.basedir + '/log4net.snk')}">
- <echo message="Key file not found. You can generate a key file by running 'sn -k log4net.snk'." />
- <echo message="The generated key file should be stored in the log4net base directory." />
- <fail message="The release build could not be built." />
- </if>
- <if test="${file::exists(log4net.basedir + '/log4net.snk')}">
- <!-- copy the log4net key file to the location where the compiler expects it to be -->
- <copy file="${log4net.basedir}/log4net.snk" todir="${current.bin.dir}/../../../" />
- </if>
- </if>
- <!-- compile the example -->
- <csc noconfig="true" target="library" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.Ext.EventID.dll">
- <sources>
- <include name="src/**/*.cs" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.cs" />
- </sources>
- <references basedir="${log4net.output.dir}">
- <include name="log4net.dll" />
- </references>
- </csc>
- </target>
-</project>
diff --git a/extensions/net/1.0/log4net.Ext.EventID/cs/nant.config b/extensions/net/1.0/log4net.Ext.EventID/cs/nant.config
deleted file mode 100644
index 5d1b0f0..0000000
--- a/extensions/net/1.0/log4net.Ext.EventID/cs/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../" />
-</project>
diff --git a/extensions/net/1.0/log4net.Ext.EventID/cs/src/AssemblyInfo.cs b/extensions/net/1.0/log4net.Ext.EventID/cs/src/AssemblyInfo.cs
deleted file mode 100644
index 952a350..0000000
--- a/extensions/net/1.0/log4net.Ext.EventID/cs/src/AssemblyInfo.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// 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("log4net.Ext.EventID")]
-[assembly: AssemblyDescription("log4net EventID Extension")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyProduct("log4net.Ext.EventID")]
-[assembly: AssemblyCulture("")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-#if STRONG
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile(@"..\..\..\..\log4net.snk")]
-[assembly: AssemblyKeyName("")]
-#endif
diff --git a/extensions/net/1.0/log4net.Ext.EventID/cs/src/EventIDLogImpl.cs b/extensions/net/1.0/log4net.Ext.EventID/cs/src/EventIDLogImpl.cs
deleted file mode 100644
index 8edd7f8..0000000
--- a/extensions/net/1.0/log4net.Ext.EventID/cs/src/EventIDLogImpl.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System;
-
-using log4net.Core;
-
-namespace log4net.Ext.EventID
-{
- public class EventIDLogImpl : LogImpl, IEventIDLog
- {
- /// <summary>
- /// The fully qualified name of this declaring type not the type of any subclass.
- /// </summary>
- private readonly static Type ThisDeclaringType = typeof(EventIDLogImpl);
-
- public EventIDLogImpl(ILogger logger) : base(logger)
- {
- }
-
- #region Implementation of IEventIDLog
-
- public void Info(int eventId, object message)
- {
- Info(eventId, message, null);
- }
-
- public void Info(int eventId, object message, System.Exception t)
- {
- if (this.IsInfoEnabled)
- {
- LoggingEvent loggingEvent = new LoggingEvent(ThisDeclaringType, Logger.Repository, Logger.Name, Level.Info, message, t);
- loggingEvent.Properties["EventID"] = eventId;
- Logger.Log(loggingEvent);
- }
- }
-
- public void Warn(int eventId, object message)
- {
- Warn(eventId, message, null);
- }
-
- public void Warn(int eventId, object message, System.Exception t)
- {
- if (this.IsWarnEnabled)
- {
- LoggingEvent loggingEvent = new LoggingEvent(ThisDeclaringType, Logger.Repository, Logger.Name, Level.Warn, message, t);
- loggingEvent.Properties["EventID"] = eventId;
- Logger.Log(loggingEvent);
- }
- }
-
- public void Error(int eventId, object message)
- {
- Error(eventId, message, null);
- }
-
- public void Error(int eventId, object message, System.Exception t)
- {
- if (this.IsErrorEnabled)
- {
- LoggingEvent loggingEvent = new LoggingEvent(ThisDeclaringType, Logger.Repository, Logger.Name, Level.Error, message, t);
- loggingEvent.Properties["EventID"] = eventId;
- Logger.Log(loggingEvent);
- }
- }
-
- public void Fatal(int eventId, object message)
- {
- Fatal(eventId, message, null);
- }
-
- public void Fatal(int eventId, object message, System.Exception t)
- {
- if (this.IsFatalEnabled)
- {
- LoggingEvent loggingEvent = new LoggingEvent(ThisDeclaringType, Logger.Repository, Logger.Name, Level.Fatal, message, t);
- loggingEvent.Properties["EventID"] = eventId;
- Logger.Log(loggingEvent);
- }
- }
-
- #endregion Implementation of IEventIDLog
- }
-}
diff --git a/extensions/net/1.0/log4net.Ext.EventID/cs/src/EventIDLogManager.cs b/extensions/net/1.0/log4net.Ext.EventID/cs/src/EventIDLogManager.cs
deleted file mode 100644
index a5d2798..0000000
--- a/extensions/net/1.0/log4net.Ext.EventID/cs/src/EventIDLogManager.cs
+++ /dev/null
@@ -1,289 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System;
-using System.Reflection;
-using System.Collections;
-
-using log4net;
-using log4net.Core;
-using log4net.Repository;
-using log4net.Repository.Hierarchy;
-
-/*
- * Custom Logging Classes to support Event IDs.
- */
-namespace log4net.Ext.EventID
-{
- public class EventIDLogManager
- {
- #region Static Member Variables
-
- /// <summary>
- /// The wrapper map to use to hold the <see cref="EventIDLogImpl"/> objects
- /// </summary>
- private static readonly WrapperMap s_wrapperMap = new WrapperMap(new WrapperCreationHandler(WrapperCreationHandler));
-
- #endregion
-
- #region Constructor
-
- /// <summary>
- /// Private constructor to prevent object creation
- /// </summary>
- private EventIDLogManager() { }
-
- #endregion
-
- #region Type Specific Manager Methods
-
- /// <summary>
- /// Returns the named logger if it exists
- /// </summary>
- /// <remarks>
- /// <para>If the named logger exists (in the default hierarchy) then it
- /// returns a reference to the logger, otherwise it returns
- /// <c>null</c>.</para>
- /// </remarks>
- /// <param name="name">The fully qualified logger name to look for</param>
- /// <returns>The logger found, or null</returns>
- public static IEventIDLog Exists(string name)
- {
- return Exists(Assembly.GetCallingAssembly(), name);
- }
-
- /// <summary>
- /// Returns the named logger if it exists
- /// </summary>
- /// <remarks>
- /// <para>If the named logger exists (in the specified domain) then it
- /// returns a reference to the logger, otherwise it returns
- /// <c>null</c>.</para>
- /// </remarks>
- /// <param name="domain">the domain to lookup in</param>
- /// <param name="name">The fully qualified logger name to look for</param>
- /// <returns>The logger found, or null</returns>
- public static IEventIDLog Exists(string domain, string name)
- {
- return WrapLogger(LoggerManager.Exists(domain, name));
- }
-
- /// <summary>
- /// Returns the named logger if it exists
- /// </summary>
- /// <remarks>
- /// <para>If the named logger exists (in the specified assembly's domain) then it
- /// returns a reference to the logger, otherwise it returns
- /// <c>null</c>.</para>
- /// </remarks>
- /// <param name="assembly">the assembly to use to lookup the domain</param>
- /// <param name="name">The fully qualified logger name to look for</param>
- /// <returns>The logger found, or null</returns>
- public static IEventIDLog Exists(Assembly assembly, string name)
- {
- return WrapLogger(LoggerManager.Exists(assembly, name));
- }
-
- /// <summary>
- /// Returns all the currently defined loggers in the default domain.
- /// </summary>
- /// <remarks>
- /// <para>The root logger is <b>not</b> included in the returned array.</para>
- /// </remarks>
- /// <returns>All the defined loggers</returns>
- public static IEventIDLog[] GetCurrentLoggers()
- {
- return GetCurrentLoggers(Assembly.GetCallingAssembly());
- }
-
- /// <summary>
- /// Returns all the currently defined loggers in the specified domain.
- /// </summary>
- /// <param name="domain">the domain to lookup in</param>
- /// <remarks>
- /// The root logger is <b>not</b> included in the returned array.
- /// </remarks>
- /// <returns>All the defined loggers</returns>
- public static IEventIDLog[] GetCurrentLoggers(string domain)
- {
- return WrapLoggers(LoggerManager.GetCurrentLoggers(domain));
- }
-
- /// <summary>
- /// Returns all the currently defined loggers in the specified assembly's domain.
- /// </summary>
- /// <param name="assembly">the assembly to use to lookup the domain</param>
- /// <remarks>
- /// The root logger is <b>not</b> included in the returned array.
- /// </remarks>
- /// <returns>All the defined loggers</returns>
- public static IEventIDLog[] GetCurrentLoggers(Assembly assembly)
- {
- return WrapLoggers(LoggerManager.GetCurrentLoggers(assembly));
- }
-
- /// <summary>
- /// Retrieve or create a named logger.
- /// </summary>
- /// <remarks>
- /// <para>Retrieve a logger named as the <paramref name="name"/>
- /// parameter. If the named logger already exists, then the
- /// existing instance will be returned. Otherwise, a new instance is
- /// created.</para>
- ///
- /// <para>By default, loggers do not have a set level but inherit
- /// it from the hierarchy. This is one of the central features of
- /// log4net.</para>
- /// </remarks>
- /// <param name="name">The name of the logger to retrieve.</param>
- /// <returns>the logger with the name specified</returns>
- public static IEventIDLog GetLogger(string name)
- {
- return GetLogger(Assembly.GetCallingAssembly(), name);
- }
-
- /// <summary>
- /// Retrieve or create a named logger.
- /// </summary>
- /// <remarks>
- /// <para>Retrieve a logger named as the <paramref name="name"/>
- /// parameter. If the named logger already exists, then the
- /// existing instance will be returned. Otherwise, a new instance is
- /// created.</para>
- ///
- /// <para>By default, loggers do not have a set level but inherit
- /// it from the hierarchy. This is one of the central features of
- /// log4net.</para>
- /// </remarks>
- /// <param name="domain">the domain to lookup in</param>
- /// <param name="name">The name of the logger to retrieve.</param>
- /// <returns>the logger with the name specified</returns>
- public static IEventIDLog GetLogger(string domain, string name)
- {
- return WrapLogger(LoggerManager.GetLogger(domain, name));
- }
-
- /// <summary>
- /// Retrieve or create a named logger.
- /// </summary>
- /// <remarks>
- /// <para>Retrieve a logger named as the <paramref name="name"/>
- /// parameter. If the named logger already exists, then the
- /// existing instance will be returned. Otherwise, a new instance is
- /// created.</para>
- ///
- /// <para>By default, loggers do not have a set level but inherit
- /// it from the hierarchy. This is one of the central features of
- /// log4net.</para>
- /// </remarks>
- /// <param name="assembly">the assembly to use to lookup the domain</param>
- /// <param name="name">The name of the logger to retrieve.</param>
- /// <returns>the logger with the name specified</returns>
- public static IEventIDLog GetLogger(Assembly assembly, string name)
- {
- return WrapLogger(LoggerManager.GetLogger(assembly, name));
- }
-
- /// <summary>
- /// Shorthand for <see cref="M:LogManager.GetLogger(string)"/>.
- /// </summary>
- /// <remarks>
- /// Get the logger for the fully qualified name of the type specified.
- /// </remarks>
- /// <param name="type">The full name of <paramref name="type"/> will
- /// be used as the name of the logger to retrieve.</param>
- /// <returns>the logger with the name specified</returns>
- public static IEventIDLog GetLogger(Type type)
- {
- return GetLogger(Assembly.GetCallingAssembly(), type.FullName);
- }
-
- /// <summary>
- /// Shorthand for <see cref="M:LogManager.GetLogger(string)"/>.
- /// </summary>
- /// <remarks>
- /// Get the logger for the fully qualified name of the type specified.
- /// </remarks>
- /// <param name="domain">the domain to lookup in</param>
- /// <param name="type">The full name of <paramref name="type"/> will
- /// be used as the name of the logger to retrieve.</param>
- /// <returns>the logger with the name specified</returns>
- public static IEventIDLog GetLogger(string domain, Type type)
- {
- return WrapLogger(LoggerManager.GetLogger(domain, type));
- }
-
- /// <summary>
- /// Shorthand for <see cref="M:LogManager.GetLogger(string)"/>.
- /// </summary>
- /// <remarks>
- /// Get the logger for the fully qualified name of the type specified.
- /// </remarks>
- /// <param name="assembly">the assembly to use to lookup the domain</param>
- /// <param name="type">The full name of <paramref name="type"/> will
- /// be used as the name of the logger to retrieve.</param>
- /// <returns>the logger with the name specified</returns>
- public static IEventIDLog GetLogger(Assembly assembly, Type type)
- {
- return WrapLogger(LoggerManager.GetLogger(assembly, type));
- }
-
- #endregion
-
- #region Extension Handlers
-
- /// <summary>
- /// Lookup the wrapper object for the logger specified
- /// </summary>
- /// <param name="logger">the logger to get the wrapper for</param>
- /// <returns>the wrapper for the logger specified</returns>
- private static IEventIDLog WrapLogger(ILogger logger)
- {
- return (IEventIDLog)s_wrapperMap.GetWrapper(logger);
- }
-
- /// <summary>
- /// Lookup the wrapper objects for the loggers specified
- /// </summary>
- /// <param name="loggers">the loggers to get the wrappers for</param>
- /// <returns>Lookup the wrapper objects for the loggers specified</returns>
- private static IEventIDLog[] WrapLoggers(ILogger[] loggers)
- {
- IEventIDLog[] results = new IEventIDLog[loggers.Length];
- for(int i=0; i<loggers.Length; i++)
- {
- results[i] = WrapLogger(loggers[i]);
- }
- return results;
- }
-
- /// <summary>
- /// Method to create the <see cref="ILoggerWrapper"/> objects used by
- /// this manager.
- /// </summary>
- /// <param name="logger">The logger to wrap</param>
- /// <returns>The wrapper for the logger specified</returns>
- private static ILoggerWrapper WrapperCreationHandler(ILogger logger)
- {
- return new EventIDLogImpl(logger);
- }
-
- #endregion
- }
-}
diff --git a/extensions/net/1.0/log4net.Ext.EventID/cs/src/IEventIDLog.cs b/extensions/net/1.0/log4net.Ext.EventID/cs/src/IEventIDLog.cs
deleted file mode 100644
index fb275bb..0000000
--- a/extensions/net/1.0/log4net.Ext.EventID/cs/src/IEventIDLog.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-/*
- * Custom Logging Classes to support Event IDs.
- */
-
-using System;
-
-using log4net;
-
-namespace log4net.Ext.EventID
-{
- public interface IEventIDLog : ILog
- {
- void Info(int eventId, object message);
- void Info(int eventId, object message, Exception t);
-
- void Warn(int eventId, object message);
- void Warn(int eventId, object message, Exception t);
-
- void Error(int eventId, object message);
- void Error(int eventId, object message, Exception t);
-
- void Fatal(int eventId, object message);
- void Fatal(int eventId, object message, Exception t);
- }
-}
-
diff --git a/extensions/net/1.0/log4net.Ext.EventID/cs/src/log4net.Ext.EventID.csproj b/extensions/net/1.0/log4net.Ext.EventID/cs/src/log4net.Ext.EventID.csproj
deleted file mode 100644
index f0d9c66..0000000
--- a/extensions/net/1.0/log4net.Ext.EventID/cs/src/log4net.Ext.EventID.csproj
+++ /dev/null
@@ -1,143 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<VisualStudioProject>
- <CSHARP
- ProjectType = "Local"
- ProductVersion = "7.0.9466"
- SchemaVersion = "1.0"
- ProjectGuid = "{CB985027-C009-4C0F-88C1-8CF11912EE4C}"
- >
- <Build>
- <Settings
- ApplicationIcon = ""
- AssemblyKeyContainerName = ""
- AssemblyName = "log4net.Ext.EventID"
- AssemblyOriginatorKeyFile = ""
- DefaultClientScript = "JScript"
- DefaultHTMLPageLayout = "Grid"
- DefaultTargetSchema = "IE50"
- DelaySign = "false"
- OutputType = "Library"
- PreBuildEvent = ""
- PostBuildEvent = ""
- RootNamespace = "log4net.Ext.EventID"
- RunPostBuildEvent = "OnBuildSuccess"
- StartupObject = ""
- >
- <Config
- Name = "Debug"
- AllowUnsafeBlocks = "false"
- BaseAddress = "285212672"
- CheckForOverflowUnderflow = "false"
- ConfigurationOverrideFile = ""
- DefineConstants = "DEBUG;TRACE"
- DocumentationFile = ""
- DebugSymbols = "true"
- FileAlignment = "4096"
- IncrementalBuild = "true"
- NoStdLib = "false"
- NoWarn = ""
- Optimize = "false"
- OutputPath = "..\build\debug\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "4"
- />
- <Config
- Name = "Release"
- AllowUnsafeBlocks = "false"
- BaseAddress = "285212672"
- CheckForOverflowUnderflow = "false"
- ConfigurationOverrideFile = ""
- DefineConstants = "TRACE;STRONG"
- DocumentationFile = ""
- DebugSymbols = "false"
- FileAlignment = "4096"
- IncrementalBuild = "false"
- NoStdLib = "false"
- NoWarn = ""
- Optimize = "true"
- OutputPath = "..\build\release\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "4"
- />
- </Settings>
- <References>
- <Reference
- Name = "System"
- AssemblyName = "System"
- HintPath = "..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
- />
- <Reference
- Name = "System.Data"
- AssemblyName = "System.Data"
- HintPath = "..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
- />
- <Reference
- Name = "System.XML"
- AssemblyName = "System.Xml"
- HintPath = "..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
- />
- <Reference
- Name = "log4net"
- AssemblyName = "log4net"
- HintPath = "..\..\..\..\..\..\bin\net\1.0\release\log4net.dll"
- />
- </References>
- </Build>
- <Files>
- <Include>
- <File
- RelPath = "AssemblyInfo.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "AssemblyVersionInfo.cs"
- Link = "..\..\..\..\..\..\src\AssemblyVersionInfo.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "EventIDLogImpl.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "EventIDLogManager.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "IEventIDLog.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- </Include>
- </Files>
- </CSHARP>
-</VisualStudioProject>
-
diff --git a/extensions/net/1.0/log4net.Ext.EventID/nant.build b/extensions/net/1.0/log4net.Ext.EventID/nant.build
deleted file mode 100644
index b1c3923..0000000
--- a/extensions/net/1.0/log4net.Ext.EventID/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="eventid-extension" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile EventID extension -->
- <target name="compile" description="Builds EventID extension">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/extensions/net/1.0/log4net.Ext.EventID/nant.config b/extensions/net/1.0/log4net.Ext.EventID/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/extensions/net/1.0/log4net.Ext.EventID/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/nant.build b/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/nant.build
deleted file mode 100644
index 0321422..0000000
--- a/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/nant.build
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- make sure the log4net key file is available to the compiler in a release build -->
- <if test="${current.build.config.release}">
- <!-- check if the log4net key file is available -->
- <if test="${not file::exists(log4net.basedir + '/log4net.snk')}">
- <echo message="Key file not found. You can generate a key file by running 'sn -k log4net.snk'." />
- <echo message="The generated key file should be stored in the log4net base directory." />
- <fail message="The release build could not be built." />
- </if>
- <if test="${file::exists(log4net.basedir + '/log4net.snk')}">
- <!-- copy the log4net key file to the location where the compiler expects it to be -->
- <copy file="${log4net.basedir}/log4net.snk" todir="${current.bin.dir}/../../../" />
- </if>
- </if>
- <!-- compile the example -->
- <csc noconfig="true" target="library" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.Ext.MarshalByRef.dll">
- <sources>
- <include name="src/**/*.cs" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.cs" />
- </sources>
- <references basedir="${log4net.output.dir}">
- <include name="log4net.dll" />
- </references>
- </csc>
- </target>
-</project>
diff --git a/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/nant.config b/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/nant.config
deleted file mode 100644
index 5d1b0f0..0000000
--- a/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../" />
-</project>
diff --git a/extensions/net/1.0/log4net.Ext.MarshalByRef/nant.build b/extensions/net/1.0/log4net.Ext.MarshalByRef/nant.build
deleted file mode 100644
index 5f36a79..0000000
--- a/extensions/net/1.0/log4net.Ext.MarshalByRef/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="trace-extension" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile Trace extension -->
- <target name="compile" description="Builds Trace extension">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/extensions/net/1.0/log4net.Ext.MarshalByRef/nant.config b/extensions/net/1.0/log4net.Ext.MarshalByRef/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/extensions/net/1.0/log4net.Ext.MarshalByRef/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/extensions/net/1.0/log4net.Ext.Trace/cs/nant.build b/extensions/net/1.0/log4net.Ext.Trace/cs/nant.build
deleted file mode 100644
index b39643b..0000000
--- a/extensions/net/1.0/log4net.Ext.Trace/cs/nant.build
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include configuration file -->
- <include buildfile="nant.config" />
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
- <!-- Target for compiling the example -->
- <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
- <!-- make sure the log4net key file is available to the compiler in a release build -->
- <if test="${current.build.config.release}">
- <!-- check if the log4net key file is available -->
- <if test="${not file::exists(log4net.basedir + '/log4net.snk')}">
- <echo message="Key file not found. You can generate a key file by running 'sn -k log4net.snk'." />
- <echo message="The generated key file should be stored in the log4net base directory." />
- <fail message="The release build could not be built." />
- </if>
- <if test="${file::exists(log4net.basedir + '/log4net.snk')}">
- <!-- copy the log4net key file to the location where the compiler expects it to be -->
- <copy file="${log4net.basedir}/log4net.snk" todir="${current.bin.dir}/../../../" />
- </if>
- </if>
- <!-- compile the example -->
- <csc noconfig="true" target="library" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.Ext.Trace.dll">
- <sources>
- <include name="src/**/*.cs" />
- <include name="${log4net.basedir}/src/AssemblyVersionInfo.cs" />
- </sources>
- <references basedir="${log4net.output.dir}">
- <include name="log4net.dll" />
- </references>
- </csc>
- </target>
-</project>
diff --git a/extensions/net/1.0/log4net.Ext.Trace/cs/nant.config b/extensions/net/1.0/log4net.Ext.Trace/cs/nant.config
deleted file mode 100644
index 5d1b0f0..0000000
--- a/extensions/net/1.0/log4net.Ext.Trace/cs/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set log4net base directory -->
- <property name="log4net.basedir" value="../../../../../" />
-</project>
diff --git a/extensions/net/1.0/log4net.Ext.Trace/cs/src/AssemblyInfo.cs b/extensions/net/1.0/log4net.Ext.Trace/cs/src/AssemblyInfo.cs
deleted file mode 100644
index 5607beb..0000000
--- a/extensions/net/1.0/log4net.Ext.Trace/cs/src/AssemblyInfo.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// 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("log4net.Ext.Trace")]
-[assembly: AssemblyDescription("log4net Trace Extension")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyProduct("log4net.Ext.Trace")]
-[assembly: AssemblyCulture("")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-#if STRONG
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile(@"..\..\..\..\log4net.snk")]
-[assembly: AssemblyKeyName("")]
-#endif
diff --git a/extensions/net/1.0/log4net.Ext.Trace/cs/src/TraceLogImpl.cs b/extensions/net/1.0/log4net.Ext.Trace/cs/src/TraceLogImpl.cs
deleted file mode 100644
index 7c86594..0000000
--- a/extensions/net/1.0/log4net.Ext.Trace/cs/src/TraceLogImpl.cs
+++ /dev/null
@@ -1,96 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System;
-using System.Globalization;
-
-using log4net.Core;
-using log4net.Util;
-
-namespace log4net.Ext.Trace
-{
- public class TraceLogImpl : LogImpl, ITraceLog
- {
- /// <summary>
- /// The fully qualified name of this declaring type not the type of any subclass.
- /// </summary>
- private readonly static Type ThisDeclaringType = typeof(TraceLogImpl);
-
- /// <summary>
- /// The default value for the TRACE level
- /// </summary>
- private readonly static Level s_defaultLevelTrace = new Level(20000, "TRACE");
-
- /// <summary>
- /// The current value for the TRACE level
- /// </summary>
- private Level m_levelTrace;
-
-
- public TraceLogImpl(ILogger logger) : base(logger)
- {
- }
-
- /// <summary>
- /// Lookup the current value of the TRACE level
- /// </summary>
- protected override void ReloadLevels(log4net.Repository.ILoggerRepository repository)
- {
- base.ReloadLevels(repository);
-
- m_levelTrace = repository.LevelMap.LookupWithDefault(s_defaultLevelTrace);
- }
-
- #region Implementation of ITraceLog
-
- public void Trace(object message)
- {
- Logger.Log(ThisDeclaringType, m_levelTrace, message, null);
- }
-
- public void Trace(object message, System.Exception t)
- {
- Logger.Log(ThisDeclaringType, m_levelTrace, message, t);
- }
-
- public void TraceFormat(string format, params object[] args)
- {
- if (IsTraceEnabled)
- {
- Logger.Log(ThisDeclaringType, m_levelTrace, new SystemStringFormat(CultureInfo.InvariantCulture, format, args), null);
- }
- }
-
- public void TraceFormat(IFormatProvider provider, string format, params object[] args)
- {
- if (IsTraceEnabled)
- {
- Logger.Log(ThisDeclaringType, m_levelTrace, new SystemStringFormat(provider, format, args), null);
- }
- }
-
- public bool IsTraceEnabled
- {
- get { return Logger.IsEnabledFor(m_levelTrace); }
- }
-
- #endregion Implementation of ITraceLog
- }
-}
-
diff --git a/extensions/net/1.0/log4net.Ext.Trace/cs/src/TraceLogManager.cs b/extensions/net/1.0/log4net.Ext.Trace/cs/src/TraceLogManager.cs
deleted file mode 100644
index 0299407..0000000
--- a/extensions/net/1.0/log4net.Ext.Trace/cs/src/TraceLogManager.cs
+++ /dev/null
@@ -1,289 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System;
-using System.Reflection;
-using System.Collections;
-
-using log4net;
-using log4net.Core;
-using log4net.Repository;
-using log4net.Repository.Hierarchy;
-
-/*
- * Custom Logging Classes to support additional logging levels.
- */
-namespace log4net.Ext.Trace
-{
- public class TraceLogManager
- {
- #region Static Member Variables
-
- /// <summary>
- /// The wrapper map to use to hold the <see cref="TraceLogImpl"/> objects
- /// </summary>
- private static readonly WrapperMap s_wrapperMap = new WrapperMap(new WrapperCreationHandler(WrapperCreationHandler));
-
- #endregion
-
- #region Constructor
-
- /// <summary>
- /// Private constructor to prevent object creation
- /// </summary>
- private TraceLogManager() { }
-
- #endregion
-
- #region Type Specific Manager Methods
-
- /// <summary>
- /// Returns the named logger if it exists
- /// </summary>
- /// <remarks>
- /// <para>If the named logger exists (in the default hierarchy) then it
- /// returns a reference to the logger, otherwise it returns
- /// <c>null</c>.</para>
- /// </remarks>
- /// <param name="name">The fully qualified logger name to look for</param>
- /// <returns>The logger found, or null</returns>
- public static ITraceLog Exists(string name)
- {
- return Exists(Assembly.GetCallingAssembly(), name);
- }
-
- /// <summary>
- /// Returns the named logger if it exists
- /// </summary>
- /// <remarks>
- /// <para>If the named logger exists (in the specified domain) then it
- /// returns a reference to the logger, otherwise it returns
- /// <c>null</c>.</para>
- /// </remarks>
- /// <param name="domain">the domain to lookup in</param>
- /// <param name="name">The fully qualified logger name to look for</param>
- /// <returns>The logger found, or null</returns>
- public static ITraceLog Exists(string domain, string name)
- {
- return WrapLogger(LoggerManager.Exists(domain, name));
- }
-
- /// <summary>
- /// Returns the named logger if it exists
- /// </summary>
- /// <remarks>
- /// <para>If the named logger exists (in the specified assembly's domain) then it
- /// returns a reference to the logger, otherwise it returns
- /// <c>null</c>.</para>
- /// </remarks>
- /// <param name="assembly">the assembly to use to lookup the domain</param>
- /// <param name="name">The fully qualified logger name to look for</param>
- /// <returns>The logger found, or null</returns>
- public static ITraceLog Exists(Assembly assembly, string name)
- {
- return WrapLogger(LoggerManager.Exists(assembly, name));
- }
-
- /// <summary>
- /// Returns all the currently defined loggers in the default domain.
- /// </summary>
- /// <remarks>
- /// <para>The root logger is <b>not</b> included in the returned array.</para>
- /// </remarks>
- /// <returns>All the defined loggers</returns>
- public static ITraceLog[] GetCurrentLoggers()
- {
- return GetCurrentLoggers(Assembly.GetCallingAssembly());
- }
-
- /// <summary>
- /// Returns all the currently defined loggers in the specified domain.
- /// </summary>
- /// <param name="domain">the domain to lookup in</param>
- /// <remarks>
- /// The root logger is <b>not</b> included in the returned array.
- /// </remarks>
- /// <returns>All the defined loggers</returns>
- public static ITraceLog[] GetCurrentLoggers(string domain)
- {
- return WrapLoggers(LoggerManager.GetCurrentLoggers(domain));
- }
-
- /// <summary>
- /// Returns all the currently defined loggers in the specified assembly's domain.
- /// </summary>
- /// <param name="assembly">the assembly to use to lookup the domain</param>
- /// <remarks>
- /// The root logger is <b>not</b> included in the returned array.
- /// </remarks>
- /// <returns>All the defined loggers</returns>
- public static ITraceLog[] GetCurrentLoggers(Assembly assembly)
- {
- return WrapLoggers(LoggerManager.GetCurrentLoggers(assembly));
- }
-
- /// <summary>
- /// Retrieve or create a named logger.
- /// </summary>
- /// <remarks>
- /// <para>Retrieve a logger named as the <paramref name="name"/>
- /// parameter. If the named logger already exists, then the
- /// existing instance will be returned. Otherwise, a new instance is
- /// created.</para>
- ///
- /// <para>By default, loggers do not have a set level but inherit
- /// it from the hierarchy. This is one of the central features of
- /// log4net.</para>
- /// </remarks>
- /// <param name="name">The name of the logger to retrieve.</param>
- /// <returns>the logger with the name specified</returns>
- public static ITraceLog GetLogger(string name)
- {
- return GetLogger(Assembly.GetCallingAssembly(), name);
- }
-
- /// <summary>
- /// Retrieve or create a named logger.
- /// </summary>
- /// <remarks>
- /// <para>Retrieve a logger named as the <paramref name="name"/>
- /// parameter. If the named logger already exists, then the
- /// existing instance will be returned. Otherwise, a new instance is
- /// created.</para>
- ///
- /// <para>By default, loggers do not have a set level but inherit
- /// it from the hierarchy. This is one of the central features of
- /// log4net.</para>
- /// </remarks>
- /// <param name="domain">the domain to lookup in</param>
- /// <param name="name">The name of the logger to retrieve.</param>
- /// <returns>the logger with the name specified</returns>
- public static ITraceLog GetLogger(string domain, string name)
- {
- return WrapLogger(LoggerManager.GetLogger(domain, name));
- }
-
- /// <summary>
- /// Retrieve or create a named logger.
- /// </summary>
- /// <remarks>
- /// <para>Retrieve a logger named as the <paramref name="name"/>
- /// parameter. If the named logger already exists, then the
- /// existing instance will be returned. Otherwise, a new instance is
- /// created.</para>
- ///
- /// <para>By default, loggers do not have a set level but inherit
- /// it from the hierarchy. This is one of the central features of
- /// log4net.</para>
- /// </remarks>
- /// <param name="assembly">the assembly to use to lookup the domain</param>
- /// <param name="name">The name of the logger to retrieve.</param>
- /// <returns>the logger with the name specified</returns>
- public static ITraceLog GetLogger(Assembly assembly, string name)
- {
- return WrapLogger(LoggerManager.GetLogger(assembly, name));
- }
-
- /// <summary>
- /// Shorthand for <see cref="M:LogManager.GetLogger(string)"/>.
- /// </summary>
- /// <remarks>
- /// Get the logger for the fully qualified name of the type specified.
- /// </remarks>
- /// <param name="type">The full name of <paramref name="type"/> will
- /// be used as the name of the logger to retrieve.</param>
- /// <returns>the logger with the name specified</returns>
- public static ITraceLog GetLogger(Type type)
- {
- return GetLogger(Assembly.GetCallingAssembly(), type.FullName);
- }
-
- /// <summary>
- /// Shorthand for <see cref="M:LogManager.GetLogger(string)"/>.
- /// </summary>
- /// <remarks>
- /// Get the logger for the fully qualified name of the type specified.
- /// </remarks>
- /// <param name="domain">the domain to lookup in</param>
- /// <param name="type">The full name of <paramref name="type"/> will
- /// be used as the name of the logger to retrieve.</param>
- /// <returns>the logger with the name specified</returns>
- public static ITraceLog GetLogger(string domain, Type type)
- {
- return WrapLogger(LoggerManager.GetLogger(domain, type));
- }
-
- /// <summary>
- /// Shorthand for <see cref="M:LogManager.GetLogger(string)"/>.
- /// </summary>
- /// <remarks>
- /// Get the logger for the fully qualified name of the type specified.
- /// </remarks>
- /// <param name="assembly">the assembly to use to lookup the domain</param>
- /// <param name="type">The full name of <paramref name="type"/> will
- /// be used as the name of the logger to retrieve.</param>
- /// <returns>the logger with the name specified</returns>
- public static ITraceLog GetLogger(Assembly assembly, Type type)
- {
- return WrapLogger(LoggerManager.GetLogger(assembly, type));
- }
-
- #endregion
-
- #region Extension Handlers
-
- /// <summary>
- /// Lookup the wrapper object for the logger specified
- /// </summary>
- /// <param name="logger">the logger to get the wrapper for</param>
- /// <returns>the wrapper for the logger specified</returns>
- private static ITraceLog WrapLogger(ILogger logger)
- {
- return (ITraceLog)s_wrapperMap.GetWrapper(logger);
- }
-
- /// <summary>
- /// Lookup the wrapper objects for the loggers specified
- /// </summary>
- /// <param name="loggers">the loggers to get the wrappers for</param>
- /// <returns>Lookup the wrapper objects for the loggers specified</returns>
- private static ITraceLog[] WrapLoggers(ILogger[] loggers)
- {
- ITraceLog[] results = new ITraceLog[loggers.Length];
- for(int i=0; i<loggers.Length; i++)
- {
- results[i] = WrapLogger(loggers[i]);
- }
- return results;
- }
-
- /// <summary>
- /// Method to create the <see cref="ILoggerWrapper"/> objects used by
- /// this manager.
- /// </summary>
- /// <param name="logger">The logger to wrap</param>
- /// <returns>The wrapper for the logger specified</returns>
- private static ILoggerWrapper WrapperCreationHandler(ILogger logger)
- {
- return new TraceLogImpl(logger);
- }
-
- #endregion
- }
-}
diff --git a/extensions/net/1.0/log4net.Ext.Trace/cs/src/log4net.Ext.Trace.csproj b/extensions/net/1.0/log4net.Ext.Trace/cs/src/log4net.Ext.Trace.csproj
deleted file mode 100644
index c3679ec..0000000
--- a/extensions/net/1.0/log4net.Ext.Trace/cs/src/log4net.Ext.Trace.csproj
+++ /dev/null
@@ -1,143 +0,0 @@
-<?xml version='1.0'?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-
--->
-
-<VisualStudioProject>
- <CSHARP
- ProjectType = "Local"
- ProductVersion = "7.0.9466"
- SchemaVersion = "1.0"
- ProjectGuid = "{8C73DF1C-AB2B-4309-A3EC-1ED594239E15}"
- >
- <Build>
- <Settings
- ApplicationIcon = ""
- AssemblyKeyContainerName = ""
- AssemblyName = "log4net.Ext.Trace"
- AssemblyOriginatorKeyFile = ""
- DefaultClientScript = "JScript"
- DefaultHTMLPageLayout = "Grid"
- DefaultTargetSchema = "IE50"
- DelaySign = "false"
- OutputType = "Library"
- PreBuildEvent = ""
- PostBuildEvent = ""
- RootNamespace = "log4net.Ext.Trace"
- RunPostBuildEvent = "OnBuildSuccess"
- StartupObject = ""
- >
- <Config
- Name = "Debug"
- AllowUnsafeBlocks = "false"
- BaseAddress = "285212672"
- CheckForOverflowUnderflow = "false"
- ConfigurationOverrideFile = ""
- DefineConstants = "DEBUG;TRACE"
- DocumentationFile = ""
- DebugSymbols = "true"
- FileAlignment = "4096"
- IncrementalBuild = "true"
- NoStdLib = "false"
- NoWarn = ""
- Optimize = "false"
- OutputPath = "..\build\debug\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "4"
- />
- <Config
- Name = "Release"
- AllowUnsafeBlocks = "false"
- BaseAddress = "285212672"
- CheckForOverflowUnderflow = "false"
- ConfigurationOverrideFile = ""
- DefineConstants = "TRACE;STRONG"
- DocumentationFile = ""
- DebugSymbols = "false"
- FileAlignment = "4096"
- IncrementalBuild = "false"
- NoStdLib = "false"
- NoWarn = ""
- Optimize = "true"
- OutputPath = "..\build\release\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "4"
- />
- </Settings>
- <References>
- <Reference
- Name = "System"
- AssemblyName = "System"
- HintPath = "..\..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
- />
- <Reference
- Name = "System.Data"
- AssemblyName = "System.Data"
- HintPath = "..\..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
- />
- <Reference
- Name = "System.XML"
- AssemblyName = "System.Xml"
- HintPath = "..\..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
- />
- <Reference
- Name = "log4net"
- AssemblyName = "log4net"
- HintPath = "..\..\..\..\..\..\bin\net\1.0\release\log4net.dll"
- />
- </References>
- </Build>
- <Files>
- <Include>
- <File
- RelPath = "AssemblyInfo.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "AssemblyVersionInfo.cs"
- Link = "..\..\..\..\..\..\src\AssemblyVersionInfo.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "ITraceLog.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "TraceLogImpl.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "TraceLogManager.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- </Include>
- </Files>
- </CSHARP>
-</VisualStudioProject>
-
diff --git a/extensions/net/1.0/log4net.Ext.Trace/nant.build b/extensions/net/1.0/log4net.Ext.Trace/nant.build
deleted file mode 100644
index 5f36a79..0000000
--- a/extensions/net/1.0/log4net.Ext.Trace/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="trace-extension" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile Trace extension -->
- <target name="compile" description="Builds Trace extension">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/extensions/net/1.0/log4net.Ext.Trace/nant.config b/extensions/net/1.0/log4net.Ext.Trace/nant.config
deleted file mode 100644
index ba0a724..0000000
--- a/extensions/net/1.0/log4net.Ext.Trace/nant.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
-</project>
diff --git a/extensions/net/1.0/nant.build b/extensions/net/1.0/nant.build
deleted file mode 100644
index e8bc0d58..0000000
--- a/extensions/net/1.0/nant.build
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="net-1.0-extensions" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- include configuration file -->
- <include buildfile="nant.config" />
- <!-- compile all .NET Framework 1.0 extensions -->
- <target name="compile" description="Builds .NET Framework 1.0 extensions">
- <if test="${framework::exists(project.runtime.config + '-' + project.runtime.version)}">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </if>
- <if test="${not framework::exists(project.runtime.config + '-' + project.runtime.version)}">
- <if test="${property::exists('project.build.package') and project.build.package}">
- <fail message="${project.runtime.description} is not available." />
- </if>
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo message="${project.runtime.description} is not available. Examples skipped." />
- </if>
- </if>
- </target>
-</project>
diff --git a/extensions/net/1.0/nant.config b/extensions/net/1.0/nant.config
deleted file mode 100644
index 2119550..0000000
--- a/extensions/net/1.0/nant.config
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set runtime version -->
- <property name="project.runtime.version" value="1.0" />
- <!-- Set runtime description -->
- <property name="project.runtime.description" value=".NET Framework 1.0" />
-</project>
diff --git a/extensions/net/nant.build b/extensions/net/nant.build
deleted file mode 100644
index e41ee82..0000000
--- a/extensions/net/nant.build
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="net-extensions" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- compile .NET Framework extensions -->
- <target name="compile" description="Builds .NET Framework extensions">
- <nant target="compile">
- <buildfiles>
- <include name="*/nant.build" />
- <!-- exclude current build file -->
- <exclude name="exclude.build" />
- </buildfiles>
- </nant>
- </target>
-</project>
diff --git a/extensions/net/nant.config b/extensions/net/nant.config
deleted file mode 100644
index 9a67b8a..0000000
--- a/extensions/net/nant.config
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="net-configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Include parent configuration file -->
- <include buildfile="../nant.config" />
- <!-- Set runtime configuration -->
- <property name="project.runtime.config" value="net" />
-</project>
diff --git a/install-dotnet-core-sdk-1.1.ps1 b/install-dotnet-sdk.ps1
similarity index 69%
rename from install-dotnet-core-sdk-1.1.ps1
rename to install-dotnet-sdk.ps1
index 08282ff..534e5e3 100644
--- a/install-dotnet-core-sdk-1.1.ps1
+++ b/install-dotnet-sdk.ps1
@@ -18,10 +18,6 @@
#Enforce TLS 1.2 as Microsoft is deprecating all old TLS versions
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;
-$installer="dotnet-dev-win-x64.1.1.14.exe"
-Write-Host "Downloading $installer"
-Invoke-WebRequest -Uri "https://download.visualstudio.microsoft.com/download/pr/c6b9a396-5e7a-4b91-86f6-f9e8df3bf1dd/6d61addfd6069e404981bede03f8f4f9/$installer" -OutFile $installer
-Write-Host "Running $installer"
-Start-Process -FilePath $installer -ArgumentList "/wait","/passive" -Wait
-Write-Host "dotnet core sdk 1.1 installed"
-
+'Running Installer'
+winget install Microsoft.DotNet.SDK.8
+'dotnet 8 sdk installed'
\ No newline at end of file
diff --git a/install-net-framework-sdk-3.5.ps1 b/install-net-framework-sdk-3.5.ps1
deleted file mode 100644
index e49ce0b..0000000
--- a/install-net-framework-sdk-3.5.ps1
+++ /dev/null
@@ -1,45 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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.
-#
-#Enforce TLS 1.2 as Microsoft is deprecating all old TLS versions
-[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;
-
-if (-not (Test-Path dotnetfx35.exe)) {
- Write-Host "Downloading dotnetfx35.exe"
- Invoke-WebRequest -Uri "https://download.microsoft.com/download/2/0/E/20E90413-712F-438C-988E-FDAA79A8AC3D/dotnetfx35.exe" -OutFile dotnetfx35.exe
-}
-
-Write-Host "Running dotnetfx35.exe"
-$process = Start-Process -FilePath dotnetfx35.exe -ArgumentList "/wait","/passive" -Wait -PassThru
-if ($process.ExitCode -eq 0) {
- Write-Host "dotnetfx35 installed"
-} else {
- Write-Host "dotnetfx35 installer returned exit code ${process.ExitCode}"
-}
-
-if (-not (Test-Path dotnetfx35client.exe)) {
- Write-host "Downloading dotnetfx35client.exe"
- Invoke-WebRequest -Uri "https://download.microsoft.com/download/c/d/c/cdc0f321-4f72-4a08-9bac-082f3692ecd9/DotNetFx35Client.exe" -OutFile dotnetfx35client.exe
-}
-
-Write-Host "Running dotnetfx35client.exe"
-$process = Start-Process -FilePath dotnetfx35client.exe -ArgumentList "/quiet","/passive" -Wait -PassThru
-if ($process.ExitCode -eq 0) {
- Write-Host "dotnetfx35client installed"
-} else {
- Write-Host "dotnetfx35client installer returned exit code ${process.ExitCode}"
-}
diff --git a/log4net.build b/log4net.build
deleted file mode 100644
index f1700d0..0000000
--- a/log4net.build
+++ /dev/null
@@ -1,1931 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net" default="compile-all" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- Global project settings -->
- <property name="log4net.basedir" value="." />
- <property name="project.build.config" value="debug" />
- <property name="project.build.package" value="false" />
- <property name="package.version" value="2.0.17"/>
-
- <!-- Include log4net helpers -->
- <include buildfile="${log4net.basedir}/log4net.include" />
- <!-- Targets that should always be executed -->
- <call target="set-build-configuration" />
- <call target="set-framework-configuration" />
- <!-- Targets that check settings -->
- <target name="check-htmlhelp-compiler">
- <if test="${not property::exists('htmlhelp.compiler')}">
- <readregistry
- property="htmlhelp.workshop.installroot"
- key="SOFTWARE\Microsoft\HTML Help Workshop\InstallDir"
- hive="CurrentUser"
- failonerror="false" />
- <if test="${property::exists('htmlhelp.workshop.installroot')}">
- <property
- name="htmlhelp.compiler"
- value="${htmlhelp.workshop.installroot}/hhc.exe" />
- </if>
- </if>
- <if test="${not property::exists('htmlhelp.compiler')}">
- <!-- sysinfo task fails under x64 due to invalid property names - https://sourceforge.net/tracker/?func=detail&atid=402868&aid=1213185&group_id=31650 -->
- <sysinfo failonerror="false" />
- <property
- name="htmlhelp.compiler"
- value="${sys.os.folder.programfiles}/HTML Help Worshop/hhc.exe" />
- </if>
- </target>
- <!-- Displays configuration info, usefull for working out why log4net doesn't build -->
- <target name="display-setup" depends="check-htmlhelp-compiler">
- <!-- .NET Framework 1.0 -->
- <if test="${framework::exists('net-1.0')}">
- <property name="nant.settings.currentframework" value="net-1.0" />
- <call target="display-target-framework" />
- </if>
- <if test="${not framework::exists('net-1.0')}">
- <echo message=".NET Framework 1.0 runtime is not available." />
- </if>
- <!-- .NET Framework 1.1 -->
- <if test="${framework::exists('net-1.1')}">
- <property name="nant.settings.currentframework" value="net-1.1" />
- <call target="display-target-framework" />
- </if>
- <if test="${not framework::exists('net-1.1')}">
- <echo message=".NET Framework 1.1 runtime is not available." />
- </if>
- <!-- .NET Framework 2.0 -->
- <if test="${framework::exists('net-2.0')}">
- <property name="nant.settings.currentframework" value="net-2.0" />
- <call target="display-target-framework" />
- </if>
- <if test="${not framework::exists('net-2.0')}">
- <echo message=".NET Framework 2.0 runtime is not available." />
- </if>
- <!-- .NET Framework 3.5 -->
- <if test="${framework::exists('net-3.5')}">
- <property name="nant.settings.currentframework" value="net-3.5" />
- <call target="display-target-framework" />
- </if>
- <if test="${not framework::exists('net-3.5')}">
- <echo message=".NET Framework 3.5 runtime is not available." />
- </if>
- <!-- .NET Framework 4.0 -->
- <if test="${framework::exists('net-4.0')}">
- <property name="nant.settings.currentframework" value="net-4.0" />
- <call target="display-target-framework" />
- </if>
- <if test="${not framework::exists('net-4.0')}">
- <echo message=".NET Framework 4.0 runtime is not available." />
- </if>
- <!-- .NET Compact Framework 1.0 -->
- <if test="${framework::exists('netcf-1.0')}">
- <property name="nant.settings.currentframework" value="netcf-1.0" />
- <call target="display-target-framework" />
- </if>
- <if test="${not framework::exists('netcf-1.0')}">
- <echo message=".NET Compact Framework 1.0 runtime is not available." />
- </if>
- <!-- .NET Compact Framework 2.0 -->
- <if test="${framework::exists('netcf-2.0')}">
- <property name="nant.settings.currentframework" value="netcf-2.0" />
- <call target="display-target-framework" />
- </if>
- <if test="${not framework::exists('netcf-2.0')}">
- <echo message=".NET Compact Framework 2.0 runtime is not available." />
- </if>
- <!-- Mono 1.0 -->
- <if test="${framework::exists('mono-1.0')}">
- <property name="nant.settings.currentframework" value="mono-1.0" />
- <call target="display-target-framework" />
- </if>
- <if test="${not framework::exists('mono-1.0')}">
- <echo message="Mono 1.0 runtime is not available." />
- </if>
- <!-- Mono 2.0 -->
- <if test="${framework::exists('mono-2.0')}">
- <property name="nant.settings.currentframework" value="mono-2.0" />
- <call target="display-target-framework" />
- </if>
- <if test="${not framework::exists('mono-2.0')}">
- <echo message="Mono 2.0 runtime is not available." />
- </if>
- <!-- Mono 3.5 -->
- <if test="${framework::exists('mono-3.5')}">
- <property name="nant.settings.currentframework" value="mono-3.5" />
- <call target="display-target-framework" />
- </if>
- <if test="${not framework::exists('mono-3.5')}">
- <echo message="Mono 3.5 runtime is not available." />
- </if>
- <!-- Mono 4.0 -->
- <if test="${framework::exists('mono-4.0')}">
- <property name="nant.settings.currentframework" value="mono-4.0" />
- <call target="display-target-framework" />
- </if>
- <if test="${not framework::exists('mono-4.0')}">
- <echo message="Mono 4.0 runtime is not available." />
- </if>
- <!-- SSCLI 1.0 -->
- <if test="${framework::exists('sscli-1.0')}">
- <property name="nant.settings.currentframework" value="sscli-1.0" />
- <call target="display-target-framework" />
- </if>
- <if test="${not framework::exists('sscli-1.0')}">
- <echo message="SSCLI 1.0 runtime is not available." />
- </if>
- <!-- HTML Help Compiler -->
- <echo message="htmlhelp.compiler: ${htmlhelp.compiler}" />
- </target>
- <target name="display-target-framework">
- <echo message="" />
- <echo message="----------------------------------------------------------" />
- <echo message=" ${framework::get-description(framework::get-target-framework())}" />
- <echo message="----------------------------------------------------------" />
- <echo message="" />
- <echo message="framework : ${framework::get-target-framework()}" />
- <echo message="description : ${framework::get-description(framework::get-target-framework())}" />
- <if test="${framework::sdk-exists(framework::get-target-framework())}">
- <echo message="sdk directory : ${framework::get-sdk-directory(framework::get-target-framework())}" />
- </if>
- <if test="${not framework::sdk-exists(framework::get-target-framework())}">
- <echo message="sdk directory : <not configured/available>" />
- </if>
- <echo message="framework directory : ${framework::get-framework-directory(framework::get-target-framework())}" />
- <echo message="assembly directory : ${framework::get-assembly-directory(framework::get-target-framework())}" />
- <echo message="" />
- </target>
- <!-- Target for setting the package configuration -->
- <target name="set-package-configuration">
- <property name="current.package.name" value="${project::get-name()}-${package.version}" />
- <property name="current.package.src.dir" value="build/${current.package.name}-src" />
- <property name="current.package.src.zipfile" value="${project::get-name()}-${package.version}-src.zip" />
- <delete dir="${current.package.src.dir}" if="${directory::exists(current.package.src.dir)}" />
- <mkdir dir="${current.package.src.dir}" />
- <property name="current.package.bin.dir" value="build/${current.package.name}-bin" />
- <property name="current.package.bin.zipfile" value="${project::get-name()}-${package.version}-bin.zip" />
- <delete dir="${current.package.bin.dir}" if="${directory::exists(current.package.bin.dir)}" />
- <mkdir dir="${current.package.bin.dir}" />
- </target>
- <!-- Target for compiling all build configurations for all runtime configurations -->
- <target name="compile-all" description="Compile all build configurations for all runtime configurations"
- depends="generate-assembly-description">
- <echo message="Compiling all build configurations for all runtime configurations." />
- <call target="set-debug-build-configuration" />
- <call target="compile-build" />
- <call target="set-release-build-configuration" />
- <call target="compile-build" />
- </target>
- <!-- Target for compiling all build configurations for the current runtime configurations -->
- <target name="compile-runtime" description="Compile all build configurations for the current target framework">
- <echo message="Compiling all build configurations for ${framework::get-description(framework::get-target-framework())}." />
- <call target="set-debug-build-configuration" />
- <!-- make sure that the runtime properties that rely on build configuration information are refreshed -->
- <call target="set-runtime-configuration" />
- <call target="compile-${framework::get-target-framework()}" />
- <call target="set-release-build-configuration" />
- <!-- make sure that the runtime properties that rely on build configuration information are refreshed -->
- <call target="set-runtime-configuration" />
- <call target="compile-${framework::get-target-framework()}" />
- </target>
- <!-- Target for compiling all runtime configurations in the current build configuration -->
- <target name="compile-build" description="Compile current build configurations for all runtime configurations">
- <echo message="Compiling all framework versions for the ${current.build.config} build configuration." />
- <!-- NETCF_1_0 -->
- <if test="${framework::exists('netcf-1.0')}">
- <call target="compile-netcf-1.0" />
- </if>
- <!--if test="${not framework::exists('netcf-1.0')}">
- <if test="${property::exists('project.build.package') and project.build.package}">
- <fail message="The .NET Compact Framework 1.0 is not available." />
- </if>
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo
- message="The .NET Compact Framework 1.0 is not available. Build skipped." />
- </if>
- </if-->
- <!-- NETCF_2_0 -->
- <if test="${framework::exists('netcf-2.0')}">
- <call target="compile-netcf-2.0" />
- </if>
- <!--if test="${not framework::exists('netcf-2.0')}">
- <if test="${property::exists('project.build.package') and project.build.package and not(directory::exists(path::combine(bin.dir, 'netcf/2.0/debug')) and directory::exists(path::combine(bin.dir, 'netcf/2.0/release')) and directory::exists(path::combine(bin.dir, 'netcf/2.0/oldkey')))}">
- <fail message="The .NET Compact Framework 2.0 is not available." />
- </if>
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo
- message="The .NET Compact Framework 2.0 is not available. Build skipped." />
- </if>
- </if-->
- <!-- NET_1_0 -->
- <if test="${framework::exists('net-1.0')}">
- <call target="compile-net-1.0" />
- <call target="compile-cli-1.0" />
- </if>
- <if test="${not framework::exists('net-1.0')}">
- <echo message="The .NET Framework 1.0 is not available. Build skipped." />
- </if>
- <!-- NET_1_1 -->
- <if test="${framework::exists('net-1.1')}">
- <call target="compile-net-1.1" />
- </if>
- <if test="${not framework::exists('net-1.1')}">
- <echo message="The .NET Framework 1.1 is not available. Build skipped." />
- </if>
- <!-- NET_2_0 -->
- <if test="${framework::exists('net-2.0')}">
- <call target="compile-net-2.0" />
- </if>
- <if test="${not framework::exists('net-2.0')}">
- <echo message="The .NET Framework 2.0 is not available. Build skipped." />
- </if>
- <!-- NET_3_5 -->
- <if test="${framework::exists('net-3.5')}">
- <call target="compile-net-3.5" />
- <call target="compile-net-3.5-cp" />
- </if>
- <if test="${not framework::exists('net-3.5')}">
- <if test="${property::exists('project.build.package') and project.build.package and not(directory::exists(path::combine(bin.dir, 'net/3.5/debug')) and directory::exists(path::combine(bin.dir, 'net/3.5/release')) and directory::exists(path::combine(bin.dir, 'net/3.5/oldkey')) and directory::exists(path::combine(bin.dir, 'net-cp/3.5/debug')) and directory::exists(path::combine(bin.dir, 'net-cp/3.5/release')) and directory::exists(path::combine(bin.dir, 'net-cp/3.5/oldkey')))}">
- <fail message="The .NET Framework 3.5 is not available." />
- </if>
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo message="The .NET Framework 3.5 is not available. Build skipped." />
- </if>
- </if>
- <!-- NET_4_0 -->
- <if test="${framework::exists('net-4.0')}">
- <call target="compile-net-4.0" />
- <call target="compile-net-4.0-cp" />
- <call target="compile-net-4.5" />
- </if>
- <if test="${not framework::exists('net-4.0')}">
- <if test="${property::exists('project.build.package') and project.build.package and not(directory::exists(path::combine(bin.dir, 'net/4.0/debug')) and directory::exists(path::combine(bin.dir, 'net/4.0/release')) and directory::exists(path::combine(bin.dir, 'net/4.0/oldkey')) and directory::exists(path::combine(bin.dir, 'net-cp/4.0/debug')) and directory::exists(path::combine(bin.dir, 'net-cp/4.0/release')) and directory::exists(path::combine(bin.dir, 'net-cp/4.0/oldkey')))}">
- <fail message="The .NET Framework 4.0 is not available." />
- </if>
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo message="The .NET Framework 4.0 is not available. Build skipped." />
- </if>
- </if>
- <!-- MONO_1_0 -->
- <if test="${framework::exists('mono-1.0')}">
- <call target="compile-mono-1.0" />
- </if>
- <if test="${not framework::exists('mono-1.0')}">
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo message="Mono 1.0 is not available. Build skipped." />
- </if>
- </if>
- <!-- MONO_2_0 -->
- <if test="${framework::exists('mono-2.0')}">
- <call target="compile-mono-2.0" />
- </if>
- <if test="${not framework::exists('mono-2.0')}">
- <if test="${property::exists('project.build.package') and project.build.package and not(directory::exists(path::combine(bin.dir, 'mono/2.0/debug')) and directory::exists(path::combine(bin.dir, 'mono/2.0/release')) and directory::exists(path::combine(bin.dir, 'mono/2.0/oldkey')))}">
- <fail message="Mono 2.0 is not available." />
- </if>
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo message="Mono 2.0 is not available. Build skipped." />
- </if>
- </if>
- <!-- MONO_3_5 -->
- <if test="${framework::exists('mono-3.5')}">
- <call target="compile-mono-3.5" />
- </if>
- <if test="${not framework::exists('mono-3.5')}">
- <if test="${property::exists('project.build.package') and project.build.package and not(directory::exists(path::combine(bin.dir, 'mono/3.5/debug')) and directory::exists(path::combine(bin.dir, 'mono/3.5/release')) and directory::exists(path::combine(bin.dir, 'mono/3.5/oldkey')))}">
- <fail message="Mono 3.5 is not available." />
- </if>
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo message="Mono 3.5 is not available. Build skipped." />
- </if>
- </if>
- <!-- MONO_4_0 -->
- <if test="${framework::exists('mono-4.0')}">
- <call target="compile-mono-4.0" />
- </if>
- <if test="${not framework::exists('mono-4.0')}">
- <if test="${property::exists('project.build.package') and project.build.package and not(directory::exists(path::combine(bin.dir, 'mono/4.0/debug')) and directory::exists(path::combine(bin.dir, 'mono/4.0/release')) and directory::exists(path::combine(bin.dir, 'mono/4.0/oldkey')))}">
- <fail message="Mono 4.0 is not available." />
- </if>
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo message="Mono 4.0 is not available. Build skipped." />
- </if>
- </if>
- <!-- SSCLI_1_0 -->
- <if test="${framework::exists('sscli-1.0')}">
- <call target="compile-sscli-1.0" />
- </if>
- <!--if test="${not framework::exists('sscli-1.0')}">
- <if test="${property::exists('project.build.package') and project.build.package}">
- <fail message="SSCLI 1.0 is not available." />
- </if>
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo message="SSCLI 1.0 is not available. Build skipped." />
- </if>
- </if-->
- <call target="compile-netstandard" />
- </target>
- <target name="compile" description="Builds the current build configuration for the current target framework." depends="check-current-build-config">
- <call target="compile-${framework::get-target-framework()}" />
- </target>
- <target name="compile-netcf-1.0" description="Builds .NET Compact Framework 1.0 version" depends="set-netcf-1.0-runtime-configuration, check-log4net-basedir, clean-current-bin-dir">
- <!-- initialize the temp.build.skip property to false -->
- <property name="temp.build.skip" value="false" />
- <if test="${current.build.config.release}">
- <!-- check if the log4net key file is available -->
- <if test="${not file::exists(log4net.basedir + '/log4net.snk')}">
- <if test="${property::exists('project.build.package') and project.build.package}">
- <fail message="Key file not found." />
- </if>
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo message="Key file not found. You can generate a key file by running 'sn -k log4net.snk'." />
- <echo message="The generated key file should be stored in the log4net base directory." />
- <echo message="The release build will be skipped." />
- <property name="temp.build.skip" value="true" />
- </if>
- </if>
- <if test="${file::exists(log4net.basedir + '/log4net.snk')}">
- <!-- copy the log4net key file to the location where the compiler expects it to be -->
- <copy file="${log4net.basedir}/log4net.snk" todir="${current.bin.dir}/../../../" />
- </if>
- </if>
- <if test="${not temp.build.skip}">
- <csc warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.dll" doc="${current.bin.dir}/log4net.xml">
- <nowarn>
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="mscorlib.dll" />
- <include name="System.dll" />
- <include name="System.Data.dll" />
- <include name="System.Xml.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- </if>
- </target>
- <target name="compile-netcf-2.0" description="Builds .NET Compact Framework 2.0 version" depends="set-netcf-2.0-runtime-configuration, check-log4net-basedir, clean-current-bin-dir">
- <!-- initialize the temp.build.skip property to false -->
- <property name="temp.build.skip" value="false" />
- <if test="${current.build.config.release}">
- <!-- check if the old log4net key file is available -->
- <if test="${not file::exists(log4net.basedir + '/old-log4net.snk')}">
- <if test="${property::exists('project.build.package') and project.build.package}">
- <fail message="Old key file not found." />
- </if>
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo message="Old key file not found."/>
- <echo message="The release build using the old key will be skipped." />
- <property name="temp.build.skip" value="true" />
- </if>
- </if>
- </if>
- <if test="${not temp.build.skip}">
- <csc if="${current.build.config.release}" keyfile="${path::combine(log4net.basedir, 'old-log4net.snk')}" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/../oldkey/log4net.dll" doc="${current.bin.dir}/../oldkey/log4net.xml">
- <nowarn>
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="mscorlib.dll" />
- <include name="System.dll" />
- <include name="System.Data.dll" />
- <include name="System.Xml.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- </if>
- <csc if="${current.build.config.release}" keyfile="${path::combine(log4net.basedir, 'log4net.snk')}" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.dll" doc="${current.bin.dir}/log4net.xml">
- <nowarn>
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="mscorlib.dll" />
- <include name="System.dll" />
- <include name="System.Data.dll" />
- <include name="System.Xml.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- <csc if="${current.build.config.debug}" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.dll" doc="${current.bin.dir}/log4net.xml">
- <nowarn>
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="mscorlib.dll" />
- <include name="System.dll" />
- <include name="System.Data.dll" />
- <include name="System.Xml.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- </target>
- <target name="compile-net-1.0" description="Builds .NET Framework 1.0 version" depends="set-net-1.0-runtime-configuration, check-log4net-basedir, clean-current-bin-dir">
- <!-- initialize the temp.build.skip property to false -->
- <property name="temp.build.skip" value="false" />
- <if test="${current.build.config.release}">
- <!-- check if the log4net key file is available -->
- <if test="${not file::exists(log4net.basedir + '/log4net.snk')}">
- <if test="${property::exists('project.build.package') and project.build.package}">
- <fail message="Old key file not found." />
- </if>
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo message="Old key file not found."/>
- <echo message="The release build using the old key will be skipped." />
- <property name="temp.build.skip" value="true" />
- </if>
- </if>
- <if test="${file::exists(log4net.basedir + '/old-log4net.snk')}">
- <!-- copy the log4net key file to the location where
- the compiler expects it to be -->
- <copy file="${log4net.basedir}/old-log4net.snk"
- tofile="${current.bin.dir}/../../../log4net.snk"
- overwrite="true"/>
- </if>
- </if>
- <if test="${not temp.build.skip}">
- <csc if="${current.build.config.release}" nostdlib="true" noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/../oldkey/log4net.dll" doc="${current.bin.dir}/../oldkey/log4net.xml">
- <nowarn>
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="mscorlib.dll" />
- <include name="System.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Xml.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- </if>
- <copy file="${log4net.basedir}/log4net.snk"
- todir="${current.bin.dir}/../../../"
- overwrite="true"/>
- <csc nostdlib="true" noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.dll" doc="${current.bin.dir}/log4net.xml">
- <nowarn>
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="mscorlib.dll" />
- <include name="System.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Xml.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- </target>
- <target name="compile-net-1.1" description="Builds .NET Framework 1.1 version" depends="set-net-1.1-runtime-configuration, check-log4net-basedir, clean-current-bin-dir">
- <!-- initialize the temp.build.skip property to false -->
- <property name="temp.build.skip" value="false" />
- <if test="${current.build.config.release}">
- <!-- check if the log4net key file is available -->
- <if test="${not file::exists(log4net.basedir + '/log4net.snk')}">
- <if test="${property::exists('project.build.package') and project.build.package}">
- <fail message="Old key file not found." />
- </if>
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo message="Old key file not found."/>
- <echo message="The release build using the old key will be skipped." />
- <property name="temp.build.skip" value="true" />
- </if>
- </if>
- <if test="${file::exists(log4net.basedir + '/old-log4net.snk')}">
- <!-- copy the log4net key file to the location where
- the compiler expects it to be -->
- <copy file="${log4net.basedir}/old-log4net.snk"
- tofile="${current.bin.dir}/../../../log4net.snk"
- overwrite="true"/>
- </if>
- </if>
- <if test="${not temp.build.skip}">
- <csc if="${current.build.config.release}" nostdlib="true" noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/../oldkey/log4net.dll" doc="${current.bin.dir}/../oldkey/log4net.xml">
- <nowarn>
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="mscorlib.dll" />
- <include name="System.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Xml.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- </if>
- <copy file="${log4net.basedir}/log4net.snk"
- todir="${current.bin.dir}/../../../"
- overwrite="true"/>
- <csc nostdlib="true" noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.dll" doc="${current.bin.dir}/log4net.xml">
- <nowarn>
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="mscorlib.dll" />
- <include name="System.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Xml.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- </target>
- <target name="compile-net-2.0" description="Builds .NET Framework 2.0 version" depends="set-net-2.0-runtime-configuration, check-log4net-basedir, clean-current-bin-dir">
- <!-- initialize the temp.build.skip property to false -->
- <property name="temp.build.skip" value="false" />
- <if test="${current.build.config.release}">
- <!-- check if the old log4net key file is available -->
- <if test="${not file::exists(log4net.basedir + '/old-log4net.snk')}">
- <if test="${property::exists('project.build.package') and project.build.package}">
- <fail message="Old key file not found." />
- </if>
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo message="Old key file not found."/>
- <echo message="The release build using the old key will be skipped." />
- <property name="temp.build.skip" value="true" />
- </if>
- </if>
- </if>
- <if test="${not temp.build.skip}">
- <csc if="${current.build.config.release}" keyfile="${path::combine(log4net.basedir, 'old-log4net.snk')}" nostdlib="true" noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/../oldkey/log4net.dll" doc="${current.bin.dir}/../oldkey/log4net.xml">
- <nowarn>
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="mscorlib.dll" />
- <include name="System.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Xml.dll" />
- <include name="System.Configuration.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- </if>
- <csc if="${current.build.config.release}" keyfile="${path::combine(log4net.basedir, 'log4net.snk')}" nostdlib="true" noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.dll" doc="${current.bin.dir}/log4net.xml">
- <nowarn>
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="mscorlib.dll" />
- <include name="System.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Xml.dll" />
- <include name="System.Configuration.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- <csc if="${current.build.config.debug}" nostdlib="true" noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.dll" doc="${current.bin.dir}/log4net.xml">
- <nowarn>
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="mscorlib.dll" />
- <include name="System.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Xml.dll" />
- <include name="System.Configuration.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- </target>
- <target name="compile-net-3.5" description="Builds .NET Framework 3.5 version" depends="set-net-3.5-runtime-configuration, check-log4net-basedir, clean-current-bin-dir">
- <!-- initialize the temp.build.skip property to false -->
- <property name="temp.build.skip" value="false" />
- <if test="${current.build.config.release}">
- <!-- check if the old log4net key file is available -->
- <if test="${not file::exists(log4net.basedir + '/old-log4net.snk')}">
- <if test="${property::exists('project.build.package') and project.build.package}">
- <fail message="Old key file not found." />
- </if>
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo message="old key file not found."/>
- <echo message="The release build using the old key will be skipped." />
- <property name="temp.build.skip" value="true" />
- </if>
- </if>
- </if>
- <if test="${not temp.build.skip}">
- <csc if="${current.build.config.release}" keyfile="${path::combine(log4net.basedir, 'old-log4net.snk')}" nostdlib="true" noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/../oldkey/log4net.dll" doc="${current.bin.dir}/../oldkey/log4net.xml">
- <nowarn>
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="mscorlib.dll" />
- <include name="System.dll" />
- <include name="System.Core.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Xml.dll" />
- <include name="System.Configuration.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- </if>
- <csc if="${current.build.config.release}" keyfile="${path::combine(log4net.basedir, 'log4net.snk')}" nostdlib="true" noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.dll" doc="${current.bin.dir}/log4net.xml">
- <nowarn>
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="mscorlib.dll" />
- <include name="System.dll" />
- <include name="System.Core.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Xml.dll" />
- <include name="System.Configuration.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- <csc if="${current.build.config.debug}" nostdlib="true" noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.dll" doc="${current.bin.dir}/log4net.xml">
- <nowarn>
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="mscorlib.dll" />
- <include name="System.dll" />
- <include name="System.Core.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Xml.dll" />
- <include name="System.Configuration.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- </target>
- <target name="compile-net-3.5-cp" description="Builds .NET Framework 3.5 Client Profile version" depends="set-net-3.5-cp-runtime-configuration, check-log4net-basedir, clean-current-bin-dir">
- <!-- initialize the temp.build.skip property to false -->
- <property name="temp.build.skip" value="false" />
- <if test="${current.build.config.release}">
- <!-- check if the old log4net key file is available -->
- <if test="${not file::exists(log4net.basedir + '/old-log4net.snk')}">
- <if test="${property::exists('project.build.package') and project.build.package}">
- <fail message="Old key file not found." />
- </if>
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo message="Old key file not found."/>
- <echo message="The release build using the old key will be skipped." />
- <property name="temp.build.skip" value="true" />
- </if>
- </if>
- </if>
- <if test="${not temp.build.skip}">
- <csc if="${current.build.config.release}" keyfile="${path::combine(log4net.basedir, 'old-log4net.snk')}" nostdlib="true" noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/../oldkey/log4net.dll" doc="${current.bin.dir}/../oldkey/log4net.xml">
- <nowarn>
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="mscorlib.dll" />
- <include name="System.dll" />
- <include name="System.Core.dll" />
- <include name="System.Data.dll" />
- <include name="System.Xml.dll" />
- <include name="System.Configuration.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- </if>
- <csc if="${current.build.config.release}" keyfile="${path::combine(log4net.basedir, 'log4net.snk')}" nostdlib="true" noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.dll" doc="${current.bin.dir}/log4net.xml">
- <nowarn>
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="mscorlib.dll" />
- <include name="System.dll" />
- <include name="System.Core.dll" />
- <include name="System.Data.dll" />
- <include name="System.Xml.dll" />
- <include name="System.Configuration.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- <csc if="${current.build.config.debug}" nostdlib="true" noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.dll" doc="${current.bin.dir}/log4net.xml">
- <nowarn>
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="mscorlib.dll" />
- <include name="System.dll" />
- <include name="System.Core.dll" />
- <include name="System.Data.dll" />
- <include name="System.Xml.dll" />
- <include name="System.Configuration.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- </target>
- <target name="compile-net-4.0" description="Builds .NET Framework 4.0 version" depends="set-net-4.0-runtime-configuration, check-log4net-basedir, clean-current-bin-dir">
- <!-- initialize the temp.build.skip property to false -->
- <property name="temp.build.skip" value="false" />
- <if test="${current.build.config.release}">
- <!-- check if the old log4net key file is available -->
- <if test="${not file::exists(log4net.basedir + '/old-log4net.snk')}">
- <if test="${property::exists('project.build.package') and project.build.package}">
- <fail message="Old key file not found." />
- </if>
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo message="Old key file not found."/>
- <echo message="The release build using the old key will be skipped." />
- <property name="temp.build.skip" value="true" />
- </if>
- </if>
- </if>
- <if test="${not temp.build.skip}">
- <csc if="${current.build.config.release}" keyfile="${path::combine(log4net.basedir, 'old-log4net.snk')}" nostdlib="true" noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/../oldkey/log4net.dll" doc="${current.bin.dir}/../oldkey/log4net.xml">
- <nowarn>
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="mscorlib.dll" />
- <include name="System.dll" />
- <include name="System.Core.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Xml.dll" />
- <include name="System.Configuration.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- </if>
- <csc if="${current.build.config.release}" keyfile="${path::combine(log4net.basedir, 'log4net.snk')}" nostdlib="true" noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.dll" doc="${current.bin.dir}/log4net.xml">
- <nowarn>
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="mscorlib.dll" />
- <include name="System.dll" />
- <include name="System.Core.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Xml.dll" />
- <include name="System.Configuration.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- <csc if="${current.build.config.debug}" nostdlib="true" noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.dll" doc="${current.bin.dir}/log4net.xml">
- <nowarn>
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="mscorlib.dll" />
- <include name="System.dll" />
- <include name="System.Core.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Xml.dll" />
- <include name="System.Configuration.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- </target>
- <target name="compile-net-4.0-cp" description="Builds .NET Framework 4.0 Client Profile version" depends="set-net-4.0-cp-runtime-configuration, check-log4net-basedir, clean-current-bin-dir">
- <!-- initialize the temp.build.skip property to false -->
- <property name="temp.build.skip" value="false" />
- <if test="${current.build.config.release}">
- <!-- check if the old log4net key file is available -->
- <if test="${not file::exists(log4net.basedir + '/old-log4net.snk')}">
- <if test="${property::exists('project.build.package') and project.build.package}">
- <fail message="Old key file not found." />
- </if>
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo message="Old key file not found."/>
- <echo message="The release build using the old key will be skipped." />
- <property name="temp.build.skip" value="true" />
- </if>
- </if>
- </if>
- <if test="${not temp.build.skip}">
- <csc if="${current.build.config.release}" keyfile="${path::combine(log4net.basedir, 'old-log4net.snk')}" nostdlib="true" noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/../oldkey/log4net.dll" doc="${current.bin.dir}/../oldkey/log4net.xml">
- <nowarn>
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="mscorlib.dll" />
- <include name="System.dll" />
- <include name="System.Core.dll" />
- <include name="System.Data.dll" />
- <include name="System.Xml.dll" />
- <include name="System.Configuration.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- </if>
- <csc if="${current.build.config.release}" keyfile="${path::combine(log4net.basedir, 'log4net.snk')}" nostdlib="true" noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.dll" doc="${current.bin.dir}/log4net.xml">
- <nowarn>
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="mscorlib.dll" />
- <include name="System.dll" />
- <include name="System.Core.dll" />
- <include name="System.Data.dll" />
- <include name="System.Xml.dll" />
- <include name="System.Configuration.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- <csc if="${current.build.config.debug}" nostdlib="true" noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.dll" doc="${current.bin.dir}/log4net.xml">
- <nowarn>
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="mscorlib.dll" />
- <include name="System.dll" />
- <include name="System.Core.dll" />
- <include name="System.Data.dll" />
- <include name="System.Xml.dll" />
- <include name="System.Configuration.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- </target>
- <target name="compile-net-4.5" description="Builds .NET Framework 4.5 version" depends="set-net-4.5-runtime-configuration, check-log4net-basedir, clean-current-bin-dir">
- <!-- initialize the temp.build.skip property to false -->
- <property name="temp.build.skip" value="false" />
- <if test="${current.build.config.release}">
- <!-- check if the old log4net key file is available -->
- <if test="${not file::exists(log4net.basedir + '/old-log4net.snk')}">
- <if test="${property::exists('project.build.package') and project.build.package}">
- <fail message="Old key file not found." />
- </if>
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo message="Old key file not found."/>
- <echo message="The release build using the old key will be skipped." />
- <property name="temp.build.skip" value="true" />
- </if>
- </if>
- </if>
- <if test="${not temp.build.skip}">
- <csc if="${current.build.config.release}" keyfile="${path::combine(log4net.basedir, 'old-log4net.snk')}" nostdlib="true" noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/../oldkey/log4net.dll" doc="${current.bin.dir}/../oldkey/log4net.xml">
- <nowarn>
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="mscorlib.dll" />
- <include name="System.dll" />
- <include name="System.Core.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Xml.dll" />
- <include name="System.Configuration.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- </if>
- <csc if="${current.build.config.release}" keyfile="${path::combine(log4net.basedir, 'log4net.snk')}" nostdlib="true" noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.dll" doc="${current.bin.dir}/log4net.xml">
- <nowarn>
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="mscorlib.dll" />
- <include name="System.dll" />
- <include name="System.Core.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Xml.dll" />
- <include name="System.Configuration.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- <csc if="${current.build.config.debug}" nostdlib="true" noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.dll" doc="${current.bin.dir}/log4net.xml">
- <nowarn>
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="mscorlib.dll" />
- <include name="System.dll" />
- <include name="System.Core.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Xml.dll" />
- <include name="System.Configuration.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- </target>
- <target name="compile-mono-1.0" description="Builds Mono 1.0 version" depends="set-mono-1.0-runtime-configuration, check-log4net-basedir, clean-current-bin-dir">
- <!-- initialize the temp.build.skip property to false -->
- <property name="temp.build.skip" value="false" />
- <if test="${current.build.config.release}">
- <!-- check if the old log4net key file is available -->
- <if test="${not file::exists(log4net.basedir + '/old-log4net.snk')}">
- <if test="${property::exists('project.build.package') and project.build.package}">
- <fail message="Old key file not found." />
- </if>
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo message="Old key file not found."/>
- <echo message="The release build using the old key will be skipped." />
- <property name="temp.build.skip" value="true" />
- </if>
- </if>
- <if test="${file::exists(log4net.basedir + '/old-log4net.snk')}">
- <mkdir dir="${current.bin.dir}/../oldkey" />
- </if>
- </if>
- <if test="${not temp.build.skip}">
- <csc if="${current.build.config.release}" keyfile="${path::combine(log4net.basedir, 'old-log4net.snk')}" nostdlib="false" noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/../oldkey/log4net.dll" doc="${current.bin.dir}/../oldkey/log4net.xml">
- <nowarn>
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="System.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Xml.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- </if>
- <csc if="${current.build.config.release}" keyfile="${path::combine(log4net.basedir, 'log4net.snk')}" nostdlib="false" noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.dll" doc="${current.bin.dir}/log4net.xml">
- <nowarn>
- <!-- workaround for Mono bug #61902 -->
- <warning number="0618" />
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="System.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Xml.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- <csc if="${current.build.config.debug}" nostdlib="false" noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.dll" doc="${current.bin.dir}/log4net.xml">
- <nowarn>
- <!-- workaround for Mono bug #61902 -->
- <warning number="0618" />
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="System.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Xml.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- </target>
- <target name="compile-mono-2.0" description="Builds Mono 2.0 version" depends="set-mono-2.0-runtime-configuration, check-log4net-basedir, clean-current-bin-dir">
- <!-- initialize the temp.build.skip property to false -->
- <property name="temp.build.skip" value="false" />
- <if test="${current.build.config.release}">
- <!-- check if the old log4net key file is available -->
- <if test="${not file::exists(log4net.basedir + '/old-log4net.snk')}">
- <if test="${property::exists('project.build.package') and project.build.package}">
- <fail message="Old key file not found." />
- </if>
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo message="Old key file not found."/>
- <echo message="The release build using the old key will be skipped." />
- <property name="temp.build.skip" value="true" />
- </if>
- </if>
- <if test="${file::exists(log4net.basedir + '/old-log4net.snk')}">
- <mkdir dir="${current.bin.dir}/../oldkey" />
- </if>
- </if>
- <if test="${not temp.build.skip}">
- <csc if="${current.build.config.release}" keyfile="${path::combine(log4net.basedir, 'old-log4net.snk')}" nostdlib="false" noconfig="true" warnaserror="false" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/../oldkey/log4net.dll" doc="${current.bin.dir}/../oldkey/log4net.xml">
- <nowarn>
- <!-- workaround for Mono bug #61902 -->
- <!--warning number="0618" /-->
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="System.dll" />
- <include name="System.Configuration.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Xml.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- </if>
- <csc if="${current.build.config.release}" keyfile="${path::combine(log4net.basedir, 'log4net.snk')}" nostdlib="false" noconfig="true" warnaserror="false" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.dll" doc="${current.bin.dir}/log4net.xml">
- <nowarn>
- <!-- workaround for Mono bug #61902 -->
- <!--warning number="0618" /-->
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="System.dll" />
- <include name="System.Configuration.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Xml.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- <csc if="${current.build.config.debug}" nostdlib="false" noconfig="true" warnaserror="false" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.dll" doc="${current.bin.dir}/log4net.xml">
- <nowarn>
- <!-- workaround for Mono bug #61902 -->
- <!--warning number="0618" /-->
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="System.dll" />
- <include name="System.Configuration.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Xml.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- </target>
- <target name="compile-mono-3.5" description="Builds Mono 3.5 version" depends="set-mono-3.5-runtime-configuration, check-log4net-basedir, clean-current-bin-dir">
- <!-- initialize the temp.build.skip property to false -->
- <property name="temp.build.skip" value="false" />
- <if test="${current.build.config.release}">
- <!-- check if the old log4net key file is available -->
- <if test="${not file::exists(log4net.basedir + '/old-log4net.snk')}">
- <if test="${property::exists('project.build.package') and project.build.package}">
- <fail message="Old key file not found." />
- </if>
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo message="Old key file not found."/>
- <echo message="The release build using the old key will be skipped." />
- <property name="temp.build.skip" value="true" />
- </if>
- </if>
- <if test="${file::exists(log4net.basedir + '/old-log4net.snk')}">
- <mkdir dir="${current.bin.dir}/../oldkey" />
- </if>
- </if>
- <if test="${not temp.build.skip}">
- <csc if="${current.build.config.release}" keyfile="${path::combine(log4net.basedir, 'old-log4net.snk')}" nostdlib="false" noconfig="true" warnaserror="false" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/../oldkey/log4net.dll" doc="${current.bin.dir}/../oldkey/log4net.xml">
- <nowarn>
- <!-- workaround for Mono bug #61902 -->
- <!--warning number="0618" /-->
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="System.dll" />
- <include name="System.Configuration.dll" />
- <include name="System.Core.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Xml.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- </if>
- <csc if="${current.build.config.release}" keyfile="${path::combine(log4net.basedir, 'log4net.snk')}" nostdlib="false" noconfig="true" warnaserror="false" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.dll" doc="${current.bin.dir}/log4net.xml">
- <nowarn>
- <!-- workaround for Mono bug #61902 -->
- <!--warning number="0618" /-->
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="System.dll" />
- <include name="System.Configuration.dll" />
- <include name="System.Core.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Xml.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- <csc if="${current.build.config.debug}" nostdlib="false" noconfig="true" warnaserror="false" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.dll" doc="${current.bin.dir}/log4net.xml">
- <nowarn>
- <!-- workaround for Mono bug #61902 -->
- <!--warning number="0618" /-->
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="System.dll" />
- <include name="System.Configuration.dll" />
- <include name="System.Core.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Xml.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- </target>
- <target name="compile-mono-4.0" description="Builds Mono 4.0 version" depends="set-mono-4.0-runtime-configuration, check-log4net-basedir, clean-current-bin-dir">
- <!-- initialize the temp.build.skip property to false -->
- <property name="temp.build.skip" value="false" />
- <if test="${current.build.config.release}">
- <!-- check if the old log4net key file is available -->
- <if test="${not file::exists(log4net.basedir + '/old-log4net.snk')}">
- <if test="${property::exists('project.build.package') and project.build.package}">
- <fail message="Old key file not found." />
- </if>
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo message="Old key file not found."/>
- <echo message="The release build using the old key will be skipped." />
- <property name="temp.build.skip" value="true" />
- </if>
- </if>
- <if test="${file::exists(log4net.basedir + '/old-log4net.snk')}">
- <mkdir dir="${current.bin.dir}/../oldkey" />
- </if>
- </if>
- <if test="${not temp.build.skip}">
- <csc if="${current.build.config.release}" keyfile="${path::combine(log4net.basedir, 'old-log4net.snk')}" nostdlib="false" noconfig="true" warnaserror="false" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/../oldkey/log4net.dll" doc="${current.bin.dir}/../oldkey/log4net.xml">
- <nowarn>
- <!-- workaround for Mono bug #61902 -->
- <!--warning number="0618" /-->
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="System.dll" />
- <include name="System.Core.dll" />
- <include name="System.Configuration.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Xml.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- </if>
- <csc if="${current.build.config.release}" keyfile="${path::combine(log4net.basedir, 'log4net.snk')}" nostdlib="false" noconfig="true" warnaserror="false" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.dll" doc="${current.bin.dir}/log4net.xml">
- <nowarn>
- <!-- workaround for Mono bug #61902 -->
- <!--warning number="0618" /-->
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="System.dll" />
- <include name="System.Configuration.dll" />
- <include name="System.Core.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Xml.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- <csc if="${current.build.config.debug}" nostdlib="false" noconfig="true" warnaserror="false" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.dll" doc="${current.bin.dir}/log4net.xml">
- <nowarn>
- <!-- workaround for Mono bug #61902 -->
- <!--warning number="0618" /-->
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="System.dll" />
- <include name="System.Configuration.dll" />
- <include name="System.Core.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Xml.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- </target>
- <target name="compile-sscli-1.0" description="Builds SSCLI 1.0 version" depends="set-sscli-1.0-runtime-configuration, check-log4net-basedir, clean-current-bin-dir">
- <!-- initialize the temp.build.skip property to false -->
- <property name="temp.build.skip" value="false" />
- <if test="${current.build.config.release}">
- <!-- check if the log4net key file is available -->
- <if test="${not file::exists(log4net.basedir + '/log4net.snk')}">
- <if test="${property::exists('project.build.package') and project.build.package}">
- <fail message="Key file not found." />
- </if>
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo message="Key file not found. You can generate a key file by running 'sn -k log4net.snk'." />
- <echo message="The generated key file should be stored in the log4net base directory." />
- <echo message="The release build will be skipped." />
- <property name="temp.build.skip" value="true" />
- </if>
- </if>
- <if test="${file::exists(log4net.basedir + '/log4net.snk')}">
- <!-- copy the log4net key file to the location where the compiler expects it to be -->
- <copy file="${log4net.basedir}/log4net.snk" todir="${current.bin.dir}/../../../" />
- </if>
- </if>
- <if test="${not temp.build.skip}">
- <csc nostdlib="true" noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.dll">
- <nowarn>
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="mscorlib.dll" />
- <include name="System.dll" />
- <include name="System.Xml.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- </if>
- </target>
- <!--
- This version is built to run on any CLI 1.0 (ECMA 335) standard runtime.
- The build excludes any code that is platform specific.
- The .NET 1.0 compiler and library are used to build the assembly.
-
- The log4net CLI 1.0 assembly is runtime compatible with the
- following frameworks:
-
- * Microsoft(R) .NET Framework 1.0 (and higher)
- * Mono 1.0 (and higher)
-
- We only provide this "flavor" of log4net in release
- configuration because debugging information is not standardized
- and would be too closely tied to a specific implementation.
- -->
- <target name="compile-cli-1.0" description="Builds CLI 1.0 version" depends="set-cli-1.0-configuration, check-log4net-basedir, clean-current-bin-dir" if="${current.build.config.release}">
- <delete>
- <fileset basedir="${current.bin.dir}">
- <include name="log4net.*" />
- </fileset>
- </delete>
- <!-- initialize the temp.build.skip property to false -->
- <property name="temp.build.skip" value="false" />
- <if test="${current.build.config.release}">
- <!-- check if the log4net key file is available -->
- <if test="${not file::exists(log4net.basedir + '/old-log4net.snk')}">
- <if test="${property::exists('project.build.package') and project.build.package}">
- <fail message="Old key file not found." />
- </if>
- <if test="${not(property::exists('project.build.package') and project.build.package)}">
- <echo message="Old key file not found."/>
- <echo message="The release build using the old key will be skipped." />
- <property name="temp.build.skip" value="true" />
- </if>
- </if>
- <if test="${file::exists(log4net.basedir + '/old-log4net.snk')}">
- <!-- copy the log4net key file to the location where
- the compiler expects it to be -->
- <copy file="${log4net.basedir}/old-log4net.snk"
- tofile="${current.bin.dir}/../../../log4net.snk"
- overwrite="true"/>
- </if>
- </if>
- <if test="${not temp.build.skip}">
- <csc nostdlib="true" noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/../oldkey/log4net.dll" doc="${current.bin.dir}/../oldkey/log4net.xml">
- <nowarn>
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="mscorlib.dll" />
- <include name="System.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Xml.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- </if>
- <copy file="${log4net.basedir}/log4net.snk"
- todir="${current.bin.dir}/../../../"
- overwrite="true"/>
- <csc nostdlib="true" noconfig="true" warnaserror="true" target="library" debug="${current.build.debug}" optimize="${current.build.optimize}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.dll" doc="${current.bin.dir}/log4net.xml">
- <nowarn>
- <!-- informational assembly version uses a free form text -->
- <warning number="1607" />
- </nowarn>
- <sources basedir="${log4net.basedir}/src">
- <include name="**/*.cs" />
- </sources>
- <resources failonempty="true">
- <include name="${log4net.basedir}/NOTICE" />
- <include name="${log4net.basedir}/LICENSE" />
- </resources>
- <references>
- <include name="mscorlib.dll" />
- <include name="System.dll" />
- <include name="System.Data.dll" />
- <include name="System.Web.dll" />
- <include name="System.Xml.dll" />
- <!-- allow for third party assemblies to be referenced by just storing them in the lib/<framework family>/<framework version>/<build configuration> directory -->
- <include name="lib/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}/*.dll" />
- </references>
- </csc>
- </target>
- <!-- Target for generating docs for all runtime configurations -->
- <target name="generate-sdkdoc-all" depends="check-current-build-config">
- <echo message="Generating SDK documentation temporarily disabled." />
- <!--
- <echo message="Generating SDK documentation based on the ${current.build.config} build configuration for all runtime configurations." />
- <if test="${framework::exists('netcf-1.0')}">
- <call target="set-netcf-1.0-runtime-configuration" />
- <call target="generate-sdkdoc" />
- </if>
- <if test="${framework::exists('netcf-2.0')}">
- <call target="set-netcf-2.0-runtime-configuration" />
- <call target="generate-sdkdoc" />
- </if>
- <if test="${framework::exists('net-1.0')}">
- <call target="set-net-1.0-runtime-configuration" />
- <call target="generate-sdkdoc" />
- </if>
- <if test="${framework::exists('net-1.1')}">
- <call target="set-net-1.1-runtime-configuration" />
- <call target="generate-sdkdoc" />
- </if>
- -->
- </target>
- <!-- Target for generating docs for build configurations -->
- <target name="generate-sdkdoc-step1" depends="compile, check-htmlhelp-compiler, check-current-sdkdoc-dir, check-current-sdkdoc-debug, clean-current-sdkdoc-dir">
- <mkdir dir="${current.sdkdoc.dir}"/>
- <!-- TODO: add a step for running SHFB here -->
- </target>
- <!-- Remove everything except the help file itself from the current SDK documentation directory -->
- <target name="generate-sdkdoc" depends="generate-sdkdoc-step1">
- <delete>
- <fileset basedir="${current.sdkdoc.dir}">
- <include name="**/*" />
- <exclude name="**/*.chm" />
- </fileset>
- </delete>
- </target>
- <!-- Build the SDK documentation for the website -->
- <target name="generate-sdkdoc-for-site"
- depends="set-release-build-configuration,generate-sdkdoc-step1">
- <mkdir dir="target/site/release/sdk"/>
- <copy todir="target/site/release/sdk">
- <fileset basedir="${current.sdkdoc.dir}">
- <include name="**/*" />
- <exclude name="**/*.chm" />
- <exclude name="**/*.hh?" />
- <exclude name="**/*.log" />
- </fileset>
- </copy>
- </target>
- <target name="generate-site">
- <property name="mvn" value="mvn"/>
- <if test="${platform::is-windows()}">
- <property name="mvn" value="mvn.cmd"/>
- </if>
- <exec program="${mvn}" commandline="site:site install"/>
- </target>
- <target name="package" description="Build and Package distribution">
- <!-- set flag to indicating that this is a package build -->
- <property name="project.build.package" value="true" />
- <call target="set-package-configuration" />
- <!-- copies the sources to the current package directory -->
- <call target="package-src" />
- <!-- compile all build configurations for all runtime configurations -->
- <call target="compile-all" />
- <!-- generate the sdk docs using the release build configuration for all runtime configuration -->
- <call target="set-release-build-configuration" />
- <call target="package-bin" />
- <call target="create-nuget-package" />
- </target>
- <target name="package-src">
- <copy todir="${current.package.src.dir}">
- <fileset basedir=".">
- <include name="KEYS"/>
- <include name="LICENSE"/>
- <include name="NOTICE"/>
- <include name="README.txt"/>
- <include name="STATUS.txt"/>
- <include name="build.cmd"/>
- <include name="log4net.build"/>
- <include name="log4net.include"/>
- <include name="log4net.nuspec"/>
- <include name="log4net.snk"/>
- <include name="log4net.snk.readme"/>
- <include name="old-log4net.snk.gpg"/>
- <include name="pom.xml"/>
-
- <include name="examples/**" />
- <include name="extensions/**" />
- <include name="netstandard/**" />
- <include name="src/**" />
- <include name="tests/**" />
-
- <exclude name="**/*.suo" />
- <exclude name="**/bin/**" />
- <exclude name="**/build/**" />
- <exclude name="**/log4net*.xml" />
- <exclude name="**/obj/**" />
- <exclude name="**/*.csproj.user" />
- <exclude name="**/*.vbproj.user" />
-
- <exclude name="src/GeneratedAssemblyInfo.cs" />
- <exclude name="netstandard/TestResult.xml"/>
- <exclude name="netstandard/**/project.lock.json"/>
- <exclude name="tests/doc/**" />
- <exclude name="tests/lib/net/**" />
- <exclude name="tests/lib/mono/**" />
- <exclude name="tests/lib/netcf/**" />
- </fileset>
- </copy>
-
- <!-- delete the specified zipfile if it already exists -->
- <delete>
- <fileset basedir="build">
- <include name="${current.package.src.zipfile}" />
- </fileset>
- </delete>
- <zip zipfile="build/${current.package.src.zipfile}" ziplevel="9"
- includeemptydirs="true">
- <fileset basedir="${current.package.src.dir}"
- prefix="${current.package.name}">
- <include name="**"/>
- </fileset>
- </zip>
- </target>
- <target name="package-bin" depends="generate-sdkdoc-step1,generate-site">
- <copy todir="${current.package.bin.dir}">
- <fileset basedir=".">
- <include name="KEYS"/>
- <include name="LICENSE"/>
- <include name="NOTICE"/>
- <include name="README.txt"/>
- <include name="STATUS.txt"/>
- <include name="bin/**/release/**"/>
- </fileset>
- </copy>
- <copy todir="${current.package.bin.dir}">
- <fileset basedir="${current.sdkdoc.dir}">
- <include name="**/*.chm" />
- </fileset>
- </copy>
- <property name="current.package.doc.dir"
- value="${current.package.bin.dir}/doc"/>
- <mkdir dir="${current.package.doc.dir}/release/sdk"/>
- <copy todir="${current.package.doc.dir}/release/sdk">
- <fileset basedir="${current.sdkdoc.dir}">
- <include name="**/*" />
- <exclude name="**/*.chm" />
- <exclude name="**/*.hh?" />
- <exclude name="**/*.log" />
- </fileset>
- </copy>
- <copy todir="${current.package.doc.dir}">
- <fileset basedir="target/site">
- <include name="**"/>
- </fileset>
- </copy>
-
- <delete>
- <fileset basedir="build">
- <include name="${current.package.bin.dir}-*key.zip" />
- </fileset>
- </delete>
- <zip zipfile="${current.package.bin.dir}-newkey.zip" ziplevel="9">
- <fileset basedir="${current.package.bin.dir}"
- prefix="${current.package.name}">
- <include name="**"/>
- </fileset>
- </zip>
-
- <!-- binary dist with old strong name key -->
- <foreach item="Folder" property="platform-and-version">
- <in>
- <items>
- <include name="bin/*/*"/>
- </items>
- </in>
- <do>
- <copy todir="${current.package.bin.dir}/${string::replace(platform-and-version, project::get-base-directory(), '')}/release"
- overwrite="true">
- <fileset basedir="${platform-and-version}/oldkey">
- <include name="**"/>
- </fileset>
- </copy>
- </do>
- </foreach>
- <zip zipfile="${current.package.bin.dir}-oldkey.zip" ziplevel="9">
- <fileset basedir="${current.package.bin.dir}"
- prefix="${current.package.name}">
- <include name="**"/>
- </fileset>
- </zip>
- </target>
- <target name="create-nuget-package">
- <exec program="nuget.exe" commandline="pack log4net.nuspec"/>
- </target>
-
- <target name="generate-assembly-description">
- <if test="${not(property::exists('source.git.revision'))}">
- <property name="source.git.revision" value="0"/>
- <property name="source.git.url" value="https://git-wip-us.apache.org/repos/asf/logging-log4net.git"/>
- <property name="assembly.description"
- value="The Apache Software Foundation log4net Logging Framework"/>
- <if test="${directory::exists('.git')}">
- <exec program="git" workingdir="." verbose="false"
- output="_gitrevision" failonerror="true" >
- <arg value="log"/>
- <arg value="-1" />
- <arg line="--pretty=format:%h" />
- </exec>
- <exec program="git" workingdir="." verbose="false"
- output="_giturl" failonerror="true" >
- <arg value="config" />
- <arg line="remote.origin.url" />
- </exec>
- <sleep milliseconds="500" />
- <loadfile property="source.git.revision" file="_gitrevision"/>
- <loadfile property="source.git.url" file="_giturl"/>
- <delete file="_gitrevision"/>
- <delete file="_giturl"/>
- <property name="assembly.description"
- value="The Apache Software Foundation log4net Logging Framework built from git revision ${string::trim(source.git.revision)} of ${string::trim(source.git.url)}"/>
- </if>
- <delete file="src/GeneratedAssemblyInfo.cs"/>
- <asminfo language="CSharp" output="src/GeneratedAssemblyInfo.cs">
- <imports>
- <import namespace="System.Reflection"/>
- </imports>
- <attributes>
- <attribute type="AssemblyDescriptionAttribute"
- value="${assembly.description}"/>
- </attributes>
- </asminfo>
- </if>
- </target>
- <target name="compile-netstandard">
- <exec program="dotnet" workingdir="netstandard"
- failonerror="false" resultproperty="dotnet.available">
- <arg value="restore"/>
- </exec>
- <if test="${dotnet.available == '0'}">
- <exec program="dotnet" workingdir="netstandard">
- <arg value="build"/>
- <arg value="log4net"/>
- <arg if="${current.build.config.release}" value="-c"/>
- <arg if="${current.build.config.release}" value="Release"/>
- </exec>
- <mkdir dir="${log4net.basedir}/bin/netstandard/1.3"/>
- <if test="${current.build.config.release}">
- <move todir="${log4net.basedir}/bin/netstandard/1.3/Release">
- <fileset basedir="netstandard/log4net/bin/Release/netstandard1.3"/>
- </move>
- </if>
- <ifnot test="${current.build.config.release}">
- <move todir="${log4net.basedir}/bin/netstandard/1.3/Debug">
- <fileset basedir="netstandard/log4net/bin/Debug/netstandard1.3"/>
- </move>
- </ifnot>
- </if>
- <if test="${dotnet.available != '0'}">
- <echo message=".NET Core is not available." />
- </if>
- </target>
-</project>
diff --git a/log4net.include b/log4net.include
deleted file mode 100644
index 028449c..0000000
--- a/log4net.include
+++ /dev/null
@@ -1,409 +0,0 @@
-<?xml version="1.0" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<project name="log4net-helpers" xmlnds="http://tempuri.org/nant-vs.xsd">
- <!-- The path to the log4net output directory for current build/runtime -->
- <property
- name="log4net.output.dir"
- value="${log4net.basedir}/bin/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}"
- dynamic="true" />
- <target name="check-bin-dir">
- <if test="${not property::exists('bin.dir')}">
- <property name="bin.dir" value="bin" />
- </if>
- <mkdir dir="${bin.dir}" />
- </target>
- <target name="check-build-debug">
- <if test="${not property::exists('build.debug')}">
- <fail message="The build debug setting has not been specified." />
- </if>
- </target>
- <target name="check-build-defines">
- <if test="${not property::exists('build.defines.csc')}">
- <fail message="The build defines for the csc task have not been specified." />
- </if>
- <if test="${not property::exists('build.defines.jsc')}">
- <fail message="The build defines for the jsc task have not been specified." />
- </if>
- <if test="${not property::exists('build.defines.vbc')}">
- <fail message="The build defines for the vbc task have not been specified." />
- </if>
- <if test="${not property::exists('build.defines.vjc')}">
- <fail message="The build defines for the vjc task have not been specified." />
- </if>
- <if test="${not property::exists('build.defines.cl')}">
- <fail message="The build defines for the cl task have not been specified." />
- </if>
- </target>
- <target name="check-doc-dir">
- <if test="${not property::exists('doc.dir')}">
- <property name="doc.dir" value="doc" />
- </if>
- <mkdir dir="${doc.dir}" />
- </target>
- <target name="check-sdkdoc-dir" depends="check-doc-dir">
- <if test="${not property::exists('sdkdoc.dir')}">
- <property name="sdkdoc.dir" value="${doc.dir}/sdk" />
- </if>
- <!--
- Temporarily disabled SDK generation through NAnt build
- <mkdir dir="${sdkdoc.dir}" />
- -->
- </target>
- <target name="check-sdkdoc-debug">
- <if test="${not property::exists('sdkdoc.debug')}">
- <fail message="The sdk documentation debug setting has not been specified." />
- </if>
- </target>
- <target name="check-current-bin-dir">
- <if test="${not property::exists('current.bin.dir')}">
- <fail message="The current binaries directory has not been specified." />
- </if>
- <mkdir dir="${current.bin.dir}" />
- </target>
- <target name="check-current-build-debug">
- <if test="${not property::exists('current.build.debug')}">
- <fail message="The current build debug setting has not been specified." />
- </if>
- </target>
- <target name="check-current-build-defines">
- <if test="${not property::exists('current.build.defines.csc')}">
- <fail message="The current build defines for the csc task have not been specified." />
- </if>
- <if test="${not property::exists('current.build.defines.jsc')}">
- <fail message="The current build defines for the jsc task have not been specified." />
- </if>
- <if test="${not property::exists('current.build.defines.vbc')}">
- <fail message="The current build defines for the vbc task have not been specified." />
- </if>
- <if test="${not property::exists('current.build.defines.vjc')}">
- <fail message="The current build defines for the vjc task have not been specified." />
- </if>
- <if test="${not property::exists('current.build.defines.cl')}">
- <fail message="The current build defines for the cl task have not been specified." />
- </if>
- </target>
- <target name="check-current-sdkdoc-dir">
- <if test="${not property::exists('current.sdkdoc.dir')}">
- <fail message="The current sdk document directory has not been specified." />
- </if>
- <!--
- Temporarily disabled SDK generation through NAnt build
- <mkdir dir="${sdkdoc.dir}" />
- -->
- </target>
- <target name="check-current-sdkdoc-debug">
- <if test="${not property::exists('current.sdkdoc.debug')}">
- <fail message="The curernt sdk documentation debug setting has not been specified." />
- </if>
- </target>
- <target name="check-current-build-config">
- <if test="${not property::exists('current.build.config')}">
- <if test="${not property::exists('project.build.config')}">
- <fail message="The build configuration has not been specified and no default build configuration is available." />
- </if>
- <if test="${property::exists('project.build.config')}">
- <property name="current.build.config" value="${project.build.config}" />
- </if>
- </if>
- </target>
- <target name="check-log4net-basedir">
- <if test="${not property::exists('log4net.basedir')}">
- <fail message="The log4net base directory has not been specified." />
- </if>
- </target>
- <target name="check-log4net-output-dir">
- <if test="${not property::exists('log4net.output.dir')}">
- <fail message="The log4net output directory has not been specified." />
- </if>
- </target>
- <target name="check-log4net-assembly" depends="check-current-build-config, check-log4net-output-dir">
- <if test="${not file::exists(path::combine(log4net.output.dir, 'log4net.dll'))}">
- <fail message="The log4net '${current.build.config}' assembly for ${framework::get-description(framework::get-target-framework())} is not available." />
- </if>
- </target>
- <!-- Targets for cleaning up -->
- <target name="clean-current-bin-dir" depends="check-current-bin-dir" description="Cleans the current binaries directory">
- <echo message="Cleaning the ${current.bin.dir} binaries directory." />
- <delete dir="${current.bin.dir}/../oldkey" if="${directory::exists(current.bin.dir) and current.build.config.release}" />
- <delete dir="${current.bin.dir}" if="${directory::exists(current.bin.dir)}" />
- <mkdir dir="${current.bin.dir}" />
- </target>
- <target name="clean-current-sdkdoc-dir" depends="check-current-sdkdoc-dir" description="cleaning the current SDK documentation directory">
- <echo message="Cleaning the ${current.sdkdoc.dir} SDK documentation directory." />
- <!--
- Temporarily disabled SDK generation through NAnt build
- <delete dir="${current.sdkdoc.dir}" if="${directory::exists(current.sdkdoc.dir)}" />
- <mkdir dir="${current.sdkdoc.dir}" />
- -->
- </target>
- <!-- Targets for setting up the environment -->
- <target name="set-build-configuration" depends="check-current-build-config">
- <if test="${not target::exists('set-' + current.build.config + '-build-configuration')}">
- <fail message="The ${current.build.config} build configuration is not supported by log4net." />
- </if>
- <call target="set-${current.build.config}-build-configuration" />
- </target>
- <target name="set-debug-build-configuration">
- <property name="build.debug" value="true" />
- <property name="build.optimize" value="false" />
- <property name="build.defines.csc" value="DEBUG,TRACE" />
- <property name="build.defines.jsc" value="DEBUG,TRACE" />
- <property name="build.defines.vbc" value="DEBUG=True,TRACE=True" />
- <property name="build.defines.vjc" value="DEBUG,TRACE" />
- <property name="build.defines.cl" value="/D _DEBUG" />
- <property name="sdkdoc.debug" value="false" />
- <property name="current.build.config" value="debug" />
- <call target="set-build-configuration-flags" />
- </target>
- <target name="set-release-build-configuration">
- <property name="build.debug" value="PdbOnly" />
- <property name="build.optimize" value="true" />
- <property name="build.defines.csc" value="TRACE,STRONG" />
- <property name="build.defines.jsc" value="TRACE,STRONG" />
- <property name="build.defines.vbc" value="TRACE=True,STRONG=True" />
- <property name="build.defines.vjc" value="TRACE,STRONG" />
- <property name="build.defines.cl" value="/D STRONG" />
- <property name="sdkdoc.debug" value="false" />
- <property name="current.build.config" value="release" />
- <call target="set-build-configuration-flags" />
- </target>
- <target name="set-build-configuration-flags" depends="check-current-build-config">
- <property name="current.build.config.debug" value="false" />
- <property name="current.build.config.release" value="false" />
- <property name="current.build.config.${current.build.config}" value="true" />
- </target>
- <target name="set-framework-configuration" depends="check-current-build-config">
- <if test="${not target::exists('set-' + framework::get-target-framework() + '-runtime-configuration')}">
- <fail message="The current target framework (${framework::get-description(framework::get-target-framework())}) is not supported by log4net." />
- </if>
- <call target="set-${framework::get-target-framework()}-runtime-configuration" />
- </target>
- <target name="set-net-1.0-runtime-configuration" depends="check-bin-dir, check-sdkdoc-dir, check-sdkdoc-debug, check-current-build-config, check-build-debug, check-build-defines">
- <property name="nant.settings.currentframework" value="net-1.0" />
- <property name="current.build.debug" value="${build.debug}" dynamic="true" />
- <property name="current.build.optimize" value="${build.optimize}" dynamic="true" />
- <property name="current.build.defines.csc" value="${build.defines.csc},NET,NET_1_0" dynamic="true" />
- <property name="current.build.defines.jsc" value="${build.defines.jsc},NET,NET_1_0" dynamic="true" />
- <property name="current.build.defines.vbc" value="${build.defines.vbc},NET=True,NET_1_0=True" dynamic="true" />
- <property name="current.build.defines.vjc" value="${build.defines.vjc},NET,NET_1_0" dynamic="true" />
- <property name="current.build.defines.cl" value="${build.defines.cl} /D NET /D NET_1_0" dynamic="true" />
- <property name="current.bin.dir" value="${bin.dir}/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}" />
- <property name="current.sdkdoc.dir" value="${sdkdoc.dir}/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}" />
- <property name="current.sdkdoc.debug" value="${sdkdoc.debug}" dynamic="true" />
- </target>
- <target name="set-net-1.1-runtime-configuration" depends="check-bin-dir, check-sdkdoc-dir, check-sdkdoc-debug, check-current-build-config, check-build-debug, check-build-defines">
- <property name="nant.settings.currentframework" value="net-1.1" />
- <property name="current.build.debug" value="${build.debug}" dynamic="true" />
- <property name="current.build.optimize" value="${build.optimize}" dynamic="true" />
- <property name="current.build.defines.csc" value="${build.defines.csc},NET,NET_1_1" dynamic="true" />
- <property name="current.build.defines.jsc" value="${build.defines.jsc},NET,NET_1_1" dynamic="true" />
- <property name="current.build.defines.vbc" value="${build.defines.vbc},NET=True,NET_1_1=True" dynamic="true" />
- <property name="current.build.defines.vjc" value="${build.defines.vjc},NET,NET_1_1" dynamic="true" />
- <property name="current.build.defines.cl" value="${build.defines.cl} /D NET /D NET_1_1" dynamic="true" />
- <property name="current.bin.dir" value="${bin.dir}/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}" />
- <property name="current.sdkdoc.dir" value="${sdkdoc.dir}/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}" />
- <property name="current.sdkdoc.debug" value="${sdkdoc.debug}" dynamic="true" />
- </target>
- <target name="set-net-2.0-runtime-configuration" depends="check-bin-dir, check-sdkdoc-dir, check-sdkdoc-debug, check-current-build-config, check-build-debug, check-build-defines">
- <property name="nant.settings.currentframework" value="net-2.0" />
- <property name="current.build.debug" value="${build.debug}" dynamic="true" />
- <property name="current.build.optimize" value="${build.optimize}" dynamic="true" />
- <property name="current.build.defines.csc" value="${build.defines.csc},NET,NET_2_0" dynamic="true" />
- <property name="current.build.defines.jsc" value="${build.defines.jsc},NET,NET_2_0" dynamic="true" />
- <property name="current.build.defines.vbc" value="${build.defines.vbc},NET=True,NET_2_0=True" dynamic="true" />
- <property name="current.build.defines.vjc" value="${build.defines.vjc},NET,NET_2_0" dynamic="true" />
- <property name="current.build.defines.cl" value="${build.defines.cl} /D NET /D NET_2_0" dynamic="true" />
- <property name="current.bin.dir" value="${bin.dir}/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}" />
- <property name="current.sdkdoc.dir" value="${sdkdoc.dir}/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}" />
- <property name="current.sdkdoc.debug" value="${sdkdoc.debug}" dynamic="true" />
- </target>
- <!-- uses NET_2_0 defines plus NET_3_5 -->
- <target name="set-net-3.5-runtime-configuration" depends="check-bin-dir, check-sdkdoc-dir, check-sdkdoc-debug, check-current-build-config, check-build-debug, check-build-defines">
- <property name="nant.settings.currentframework" value="net-3.5" />
- <property name="current.build.debug" value="${build.debug}" dynamic="true" />
- <property name="current.build.optimize" value="${build.optimize}" dynamic="true" />
- <property name="current.build.defines.csc" value="${build.defines.csc},NET,NET_2_0,NET_3_5" dynamic="true" />
- <property name="current.build.defines.jsc" value="${build.defines.jsc},NET,NET_2_0,NET_3_5" dynamic="true" />
- <property name="current.build.defines.vbc" value="${build.defines.vbc},NET=True,NET_2_0=True,NET_3_5=True" dynamic="true" />
- <property name="current.build.defines.vjc" value="${build.defines.vjc},NET,NET_2_0,NET_3_5" dynamic="true" />
- <property name="current.build.defines.cl" value="${build.defines.cl} /D NET /D NET_2_0 /D NET_3_5" dynamic="true" />
- <property name="current.bin.dir" value="${bin.dir}/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}" />
- <property name="current.sdkdoc.dir" value="${sdkdoc.dir}/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}" />
- <property name="current.sdkdoc.debug" value="${sdkdoc.debug}" dynamic="true" />
- </target>
- <!-- uses NET_2_0 defines plus NET_3_5 and CLIENT_PROFILE-->
- <target name="set-net-3.5-cp-runtime-configuration" depends="check-bin-dir, check-sdkdoc-dir, check-sdkdoc-debug, check-current-build-config, check-build-debug, check-build-defines">
- <property name="nant.settings.currentframework" value="net-3.5" />
- <property name="current.build.debug" value="${build.debug}" dynamic="true" />
- <property name="current.build.optimize" value="${build.optimize}" dynamic="true" />
- <property name="current.build.defines.csc" value="${build.defines.csc},NET,NET_2_0,NET_3_5,CLIENT_PROFILE" dynamic="true" />
- <property name="current.build.defines.jsc" value="${build.defines.jsc},NET,NET_2_0,NET_3_5,CLIENT_PROFILE" dynamic="true" />
- <property name="current.build.defines.vbc" value="${build.defines.vbc},NET=True,NET_2_0=True,NET_3_5=True,CLIENT_PROFILE=True" dynamic="true" />
- <property name="current.build.defines.vjc" value="${build.defines.vjc},NET,NET_2_0,NET_3_5,CLIENT_PROFILE" dynamic="true" />
- <property name="current.build.defines.cl" value="${build.defines.cl} /D NET /D NET_2_0 /D NET_3_5 /D CLIENT_PROFILE" dynamic="true" />
- <property name="current.bin.dir" value="${bin.dir}/${framework::get-family(framework::get-target-framework())}-cp/${framework::get-version(framework::get-target-framework())}/${current.build.config}" />
- <property name="current.sdkdoc.dir" value="${sdkdoc.dir}/${framework::get-family(framework::get-target-framework())}-cp/${framework::get-version(framework::get-target-framework())}" />
- <property name="current.sdkdoc.debug" value="${sdkdoc.debug}" dynamic="true" />
- </target>
- <!-- uses NET_2_0 plus NET_4_0 defines -->
- <target name="set-net-4.0-runtime-configuration" depends="check-bin-dir, check-sdkdoc-dir, check-sdkdoc-debug, check-current-build-config, check-build-debug, check-build-defines">
- <property name="nant.settings.currentframework" value="net-4.0" />
- <property name="current.build.debug" value="${build.debug}" dynamic="true" />
- <property name="current.build.optimize" value="${build.optimize}" dynamic="true" />
- <property name="current.build.defines.csc" value="${build.defines.csc},NET,NET_2_0,NET_4_0" dynamic="true" />
- <property name="current.build.defines.jsc" value="${build.defines.jsc},NET,NET_2_0,NET_4_0" dynamic="true" />
- <property name="current.build.defines.vbc" value="${build.defines.vbc},NET=True,NET_2_0=True,NET_4_0=True" dynamic="true" />
- <property name="current.build.defines.vjc" value="${build.defines.vjc},NET,NET_2_0,NET_4_0" dynamic="true" />
- <property name="current.build.defines.cl" value="${build.defines.cl} /D NET /D NET_2_0 /D NET_4_0" dynamic="true" />
- <property name="current.bin.dir" value="${bin.dir}/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}" />
- <property name="current.sdkdoc.dir" value="${sdkdoc.dir}/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}" />
- <property name="current.sdkdoc.debug" value="${sdkdoc.debug}" dynamic="true" />
- </target>
- <!-- uses NET_2_0 plus NET_4_0 and CLIENT_PROFILE defines -->
- <target name="set-net-4.0-cp-runtime-configuration" depends="check-bin-dir, check-sdkdoc-dir, check-sdkdoc-debug, check-current-build-config, check-build-debug, check-build-defines">
- <property name="nant.settings.currentframework" value="net-4.0" />
- <property name="current.build.debug" value="${build.debug}" dynamic="true" />
- <property name="current.build.optimize" value="${build.optimize}" dynamic="true" />
- <property name="current.build.defines.csc" value="${build.defines.csc},NET,NET_2_0,NET_4_0,CLIENT_PROFILE" dynamic="true" />
- <property name="current.build.defines.jsc" value="${build.defines.jsc},NET,NET_2_0,NET_4_0,CLIENT_PROFILE" dynamic="true" />
- <property name="current.build.defines.vbc" value="${build.defines.vbc},NET=True,NET_2_0=True,NET_4_0=True,CLIENT_PROFILE=True" dynamic="true" />
- <property name="current.build.defines.vjc" value="${build.defines.vjc},NET,NET_2_0,NET_4_0,CLIENT_PROFILE" dynamic="true" />
- <property name="current.build.defines.cl" value="${build.defines.cl} /D NET /D NET_2_0 /D NET_4_0 /D CLIENT_PROFILE" dynamic="true" />
- <property name="current.bin.dir" value="${bin.dir}/${framework::get-family(framework::get-target-framework())}-cp/${framework::get-version(framework::get-target-framework())}/${current.build.config}" />
- <property name="current.sdkdoc.dir" value="${sdkdoc.dir}/${framework::get-family(framework::get-target-framework())}-cp/${framework::get-version(framework::get-target-framework())}" />
- <property name="current.sdkdoc.debug" value="${sdkdoc.debug}" dynamic="true" />
- </target>
- <!-- uses NET_4_0 plus NET_4_5 defines -->
- <target name="set-net-4.5-runtime-configuration" depends="check-bin-dir, check-sdkdoc-dir, check-sdkdoc-debug, check-current-build-config, check-build-debug, check-build-defines">
- <property name="nant.settings.currentframework" value="net-4.0" />
- <property name="current.build.debug" value="${build.debug}" dynamic="true" />
- <property name="current.build.optimize" value="${build.optimize}" dynamic="true" />
- <property name="current.build.defines.csc" value="${build.defines.csc},NET,NET_2_0,NET_4_0,NET_4_5" dynamic="true" />
- <property name="current.build.defines.jsc" value="${build.defines.jsc},NET,NET_2_0,NET_4_0,NET_4_5" dynamic="true" />
- <property name="current.build.defines.vbc" value="${build.defines.vbc},NET=True,NET_2_0=True,NET_4_0=True,NET_4_5=True" dynamic="true" />
- <property name="current.build.defines.vjc" value="${build.defines.vjc},NET,NET_2_0,NET_4_0,NET_4_5" dynamic="true" />
- <property name="current.build.defines.cl" value="${build.defines.cl} /D NET /D NET_2_0 /D NET_4_0 /D NET_4_5" dynamic="true" />
- <property name="current.bin.dir" value="${bin.dir}/${framework::get-family(framework::get-target-framework())}/4.5/${current.build.config}" />
- <property name="current.sdkdoc.dir" value="${sdkdoc.dir}/${framework::get-family(framework::get-target-framework())}/4.5" />
- <property name="current.sdkdoc.debug" value="${sdkdoc.debug}" dynamic="true" />
- </target>
- <target name="set-netcf-1.0-runtime-configuration" depends="check-bin-dir, check-sdkdoc-dir, check-sdkdoc-debug, check-current-build-config, check-build-debug, check-build-defines">
- <property name="nant.settings.currentframework" value="netcf-1.0" />
- <property name="current.build.debug" value="${build.debug}" dynamic="true" />
- <property name="current.build.optimize" value="${build.optimize}" dynamic="true" />
- <property name="current.build.defines.csc" value="${build.defines.csc},NETCF,NETCF_1_0" dynamic="true" />
- <property name="current.build.defines.jsc" value="${build.defines.jsc},NETCF,NETCF_1_0" dynamic="true" />
- <property name="current.build.defines.vbc" value="${build.defines.vbc},NETCF=True,NETCF_1_0=True" dynamic="true" />
- <property name="current.build.defines.vjc" value="${build.defines.vjc},NETCF,NETCF_1_0" dynamic="true" />
- <property name="current.build.defines.cl" value="${build.defines.cl} /D NETCF /D NETCF_1_0" dynamic="true" />
- <property name="current.bin.dir" value="${bin.dir}/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}" />
- <property name="current.sdkdoc.dir" value="${sdkdoc.dir}/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}" />
- <property name="current.sdkdoc.debug" value="${sdkdoc.debug}" dynamic="true" />
- </target>
- <target name="set-netcf-2.0-runtime-configuration" depends="check-bin-dir, check-sdkdoc-dir, check-sdkdoc-debug, check-current-build-config, check-build-debug, check-build-defines">
- <property name="nant.settings.currentframework" value="netcf-2.0" />
- <property name="current.build.debug" value="${build.debug}" dynamic="true" />
- <property name="current.build.optimize" value="${build.optimize}" dynamic="true" />
- <property name="current.build.defines.csc" value="${build.defines.csc},NETCF,NETCF_2_0" dynamic="true" />
- <property name="current.build.defines.jsc" value="${build.defines.jsc},NETCF,NETCF_2_0" dynamic="true" />
- <property name="current.build.defines.vbc" value="${build.defines.vbc},NETCF=True,NETCF_2_0=True" dynamic="true" />
- <property name="current.build.defines.vjc" value="${build.defines.vjc},NETCF,NETCF_2_0" dynamic="true" />
- <property name="current.build.defines.cl" value="${build.defines.cl} /D NETCF /D NETCF_2_0" dynamic="true" />
- <property name="current.bin.dir" value="${bin.dir}/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}" />
- <property name="current.sdkdoc.dir" value="${sdkdoc.dir}/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}" />
- <property name="current.sdkdoc.debug" value="${sdkdoc.debug}" dynamic="true" />
- </target>
- <target name="set-mono-1.0-runtime-configuration" depends="check-bin-dir, check-sdkdoc-dir, check-sdkdoc-debug, check-current-build-config, check-build-debug, check-build-defines">
- <property name="nant.settings.currentframework" value="mono-1.0" />
- <property name="current.build.debug" value="${build.debug}" dynamic="true" />
- <property name="current.build.optimize" value="${build.optimize}" dynamic="true" />
- <property name="current.build.defines.csc" value="${build.defines.csc},MONO,MONO_1_0" dynamic="true" />
- <property name="current.build.defines.jsc" value="${build.defines.jsc},MONO,MONO_1_0" dynamic="true" />
- <property name="current.build.defines.vbc" value="${build.defines.vbc},MONO=True,MONO_1_0=True" dynamic="true" />
- <property name="current.build.defines.vjc" value="${build.defines.vjc},MONO,MONO_1_0" dynamic="true" />
- <property name="current.build.defines.cl" value="${build.defines.cl} /D MONO /D MONO_1_0" dynamic="true" />
- <property name="current.bin.dir" value="${bin.dir}/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}" />
- <property name="current.sdkdoc.dir" value="${sdkdoc.dir}/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}" />
- <property name="current.sdkdoc.debug" value="${sdkdoc.debug}" dynamic="true" />
- </target>
- <target name="set-mono-2.0-runtime-configuration" depends="check-bin-dir, check-sdkdoc-dir, check-sdkdoc-debug, check-current-build-config, check-build-debug, check-build-defines">
- <property name="nant.settings.currentframework" value="mono-2.0" />
- <property name="current.build.debug" value="${build.debug}" dynamic="true" />
- <property name="current.build.optimize" value="${build.optimize}" dynamic="true" />
- <property name="current.build.defines.csc" value="${build.defines.csc},MONO,MONO_2_0" dynamic="true" />
- <property name="current.build.defines.jsc" value="${build.defines.jsc},MONO,MONO_2_0" dynamic="true" />
- <property name="current.build.defines.vbc" value="${build.defines.vbc},MONO=True,MONO_2_0=True" dynamic="true" />
- <property name="current.build.defines.vjc" value="${build.defines.vjc},MONO,MONO_2_0" dynamic="true" />
- <property name="current.build.defines.cl" value="${build.defines.cl} /D MONO /D MONO_2_0" dynamic="true" />
- <property name="current.bin.dir" value="${bin.dir}/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}" />
- <property name="current.sdkdoc.dir" value="${sdkdoc.dir}/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}" />
- <property name="current.sdkdoc.debug" value="${sdkdoc.debug}" dynamic="true" />
- </target>
- <target name="set-mono-3.5-runtime-configuration" depends="check-bin-dir, check-sdkdoc-dir, check-sdkdoc-debug, check-current-build-config, check-build-debug, check-build-defines">
- <property name="nant.settings.currentframework" value="mono-3.5" />
- <property name="current.build.debug" value="${build.debug}" dynamic="true" />
- <property name="current.build.optimize" value="${build.optimize}" dynamic="true" />
- <property name="current.build.defines.csc" value="${build.defines.csc},MONO,MONO_2_0" dynamic="true" />
- <property name="current.build.defines.jsc" value="${build.defines.jsc},MONO,MONO_2_0" dynamic="true" />
- <property name="current.build.defines.vbc" value="${build.defines.vbc},MONO=True,MONO_2_0=True" dynamic="true" />
- <property name="current.build.defines.vjc" value="${build.defines.vjc},MONO,MONO_2_0" dynamic="true" />
- <property name="current.build.defines.cl" value="${build.defines.cl} /D MONO /D MONO_2_0" dynamic="true" />
- <property name="current.bin.dir" value="${bin.dir}/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}" />
- <property name="current.sdkdoc.dir" value="${sdkdoc.dir}/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}" />
- <property name="current.sdkdoc.debug" value="${sdkdoc.debug}" dynamic="true" />
- </target>
- <target name="set-mono-4.0-runtime-configuration" depends="check-bin-dir, check-sdkdoc-dir, check-sdkdoc-debug, check-current-build-config, check-build-debug, check-build-defines">
- <property name="nant.settings.currentframework" value="mono-4.0" />
- <property name="current.build.debug" value="${build.debug}" dynamic="true" />
- <property name="current.build.optimize" value="${build.optimize}" dynamic="true" />
- <property name="current.build.defines.csc" value="${build.defines.csc},MONO,MONO_2_0,MONO_4_0" dynamic="true" />
- <property name="current.build.defines.jsc" value="${build.defines.jsc},MONO,MONO_2_0,MONO_4_0" dynamic="true" />
- <property name="current.build.defines.vbc" value="${build.defines.vbc},MONO=True,MONO_2_0=True,MONO_4_0=True" dynamic="true" />
- <property name="current.build.defines.vjc" value="${build.defines.vjc},MONO,MONO_2_0,MONO_4_0" dynamic="true" />
- <property name="current.build.defines.cl" value="${build.defines.cl} /D MONO /D MONO_2_0 /D MONO_4_0" dynamic="true" />
- <property name="current.bin.dir" value="${bin.dir}/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}" />
- <property name="current.sdkdoc.dir" value="${sdkdoc.dir}/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}" />
- <property name="current.sdkdoc.debug" value="${sdkdoc.debug}" dynamic="true" />
- </target>
- <target name="set-sscli-1.0-runtime-configuration" depends="check-bin-dir, check-sdkdoc-dir, check-sdkdoc-debug, check-current-build-config, check-build-debug, check-build-defines">
- <property name="nant.settings.currentframework" value="sscli-1.0" />
- <property name="current.build.debug" value="${build.debug}" dynamic="true" />
- <property name="current.build.optimize" value="${build.optimize}" dynamic="true" />
- <property name="current.build.defines.csc" value="${build.defines.csc},SSCLI,SSCLI_1_0" dynamic="true" />
- <property name="current.build.defines.jsc" value="${build.defines.jsc},SSCLI,SSCLI_1_0" dynamic="true" />
- <property name="current.build.defines.vbc" value="${build.defines.vbc},SSCLI=True,SSCLI_1_0=True" dynamic="true" />
- <property name="current.build.defines.vjc" value="${build.defines.vjc},SSCLI,SSCLI_1_0" dynamic="true" />
- <property name="current.build.defines.cl" value="${build.defines.cl} /D SSCLI /D SSCLI_1_0" dynamic="true" />
- <property name="current.bin.dir" value="${bin.dir}/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}/${current.build.config}" />
- <property name="current.sdkdoc.dir" value="${sdkdoc.dir}/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}" />
- <property name="current.sdkdoc.debug" value="${sdkdoc.debug}" dynamic="true" />
- </target>
- <target name="set-cli-1.0-configuration" depends="check-bin-dir">
- <property name="nant.settings.currentframework" value="net-1.0" />
- <property name="current.build.debug" value="${build.debug}" dynamic="true" />
- <property name="current.build.optimize" value="${build.optimize}" dynamic="true" />
- <property name="current.build.defines.csc" value="${build.defines.csc},CLI,CLI_1_0" dynamic="true" />
- <property name="current.build.defines.jsc" value="${build.defines.jsc},CLI,CLI_1_0" dynamic="true" />
- <property name="current.build.defines.vbc" value="${build.defines.vbc},CLI=True,CLI_1_0=True" dynamic="true" />
- <property name="current.build.defines.vjc" value="${build.defines.vjc},CLI,CLI_1_0" dynamic="true" />
- <property name="current.build.defines.cl" value="${build.defines.cl} /D CLI /D CLI_1_0" dynamic="true" />
- <property name="current.bin.dir" value="${bin.dir}/cli/1.0/${current.build.config}" />
- <property name="current.sdkdoc.dir" value="${sdkdoc.dir}" />
- <property name="current.sdkdoc.debug" value="${sdkdoc.debug}" dynamic="true" />
- </target>
-</project>
diff --git a/log4net.shfbproj b/log4net.shfbproj
deleted file mode 100644
index ac37fbb..0000000
--- a/log4net.shfbproj
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
- <PropertyGroup>
- <!-- The configuration and platform will be used to determine which
- assemblies to include from solution and project documentation
- sources -->
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{18040100-bf45-4b3e-9265-9dc4b14c17ec}</ProjectGuid>
- <SHFBSchemaVersion>2015.6.5.0</SHFBSchemaVersion>
- <!-- AssemblyName, Name, and RootNamespace are not used by SHFB but Visual
- Studio adds them anyway -->
- <AssemblyName>Documentation</AssemblyName>
- <RootNamespace>Documentation</RootNamespace>
- <Name>Documentation</Name>
- <!-- SHFB properties -->
- <FrameworkVersion>.NET Framework 3.5</FrameworkVersion>
- <OutputPath>doc\sdk\net\4.0\</OutputPath>
- <HtmlHelpName>log4net-sdk-2.0.17</HtmlHelpName>
- <Language>en-US</Language>
- <SyntaxFilters>Standard</SyntaxFilters>
- <SdkLinkTarget>Blank</SdkLinkTarget>
- <RootNamespaceContainer>False</RootNamespaceContainer>
- <PresentationStyle>VS2010</PresentationStyle>
- <Preliminary>False</Preliminary>
- <NamingMethod>MemberName</NamingMethod>
- <HelpTitle>Apache log4net™ SDK Documentation</HelpTitle>
- <CopyrightText>Copyright 2004-2017 The Apache Software Foundation</CopyrightText>
- <CopyrightHref>http://logging.apache.org/log4net/</CopyrightHref>
- <ContentPlacement>AboveNamespaces</ContentPlacement>
- <DocumentationSources>
- <DocumentationSource sourceFile="bin\net\4.0\release\log4net.dll" xmlns="" />
- <DocumentationSource sourceFile="bin\net\4.0\release\log4net.xml" xmlns="" />
- </DocumentationSources>
- <BuildAssemblerVerbosity>OnlyWarningsAndErrors</BuildAssemblerVerbosity>
- <HelpFileFormat>HtmlHelp1, Website</HelpFileFormat>
- <IndentHtml>False</IndentHtml>
- <KeepLogFile>True</KeepLogFile>
- <DisableCodeBlockComponent>False</DisableCodeBlockComponent>
- <CppCommentsFixup>False</CppCommentsFixup>
- <CleanIntermediates>True</CleanIntermediates>
- <FooterText>Apache log4net, Apache and log4net are trademarks of The Apache Software Foundation.</FooterText>
- <MissingTags>Summary, Parameter, Returns, AutoDocumentCtors, TypeParameter, AutoDocumentDispose</MissingTags>
- <FeedbackEMailAddress>http://logging.apache.org/log4net/mail-lists.html</FeedbackEMailAddress>
- <WebsiteSdkLinkType>Msdn</WebsiteSdkLinkType>
- <HtmlSdkLinkType>Msdn</HtmlSdkLinkType>
- <IncludeFavorites>False</IncludeFavorites>
- <BinaryTOC>True</BinaryTOC>
- <SaveComponentCacheCapacity>100</SaveComponentCacheCapacity>
- <HelpFileVersion>1.0.0.0</HelpFileVersion>
- <MaximumGroupParts>2</MaximumGroupParts>
- <NamespaceGrouping>False</NamespaceGrouping>
- </PropertyGroup>
- <!-- There are no properties for these groups. AnyCPU needs to appear in
- order for Visual Studio to perform the build. The others are optional
- common platform types that may appear. -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|Win32' ">
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|Win32' ">
- </PropertyGroup>
- <!-- Import the SHFB build targets -->
- <Import Project="$(SHFBROOT)\SandcastleHelpFileBuilder.targets" />
-</Project>
diff --git a/netstandard/global.json b/netstandard/global.json
deleted file mode 100644
index 200ddfd..0000000
--- a/netstandard/global.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "projects": [ "log4net", "log4net.tests" ]
-}
diff --git a/netstandard/log4net.netstandard.sln b/netstandard/log4net.netstandard.sln
deleted file mode 100644
index d436d06..0000000
--- a/netstandard/log4net.netstandard.sln
+++ /dev/null
@@ -1,53 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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.
-#
-VisualStudioVersion = 14.0.25420.1
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "log4net", "log4net\log4net.xproj", "{00764202-B361-4BC8-A1B9-01D87F9D2D51}"
-EndProject
-Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "log4net.tests", "log4net.tests\log4net.tests.xproj", "{6A78D53B-C864-4316-AA00-F2EBFE975223}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4BB38D1C-1862-432B-881C-925714F7F997}"
- ProjectSection(SolutionItems) = preProject
- global.json = global.json
- nuget.config = nuget.config
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {00764202-B361-4BC8-A1B9-01D87F9D2D51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {00764202-B361-4BC8-A1B9-01D87F9D2D51}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {00764202-B361-4BC8-A1B9-01D87F9D2D51}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {00764202-B361-4BC8-A1B9-01D87F9D2D51}.Release|Any CPU.Build.0 = Release|Any CPU
- {6A78D53B-C864-4316-AA00-F2EBFE975223}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {6A78D53B-C864-4316-AA00-F2EBFE975223}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {6A78D53B-C864-4316-AA00-F2EBFE975223}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {6A78D53B-C864-4316-AA00-F2EBFE975223}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/netstandard/log4net.tests/ApplicationException.cs b/netstandard/log4net.tests/ApplicationException.cs
deleted file mode 100644
index 695eeb8..0000000
--- a/netstandard/log4net.tests/ApplicationException.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System;
-
-namespace log4net.Tests
-{
- public class ApplicationException : Exception
- {
- }
-}
diff --git a/netstandard/log4net.tests/CompatibilityExtensions.cs b/netstandard/log4net.tests/CompatibilityExtensions.cs
deleted file mode 100644
index 47ce22f..0000000
--- a/netstandard/log4net.tests/CompatibilityExtensions.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System;
-using System.IO;
-using System.Reflection;
-using System.Threading;
-
-namespace log4net
-{
- internal static class CompatibilityExtensions
- {
- public static void Close(this Mutex mutex) => mutex.Dispose();
- public static void Close(this Stream stream) => stream.Dispose();
- public static void Close(this StreamReader streamReader) => streamReader.Dispose();
-
- public static ConstructorInfo GetConstructor(this Type type, BindingFlags bindingAttr, object binder, Type[] types, object[] modifiers)
- {
- return type.GetConstructor(types);
- }
- }
-}
diff --git a/netstandard/log4net.tests/ExpectedExceptionAttribute.cs b/netstandard/log4net.tests/ExpectedExceptionAttribute.cs
deleted file mode 100644
index d51c05c..0000000
--- a/netstandard/log4net.tests/ExpectedExceptionAttribute.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-// https://github.com/nunit/nunit-csharp-samples/blob/master/ExpectedExceptionExample/ExpectedExceptionAttribute.cs
-
-using System;
-using NUnit.Framework.Interfaces;
-using NUnit.Framework.Internal;
-using NUnit.Framework.Internal.Commands;
-
-namespace NUnit.Framework
-{
- /// <summary>
- /// A simple ExpectedExceptionAttribute
- /// </summary>
- [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
- public class ExpectedExceptionAttribute : NUnitAttribute, IWrapTestMethod
- {
- private readonly Type _expectedExceptionType;
-
- public ExpectedExceptionAttribute(Type type)
- {
- _expectedExceptionType = type;
- }
-
- public TestCommand Wrap(TestCommand command)
- {
- return new ExpectedExceptionCommand(command, _expectedExceptionType);
- }
-
- private class ExpectedExceptionCommand : DelegatingTestCommand
- {
- private readonly Type _expectedType;
-
- public ExpectedExceptionCommand(TestCommand innerCommand, Type expectedType)
- : base(innerCommand)
- {
- _expectedType = expectedType;
- }
-
- public override TestResult Execute(TestExecutionContext context)
- {
- Type caughtType = null;
-
- try
- {
- innerCommand.Execute(context);
- }
- catch (Exception ex)
- {
- if (ex is NUnitException)
- ex = ex.InnerException;
- caughtType = ex.GetType();
- }
-
- if (caughtType == _expectedType)
- context.CurrentResult.SetResult(ResultState.Success);
- else if (caughtType != null)
- context.CurrentResult.SetResult(ResultState.Failure,
- string.Format("Expected {0} but got {1}", _expectedType.Name, caughtType.Name));
- else
- context.CurrentResult.SetResult(ResultState.Failure,
- string.Format("Expected {0} but no exception was thrown", _expectedType.Name));
-
- return context.CurrentResult;
- }
- }
- }
-}
diff --git a/netstandard/log4net.tests/log4net.tests.xproj b/netstandard/log4net.tests/log4net.tests.xproj
deleted file mode 100644
index 92eecae..0000000
--- a/netstandard/log4net.tests/log4net.tests.xproj
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
- <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
- </PropertyGroup>
- <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
- <PropertyGroup Label="Globals">
- <ProjectGuid>6a78d53b-c864-4316-aa00-f2ebfe975223</ProjectGuid>
- <RootNamespace>log4net.tests</RootNamespace>
- <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
- <OutputPath Condition="'$(OutputPath)'=='' ">..\..\build\netstandard\</OutputPath>
- </PropertyGroup>
- <ItemGroup>
- <Compile Include="../../tests/src/*.cs" />
- <Compile Include="../../tests/src/Appender/AppenderCollectionTest.cs" />
- <Compile Include="../../tests/src/Appender/BufferingAppenderTest.cs" />
- <Compile Include="../../tests/src/Appender/CountingAppender.cs" />
- <Compile Include="../../tests/src/Appender/RollingFileAppenderTest.cs" />
- <Compile Include="../../tests/src/Appender/SmtpPickupDirAppenderTest.cs" />
- <Compile Include="../../tests/src/Appender/StringAppender.cs" />
- <Compile Include="../../tests/src/Appender/TraceAppenderTest.cs" />
- <Compile Include="../../tests/src/Context/LogicalThreadContextTest.cs" />
- <Compile Include="../../tests/src/Context/ThreadContextTest.cs" />
- <Compile Include="../../tests/src/Core/**/*.cs" />
- <Compile Include="../../tests/src/DateFormatter/**/*.cs" />
- <Compile Include="../../tests/src/Hierarchy/**/*.cs" />
- <Compile Include="../../tests/src/Layout/**/*.cs" />
- <Compile Include="../../tests/src/LoggerRepository/**/*.cs" />
- <Compile Include="../../tests/src/Util/CyclicBufferTest.cs" />
- <Compile Include="../../tests/src/Util/LogLogTest.cs" />
- <Compile Include="../../tests/src/Util/PatternConverterTest.cs" />
- <Compile Include="../../tests/src/Util/RandomStringPatternConverterTest.cs" />
- <Compile Include="../../tests/src/Util/SystemInfoTest.cs" />
- <Compile Include="../../tests/src/Util/TransformTest.cs" />
- </ItemGroup>
- <ItemGroup>
- <Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
- </ItemGroup>
- <PropertyGroup>
- <SchemaVersion>2.0</SchemaVersion>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
- <ProduceOutputsOnBuild>True</ProduceOutputsOnBuild>
- </PropertyGroup>
- <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
-</Project>
diff --git a/netstandard/log4net.tests/project.json b/netstandard/log4net.tests/project.json
deleted file mode 100644
index e5a3772..0000000
--- a/netstandard/log4net.tests/project.json
+++ /dev/null
@@ -1,45 +0,0 @@
-{
- "version": "2.0.9",
- "buildOptions": {
- "compile": [
- "../../tests/src/*.cs",
- "../../tests/src/Appender/AppenderCollectionTest.cs",
- "../../tests/src/Appender/BufferingAppenderTest.cs",
- "../../tests/src/Appender/CountingAppender.cs",
- "../../tests/src/Appender/MemoryAppenderTest.cs",
- "../../tests/src/Appender/RollingFileAppenderTest.cs",
- "../../tests/src/Appender/SmtpPickupDirAppenderTest.cs",
- "../../tests/src/Appender/StringAppender.cs",
- "../../tests/src/Appender/TraceAppenderTest.cs",
- "../../tests/src/Context/LogicalThreadContextTest.cs",
- "../../tests/src/Context/ThreadContextTest.cs",
- "../../tests/src/Core/**/*.cs",
- "../../tests/src/DateFormatter/**/*.cs",
- "../../tests/src/Hierarchy/**/*.cs",
- "../../tests/src/Layout/**/*.cs",
- "../../tests/src/LoggerRepository/**/*.cs",
- "../../tests/src/Util/CyclicBufferTest.cs",
- "../../tests/src/Util/LogLogTest.cs",
- "../../tests/src/Util/PatternConverterTest.cs",
- "../../tests/src/Util/RandomStringPatternConverterTest.cs",
- "../../tests/src/Util/SystemInfoTest.cs",
- "../../tests/src/Util/TransformTest.cs"
- ],
- "define": [ "NETSTANDARD1_3" ]
- },
- "frameworks": {
- "netcoreapp1.0": {
- "dependencies": {
- "Microsoft.NETCore.App": {
- "version": "1.0.0",
- "type": "platform"
- },
- "dotnet-test-nunit": "3.4.0-beta-2",
- "log4net": { "target": "project" },
- "NUnit": "3.4.1"
- },
- "imports": [ "portable-net45+win8" ]
- }
- },
- "testRunner": "nunit"
-}
diff --git a/netstandard/log4net/CompatibilityExtensions.cs b/netstandard/log4net/CompatibilityExtensions.cs
deleted file mode 100644
index c0a9076..0000000
--- a/netstandard/log4net/CompatibilityExtensions.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-#if NETSTANDARD1_3
-
-using System;
-using System.Globalization;
-using System.IO;
-using System.Linq;
-using System.Net;
-using System.Net.Sockets;
-using System.Reflection;
-using System.Threading;
-using System.Xml;
-
-namespace log4net
-{
- internal static class CompatibilityExtensions
- {
- public static void Close(this Mutex mutex) => mutex.Dispose();
- public static void Close(this Socket socket) => socket.Dispose();
- public static void Close(this Stream stream) => stream.Dispose();
- public static void Close(this StreamWriter streamWriter) => streamWriter.Dispose();
- public static void Close(this UdpClient client) => client.Dispose();
- public static void Close(this WebResponse response) => response.Dispose();
- public static void Close(this XmlWriter xmlWriter) => xmlWriter.Dispose();
-
- public static Attribute[] GetCustomAttributes(this Type type, Type other, bool inherit) => type.GetTypeInfo().GetCustomAttributes(other, inherit).ToArray();
- public static bool IsAssignableFrom(this Type type, Type other) => type.GetTypeInfo().IsAssignableFrom(other.GetTypeInfo());
- public static bool IsSubclassOf(this Type type, Type t) => type.GetTypeInfo().IsSubclassOf(t);
-
- public static string ToLower(this string s, CultureInfo cultureInfo) => cultureInfo.TextInfo.ToLower(s);
- public static string ToUpper(this string s, CultureInfo cultureInfo) => cultureInfo.TextInfo.ToUpper(s);
- }
-}
-
-#endif
diff --git a/netstandard/log4net/log4net.xproj b/netstandard/log4net/log4net.xproj
deleted file mode 100644
index 083a7a4..0000000
--- a/netstandard/log4net/log4net.xproj
+++ /dev/null
@@ -1,260 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
- <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
- </PropertyGroup>
- <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
- <PropertyGroup Label="Globals">
- <ProjectGuid>00764202-b361-4bc8-a1b9-01d87f9d2d51</ProjectGuid>
- <RootNamespace>log4net</RootNamespace>
- <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
- <OutputPath Condition="'$(OutputPath)'=='' ">..\..\build\netstandard\</OutputPath>
- </PropertyGroup>
- <ItemGroup>
- <Compile Include="*.cs" />
- <!--<Compile Include="../../src/Appender/AdoNetAppender.cs" />-->
- <Compile Include="../../src/Appender/AnsiColorTerminalAppender.cs" />
- <Compile Include="../../src/Appender/AppenderCollection.cs" />
- <Compile Include="../../src/Appender/AppenderSkeleton.cs" />
- <!--<Compile Include="../../src/Appender/AspNetTraceAppender.cs" />-->
- <Compile Include="../../src/Appender/BufferingAppenderSkeleton.cs" />
- <Compile Include="../../src/Appender/BufferingForwardingAppender.cs" />
- <!--<Compile Include="../../src/Appender/ColoredConsoleAppender.cs" />-->
- <Compile Include="../../src/Appender/ConsoleAppender.cs" />
- <Compile Include="../../src/Appender/DebugAppender.cs" />
- <!--<Compile Include="../../src/Appender/EventLogAppender.cs" />-->
- <Compile Include="../../src/Appender/FileAppender.cs" />
- <Compile Include="../../src/Appender/ForwardingAppender.cs" />
- <Compile Include="../../src/Appender/IAppender.cs" />
- <Compile Include="../../src/Appender/IBulkAppender.cs" />
- <Compile Include="../../src/Appender/LocalSyslogAppender.cs" />
- <Compile Include="../../src/Appender/ManagedColoredConsoleAppender.cs" />
- <Compile Include="../../src/Appender/MemoryAppender.cs" />
- <!--<Compile Include="../../src/Appender/NetSendAppender.cs" />-->
- <Compile Include="../../src/Appender/OutputDebugStringAppender.cs" />
- <Compile Include="../../src/Appender/RemoteSyslogAppender.cs" />
- <!--<Compile Include="../../src/Appender/RemotingAppender.cs" />-->
- <Compile Include="../../src/Appender/RollingFileAppender.cs" />
- <!--<Compile Include="../../src/Appender/SmtpAppender.cs" />-->
- <Compile Include="../../src/Appender/SmtpPickupDirAppender.cs" />
- <Compile Include="../../src/Appender/TelnetAppender.cs" />
- <Compile Include="../../src/Appender/TextWriterAppender.cs" />
- <Compile Include="../../src/Appender/TraceAppender.cs" />
- <Compile Include="../../src/Appender/UdpAppender.cs" />
- <Compile Include="../../src/AssemblyInfo.cs" />
- <Compile Include="../../src/AssemblyVersionInfo.cs" />
- <Compile Include="../../src/Config/AliasDomainAttribute.cs" />
- <Compile Include="../../src/Config/AliasRepositoryAttribute.cs" />
- <Compile Include="../../src/Config/BasicConfigurator.cs" />
- <Compile Include="../../src/Config/ConfiguratorAttribute.cs" />
- <Compile Include="../../src/Config/DomainAttribute.cs" />
- <!--<Compile Include="../../src/Config/DOMConfigurator.cs" />-->
- <Compile Include="../../src/Config/DOMConfiguratorAttribute.cs" />
- <!--<Compile Include="../../src/Config/Log4NetConfigurationSectionHandler.cs" />-->
- <Compile Include="../../src/Config/PluginAttribute.cs" />
- <Compile Include="../../src/Config/RepositoryAttribute.cs" />
- <Compile Include="../../src/Config/SecurityContextProviderAttribute.cs" />
- <Compile Include="../../src/Config/XmlConfigurator.cs" />
- <Compile Include="../../src/Config/XmlConfiguratorAttribute.cs" />
- <Compile Include="../../src/Core/CompactRepositorySelector.cs" />
- <Compile Include="../../src/Core/DefaultRepositorySelector.cs" />
- <Compile Include="../../src/Core/ErrorCode.cs" />
- <Compile Include="../../src/Core/ExceptionEvaluator.cs" />
- <Compile Include="../../src/Core/IAppenderAttachable.cs" />
- <Compile Include="../../src/Core/IErrorHandler.cs" />
- <Compile Include="../../src/Core/IFixingRequired.cs" />
- <Compile Include="../../src/Core/ILogger.cs" />
- <Compile Include="../../src/Core/ILoggerWrapper.cs" />
- <Compile Include="../../src/Core/IOptionHandler.cs" />
- <Compile Include="../../src/Core/IRepositorySelector.cs" />
- <Compile Include="../../src/Core/ITriggeringEventEvaluator.cs" />
- <Compile Include="../../src/Core/Level.cs" />
- <Compile Include="../../src/Core/LevelCollection.cs" />
- <Compile Include="../../src/Core/LevelEvaluator.cs" />
- <Compile Include="../../src/Core/LevelMap.cs" />
- <Compile Include="../../src/Core/LocationInfo.cs" />
- <Compile Include="../../src/Core/LogException.cs" />
- <Compile Include="../../src/Core/LoggerManager.cs" />
- <Compile Include="../../src/Core/LoggerWrapperImpl.cs" />
- <Compile Include="../../src/Core/LoggingEvent.cs" />
- <Compile Include="../../src/Core/LogImpl.cs" />
- <Compile Include="../../src/Core/MethodItem.cs" />
- <Compile Include="../../src/Core/SecurityContext.cs" />
- <Compile Include="../../src/Core/SecurityContextProvider.cs" />
- <Compile Include="../../src/Core/StackFrameItem.cs" />
- <Compile Include="../../src/Core/TimeEvaluator.cs" />
- <Compile Include="../../src/Core/WrapperMap.cs" />
- <Compile Include="../../src/DateFormatter/AbsoluteTimeDateFormatter.cs" />
- <Compile Include="../../src/DateFormatter/DateTimeDateFormatter.cs" />
- <Compile Include="../../src/DateFormatter/IDateFormatter.cs" />
- <Compile Include="../../src/DateFormatter/Iso8601DateFormatter.cs" />
- <Compile Include="../../src/DateFormatter/SimpleDateFormatter.cs" />
- <Compile Include="../../src/Filter/DenyAllFilter.cs" />
- <Compile Include="../../src/Filter/FilterDecision.cs" />
- <Compile Include="../../src/Filter/FilterSkeleton.cs" />
- <Compile Include="../../src/Filter/IFilter.cs" />
- <Compile Include="../../src/Filter/LevelMatchFilter.cs" />
- <Compile Include="../../src/Filter/LevelRangeFilter.cs" />
- <Compile Include="../../src/Filter/LoggerMatchFilter.cs" />
- <Compile Include="../../src/Filter/MdcFilter.cs" />
- <Compile Include="../../src/Filter/NdcFilter.cs" />
- <Compile Include="../../src/Filter/PropertyFilter.cs" />
- <Compile Include="../../src/Filter/StringMatchFilter.cs" />
- <Compile Include="../../src/GlobalContext.cs" />
- <Compile Include="../../src/ILog.cs" />
- <Compile Include="../../src/Layout/DynamicPatternLayout.cs" />
- <Compile Include="../../src/Layout/ExceptionLayout.cs" />
- <Compile Include="../../src/Layout/ILayout.cs" />
- <Compile Include="../../src/Layout/IRawLayout.cs" />
- <Compile Include="../../src/Layout/Layout2RawLayoutAdapter.cs" />
- <Compile Include="../../src/Layout/LayoutSkeleton.cs" />
- <Compile Include="../../src/Layout/PatternLayout.cs" />
- <Compile Include="../../src/Layout/Pattern/AppDomainPatternConverter.cs" />
- <!--<Compile Include="../../src/Layout/Pattern/AspNetCachePatternConverter.cs" />-->
- <!--<Compile Include="../../src/Layout/Pattern/AspNetContextPatternConverter.cs" />-->
- <!--<Compile Include="../../src/Layout/Pattern/AspNetPatternConverter.cs" />-->
- <!--<Compile Include="../../src/Layout/Pattern/AspNetRequestPatternConverter.cs" />-->
- <!--<Compile Include="../../src/Layout/Pattern/AspNetSessionPatternConverter.cs" />-->
- <Compile Include="../../src/Layout/Pattern/DatePatternConverter.cs" />
- <Compile Include="../../src/Layout/Pattern/ExceptionPatternConverter.cs" />
- <Compile Include="../../src/Layout/Pattern/FileLocationPatternConverter.cs" />
- <Compile Include="../../src/Layout/Pattern/FullLocationPatternConverter.cs" />
- <Compile Include="../../src/Layout/Pattern/IdentityPatternConverter.cs" />
- <Compile Include="../../src/Layout/Pattern/LevelPatternConverter.cs" />
- <Compile Include="../../src/Layout/Pattern/LineLocationPatternConverter.cs" />
- <Compile Include="../../src/Layout/Pattern/LoggerPatternConverter.cs" />
- <Compile Include="../../src/Layout/Pattern/MessagePatternConverter.cs" />
- <Compile Include="../../src/Layout/Pattern/MethodLocationPatternConverter.cs" />
- <Compile Include="../../src/Layout/Pattern/NamedPatternConverter.cs" />
- <Compile Include="../../src/Layout/Pattern/NdcPatternConverter.cs" />
- <Compile Include="../../src/Layout/Pattern/PatternLayoutConverter.cs" />
- <Compile Include="../../src/Layout/Pattern/PropertyPatternConverter.cs" />
- <Compile Include="../../src/Layout/Pattern/RelativeTimePatternConverter.cs" />
- <!--<Compile Include="../../src/Layout/Pattern/StackTraceDetailPatternConverter.cs" />-->
- <!--<Compile Include="../../src/Layout/Pattern/StackTracePatternConverter.cs" />-->
- <Compile Include="../../src/Layout/Pattern/ThreadPatternConverter.cs" />
- <Compile Include="../../src/Layout/Pattern/TypeNamePatternConverter.cs" />
- <Compile Include="../../src/Layout/Pattern/UserNamePatternConverter.cs" />
- <Compile Include="../../src/Layout/Pattern/UtcDatePatternConverter.cs" />
- <Compile Include="../../src/Layout/RawLayoutConverter.cs" />
- <Compile Include="../../src/Layout/RawPropertyLayout.cs" />
- <Compile Include="../../src/Layout/RawTimeStampLayout.cs" />
- <Compile Include="../../src/Layout/RawUtcTimeStampLayout.cs" />
- <Compile Include="../../src/Layout/SimpleLayout.cs" />
- <Compile Include="../../src/Layout/XmlLayout.cs" />
- <Compile Include="../../src/Layout/XmlLayoutBase.cs" />
- <Compile Include="../../src/Layout/XmlLayoutSchemaLog4j.cs" />
- <Compile Include="../../src/LogicalThreadContext.cs" />
- <Compile Include="../../src/LogManager.cs" />
- <Compile Include="../../src/MDC.cs" />
- <Compile Include="../../src/NDC.cs" />
- <Compile Include="../../src/ObjectRenderer/DefaultRenderer.cs" />
- <Compile Include="../../src/ObjectRenderer/IObjectRenderer.cs" />
- <Compile Include="../../src/ObjectRenderer/RendererMap.cs" />
- <Compile Include="../../src/Plugin/IPlugin.cs" />
- <Compile Include="../../src/Plugin/IPluginFactory.cs" />
- <Compile Include="../../src/Plugin/PluginCollection.cs" />
- <Compile Include="../../src/Plugin/PluginMap.cs" />
- <Compile Include="../../src/Plugin/PluginSkeleton.cs" />
- <!--<Compile Include="../../src/Plugin/RemoteLoggingServerPlugin.cs" />-->
- <Compile Include="../../src/Repository/ConfigurationChangedEventArgs.cs" />
- <Compile Include="../../src/Repository/Hierarchy\DefaultLoggerFactory.cs" />
- <Compile Include="../../src/Repository/Hierarchy\Hierarchy.cs" />
- <Compile Include="../../src/Repository/Hierarchy\ILoggerFactory.cs" />
- <Compile Include="../../src/Repository/Hierarchy\Logger.cs" />
- <Compile Include="../../src/Repository/Hierarchy\LoggerKey.cs" />
- <Compile Include="../../src/Repository/Hierarchy\ProvisionNode.cs" />
- <Compile Include="../../src/Repository/Hierarchy\RootLogger.cs" />
- <Compile Include="../../src/Repository/Hierarchy\XmlHierarchyConfigurator.cs" />
- <Compile Include="../../src/Repository/IBasicRepositoryConfigurator.cs" />
- <Compile Include="../../src/Repository/ILoggerRepository.cs" />
- <Compile Include="../../src/Repository/IXmlRepositoryConfigurator.cs" />
- <Compile Include="../../src/Repository/LoggerRepositorySkeleton.cs" />
- <Compile Include="../../src/ThreadContext.cs" />
- <Compile Include="../../src/Util/AppenderAttachedImpl.cs" />
- <Compile Include="../../src/Util/CompositeProperties.cs" />
- <Compile Include="../../src/Util/ContextPropertiesBase.cs" />
- <Compile Include="../../src/Util/ConverterInfo.cs" />
- <Compile Include="../../src/Util/CountingQuietTextWriter.cs" />
- <Compile Include="../../src/Util/CyclicBuffer.cs" />
- <Compile Include="../../src/Util/EmptyCollection.cs" />
- <Compile Include="../../src/Util/EmptyDictionary.cs" />
- <Compile Include="../../src/Util/FormattingInfo.cs" />
- <Compile Include="../../src/Util/GlobalContextProperties.cs" />
- <Compile Include="../../src/Util/ILogExtensions.cs" />
- <Compile Include="../../src/Util/LevelMapping.cs" />
- <Compile Include="../../src/Util/LevelMappingEntry.cs" />
- <Compile Include="../../src/Util/LogicalThreadContextProperties.cs" />
- <Compile Include="../../src/Util/LogicalThreadContextStack.cs" />
- <Compile Include="../../src/Util/LogicalThreadContextStacks.cs" />
- <Compile Include="../../src/Util/LogLog.cs" />
- <!--<Compile Include="../../src/Util/NativeError.cs" />-->
- <Compile Include="../../src/Util/NullDictionaryEnumerator.cs" />
- <Compile Include="../../src/Util/NullEnumerator.cs" />
- <Compile Include="../../src/Util/NullSecurityContext.cs" />
- <Compile Include="../../src/Util/OnlyOnceErrorHandler.cs" />
- <Compile Include="../../src/Util/OptionConverter.cs" />
- <Compile Include="../../src/Util/PatternConverter.cs" />
- <Compile Include="../../src/Util/PatternParser.cs" />
- <Compile Include="../../src/Util/PatternString.cs" />
- <Compile Include="../../src/Util/PatternStringConverters/AppDomainPatternConverter.cs" />
- <Compile Include="../../src/Util/PatternStringConverters/DatePatternConverter.cs" />
- <!--<Compile Include="../../src/Util/PatternStringConverters/EnvironmentFolderPathPatternConverter.cs" />-->
- <Compile Include="../../src/Util/PatternStringConverters/EnvironmentPatternConverter.cs" />
- <Compile Include="../../src/Util/PatternStringConverters/IdentityPatternConverter.cs" />
- <Compile Include="../../src/Util/PatternStringConverters/LiteralPatternConverter.cs" />
- <Compile Include="../../src/Util/PatternStringConverters/NewLinePatternConverter.cs" />
- <Compile Include="../../src/Util/PatternStringConverters/ProcessIdPatternConverter.cs" />
- <Compile Include="../../src/Util/PatternStringConverters/PropertyPatternConverter.cs" />
- <Compile Include="../../src/Util/PatternStringConverters/RandomStringPatternConverter.cs" />
- <Compile Include="../../src/Util/PatternStringConverters/UserNamePatternConverter.cs" />
- <Compile Include="../../src/Util/PatternStringConverters/UtcDatePatternConverter.cs" />
- <Compile Include="../../src/Util/PropertiesDictionary.cs" />
- <Compile Include="../../src/Util/PropertyEntry.cs" />
- <Compile Include="../../src/Util/ProtectCloseTextWriter.cs" />
- <Compile Include="../../src/Util/QuietTextWriter.cs" />
- <Compile Include="../../src/Util/ReaderWriterLock.cs" />
- <Compile Include="../../src/Util/ReadOnlyPropertiesDictionary.cs" />
- <Compile Include="../../src/Util/ReusableStringWriter.cs" />
- <Compile Include="../../src/Util/SystemInfo.cs" />
- <Compile Include="../../src/Util/SystemStringFormat.cs" />
- <Compile Include="../../src/Util/TextWriterAdapter.cs" />
- <Compile Include="../../src/Util/ThreadContextProperties.cs" />
- <Compile Include="../../src/Util/ThreadContextStack.cs" />
- <Compile Include="../../src/Util/ThreadContextStacks.cs" />
- <Compile Include="../../src/Util/Transform.cs" />
- <Compile Include="../../src/Util/TypeConverters/BooleanConverter.cs" />
- <Compile Include="../../src/Util/TypeConverters/ConversionNotSupportedException.cs" />
- <Compile Include="../../src/Util/TypeConverters/ConverterRegistry.cs" />
- <Compile Include="../../src/Util/TypeConverters/EncodingConverter.cs" />
- <Compile Include="../../src/Util/TypeConverters/IConvertFrom.cs" />
- <Compile Include="../../src/Util/TypeConverters/IConvertTo.cs" />
- <Compile Include="../../src/Util/TypeConverters/IPAddressConverter.cs" />
- <Compile Include="../../src/Util/TypeConverters/PatternLayoutConverter.cs" />
- <Compile Include="../../src/Util/TypeConverters/PatternStringConverter.cs" />
- <Compile Include="../../src/Util/TypeConverters/TypeConverter.cs" />
- <Compile Include="../../src/Util/TypeConverters/TypeConverterAttribute.cs" />
- <!--<Compile Include="../../src/Util/WindowsSecurityContext.cs" />-->
- </ItemGroup>
- <PropertyGroup>
- <SchemaVersion>2.0</SchemaVersion>
- </PropertyGroup>
- <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
-</Project>
diff --git a/netstandard/log4net/project.json b/netstandard/log4net/project.json
deleted file mode 100644
index e5fc4e3..0000000
--- a/netstandard/log4net/project.json
+++ /dev/null
@@ -1,70 +0,0 @@
-{
- "name": "log4net",
- "version": "2.0.9",
- "title": "Apache log4net for .NET Core",
- "copyright": "Copyright 2004-2017 The Apache Software Foundation.",
- "frameworks": {
- "netstandard1.3": {
- "buildOptions": {
- "compile": {
- "include": [ "*.cs", "../../src/**/*.cs" ],
- "exclude": [
- "../../src/Appender/AdoNetAppender.cs",
- "../../src/Appender/AspNetTraceAppender.cs",
- "../../src/Appender/ColoredConsoleAppender.cs",
- "../../src/Appender/EventLogAppender.cs",
- "../../src/Appender/NetSendAppender.cs",
- "../../src/Appender/RemotingAppender.cs",
- "../../src/Appender/SmtpAppender.cs",
- "../../src/Config/DOMConfigurator.cs",
- "../../src/Config/DOMConfiguratorAttribute.cs",
- "../../src/Config/Log4NetConfigurationSectionHandler.cs",
- "../../src/Layout/Pattern/AspNetCachePatternConverter.cs",
- "../../src/Layout/Pattern/AspNetContextPatternConverter.cs",
- "../../src/Layout/Pattern/AspNetPatternConverter.cs",
- "../../src/Layout/Pattern/AspNetRequestPatternConverter.cs",
- "../../src/Layout/Pattern/AspNetSessionPatternConverter.cs",
- "../../src/Layout/Pattern/StackTraceDetailPatternConverter.cs",
- "../../src/Layout/Pattern/StackTracePatternConverter.cs",
- "../../src/Plugin/RemoteLoggingServerPlugin.cs",
- "../../src/Util/PatternStringConverters/AppSettingPatternConverter.cs",
- "../../src/Util/PatternStringConverters/EnvironmentFolderPathPatternConverter.cs",
- "../../src/Util/NativeError.cs",
- "../../src/Util/WindowsSecurityContext.cs"
- ]
- },
- "define": [ "HAS_READERWRITERLOCKSLIM" ],
- "publicSign": true,
- "keyFile": "../../log4net.snk"
- },
- "dependencies": {
- "System.AppContext": "4.1.0",
- "System.Collections.NonGeneric": "4.0.1",
- "System.Console": "4.0.0",
- "System.Diagnostics.Debug": "4.0.11",
- "System.Diagnostics.Process": "4.1.0",
- "System.Diagnostics.StackTrace": "4.0.1",
- "System.Diagnostics.TraceSource": "4.0.0",
- "System.IO.FileSystem": "4.0.1",
- "System.IO.FileSystem.Watcher": "4.0.0",
- "System.Linq": "4.1.0",
- "System.Net.NameResolution": "4.0.0",
- "System.Net.Requests": "4.0.11",
- "System.Net.Sockets": "4.1.0",
- "System.Reflection": "4.3.0",
- "System.Reflection.Extensions": "4.0.1",
- "System.Reflection.TypeExtensions": "4.1.0",
- "System.Runtime.Extensions": "4.1.0",
- "System.Runtime.InteropServices": "4.1.0",
- "System.Runtime.InteropServices.RuntimeInformation": "4.0.0",
- "System.Runtime.Serialization.Formatters": "4.3.0",
- "System.Text.RegularExpressions": "4.1.0",
- "System.Threading": "4.0.11",
- "System.Threading.Thread": "4.0.0",
- "System.Threading.Timer": "4.0.1",
- "System.Xml.ReaderWriter": "4.0.11",
- "System.Xml.XmlDocument": "4.0.1"
- }
- }
- }
-}
diff --git a/package.json b/package.json
index 443bab2..44a2596 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "log4net",
- "version": "2.0.12",
+ "version": "3.0.0",
"description": "Log4Net is a logging framework for .NET",
"scripts": {
"test": "run-s clean-build test-dotnet run-dotnet-core-tests",
@@ -23,7 +23,7 @@
},
"repository": {
"type": "git",
- "url": "git+ssh://git@github.com/fluffynuts/logging-log4net.git"
+ "url": "git+ssh://git@github.com/apache/logging-log4net.git"
},
"author": "",
"license": "Apache-2.0",
diff --git a/rat.excludesFile b/rat.excludesFile
index ffffc78..32ca3fb 100644
--- a/rat.excludesFile
+++ b/rat.excludesFile
@@ -1,5 +1,7 @@
rat.excludesFile
+.editorconfig
**/*.suo
+**/*.sln
**/*.user
**/*.yml
**/*.yaml
@@ -13,6 +15,7 @@
**/*.config
**/*.log
**/*.targets
+**/*.bin
**/GeneratedAssemblyInfo.cs
**/obj/**
**/bin/**
@@ -22,5 +25,6 @@
src/.idea/**
src/integration-testing/**
build/**
+build-tools/**
doc/**
src/site/**
\ No newline at end of file
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index 41fa9c9..6406a15 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -1,5 +1,7 @@
<Project>
<PropertyGroup>
<UseSharedCompilation>true</UseSharedCompilation>
+ <LangVersion>latest</LangVersion>
+ <Nullable>annotations</Nullable>
</PropertyGroup>
</Project>
diff --git a/src/integration-testing/log4net-611-lib/log4net-611-lib.csproj b/src/integration-testing/log4net-611-lib/log4net-611-lib.csproj
index 07a87a1..225c91a 100644
--- a/src/integration-testing/log4net-611-lib/log4net-611-lib.csproj
+++ b/src/integration-testing/log4net-611-lib/log4net-611-lib.csproj
@@ -5,7 +5,6 @@
<RootNamespace>log4net_611_lib</RootNamespace>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>disable</Nullable>
- <LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
diff --git a/src/integration-testing/log4net-611-main/log4net-611-main.csproj b/src/integration-testing/log4net-611-main/log4net-611-main.csproj
index a3474a3..644a522 100644
--- a/src/integration-testing/log4net-611-main/log4net-611-main.csproj
+++ b/src/integration-testing/log4net-611-main/log4net-611-main.csproj
@@ -2,11 +2,10 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
- <TargetFrameworks>net462;net6.0</TargetFrameworks>
+ <TargetFrameworks>net462;net8.0</TargetFrameworks>
<RootNamespace>log4net_611_main</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
- <LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
diff --git a/src/integration-testing/log4net-672/log4net-672.csproj b/src/integration-testing/log4net-672/log4net-672.csproj
index 5a134f9..7905ac1 100644
--- a/src/integration-testing/log4net-672/log4net-672.csproj
+++ b/src/integration-testing/log4net-672/log4net-672.csproj
@@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
- <TargetFramework>net6.0</TargetFramework>
+ <TargetFramework>net8.0</TargetFramework>
<RootNamespace>log4net_672</RootNamespace>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
diff --git a/src/integration-testing/log4net-673/log4net-673.csproj b/src/integration-testing/log4net-673/log4net-673.csproj
index a799926..d063a14 100644
--- a/src/integration-testing/log4net-673/log4net-673.csproj
+++ b/src/integration-testing/log4net-673/log4net-673.csproj
@@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
- <TargetFramework>net6.0</TargetFramework>
+ <TargetFramework>net8.0</TargetFramework>
<RootNamespace>log4net_673</RootNamespace>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>disable</Nullable>
diff --git a/src/integration-testing/log4net-681/log4net-681.csproj b/src/integration-testing/log4net-681/log4net-681.csproj
index 5abd45f..238e930 100644
--- a/src/integration-testing/log4net-681/log4net-681.csproj
+++ b/src/integration-testing/log4net-681/log4net-681.csproj
@@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
- <TargetFramework>net6.0</TargetFramework>
+ <TargetFramework>net8.0</TargetFramework>
<RootNamespace>log4net_681</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
diff --git a/src/log4net.Tests/Appender/AdoNet/Log4NetCommand.cs b/src/log4net.Tests/Appender/AdoNet/Log4NetCommand.cs
index 9cf82a8..f2fbfa4 100644
--- a/src/log4net.Tests/Appender/AdoNet/Log4NetCommand.cs
+++ b/src/log4net.Tests/Appender/AdoNet/Log4NetCommand.cs
@@ -22,25 +22,17 @@
using System;
using System.Data;
+#nullable enable
+
namespace log4net.Tests.Appender.AdoNet
{
public class Log4NetCommand : IDbCommand
{
- #region AdoNetAppender
-
- private static Log4NetCommand mostRecentInstance;
-
- private IDbTransaction transaction;
- private string commandText;
- private readonly IDataParameterCollection parameters;
- private CommandType commandType;
- private int executeNonQueryCount;
-
public Log4NetCommand()
{
- mostRecentInstance = this;
+ MostRecentInstance = this;
- parameters = new Log4NetParameterCollection();
+ Parameters = new Log4NetParameterCollection();
}
public void Dispose()
@@ -48,58 +40,35 @@
// empty
}
- public IDbTransaction Transaction
- {
- get { return transaction; }
- set { transaction = value; }
- }
+ public IDbTransaction? Transaction { get; set; }
public int ExecuteNonQuery()
{
- executeNonQueryCount++;
+ ExecuteNonQueryCount++;
return 0;
}
- public int ExecuteNonQueryCount
- {
- get { return executeNonQueryCount; }
- }
+ public int ExecuteNonQueryCount { get; private set; }
public IDbDataParameter CreateParameter()
{
return new Log4NetParameter();
}
- public string CommandText
- {
- get { return commandText; }
- set { commandText = value; }
- }
+#pragma warning disable CS8766 // Nullability of reference types in return type doesn't match implicitly implemented member (possibly because of nullability attributes).
+ public string? CommandText { get; set; }
+#pragma warning restore CS8766
- public CommandType CommandType
- {
- get { return commandType; }
- set { commandType = value; }
- }
+ public CommandType CommandType { get; set; }
public void Prepare()
{
// empty
}
- public IDataParameterCollection Parameters
- {
- get { return parameters; }
- }
+ public IDataParameterCollection Parameters { get; }
- public static Log4NetCommand MostRecentInstance
- {
- get { return mostRecentInstance; }
- }
-
- #endregion
-
- #region Not Implemented
+ public static Log4NetCommand? MostRecentInstance { get; private set; }
public void Cancel()
{
@@ -121,24 +90,22 @@
throw new NotImplementedException();
}
- public IDbConnection Connection
+ public IDbConnection? Connection
{
- get { throw new NotImplementedException(); }
- set { throw new NotImplementedException(); }
+ get => throw new NotImplementedException();
+ set => throw new NotImplementedException();
}
public int CommandTimeout
{
- get { throw new NotImplementedException(); }
- set { throw new NotImplementedException(); }
+ get => throw new NotImplementedException();
+ set => throw new NotImplementedException();
}
public UpdateRowSource UpdatedRowSource
{
- get { throw new NotImplementedException(); }
- set { throw new NotImplementedException(); }
+ get => throw new NotImplementedException();
+ set => throw new NotImplementedException();
}
-
- #endregion
}
}
diff --git a/src/log4net.Tests/Appender/AdoNet/Log4NetConnection.cs b/src/log4net.Tests/Appender/AdoNet/Log4NetConnection.cs
index cabcb0a..a03e352 100644
--- a/src/log4net.Tests/Appender/AdoNet/Log4NetConnection.cs
+++ b/src/log4net.Tests/Appender/AdoNet/Log4NetConnection.cs
@@ -22,40 +22,29 @@
using System;
using System.Data;
+#nullable enable
+
namespace log4net.Tests.Appender.AdoNet
{
public class Log4NetConnection : IDbConnection
{
- #region AdoNetAppender
-
- private static Log4NetConnection mostRecentInstance;
-
- private bool open;
- private string connectionString;
+ private bool _open;
public Log4NetConnection()
{
- mostRecentInstance = this;
+ MostRecentInstance = this;
}
public void Close()
{
- open = false;
+ _open = false;
}
- public ConnectionState State
- {
- get
- {
- return open ? ConnectionState.Open : ConnectionState.Closed;
- }
- }
+ public ConnectionState State => _open ? ConnectionState.Open : ConnectionState.Closed;
- public string ConnectionString
- {
- get { return connectionString; }
- set { connectionString = value; }
- }
+#pragma warning disable CS8766 // Nullability of reference types in return type doesn't match implicitly implemented member (possibly because of nullability attributes).
+ public string? ConnectionString { get; set; }
+#pragma warning restore CS8766
public IDbTransaction BeginTransaction()
{
@@ -69,17 +58,10 @@
public void Open()
{
- open = true;
+ _open = true;
}
- public static Log4NetConnection MostRecentInstance
- {
- get { return mostRecentInstance; }
- }
-
- #endregion
-
- #region Not Implemented
+ public static Log4NetConnection? MostRecentInstance { get; private set; }
public IDbTransaction BeginTransaction(IsolationLevel il)
{
@@ -91,21 +73,13 @@
throw new NotImplementedException();
}
- public int ConnectionTimeout
- {
- get { throw new NotImplementedException(); }
- }
+ public int ConnectionTimeout => throw new NotImplementedException();
- public string Database
- {
- get { throw new NotImplementedException(); }
- }
+ public string Database => throw new NotImplementedException();
public void Dispose()
{
throw new NotImplementedException();
}
-
- #endregion
}
}
diff --git a/src/log4net.Tests/Appender/AdoNet/Log4NetTransaction.cs b/src/log4net.Tests/Appender/AdoNet/Log4NetTransaction.cs
index ab415ae..ebe631f 100644
--- a/src/log4net.Tests/Appender/AdoNet/Log4NetTransaction.cs
+++ b/src/log4net.Tests/Appender/AdoNet/Log4NetTransaction.cs
@@ -22,12 +22,12 @@
using System;
using System.Data;
+#nullable enable
+
namespace log4net.Tests.Appender.AdoNet
{
public class Log4NetTransaction : IDbTransaction
{
- #region AdoNetAppender
-
public void Commit()
{
// empty
@@ -38,25 +38,13 @@
// empty
}
- #endregion
+ public IDbConnection Connection => throw new NotImplementedException();
- #region Not Implemented
-
- public IDbConnection Connection
- {
- get { throw new NotImplementedException(); }
- }
-
- public IsolationLevel IsolationLevel
- {
- get { throw new NotImplementedException(); }
- }
+ public IsolationLevel IsolationLevel => throw new NotImplementedException();
public void Dispose()
{
throw new NotImplementedException();
}
-
- #endregion
}
}
diff --git a/src/log4net.Tests/Appender/AdoNetAppenderTest.cs b/src/log4net.Tests/Appender/AdoNetAppenderTest.cs
index 1b4eedf..d7690c9 100644
--- a/src/log4net.Tests/Appender/AdoNetAppenderTest.cs
+++ b/src/log4net.Tests/Appender/AdoNetAppenderTest.cs
@@ -21,15 +21,10 @@
using System;
using System.Data;
-#if NETSTANDARD1_3
-using System.Reflection;
-#endif
using System.Xml;
using log4net.Appender;
using log4net.Config;
-#if !NETSTANDARD1_3
using log4net.Core;
-#endif
using log4net.Layout;
using log4net.Repository;
using log4net.Tests.Appender.AdoNet;
@@ -46,13 +41,11 @@
{
ILoggerRepository rep = LogManager.CreateRepository(Guid.NewGuid().ToString());
- AdoNetAppender adoNetAppender = new AdoNetAppender();
- adoNetAppender.BufferSize = -1;
-#if NETSTANDARD1_3
- adoNetAppender.ConnectionType = typeof(Log4NetConnection).AssemblyQualifiedName;
-#else
- adoNetAppender.ConnectionType = "log4net.Tests.Appender.AdoNet.Log4NetConnection";
-#endif
+ AdoNetAppender adoNetAppender = new AdoNetAppender
+ {
+ BufferSize = -1,
+ ConnectionType = typeof(Log4NetConnection).AssemblyQualifiedName!
+ };
adoNetAppender.ActivateOptions();
BasicConfigurator.Configure(rep, adoNetAppender);
@@ -70,13 +63,11 @@
int bufferSize = 5;
- AdoNetAppender adoNetAppender = new AdoNetAppender();
- adoNetAppender.BufferSize = bufferSize;
-#if NETSTANDARD1_3
- adoNetAppender.ConnectionType = typeof(Log4NetConnection).AssemblyQualifiedName;
-#else
- adoNetAppender.ConnectionType = "log4net.Tests.Appender.AdoNet.Log4NetConnection";
-#endif
+ AdoNetAppender adoNetAppender = new AdoNetAppender
+ {
+ BufferSize = bufferSize,
+ ConnectionType = typeof(Log4NetConnection).AssemblyQualifiedName!
+ };
adoNetAppender.ActivateOptions();
BasicConfigurator.Configure(rep, adoNetAppender);
@@ -92,12 +83,10 @@
Assert.AreEqual(bufferSize + 1, Log4NetCommand.MostRecentInstance.ExecuteNonQueryCount);
}
-#if !NETSTANDARD1_3
[Test]
public void WebsiteExample()
{
XmlDocument log4netConfig = new XmlDocument();
- #region Load log4netConfig
log4netConfig.LoadXml(@"
<log4net>
<appender name=""AdoNetAppender"" type=""log4net.Appender.AdoNetAppender"">
@@ -154,7 +143,6 @@
<appender-ref ref=""AdoNetAppender"" />
</root>
</log4net>");
- #endregion
ILoggerRepository rep = LogManager.CreateRepository(Guid.NewGuid().ToString());
XmlConfigurator.Configure(rep, log4netConfig["log4net"]);
@@ -187,7 +175,6 @@
public void BufferingWebsiteExample()
{
XmlDocument log4netConfig = new XmlDocument();
- #region Load log4netConfig
log4netConfig.LoadXml(@"
<log4net>
<appender name=""AdoNetAppender"" type=""log4net.Appender.AdoNetAppender"">
@@ -244,7 +231,6 @@
<appender-ref ref=""AdoNetAppender"" />
</root>
</log4net>");
- #endregion
ILoggerRepository rep = LogManager.CreateRepository(Guid.NewGuid().ToString());
XmlConfigurator.Configure(rep, log4netConfig["log4net"]);
@@ -276,13 +262,11 @@
param = (IDbDataParameter)command.Parameters["@exception"];
Assert.IsEmpty((string)param.Value);
}
-#endif
[Test]
public void NullPropertyXmlConfig()
{
XmlDocument log4netConfig = new XmlDocument();
- #region Load log4netConfig
log4netConfig.LoadXml(@"
<log4net>
<appender name=""AdoNetAppender"" type=""log4net.Appender.AdoNetAppender"">
@@ -304,7 +288,6 @@
<appender-ref ref=""AdoNetAppender"" />
</root>
</log4net>");
- #endregion
ILoggerRepository rep = LogManager.CreateRepository(Guid.NewGuid().ToString());
XmlConfigurator.Configure(rep, log4netConfig["log4net"]);
@@ -320,7 +303,7 @@
}
[Test]
- public void NullPropertyProgmaticConfig()
+ public void NullPropertyProgrammaticConfig()
{
AdoNetAppenderParameter productIdParam = new AdoNetAppenderParameter();
productIdParam.ParameterName = "@productId";
@@ -331,11 +314,7 @@
productIdParam.Layout = rawPropertyLayout;
AdoNetAppender appender = new AdoNetAppender();
-#if NETSTANDARD1_3
- appender.ConnectionType = typeof(Log4NetConnection).AssemblyQualifiedName;
-#else
- appender.ConnectionType = typeof(Log4NetConnection).FullName;
-#endif
+ appender.ConnectionType = typeof(Log4NetConnection).AssemblyQualifiedName;
appender.BufferSize = -1;
appender.CommandText = "INSERT INTO Log ([productId]) VALUES (@productId)";
appender.AddParameter(productIdParam);
@@ -354,4 +333,4 @@
Assert.AreEqual(DBNull.Value, param.Value);
}
}
-}
+}
\ No newline at end of file
diff --git a/src/log4net.Tests/Appender/DebugAppenderTest.cs b/src/log4net.Tests/Appender/DebugAppenderTest.cs
index 8cc2608..a92ccda 100644
--- a/src/log4net.Tests/Appender/DebugAppenderTest.cs
+++ b/src/log4net.Tests/Appender/DebugAppenderTest.cs
@@ -18,8 +18,7 @@
*
*/
-#if NET_2_0
-
+#if NET462_OR_GREATER
using System;
using System.Diagnostics;
using log4net.Appender;
@@ -56,9 +55,7 @@
ILog log = LogManager.GetLogger(rep.Name, GetType());
log.Debug("Message");
- Assert.AreEqual(
- null,
- categoryTraceListener.Category);
+ Assert.IsNull(categoryTraceListener.Category);
Assert.IsFalse(testErrHandler.ErrorOccured);
@@ -84,9 +81,7 @@
ILog log = LogManager.GetLogger(rep.Name, GetType());
log.Debug("Message");
- Assert.AreEqual(
- null,
- categoryTraceListener.Category);
+ Assert.IsNull(categoryTraceListener.Category);
Debug.Listeners.Remove(categoryTraceListener);
}
@@ -144,17 +139,11 @@
private class TestErrorHandler : IErrorHandler
{
- private bool m_errorOccured = false;
+ public bool ErrorOccured { get; private set; }
- public bool ErrorOccured
+ public void Error(string message, Exception? e, ErrorCode errorCode)
{
- get { return m_errorOccured; }
- }
- #region IErrorHandler Members
-
- public void Error(string message, Exception e, ErrorCode errorCode)
- {
- m_errorOccured = true;
+ ErrorOccured = true;
}
public void Error(string message, Exception e)
@@ -166,10 +155,7 @@
{
Error(message, null, ErrorCode.GenericFailure);
}
-
- #endregion
}
}
}
-
-#endif
+#endif
\ No newline at end of file
diff --git a/src/log4net.Tests/Appender/EventLogAppenderTest.cs b/src/log4net.Tests/Appender/EventLogAppenderTest.cs
index 63e7771..2339ad6 100644
--- a/src/log4net.Tests/Appender/EventLogAppenderTest.cs
+++ b/src/log4net.Tests/Appender/EventLogAppenderTest.cs
@@ -18,7 +18,7 @@
#endregion
// netstandard doesn't support EventLog
-#if NET_2_0
+#if NET462_OR_GREATER
using System.Diagnostics;
@@ -36,7 +36,7 @@
/// Used for internal unit testing the <see cref="EventLogAppender"/> class.
/// </remarks>
[TestFixture]
- public class EventLogAppenderTest
+ public sealed class EventLogAppenderTest
{
/// <summary>
/// Verifies that for each event log level, the correct system
@@ -51,55 +51,45 @@
Assert.AreEqual(
EventLogEntryType.Information,
- GetEntryType(eventAppender, Level.All));
+ eventAppender.GetEntryType(Level.All));
Assert.AreEqual(
EventLogEntryType.Information,
- GetEntryType(eventAppender, Level.Debug));
+ eventAppender.GetEntryType(Level.Debug));
Assert.AreEqual(
EventLogEntryType.Information,
- GetEntryType(eventAppender, Level.Info));
+ eventAppender.GetEntryType(Level.Info));
Assert.AreEqual(
EventLogEntryType.Warning,
- GetEntryType(eventAppender, Level.Warn));
+ eventAppender.GetEntryType(Level.Warn));
Assert.AreEqual(
EventLogEntryType.Error,
- GetEntryType(eventAppender, Level.Error));
+ eventAppender.GetEntryType(Level.Error));
Assert.AreEqual(
EventLogEntryType.Error,
- GetEntryType(eventAppender, Level.Fatal));
+ eventAppender.GetEntryType(Level.Fatal));
Assert.AreEqual(
EventLogEntryType.Error,
- GetEntryType(eventAppender, Level.Off));
+ eventAppender.GetEntryType(Level.Off));
}
/// <summary>
/// ActivateOption tries to create an event source if it doesn't exist but this is going to fail on more modern Windows versions unless the code is run with local administrator privileges.
/// </summary>
[Test]
- [Ignore("seems to require administrator privileges or a specific environent when run")]
+ [Ignore("seems to require administrator privileges or a specific environment when run")]
public void ActivateOptionsDisablesAppenderIfSourceDoesntExist()
{
EventLogAppender eventAppender = new EventLogAppender();
eventAppender.ActivateOptions();
Assert.AreEqual(Level.Off, eventAppender.Threshold);
}
-
- //
- // Helper functions to dig into the appender
- //
-
- private static EventLogEntryType GetEntryType(EventLogAppender appender, Level level)
- {
- return (EventLogEntryType)Utils.InvokeMethod(appender, "GetEntryType", level);
- }
-
}
}
-#endif // NET_2_0
+#endif // NET462_OR_GREATER
\ No newline at end of file
diff --git a/src/log4net.Tests/Appender/EventRaisingAppender.cs b/src/log4net.Tests/Appender/EventRaisingAppender.cs
index e9392ea..b7da0ef 100644
--- a/src/log4net.Tests/Appender/EventRaisingAppender.cs
+++ b/src/log4net.Tests/Appender/EventRaisingAppender.cs
@@ -19,60 +19,57 @@
*
*/
-#if !NET_2_0 && !MONO_2_0
-
using System;
namespace log4net.Tests.Appender
{
- /// <summary>
- /// Provides data for the <see cref="EventRaisingAppender.LoggingEventAppended"/> event.
- /// </summary>
- /// <seealso cref="System.EventArgs" />
- public class LoggingEventEventArgs : EventArgs
- {
- public log4net.Core.LoggingEvent LoggingEvent { get; private set; }
+ /// <summary>
+ /// Provides data for the <see cref="EventRaisingAppender.LoggingEventAppended"/> event.
+ /// </summary>
+ /// <seealso cref="System.EventArgs" />
+ public class LoggingEventEventArgs : EventArgs
+ {
+ public log4net.Core.LoggingEvent LoggingEvent { get; private set; }
- public LoggingEventEventArgs(log4net.Core.LoggingEvent loggingEvent)
- {
- if (loggingEvent == null) throw new ArgumentNullException("loggingEvent");
- LoggingEvent = loggingEvent;
- }
+ public LoggingEventEventArgs(log4net.Core.LoggingEvent loggingEvent)
+ {
+ if (loggingEvent == null) throw new ArgumentNullException("loggingEvent");
+ LoggingEvent = loggingEvent;
+ }
+ }
+
+ /// <summary>
+ /// A log4net appender that raises an event each time a logging event is appended
+ /// </summary>
+ /// <remarks>
+ /// This class is intended to provide a way for test code to inspect logging
+ /// events as they are generated.
+ /// </remarks>
+ public class EventRaisingAppender : log4net.Appender.IAppender
+ {
+ public event EventHandler<LoggingEventEventArgs> LoggingEventAppended;
+
+ protected void OnLoggingEventAppended(LoggingEventEventArgs e)
+ {
+ var loggingEventAppended = LoggingEventAppended;
+ if (loggingEventAppended != null)
+ {
+ loggingEventAppended(this, e);
+ }
}
- /// <summary>
- /// A log4net appender that raises an event each time a logging event is appended
- /// </summary>
- /// <remarks>
- /// This class is intended to provide a way for test code to inspect logging
- /// events as they are generated.
- /// </remarks>
- public class EventRaisingAppender : log4net.Appender.IAppender
+ public void Close()
{
- public event EventHandler<LoggingEventEventArgs> LoggingEventAppended;
-
- protected void OnLoggingEventAppended(LoggingEventEventArgs e)
- {
- var loggingEventAppended = LoggingEventAppended;
- if (loggingEventAppended != null)
- {
- loggingEventAppended(this, e);
- }
- }
-
- public void Close()
- {
- }
-
- public void DoAppend(log4net.Core.LoggingEvent loggingEvent)
- {
- OnLoggingEventAppended(new LoggingEventEventArgs(loggingEvent));
- }
-
- public string Name
- {
- get; set;
- }
}
-}
-#endif
\ No newline at end of file
+
+ public void DoAppend(log4net.Core.LoggingEvent loggingEvent)
+ {
+ OnLoggingEventAppended(new LoggingEventEventArgs(loggingEvent));
+ }
+
+ public string Name
+ {
+ get; set;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/log4net.Tests/Appender/MemoryAppenderTest.cs b/src/log4net.Tests/Appender/MemoryAppenderTest.cs
index 7bb755b..9a6b0b2 100644
--- a/src/log4net.Tests/Appender/MemoryAppenderTest.cs
+++ b/src/log4net.Tests/Appender/MemoryAppenderTest.cs
@@ -19,8 +19,6 @@
*
*/
-#if NET_4_0 || MONO_3_5 || MONO_4_0 || NETSTANDARD
-
using System;
using System.Linq;
using System.Threading;
@@ -87,5 +85,4 @@
};
}
}
-}
-#endif
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/src/log4net.Tests/Appender/RecursiveLoggingTest.cs b/src/log4net.Tests/Appender/RecursiveLoggingTest.cs
index de0c196..56e54fb 100644
--- a/src/log4net.Tests/Appender/RecursiveLoggingTest.cs
+++ b/src/log4net.Tests/Appender/RecursiveLoggingTest.cs
@@ -19,7 +19,6 @@
*
*/
-#if !NET_2_0 && !MONO_2_0
using System;
using System.Globalization;
using log4net.Config;
@@ -28,53 +27,52 @@
namespace log4net.Tests.Appender
{
- [TestFixture]
- public class RecursiveLoggingTest
+ [TestFixture]
+ public class RecursiveLoggingTest
+ {
+ private EventRaisingAppender m_eventRaisingAppender;
+ private Repository.Hierarchy.Hierarchy m_hierarchy;
+ private int m_eventCount;
+ private ILogger m_logger;
+ private const int MaxRecursion = 3;
+
+ private void SetupRepository()
{
- private EventRaisingAppender m_eventRaisingAppender;
- private Repository.Hierarchy.Hierarchy m_hierarchy;
- private int m_eventCount;
- private ILogger m_logger;
- private const int MaxRecursion = 3;
+ m_hierarchy = new Repository.Hierarchy.Hierarchy();
- private void SetupRepository()
- {
- m_hierarchy = new Repository.Hierarchy.Hierarchy();
+ m_eventRaisingAppender = new EventRaisingAppender();
+ m_eventRaisingAppender.LoggingEventAppended += eventRaisingAppender_LoggingEventAppended;
- m_eventRaisingAppender = new EventRaisingAppender();
- m_eventRaisingAppender.LoggingEventAppended += eventRaisingAppender_LoggingEventAppended;
+ m_hierarchy.Root.Level = Level.All;
+ m_hierarchy.Root.AddAppender(m_eventRaisingAppender);
- m_hierarchy.Root.Level = Level.All;
- m_hierarchy.Root.AddAppender(m_eventRaisingAppender);
+ BasicConfigurator.Configure(m_hierarchy, m_eventRaisingAppender);
- BasicConfigurator.Configure(m_hierarchy, m_eventRaisingAppender);
-
- m_logger = m_hierarchy.GetLogger("test");
-
- }
-
- void eventRaisingAppender_LoggingEventAppended(object sender, LoggingEventEventArgs e)
- {
- if (m_eventCount < MaxRecursion && m_logger != null)
- {
- m_eventCount++;
- string message = String.Format(CultureInfo.CurrentCulture, "Log event {0} from EventRaisingAppender", m_eventCount);
- Console.WriteLine("Logging message: " + message);
- m_logger.Log(typeof(RecursiveLoggingTest), Level.Warn, message, null);
- }
- }
-
- [Test]
- public void TestAllowRecursiveLoggingFromAppender()
- {
- SetupRepository();
-
- m_eventCount = 0;
- m_logger.Log(typeof(RecursiveLoggingTest), Level.Warn, "Message logged", null);
-
- Assert.AreEqual(MaxRecursion, m_eventCount, "Expected MaxRecursion recursive calls");
- }
+ m_logger = m_hierarchy.GetLogger("test");
}
-}
-#endif
\ No newline at end of file
+
+ void eventRaisingAppender_LoggingEventAppended(object sender, LoggingEventEventArgs e)
+ {
+ if (m_eventCount < MaxRecursion && m_logger != null)
+ {
+ m_eventCount++;
+ string message = String.Format(CultureInfo.CurrentCulture, "Log event {0} from EventRaisingAppender", m_eventCount);
+ Console.WriteLine("Logging message: " + message);
+ m_logger.Log(typeof(RecursiveLoggingTest), Level.Warn, message, null);
+ }
+ }
+
+ [Test]
+ public void TestAllowRecursiveLoggingFromAppender()
+ {
+ SetupRepository();
+
+ m_eventCount = 0;
+ m_logger.Log(typeof(RecursiveLoggingTest), Level.Warn, "Message logged", null);
+
+ Assert.AreEqual(MaxRecursion, m_eventCount, "Expected MaxRecursion recursive calls");
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/src/log4net.Tests/Appender/RemotingAppenderTest.cs b/src/log4net.Tests/Appender/RemotingAppenderTest.cs
index 49a739f..511b221 100644
--- a/src/log4net.Tests/Appender/RemotingAppenderTest.cs
+++ b/src/log4net.Tests/Appender/RemotingAppenderTest.cs
@@ -17,11 +17,13 @@
//
#endregion
-// .NET Compact Framework 1.0 && netstandard has no support for System.Runtime.Remoting
-#if NET_2_0
+// netstandard has no support for System.Runtime.Remoting
+#if NET462_OR_GREATER
using System;
using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
using System.Reflection;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
@@ -47,7 +49,7 @@
[TestFixture]
public class RemotingAppenderTest
{
- private IChannel m_remotingChannel = null;
+ private IChannel? m_remotingChannel;
/// <summary>
/// Test that the Message property is correctly remoted
@@ -55,21 +57,20 @@
[Test]
public void TestRemotedMessage()
{
- // Setup the remoting appender
+ // Set up the remoting appender
ConfigureRootAppender(FixFlags.Partial);
RemoteLoggingSinkImpl.Instance.Reset();
- Logger root;
- root = ((Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).Root;
+ Logger root = ((Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).Root;
- string testMessage = string.Format("test message [ {0} ]", (new Random()).Next());
+ string testMessage = $"test message [ {(new Random()).Next()} ]";
// Log a message that will be remoted
root.Log(Level.Debug, testMessage, null);
// Wait for the remoted object to be delivered
- Thread.Sleep(2000);
+ WaitFor("Remote instance should have received all remoting events", () => RemoteLoggingSinkImpl.Instance.Events.Length > 0);
LoggingEvent[] events = RemoteLoggingSinkImpl.Instance.Events;
Assert.AreEqual(1, events.Length, "Expect to receive 1 remoted event");
@@ -83,27 +84,23 @@
[Test]
public void TestPartialFix()
{
- // Setup the remoting appender
+ // Set up the remoting appender
ConfigureRootAppender(FixFlags.Partial);
RemoteLoggingSinkImpl.Instance.Reset();
- Logger root;
- root = ((Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).Root;
+ Logger root = ((Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).Root;
// Log a message that will be remoted
root.Log(Level.Debug, "test message", null);
// Wait for the remoted object to be delivered
- Thread.Sleep(2000);
+ WaitFor("Remote instance should have received all remoting events", () => RemoteLoggingSinkImpl.Instance.Events.Length > 0);
LoggingEvent[] events = RemoteLoggingSinkImpl.Instance.Events;
Assert.AreEqual(1, events.Length, "Expect to receive 1 remoted event");
- // Grab the event data
- LoggingEventData eventData = GetLoggingEventData(events[0]);
-
- Assert.IsNull(eventData.LocationInfo, "Expect LocationInfo to be null because only doing a partial fix");
+ Assert.IsNull(events[0].LocationInfo, "Expect LocationInfo to be null because only doing a partial fix");
}
/// <summary>
@@ -112,31 +109,25 @@
[Test]
public void TestFullFix()
{
- // Setup the remoting appender
+ // Set up the remoting appender
ConfigureRootAppender(FixFlags.All);
RemoteLoggingSinkImpl.Instance.Reset();
- Logger root;
- root = ((Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).Root;
+ Logger root = ((Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).Root;
// Log a message that will be remoted
root.Log(Level.Debug, "test message", null);
// Wait for the remoted object to be delivered
- Thread.Sleep(5000);
-
WaitFor("Remote instance should have received a remoting event", () => RemoteLoggingSinkImpl.Instance.Events.Length > 0);
LoggingEvent[] events = RemoteLoggingSinkImpl.Instance.Events;
Assert.AreEqual(1, events.Length, "Expect to receive 1 remoted event");
- // Grab the event data
- LoggingEventData eventData = GetLoggingEventData(events[0]);
-
- Assert.IsNotNull(eventData.LocationInfo, "Expect LocationInfo to not be null because doing a full fix");
+ Assert.IsNotNull(events[0].LocationInfo, "Expect LocationInfo to not be null because doing a full fix");
}
- private void WaitFor(
+ private static void WaitFor(
string failMessage,
Func<bool> condition,
int maxWaitMilliseconds = 5000)
@@ -159,15 +150,14 @@
[Test]
public void TestRemotedMessageNdcPushPop()
{
- // Setup the remoting appender
+ // Set up the remoting appender
ConfigureRootAppender(FixFlags.Partial);
RemoteLoggingSinkImpl.Instance.Reset();
- Logger root;
- root = ((Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).Root;
+ Logger root = ((Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).Root;
- string testMessage = string.Format("test message [ {0} ]", (new Random()).Next());
+ string testMessage = $"test message [ {(new Random()).Next()} ]";
using (NDC.Push("value"))
{
@@ -177,7 +167,7 @@
root.Log(Level.Debug, testMessage, null);
// Wait for the remoted object to be delivered
- Thread.Sleep(2000);
+ WaitFor("Remote instance should have received all remoting events", () => RemoteLoggingSinkImpl.Instance.Events.Length > 0);
LoggingEvent[] events = RemoteLoggingSinkImpl.Instance.Events;
Assert.AreEqual(1, events.Length, "Expect to receive 1 remoted event");
@@ -188,58 +178,50 @@
[Test]
public void TestNestedNdc()
{
- // This test can suffer from timing and ordering issues as the RemotingAppender does dispatch events asynchronously
-
- // Setup the remoting appender
+ // Set up the remoting appender
ConfigureRootAppender(FixFlags.Partial);
RemoteLoggingSinkImpl.Instance.Reset();
- TestService t;
- t = new TestService();
+ var t = new TestService();
t.Test();
- // Wait for the remoted objects to be delivered
- Thread.Sleep(3000);
+ WaitFor("Remote instance should have received all remoting events", () => RemoteLoggingSinkImpl.Instance.Events.Length == 5);
LoggingEvent[] events = RemoteLoggingSinkImpl.Instance.Events;
- Assert.AreEqual(5, events.Length, "Expect to receive 5 remoted event");
- Assert.AreEqual("begin test", events[0].RenderedMessage, "Verify event 1 RenderedMessage");
- Assert.AreEqual("feature", events[1].RenderedMessage, "Verify event 2 RenderedMessage");
- Assert.AreEqual("return", events[2].RenderedMessage, "Verify event 3 RenderedMessage");
- Assert.AreEqual("return", events[3].RenderedMessage, "Verify event 4 RenderedMessage");
- Assert.AreEqual("end test", events[4].RenderedMessage, "Verify event 5 RenderedMessage");
+ // RemotingAppender dispatches events asynchronously, messages could be in any order.
+ LoggingEvent beingTest = events.First(e => e.RenderedMessage == "begin test");
+ Assert.IsNull(beingTest.Properties["NDC"], "Verify 'being test' event Properties");
- Assert.IsNull(events[0].Properties["NDC"], "Verify event 1 Properties");
- Assert.AreEqual("test1", events[1].Properties["NDC"], "Verify event 2 Properties");
- Assert.AreEqual("test1 test2", events[2].Properties["NDC"], "Verify event 3 Properties");
- Assert.AreEqual("test1", events[3].Properties["NDC"], "Verify event 4 Properties");
- Assert.IsNull(events[4].Properties["NDC"], "Verify event 5 Properties");
+ LoggingEvent feature = events.First(e => e.RenderedMessage == "feature");
+ Assert.AreEqual("test1", feature.Properties["NDC"], "Verify 'feature' event Properties");
+
+ LoggingEvent return1 = events.First(e => e.RenderedMessage == "return" && Equals(e.Properties["NDC"], "test1 test2"));
+
+ LoggingEvent return2 = events.First(e => e.RenderedMessage == "return" && Equals(e.Properties["NDC"], "test1"));
+
+ LoggingEvent endTest = events.First(e => e.RenderedMessage == "end test");
+ Assert.IsNull(endTest.Properties["NDC"], "Verify 'end test' event Properties");
}
-
private void RegisterRemotingServerChannel()
{
- if (m_remotingChannel == null)
+ if (m_remotingChannel is null)
{
BinaryClientFormatterSinkProvider clientSinkProvider = new BinaryClientFormatterSinkProvider();
BinaryServerFormatterSinkProvider serverSinkProvider = new BinaryServerFormatterSinkProvider();
serverSinkProvider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
- Hashtable channelProperties = new Hashtable();
+ var channelProperties = new Hashtable();
channelProperties["port"] = 8085;
m_remotingChannel = new TcpChannel(channelProperties, clientSinkProvider, serverSinkProvider);
// Setup remoting server
try
{
-#if NET_2_0 || MONO_2_0 || MONO_3_5 || MONO_4_0
ChannelServices.RegisterChannel(m_remotingChannel, false);
-#else
- ChannelServices.RegisterChannel(m_remotingChannel);
-#endif
}
catch (Exception ex)
{
@@ -289,7 +271,7 @@
[OneTimeTearDown]
public void UnregisterRemotingServerChannel()
{
- if (m_remotingChannel != null)
+ if (m_remotingChannel is not null)
{
((TcpChannel)m_remotingChannel).StopListening(null);
try
@@ -308,20 +290,21 @@
/// </summary>
private static void ConfigureRootAppender(FixFlags fixFlags)
{
- Logger root;
- root = ((Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).Root;
+ Logger root = ((Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).Root;
root.Level = Level.Debug;
root.AddAppender(CreateAppender(fixFlags));
- root.Repository.Configured = true;
+ root.Repository!.Configured = true;
}
private static RemotingAppender CreateAppender(FixFlags fixFlags)
{
- RemotingAppender appender = new RemotingAppender();
- appender.Sink = "tcp://localhost:8085/LoggingSink";
- appender.Lossy = false;
- appender.BufferSize = 1;
- appender.Fix = fixFlags;
+ var appender = new RemotingAppender
+ {
+ Sink = "tcp://localhost:8085/LoggingSink",
+ Lossy = false,
+ BufferSize = 1,
+ Fix = fixFlags
+ };
appender.ActivateOptions();
@@ -330,33 +313,25 @@
public class RemoteLoggingSinkImpl : MarshalByRefObject, RemotingAppender.IRemoteLoggingSink
{
- public static readonly RemoteLoggingSinkImpl Instance = new RemoteLoggingSinkImpl();
+ public static readonly RemoteLoggingSinkImpl Instance = new();
- private ArrayList m_events = new ArrayList();
+ private readonly List<LoggingEvent> m_events = new();
- #region Public Instance Constructors
private RemoteLoggingSinkImpl()
{
}
- #endregion Public Instance Constructors
- #region Implementation of IRemoteLoggingSink
/// <summary>
- /// Logs the events to to an internal buffer
+ /// Logs the events to an internal buffer.
/// </summary>
/// <param name="events">The events to log.</param>
/// <remarks>
- /// Logs the events to to an internal buffer. The logged events can
+ /// The logged events can
/// be retrieved via the <see cref="Events"/> property. To clear
/// the buffer call the <see cref="Reset"/> method.
/// </remarks>
- public void LogEvents(LoggingEvent[] events)
- {
- m_events.AddRange(events);
- }
- #endregion Implementation of IRemoteLoggingSink
+ public void LogEvents(LoggingEvent[] events) => m_events.AddRange(events);
- #region Override implementation of MarshalByRefObject
/// <summary>
/// Obtains a lifetime service object to control the lifetime
/// policy for this instance.
@@ -365,30 +340,14 @@
/// <c>null</c> to indicate that this instance should live
/// forever.
/// </returns>
- public override object InitializeLifetimeService()
+ public override object? InitializeLifetimeService()
{
return null;
}
- #endregion Override implementation of MarshalByRefObject
- public void Reset()
- {
- m_events.Clear();
- }
+ public void Reset() => m_events.Clear();
- public LoggingEvent[] Events
- {
- get { return (LoggingEvent[])m_events.ToArray(typeof(LoggingEvent)); }
- }
- }
-
- //
- // Helper functions to dig into the appender
- //
-
- private static LoggingEventData GetLoggingEventData(LoggingEvent loggingEvent)
- {
- return (LoggingEventData)Utils.GetField(loggingEvent, "m_data");
+ public LoggingEvent[] Events => m_events.ToArray();
}
}
}
@@ -399,14 +358,14 @@
{
public class TestService
{
- private static ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+ private static ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod()!.DeclaringType!);
public void Test()
{
log.Info("begin test");
Thread.Sleep(100);
- Feature f = new Feature();
+ var f = new Feature();
f.Test();
log.Info("end test");
Thread.Sleep(100);
@@ -420,7 +379,7 @@
{
public class Feature
{
- private static ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+ private static ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod()!.DeclaringType!);
public void Test()
{
@@ -429,7 +388,7 @@
log.Info("feature");
Thread.Sleep(100);
- Dal d = new Dal();
+ var d = new Dal();
d.Test();
log.Info("return");
Thread.Sleep(100);
@@ -444,7 +403,7 @@
{
public class Dal
{
- private static ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+ private static ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod()!.DeclaringType!);
public void Test()
{
@@ -457,4 +416,4 @@
}
}
-#endif // NET_2_0
\ No newline at end of file
+#endif // NET462_OR_GREATER
\ No newline at end of file
diff --git a/src/log4net.Tests/Appender/RollingFileAppenderTest.cs b/src/log4net.Tests/Appender/RollingFileAppenderTest.cs
index 101b390..2a6ddd3 100644
--- a/src/log4net.Tests/Appender/RollingFileAppenderTest.cs
+++ b/src/log4net.Tests/Appender/RollingFileAppenderTest.cs
@@ -20,7 +20,7 @@
#endregion
using System;
-using System.Collections;
+using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
@@ -33,13 +33,15 @@
using NUnit.Framework;
using System.Globalization;
+#nullable enable
+
namespace log4net.Tests.Appender
{
/// <summary>
/// Used for internal unit testing the <see cref="RollingFileAppender"/> class.
/// </summary>
[TestFixture]
- public class RollingFileAppenderTest
+ public sealed class RollingFileAppenderTest
{
private const string c_fileName = "test_41d3d834_4320f4da.log";
@@ -50,41 +52,46 @@
"012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678";
private const int c_iMaximumFileSize = 450; // in bytes
- private int _iMessagesLoggedThisFile = 0;
- private int _iMessagesLogged = 0;
- private int _iCountDirection = 0;
+ private int _iMessagesLoggedThisFile;
+ private int _iMessagesLogged;
+ private int _iCountDirection;
private int _MaxSizeRollBackups = 3;
- private CountingAppender _caRoot;
- private Logger _root;
-#if !NETSTANDARD1_3
- private CultureInfo _currentCulture;
- private CultureInfo _currentUICulture;
-#endif
- private class SilentErrorHandler : IErrorHandler
- {
- private StringBuilder m_buffer = new StringBuilder();
+ private CountingAppender? _caRoot;
+ private Logger? _root;
+ private CultureInfo? _currentCulture;
+ private CultureInfo? _currentUICulture;
- public string Message
- {
- get { return m_buffer.ToString(); }
- }
+ private sealed class SilentErrorHandler : IErrorHandler
+ {
+ private readonly StringBuilder m_buffer = new();
+
+ public string Message => m_buffer.ToString();
public void Error(string message)
{
- m_buffer.Append(message + "\n");
+ m_buffer.Append(message + '\n');
}
public void Error(string message, Exception e)
{
- m_buffer.Append(message + "\n" + e.Message + "\n");
+ m_buffer.Append(message + '\n' + e.Message + '\n');
}
- public void Error(string message, Exception e, ErrorCode errorCode)
+ public void Error(string message, Exception? e, ErrorCode errorCode)
{
- m_buffer.Append(message + "\n" + e.Message + "\n");
+ m_buffer.Append(message + '\n' + e?.Message + '\n');
}
}
+ private sealed class RollingFileAppenderForTest : RollingFileAppender
+ {
+ /// <summary>
+ /// Builds a list of filenames for all files matching the base filename plus a file pattern.
+ /// </summary>
+ internal new List<string> GetExistingFiles(string baseFilePath)
+ => base.GetExistingFiles(baseFilePath);
+ }
+
/// <summary>
/// Sets up variables used for the tests
/// </summary>
@@ -104,9 +111,9 @@
private static void ResetAndDeleteTestFiles()
{
// Regular users should not use the clear method lightly!
- Utils.GetRepository().ResetConfiguration();
- Utils.GetRepository().Shutdown();
- ((Repository.Hierarchy.Hierarchy)Utils.GetRepository()).Clear();
+ LogManager.GetRepository().ResetConfiguration();
+ LogManager.GetRepository().Shutdown();
+ ((Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).Clear();
DeleteTestFiles();
}
@@ -121,14 +128,12 @@
ResetAndDeleteTestFiles();
InitializeVariables();
-#if !NETSTANDARD1_3
// set correct thread culture
_currentCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
_currentUICulture = System.Threading.Thread.CurrentThread.CurrentUICulture;
System.Threading.Thread.CurrentThread.CurrentCulture =
System.Threading.Thread.CurrentThread.CurrentUICulture =
- System.Globalization.CultureInfo.InvariantCulture;
-#endif
+ CultureInfo.InvariantCulture;
}
/// <summary>
@@ -139,31 +144,18 @@
{
ResetAndDeleteTestFiles();
-#if !NETSTANDARD1_3
// restore previous culture
- System.Threading.Thread.CurrentThread.CurrentCulture = _currentCulture;
- System.Threading.Thread.CurrentThread.CurrentUICulture = _currentUICulture;
-#endif
+ System.Threading.Thread.CurrentThread.CurrentCulture = _currentCulture!;
+ System.Threading.Thread.CurrentThread.CurrentUICulture = _currentUICulture!;
}
/// <summary>
/// Finds the number of files that match the base file name,
/// and matches the result against an expected count
/// </summary>
- /// <param name="iExpectedCount"></param>
- private static void VerifyFileCount(int iExpectedCount)
+ private static void VerifyFileCount(int iExpectedCount, bool preserveLogFileNameExtension = false)
{
- VerifyFileCount(iExpectedCount, false);
- }
-
- /// <summary>
- /// Finds the number of files that match the base file name,
- /// and matches the result against an expected count
- /// </summary>
- /// <param name="iExpectedCount"></param>
- private static void VerifyFileCount(int iExpectedCount, bool preserveLogFileNameExtension)
- {
- ArrayList alFiles = GetExistingFiles(c_fileName, preserveLogFileNameExtension);
+ List<string> alFiles = GetExistingFiles(c_fileName, preserveLogFileNameExtension);
Assert.IsNotNull(alFiles);
Assert.AreEqual(iExpectedCount, alFiles.Count);
}
@@ -171,12 +163,11 @@
/// <summary>
/// Creates a file with the given number, and the shared base file name
/// </summary>
- /// <param name="iFileNumber"></param>
private static void CreateFile(int iFileNumber)
{
FileInfo fileInfo = new FileInfo(MakeFileName(c_fileName, iFileNumber));
- FileStream fileStream = null;
+ FileStream? fileStream = null;
try
{
fileStream = fileInfo.Create();
@@ -191,6 +182,7 @@
}
catch
{
+ // Ignore
}
}
}
@@ -212,7 +204,7 @@
[Test]
public void RollingCombinedWithPreserveExtension()
{
- _root = ((Repository.Hierarchy.Hierarchy)Utils.GetRepository()).Root;
+ _root = ((Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).Root;
_root.Level = Level.All;
PatternLayout patternLayout = new PatternLayout();
patternLayout.ActivateOptions();
@@ -231,7 +223,7 @@
roller.ActivateOptions();
_root.AddAppender(roller);
- _root.Repository.Configured = true;
+ _root.Repository!.Configured = true;
for (int i = 0; i < 1000; i++)
{
@@ -257,7 +249,7 @@
/// </summary>
private static void DeleteTestFiles()
{
- ArrayList alFiles = GetExistingFiles(c_fileName);
+ List<string> alFiles = GetExistingFiles(c_fileName);
alFiles.AddRange(GetExistingFiles(c_fileName, true));
foreach (string sFile in alFiles)
{
@@ -346,70 +338,51 @@
/// Used for test purposes, a table of these objects can be used to identify
/// any existing files and their expected length.
/// </summary>
- public class RollFileEntry
+ public sealed class RollFileEntry
{
/// <summary>
- /// Stores the name of the file
- /// </summary>
- private string m_fileName;
-
- /// <summary>
- /// The expected length of the file
- /// </summary>
- private long m_fileLength;
-
- /// <summary>
/// Default constructor
/// </summary>
public RollFileEntry()
- {
- }
+ { }
/// <summary>
/// Constructor used when the fileInfo and expected length are known
/// </summary>
- /// <param name="fileName"></param>
- /// <param name="fileLength"></param>
public RollFileEntry(string fileName, long fileLength)
{
- m_fileName = fileName;
- m_fileLength = fileLength;
+ FileName = fileName;
+ FileLength = fileLength;
}
/// <summary>
- /// Stores the name of the file
+ /// Gets the name of the file
/// </summary>
- public string FileName
- {
- get { return m_fileName; }
- }
+ public string? FileName { get; }
/// <summary>
/// The expected length of the file
/// </summary>
- public long FileLength
- {
- get { return m_fileLength; }
- }
+ public long FileLength { get; }
}
/// <summary>
/// Used for table-driven testing. This class holds information that can be used
/// for testing of file rolling.
/// </summary>
- public class RollConditions
+ public sealed class RollConditions
{
/// <summary>
/// A table of entries showing files that should exist and their expected sizes
/// before logging is called
/// </summary>
- private RollFileEntry[] m_preLogFileEntries;
+ private readonly RollFileEntry[] m_preLogFileEntries;
/// <summary>
/// A table of entries showing files that should exist and their expected sizes
/// after a message is logged
/// </summary>
- private RollFileEntry[] m_postLogFileEntries;
+ private readonly RollFileEntry[] m_postLogFileEntries;
/// <summary>
/// Constructor, taking all required parameters
@@ -441,7 +414,7 @@
}
}
- private static void VerifyExistenceAndRemoveFromList(ArrayList alExisting,
+ private static void VerifyExistenceAndRemoveFromList(List<string> alExisting,
string sFileName,
FileInfo file,
RollFileEntry entry)
@@ -460,36 +433,30 @@
/// <param name="fileEntries"></param>
private static void VerifyFileConditions(string sBaseFileName, RollFileEntry[] fileEntries)
{
- ArrayList alExisting = GetExistingFiles(sBaseFileName);
- if (null != fileEntries)
+ List<string> alExisting = GetExistingFiles(sBaseFileName);
+ // AssertEquals( "File count mismatch", alExisting.Count, fileEntries.Length );
+ foreach (RollFileEntry rollFile in fileEntries)
{
- // AssertEquals( "File count mismatch", alExisting.Count, fileEntries.Length );
- foreach (RollFileEntry rollFile in fileEntries)
+ string? sFileName = rollFile.FileName;
+ Assert.IsNotNull(sFileName);
+ FileInfo file = new FileInfo(sFileName!);
+
+ if (rollFile.FileLength > 0)
{
- string sFileName = rollFile.FileName;
- FileInfo file = new FileInfo(sFileName);
+ Assert.IsTrue(file.Exists, "filename {0} does not exist", sFileName);
+ VerifyExistenceAndRemoveFromList(alExisting, sFileName!, file, rollFile);
+ }
+ else
+ {
+ // If length is 0, file may not exist yet. If file exists, make sure length
+ // is zero. If file doesn't exist, this is OK
- if (rollFile.FileLength > 0)
+ if (file.Exists)
{
- Assert.IsTrue(file.Exists, "filename {0} does not exist", sFileName);
- VerifyExistenceAndRemoveFromList(alExisting, sFileName, file, rollFile);
- }
- else
- {
- // If length is 0, file may not exist yet. If file exists, make sure length
- // is zero. If file doesn't exist, this is OK
-
- if (file.Exists)
- {
- VerifyExistenceAndRemoveFromList(alExisting, sFileName, file, rollFile);
- }
+ VerifyExistenceAndRemoveFromList(alExisting, sFileName!, file, rollFile);
}
}
}
- else
- {
- Assert.AreEqual(0, alExisting.Count);
- }
// This check ensures no extra files matching the wildcard pattern exist.
// We only want the files we expect, and no others
@@ -524,12 +491,12 @@
/// Logs a message, verifying the expected message counts against the
/// current running totals.
/// </summary>
- /// <param name="entry"></param>
- /// <param name="sMessageToLog"></param>
- private void LogMessage(RollConditions entry, string sMessageToLog)
+ private void LogMessage(string sMessageToLog)
{
- Assert.AreEqual(_caRoot.Counter, _iMessagesLogged++);
- _root.Log(Level.Debug, sMessageToLog, null);
+ Assert.IsNotNull(_caRoot);
+ Assert.AreEqual(_caRoot!.Counter, _iMessagesLogged++);
+ Assert.IsNotNull(_root);
+ _root!.Log(Level.Debug, sMessageToLog, null);
Assert.AreEqual(_caRoot.Counter, _iMessagesLogged);
_iMessagesLoggedThisFile++;
}
@@ -574,7 +541,7 @@
// System.Diagnostics.Debug.WriteLine( i + ": Testing entry pre-conditions");
VerifyPreConditions(sBaseFileName, entry);
// System.Diagnostics.Debug.WriteLine( i + ": Logging message");
- LogMessage(entry, sMessageToLog);
+ LogMessage(sMessageToLog);
// System.Diagnostics.Debug.WriteLine( i + ": Testing entry post-conditions");
VerifyPostConditions(sBaseFileName, entry);
// System.Diagnostics.Debug.WriteLine( i + ": Finished validating entry\n");
@@ -640,7 +607,7 @@
{
string[] sFiles = sBackupGroup.Split(' ');
- ArrayList alEntries = new ArrayList();
+ var alEntries = new List<RollFileEntry>();
for (int i = 0; i < sFiles.Length; i++)
{
@@ -651,7 +618,7 @@
}
}
- return (RollFileEntry[])alEntries.ToArray(typeof(RollFileEntry));
+ return alEntries.ToArray();
}
/// <summary>
@@ -708,7 +675,7 @@
/// <param name="sBackupGroups"></param>
/// <param name="stats"></param>
/// <returns></returns>
- private static RollFileEntry[] MakeBackupFileEntriesForPostCondition(string sBackupGroups, RollingStats stats)
+ private static RollFileEntry[]? MakeBackupFileEntriesForPostCondition(string sBackupGroups, RollingStats stats)
{
if (0 == stats.NumberOfFileRolls)
{
@@ -724,59 +691,35 @@
/// This class holds information that is used while we are generating
/// test data sets
/// </summary>
- public class RollingStats
+ public sealed class RollingStats
{
- private int iTotalMessageLength;
- private int iMessagesPerFile;
- private int iMessagesThisFile;
- private int iNumberOfFileRolls;
-
/// <summary>
/// Number of total bytes a log file can reach.
/// </summary>
- public int MaximumFileSize
- {
- get { return TotalMessageLength * MessagesPerFile; }
- }
+ public int MaximumFileSize => TotalMessageLength * MessagesPerFile;
/// <summary>
/// The length of a message, including any CR/LF characters.
/// This length assumes all messages are a fixed length for
/// test purposes.
/// </summary>
- public int TotalMessageLength
- {
- get { return iTotalMessageLength; }
- set { iTotalMessageLength = value; }
- }
+ public int TotalMessageLength { get; set; }
/// <summary>
/// A count of the number of messages that are logged to each
/// file.
/// </summary>
- public int MessagesPerFile
- {
- get { return iMessagesPerFile; }
- set { iMessagesPerFile = value; }
- }
+ public int MessagesPerFile { get; set; }
/// <summary>
/// Counts how many messages have been logged to the current file
/// </summary>
- public int MessagesThisFile
- {
- get { return iMessagesThisFile; }
- set { iMessagesThisFile = value; }
- }
+ public int MessagesThisFile { get; set; }
/// <summary>
/// Counts how many times a file roll has occurred
/// </summary>
- public int NumberOfFileRolls
- {
- get { return iNumberOfFileRolls; }
- set { iNumberOfFileRolls = value; }
- }
+ public int NumberOfFileRolls { get; set; }
}
/// <summary>
@@ -806,7 +749,7 @@
/// <param name="existing"></param>
/// <param name="final"></param>
/// <returns></returns>
- private static RollFileEntry[] AddFinalElement(RollFileEntry[] existing, RollFileEntry final)
+ private static RollFileEntry[] AddFinalElement(RollFileEntry[]? existing, RollFileEntry final)
{
int iLength = 1;
if (null != existing)
@@ -828,19 +771,13 @@
/// Generates the pre and post condition arrays from an array of backup files and the
/// current file / next file.
/// </summary>
- /// <param name="sBackupFiles"></param>
- /// <param name="preCondition"></param>
- /// <param name="current"></param>
- /// <param name="currentNext"></param>
- /// <param name="rollingStats"></param>
- /// <returns></returns>
private static RollConditions BuildTableEntry(string sBackupFiles,
- RollConditions preCondition,
+ RollConditions? preCondition,
RollFileEntry current,
RollFileEntry currentNext,
RollingStats rollingStats)
{
- RollFileEntry[] backupsPost = MakeBackupFileEntriesForPostCondition(sBackupFiles, rollingStats);
+ RollFileEntry[]? backupsPost = MakeBackupFileEntriesForPostCondition(sBackupFiles, rollingStats);
RollFileEntry[] post = AddFinalElement(backupsPost, currentNext);
if (null == preCondition)
{
@@ -879,8 +816,6 @@
/// Callback point for the regular expression parser. Turns
/// the number into a file name.
/// </summary>
- /// <param name="match"></param>
- /// <returns></returns>
private static string NumberedNameMaker(Match match)
{
Int32 iValue = Int32.Parse(match.Value);
@@ -892,9 +827,6 @@
/// Calls back to a method that does the actual replacement, turning
/// the numeric value into a filename.
/// </summary>
- /// <param name="sBackupInfo"></param>
- /// <param name="evaluator"></param>
- /// <returns></returns>
private static string ConvertToFiles(string sBackupInfo, MatchEvaluator evaluator)
{
Regex regex = new Regex(@"\d+");
@@ -917,7 +849,7 @@
sTestMessage,
sBackupInfo,
iMessagesToLog,
- new MatchEvaluator(NumberedNameMaker));
+ NumberedNameMaker);
}
/// <summary>
@@ -943,7 +875,7 @@
RollingStats rollingStats = InitializeStats(sTestMessage);
- RollConditions preCondition = null;
+ RollConditions? preCondition = null;
rollingStats.MessagesThisFile = 0;
RollFileEntry currentFile = new RollFileEntry(GetCurrentFile(), 0);
@@ -1190,18 +1122,21 @@
/// </summary>
private void ConfigureRootAppender()
{
- _root = ((Repository.Hierarchy.Hierarchy)Utils.GetRepository()).Root;
+ _root = ((Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).Root;
_root.Level = Level.Debug;
_caRoot = new CountingAppender();
_root.AddAppender(_caRoot);
- Assert.AreEqual(_caRoot.Counter, 0);
+ Assert.AreEqual(0, _caRoot.Counter);
//
// Set the root appender with a RollingFileAppender
//
_root.AddAppender(CreateAppender());
- _root.Repository.Configured = true;
+ if (_root.Repository is not null)
+ {
+ _root.Repository.Configured = true;
+ }
}
/// <summary>
@@ -1211,7 +1146,7 @@
/// <param name="alFiles"></param>
/// <param name="iExpectedCurSizeRollBackups"></param>
private static void VerifyInitializeRollBackupsFromBaseFile(string sBaseFile,
- ArrayList alFiles,
+ List<string> alFiles,
int iExpectedCurSizeRollBackups)
{
InitializeAndVerifyExpectedValue(alFiles, sBaseFile, CreateRollingFileAppender("5,0,1"),
@@ -1226,7 +1161,7 @@
public void TestInitializeRollBackups1()
{
string sBaseFile = "LogFile.log";
- ArrayList arrFiles = new ArrayList();
+ List<string> arrFiles = new List<string>();
arrFiles.Add("junk1");
arrFiles.Add("junk1.log");
arrFiles.Add("junk2.log");
@@ -1243,7 +1178,7 @@
/// <param name="sBaseFile"></param>
private static void VerifyInitializeRollBackupsFromBaseFile(string sBaseFile)
{
- ArrayList alFiles = MakeTestDataFromString(sBaseFile, "0,1,2");
+ List<string> alFiles = MakeTestDataFromString(sBaseFile, "0,1,2");
int iExpectedCurSizeRollBackups = 2;
VerifyInitializeRollBackupsFromBaseFile(sBaseFile, alFiles, iExpectedCurSizeRollBackups);
@@ -1255,7 +1190,7 @@
[Test]
public void TestInitializeCountUpFixed()
{
- ArrayList alFiles = MakeTestDataFromString("3,4,5");
+ List<string> alFiles = MakeTestDataFromString("3,4,5");
int iExpectedValue = 5;
InitializeAndVerifyExpectedValue(alFiles, c_fileName, CreateRollingFileAppender("3,0,1"), iExpectedValue);
}
@@ -1266,7 +1201,7 @@
[Test]
public void TestInitializeCountUpFixed2()
{
- ArrayList alFiles = MakeTestDataFromString("0,3");
+ List<string> alFiles = MakeTestDataFromString("0,3");
int iExpectedValue = 3;
InitializeAndVerifyExpectedValue(alFiles, c_fileName, CreateRollingFileAppender("3,0,1"), iExpectedValue);
}
@@ -1278,7 +1213,7 @@
[Test]
public void TestInitializeCountUpZeroBackups()
{
- ArrayList alFiles = MakeTestDataFromString("0,3");
+ List<string> alFiles = MakeTestDataFromString("0,3");
int iExpectedValue = 0;
InitializeAndVerifyExpectedValue(alFiles, c_fileName, CreateRollingFileAppender("0,0,1"), iExpectedValue);
}
@@ -1290,7 +1225,7 @@
[Test]
public void TestInitializeCountDownZeroBackups()
{
- ArrayList alFiles = MakeTestDataFromString("0,3");
+ List<string> alFiles = MakeTestDataFromString("0,3");
int iExpectedValue = 0;
InitializeAndVerifyExpectedValue(alFiles, c_fileName, CreateRollingFileAppender("0,0,-1"), iExpectedValue);
}
@@ -1302,7 +1237,7 @@
[Test]
public void TestInitializeCountDownFixed()
{
- ArrayList alFiles = MakeTestDataFromString("4,5,6");
+ List<string> alFiles = MakeTestDataFromString("4,5,6");
VerifyInitializeDownFixedExpectedValue(alFiles, c_fileName, 0);
}
@@ -1312,7 +1247,7 @@
[Test]
public void TestInitializeCountDownFixed2()
{
- ArrayList alFiles = MakeTestDataFromString("1,5,6");
+ List<string> alFiles = MakeTestDataFromString("1,5,6");
VerifyInitializeDownFixedExpectedValue(alFiles, c_fileName, 1);
}
@@ -1322,7 +1257,7 @@
[Test]
public void TestInitializeCountDownFixed3()
{
- ArrayList alFiles = MakeTestDataFromString("2,5,6");
+ List<string> alFiles = MakeTestDataFromString("2,5,6");
VerifyInitializeDownFixedExpectedValue(alFiles, c_fileName, 2);
}
@@ -1332,7 +1267,7 @@
[Test]
public void TestInitializeCountDownFixed4()
{
- ArrayList alFiles = MakeTestDataFromString("3,5,6");
+ List<string> alFiles = MakeTestDataFromString("3,5,6");
VerifyInitializeDownFixedExpectedValue(alFiles, c_fileName, 3);
}
@@ -1342,7 +1277,7 @@
[Test]
public void TestInitializeCountDownFixed5()
{
- ArrayList alFiles = MakeTestDataFromString("1,2,3");
+ List<string> alFiles = MakeTestDataFromString("1,2,3");
VerifyInitializeDownFixedExpectedValue(alFiles, c_fileName, 3);
}
@@ -1352,7 +1287,7 @@
[Test]
public void TestInitializeCountDownFixed6()
{
- ArrayList alFiles = MakeTestDataFromString("1,2");
+ List<string> alFiles = MakeTestDataFromString("1,2");
VerifyInitializeDownFixedExpectedValue(alFiles, c_fileName, 2);
}
@@ -1362,17 +1297,18 @@
[Test]
public void TestInitializeCountDownFixed7()
{
- ArrayList alFiles = MakeTestDataFromString("2,3");
+ List<string> alFiles = MakeTestDataFromString("2,3");
VerifyInitializeDownFixedExpectedValue(alFiles, c_fileName, 3);
}
- private static void InitializeAndVerifyExpectedValue(ArrayList alFiles,
+ private static void InitializeAndVerifyExpectedValue(
+ List<string> alFiles,
string sBaseFile,
RollingFileAppender rfa,
int iExpectedValue)
{
- InitializeRollBackups(rfa, sBaseFile, alFiles);
- Assert.AreEqual(iExpectedValue, GetFieldCurSizeRollBackups(rfa));
+ rfa.InitializeRollBackups(sBaseFile, alFiles);
+ Assert.AreEqual(iExpectedValue, rfa.CurrentSizeRollBackups);
}
/// <summary>
@@ -1382,7 +1318,7 @@
/// <param name="alFiles"></param>
/// <param name="sBaseFile"></param>
/// <param name="iExpectedValue"></param>
- private static void VerifyInitializeDownInfiniteExpectedValue(ArrayList alFiles,
+ private static void VerifyInitializeDownInfiniteExpectedValue(List<string> alFiles,
string sBaseFile,
int iExpectedValue)
{
@@ -1407,8 +1343,8 @@
RollingFileAppender rfa = new RollingFileAppender();
rfa.RollingStyle = RollingFileAppender.RollingMode.Size;
- SetFieldMaxSizeRollBackups(rfa, Int32.Parse(asParams[0].Trim()));
- SetFieldCurSizeRollBackups(rfa, Int32.Parse(asParams[1].Trim()));
+ rfa.MaxSizeRollBackups = Int32.Parse(asParams[0].Trim());
+ rfa.CurrentSizeRollBackups = Int32.Parse(asParams[1].Trim());
rfa.CountDirection = Int32.Parse(asParams[2].Trim());
return rfa;
@@ -1421,7 +1357,7 @@
[Test]
public void TestInitializeCountDownInfinite()
{
- ArrayList alFiles = MakeTestDataFromString("2,3");
+ List<string> alFiles = MakeTestDataFromString("2,3");
VerifyInitializeDownInfiniteExpectedValue(alFiles, c_fileName, 3);
}
@@ -1432,7 +1368,7 @@
[Test]
public void TestInitializeCountDownInfinite2()
{
- ArrayList alFiles = MakeTestDataFromString("2,3,4,5,6,7,8,9,10");
+ List<string> alFiles = MakeTestDataFromString("2,3,4,5,6,7,8,9,10");
VerifyInitializeDownInfiniteExpectedValue(alFiles, c_fileName, 10);
}
@@ -1443,7 +1379,7 @@
[Test]
public void TestInitializeCountDownInfinite3()
{
- ArrayList alFiles = MakeTestDataFromString("9,10,3,4,5,7,9,6,1,2,8");
+ List<string> alFiles = MakeTestDataFromString("9,10,3,4,5,7,9,6,1,2,8");
VerifyInitializeDownInfiniteExpectedValue(alFiles, c_fileName, 10);
}
@@ -1454,7 +1390,7 @@
[Test]
public void TestInitializeCountUpInfinite()
{
- ArrayList alFiles = MakeTestDataFromString("2,3");
+ List<string> alFiles = MakeTestDataFromString("2,3");
VerifyInitializeUpInfiniteExpectedValue(alFiles, c_fileName, 3);
}
@@ -1465,7 +1401,7 @@
[Test]
public void TestInitializeCountUpInfinite2()
{
- ArrayList alFiles = MakeTestDataFromString("2,3,4,5,6,7,8,9,10");
+ List<string> alFiles = MakeTestDataFromString("2,3,4,5,6,7,8,9,10");
VerifyInitializeUpInfiniteExpectedValue(alFiles, c_fileName, 10);
}
@@ -1476,7 +1412,7 @@
[Test]
public void TestInitializeCountUpInfinite3()
{
- ArrayList alFiles = MakeTestDataFromString("9,10,3,4,5,7,9,6,1,2,8");
+ List<string> alFiles = MakeTestDataFromString("9,10,3,4,5,7,9,6,1,2,8");
VerifyInitializeUpInfiniteExpectedValue(alFiles, c_fileName, 10);
}
@@ -1486,28 +1422,14 @@
/// <param name="filename">The filename to log to</param>
/// <param name="lockModel">The locking model to use.</param>
/// <param name="handler">The error handler to use.</param>
- /// <returns>A configured ILogger</returns>
- private static ILogger CreateLogger(string filename,
- FileAppender.LockingModelBase lockModel,
- IErrorHandler handler)
- {
- return CreateLogger(filename, lockModel, handler, 100000, 0);
- }
-
- /// <summary>
- /// Creates a logger hierarchy, configures a rolling file appender and returns an ILogger
- /// </summary>
- /// <param name="filename">The filename to log to</param>
- /// <param name="lockModel">The locking model to use.</param>
- /// <param name="handler">The error handler to use.</param>
/// <param name="maxFileSize">Maximum file size for roll</param>
/// <param name="maxSizeRollBackups">Maximum number of roll backups</param>
/// <returns>A configured ILogger</returns>
private static ILogger CreateLogger(string filename,
- FileAppender.LockingModelBase lockModel,
+ FileAppender.LockingModelBase? lockModel,
IErrorHandler handler,
- int maxFileSize,
- int maxSizeRollBackups)
+ int maxFileSize = 100000,
+ int maxSizeRollBackups = 0)
{
Repository.Hierarchy.Hierarchy h =
(Repository.Hierarchy.Hierarchy)LogManager.CreateRepository("TestRepository");
@@ -1555,13 +1477,8 @@
private static void AssertFileEquals(string filename, string contents)
{
- FileInfo fileinfo = new FileInfo(filename);
- StreamReader sr = new StreamReader(fileinfo.OpenRead());
- string logcont = sr.ReadToEnd();
- sr.Close();
-
+ string logcont = File.ReadAllText(filename);
Assert.AreEqual(contents, logcont, "Log contents is not what is expected");
-
File.Delete(filename);
}
@@ -1602,8 +1519,7 @@
fs.Close();
AssertFileEquals(filename, "Test");
- Assert.AreEqual(sh.Message.Substring(0, 30), "Unable to acquire lock on file",
- "Expecting an error message");
+ StringAssert.StartsWith("Unable to acquire lock on file", sh.Message, "Expecting an error message");
}
/// <summary>
@@ -1625,7 +1541,7 @@
DestroyLogger();
AssertFileEquals(filename, "This is a message 2" + Environment.NewLine);
- Assert.AreEqual("Unable to acquire lock on file", sh.Message.Substring(0, 30),
+ StringAssert.StartsWith("Unable to acquire lock on file", sh.Message,
"Expecting an error message");
}
@@ -1650,12 +1566,8 @@
}
catch (IOException e1)
{
-#if MONO
- Assert.AreEqual("Sharing violation on path ", e1.Message.Substring(0, 26), "Unexpected exception");
-#else
Assert.AreEqual("The process cannot access the file ", e1.Message.Substring(0, 35),
"Unexpected exception");
-#endif
locked = true;
}
@@ -1663,10 +1575,8 @@
DestroyLogger();
Assert.IsTrue(locked, "File was not locked");
-#if !MONO || MONO_3_5 || MONO_4_0 // at least on Linux with Mono 2.4 exclusive locking doesn't work as one would expect
AssertFileEquals(filename,
"This is a message" + Environment.NewLine + "This is a message 2" + Environment.NewLine);
-#endif
Assert.AreEqual("", sh.Message, "Unexpected error message");
}
@@ -1745,7 +1655,6 @@
Assert.AreEqual("", sh.Message, "Unexpected error message");
}
-#if !NETCF
/// <summary>
/// Verifies that attempting to log to a locked file fails gracefully
/// </summary>
@@ -1826,19 +1735,13 @@
[Test]
public void TestInterProcessLockRoll()
{
- string filename = "test_interprocess_lock_roll.log";
+ const string filename = "test_interprocess_lock_roll.log";
SilentErrorHandler sh = new SilentErrorHandler();
ILogger log = CreateLogger(filename, new FileAppender.InterProcessLock(), sh, 1, 2);
- Assert.DoesNotThrow(delegate
- {
- log.Log(GetType(), Level.Info, "A", null);
- });
- Assert.DoesNotThrow(delegate
- {
- log.Log(GetType(), Level.Info, "A", null);
- });
+ Assert.DoesNotThrow(() => log.Log(GetType(), Level.Info, "A", null));
+ Assert.DoesNotThrow(() => log.Log(GetType(), Level.Info, "A", null));
DestroyLogger();
@@ -1846,7 +1749,6 @@
AssertFileEquals(filename + ".1", "A" + Environment.NewLine);
Assert.IsEmpty(sh.Message);
}
-#endif
/// <summary>
/// Verify that the default LockModel is ExclusiveLock, to maintain backwards compatibility with previous behaviour
@@ -1859,11 +1761,12 @@
SilentErrorHandler sh = new SilentErrorHandler();
ILogger log = CreateLogger(filename, null, sh);
- IAppender[] appenders = log.Repository.GetAppenders();
- Assert.AreEqual(1, appenders.Length, "The wrong number of appenders are configured");
+ IAppender[]? appenders = log.Repository?.GetAppenders();
+ Assert.IsNotNull(appenders);
+ Assert.AreEqual(1, appenders!.Length, "The wrong number of appenders are configured");
RollingFileAppender rfa = (RollingFileAppender)(appenders[0]);
- Assert.AreEqual(typeof(log4net.Appender.FileAppender.ExclusiveLock), rfa.LockingModel.GetType(),
+ Assert.AreEqual(typeof(FileAppender.ExclusiveLock), rfa.LockingModel.GetType(),
"The LockingModel is of an unexpected type");
DestroyLogger();
@@ -1873,10 +1776,8 @@
/// Tests the count up case, with infinite max backups , to see that
/// initialization of the rolling file appender results in the expected value
/// </summary>
- /// <param name="alFiles"></param>
- /// <param name="sBaseFile"></param>
- /// <param name="iExpectedValue"></param>
- private static void VerifyInitializeUpInfiniteExpectedValue(ArrayList alFiles,
+ private static void VerifyInitializeUpInfiniteExpectedValue(
+ List<string> alFiles,
string sBaseFile,
int iExpectedValue)
{
@@ -1885,13 +1786,11 @@
/// <summary>
- /// Tests the count down case, with max backups limited to 3, to see that
+ /// Tests the countdown case, with max backups limited to 3, to see that
/// initialization of the rolling file appender results in the expected value
/// </summary>
- /// <param name="alFiles"></param>
- /// <param name="sBaseFile"></param>
- /// <param name="iExpectedValue"></param>
- private static void VerifyInitializeDownFixedExpectedValue(ArrayList alFiles,
+ private static void VerifyInitializeDownFixedExpectedValue(
+ List<string> alFiles,
string sBaseFile,
int iExpectedValue)
{
@@ -1906,8 +1805,7 @@
///
/// </summary>
/// <param name="sFileNumbers">Comma separated list of numbers for counted file names</param>
- /// <returns></returns>
- private static ArrayList MakeTestDataFromString(string sFileNumbers)
+ private static List<string> MakeTestDataFromString(string sFileNumbers)
{
return MakeTestDataFromString(c_fileName, sFileNumbers);
}
@@ -1921,9 +1819,9 @@
/// <param name="sFileName">Name of file to combine with numbers when generating counted file names</param>
/// <param name="sFileNumbers">Comma separated list of numbers for counted file names</param>
/// <returns></returns>
- private static ArrayList MakeTestDataFromString(string sFileName, string sFileNumbers)
+ private static List<string> MakeTestDataFromString(string sFileName, string sFileNumbers)
{
- ArrayList alFiles = new ArrayList();
+ var alFiles = new List<string>();
string[] sNumbers = sFileNumbers.Split(',');
foreach (string sNumber in sNumbers)
@@ -1959,37 +1857,33 @@
/// Makes sure that the initialization can detect the backup
/// number correctly.
/// </summary>
- /// <param name="iBackups"></param>
- /// <param name="iMaxSizeRollBackups"></param>
- public void VerifyInitializeRollBackups(int iBackups, int iMaxSizeRollBackups)
+ private void VerifyInitializeRollBackups(int iBackups, int iMaxSizeRollBackups)
{
string sBaseFile = "LogFile.log";
- ArrayList arrFiles = new ArrayList();
- arrFiles.Add("junk1");
+ var arrFiles = new List<string> { "junk1" };
for (int i = 0; i < iBackups; i++)
{
arrFiles.Add(MakeFileName(sBaseFile, i));
}
- RollingFileAppender rfa = new RollingFileAppender();
+ RollingFileAppender rfa = new();
rfa.RollingStyle = RollingFileAppender.RollingMode.Size;
- SetFieldMaxSizeRollBackups(rfa, iMaxSizeRollBackups);
- SetFieldCurSizeRollBackups(rfa, 0);
- InitializeRollBackups(rfa, sBaseFile, arrFiles);
+ rfa.MaxSizeRollBackups = iMaxSizeRollBackups;
+ rfa.CurrentSizeRollBackups = 0;
+ rfa.InitializeRollBackups(sBaseFile, arrFiles);
// iBackups / Meaning
// 0 = none
// 1 = file.log
// 2 = file.log.1
// 3 = file.log.2
- if (0 == iBackups ||
- 1 == iBackups)
+ if (iBackups is 0 or 1)
{
- Assert.AreEqual(0, GetFieldCurSizeRollBackups(rfa));
+ Assert.AreEqual(0, rfa.CurrentSizeRollBackups);
}
else
{
- Assert.AreEqual(Math.Min(iBackups - 1, iMaxSizeRollBackups), GetFieldCurSizeRollBackups(rfa));
+ Assert.AreEqual(Math.Min(iBackups - 1, iMaxSizeRollBackups), rfa.CurrentSizeRollBackups);
}
}
@@ -2024,130 +1918,48 @@
appender.Close();
}
- /// <summary>
- ///
- /// </summary>
- [Test,
- Ignore("Not Implemented: Want to test counted files limited up, to see that others are ?? ignored? deleted?")]
- public void TestInitialization3()
- {
- }
-
- /// <summary>
- ///
- /// </summary>
- [Test,
- Ignore(
- "Not Implemented: Want to test counted files limited down, to see that others are ?? ignored? deleted?")]
- public void TestInitialization4()
- {
- }
-
- /// <summary>
- ///
- /// </summary>
- [Test,
- Ignore("Not Implemented: Want to test dated files with a limit, to see that others are ?? ignored? deleted?")]
- public void TestInitialization5()
- {
- }
-
- /// <summary>
- ///
- /// </summary>
- [Test,
- Ignore("Not Implemented: Want to test dated files with no limit, to see that others are ?? ignored? deleted?")]
- public void TestInitialization6()
- {
- }
-
- /// <summary>
- ///
- /// </summary>
- [Test,
- Ignore(
- "Not Implemented: Want to test dated files with mixed dates existing, to see that other dates do not matter")]
- public void TestInitialization7()
- {
- }
-
-
//
// Helper functions to dig into the appender
//
- private static ArrayList GetExistingFiles(string baseFilePath)
+ private static List<string> GetExistingFiles(string baseFilePath, bool preserveLogFileNameExtension = false)
{
- return GetExistingFiles(baseFilePath, false);
- }
-
- private static ArrayList GetExistingFiles(string baseFilePath, bool preserveLogFileNameExtension)
- {
- RollingFileAppender appender = new RollingFileAppender();
- appender.PreserveLogFileNameExtension = preserveLogFileNameExtension;
- appender.SecurityContext = NullSecurityContext.Instance;
-
- return (ArrayList)Utils.InvokeMethod(appender, "GetExistingFiles", baseFilePath);
- }
-
- private static void InitializeRollBackups(RollingFileAppender appender, string baseFile, ArrayList arrayFiles)
- {
- Utils.InvokeMethod(appender, "InitializeRollBackups", baseFile, arrayFiles);
- }
-
- private static int GetFieldCurSizeRollBackups(RollingFileAppender appender)
- {
- return (int)Utils.GetField(appender, "m_curSizeRollBackups");
- }
-
- private static void SetFieldCurSizeRollBackups(RollingFileAppender appender, int val)
- {
- Utils.SetField(appender, "m_curSizeRollBackups", val);
- }
-
- private static void SetFieldMaxSizeRollBackups(RollingFileAppender appender, int val)
- {
- Utils.SetField(appender, "m_maxSizeRollBackups", val);
+ RollingFileAppenderForTest appender = new()
+ {
+ PreserveLogFileNameExtension = preserveLogFileNameExtension,
+ SecurityContext = NullSecurityContext.Instance
+ };
+ return appender.GetExistingFiles(baseFilePath);
}
private static string GetTestMessage()
{
- switch (Environment.NewLine.Length)
+ return Environment.NewLine.Length switch
{
- case 2:
- return c_testMessage98Chars;
-
- case 1:
- return c_testMessage99Chars;
-
- default:
- throw new Exception("Unexpected Environment.NewLine.Length");
- }
+ 2 => c_testMessage98Chars,
+ 1 => c_testMessage99Chars,
+ _ => throw new Exception("Unexpected Environment.NewLine.Length"),
+ };
}
}
[TestFixture]
- public class RollingFileAppenderSubClassTest : RollingFileAppender
+ public sealed class RollingFileAppenderSubClassTest : RollingFileAppender
{
[Test]
public void TestComputeCheckPeriod()
{
RollingFileAppender rfa = new RollingFileAppender();
- Assert.AreEqual(RollPoint.TopOfMinute, InvokeComputeCheckPeriod(rfa, ".yyyy-MM-dd HH:mm"),
+ Assert.AreEqual(RollPoint.TopOfMinute, rfa.ComputeCheckPeriod(".yyyy-MM-dd HH:mm"),
"TopOfMinute pattern");
- Assert.AreEqual(RollPoint.TopOfHour, InvokeComputeCheckPeriod(rfa, ".yyyy-MM-dd HH"), "TopOfHour pattern");
- Assert.AreEqual(RollPoint.HalfDay, InvokeComputeCheckPeriod(rfa, ".yyyy-MM-dd tt"), "HalfDay pattern");
- Assert.AreEqual(RollPoint.TopOfDay, InvokeComputeCheckPeriod(rfa, ".yyyy-MM-dd"), "TopOfDay pattern");
- Assert.AreEqual(RollPoint.TopOfMonth, InvokeComputeCheckPeriod(rfa, ".yyyy-MM"), "TopOfMonth pattern");
+ Assert.AreEqual(RollPoint.TopOfHour, rfa.ComputeCheckPeriod(".yyyy-MM-dd HH"), "TopOfHour pattern");
+ Assert.AreEqual(RollPoint.HalfDay, rfa.ComputeCheckPeriod(".yyyy-MM-dd tt"), "HalfDay pattern");
+ Assert.AreEqual(RollPoint.TopOfDay, rfa.ComputeCheckPeriod(".yyyy-MM-dd"), "TopOfDay pattern");
+ Assert.AreEqual(RollPoint.TopOfMonth, rfa.ComputeCheckPeriod(".yyyy-MM"), "TopOfMonth pattern");
// Test invalid roll point
- Assert.AreEqual(RollPoint.InvalidRollPoint, InvokeComputeCheckPeriod(rfa, "..."), "TopOfMonth pattern");
- }
-
- private static RollPoint InvokeComputeCheckPeriod(RollingFileAppender rollingFileAppender, string datePattern)
- {
- return (RollPoint)Utils.InvokeMethod(rollingFileAppender, "ComputeCheckPeriod", datePattern);
+ Assert.AreEqual(RollPoint.InvalidRollPoint, rfa.ComputeCheckPeriod("..."), "TopOfMonth pattern");
}
}
}
\ No newline at end of file
diff --git a/src/log4net.Tests/Appender/SmtpPickupDirAppenderTest.cs b/src/log4net.Tests/Appender/SmtpPickupDirAppenderTest.cs
index 6ebc75a..4b2bca2 100644
--- a/src/log4net.Tests/Appender/SmtpPickupDirAppenderTest.cs
+++ b/src/log4net.Tests/Appender/SmtpPickupDirAppenderTest.cs
@@ -18,8 +18,6 @@
#endregion
using System;
-using System.Collections;
-using System.Diagnostics;
using System.IO;
using System.Text;
@@ -41,26 +39,23 @@
private class SilentErrorHandler : IErrorHandler
{
- private StringBuilder m_buffer = new StringBuilder();
+ private readonly StringBuilder m_buffer = new();
- public string Message
- {
- get { return m_buffer.ToString(); }
- }
+ public string Message => m_buffer.ToString();
public void Error(string message)
{
- m_buffer.Append(message + "\n");
+ m_buffer.Append(message + '\n');
}
public void Error(string message, Exception e)
{
- m_buffer.Append(message + "\n" + e.Message + "\n");
+ m_buffer.Append(message + '\n' + e.Message + '\n');
}
public void Error(string message, Exception e, ErrorCode errorCode)
{
- m_buffer.Append(message + "\n" + e.Message + "\n");
+ m_buffer.Append(message + '\n' + e.Message + '\n');
}
}
@@ -68,6 +63,7 @@
{
_testPickupDir = Path.Combine(Directory.GetCurrentDirectory(), "SmtpPickupDirAppenderTest_PickupDir");
}
+
/// <summary>
/// Sets up variables used for the tests
/// </summary>
@@ -84,9 +80,9 @@
private void ResetLogger()
{
// Regular users should not use the clear method lightly!
- Utils.GetRepository().ResetConfiguration();
- Utils.GetRepository().Shutdown();
- ((Repository.Hierarchy.Hierarchy)Utils.GetRepository()).Clear();
+ LogManager.GetRepository().ResetConfiguration();
+ LogManager.GetRepository().Shutdown();
+ ((Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).Clear();
}
/// <summary>
@@ -131,8 +127,7 @@
{
Repository.Hierarchy.Hierarchy h = (Repository.Hierarchy.Hierarchy)LogManager.CreateRepository("TestRepository");
- PatternLayout layout = new PatternLayout();
- layout.ConversionPattern = "%m%n";
+ var layout = new PatternLayout { ConversionPattern = "%m%n" };
layout.ActivateOptions();
appender.Layout = layout;
@@ -199,7 +194,7 @@
}
Assert.IsTrue(hasDateHeader, "Output must contains a date header");
- Assert.AreEqual("", sh.Message, "Unexpected error message");
+ Assert.AreEqual(string.Empty, sh.Message, "Unexpected error message");
}
/// <summary>
@@ -220,7 +215,7 @@
Assert.AreEqual(1, Directory.GetFiles(_testPickupDir).Length);
FileInfo fileInfo = new FileInfo(Directory.GetFiles(_testPickupDir)[0]);
Assert.AreEqual("." + fileExtension, fileInfo.Extension);
- Assert.DoesNotThrow(delegate { new Guid(fileInfo.Name.Substring(0, fileInfo.Name.Length - fileInfo.Extension.Length)); }); // Assert that filename before extension is a guid
+ Assert.IsTrue(Guid.TryParse(fileInfo.Name.Substring(0, fileInfo.Name.Length - fileInfo.Extension.Length), out _));
Assert.AreEqual("", sh.Message, "Unexpected error message");
}
@@ -241,9 +236,9 @@
Assert.AreEqual(1, Directory.GetFiles(_testPickupDir).Length);
FileInfo fileInfo = new FileInfo(Directory.GetFiles(_testPickupDir)[0]);
Assert.IsEmpty(fileInfo.Extension);
- Assert.DoesNotThrow(delegate { new Guid(fileInfo.Name); }); // Assert that filename is a guid
+ Assert.IsTrue(Guid.TryParse(fileInfo.Name, out _));
- Assert.AreEqual("", sh.Message, "Unexpected error message");
+ Assert.AreEqual(string.Empty, sh.Message, "Unexpected error message");
}
}
}
\ No newline at end of file
diff --git a/src/log4net.Tests/Appender/StringAppender.cs b/src/log4net.Tests/Appender/StringAppender.cs
index 83602f8..90e0c6e 100644
--- a/src/log4net.Tests/Appender/StringAppender.cs
+++ b/src/log4net.Tests/Appender/StringAppender.cs
@@ -30,7 +30,7 @@
/// <author>Nicko Cadell</author>
public class StringAppender : AppenderSkeleton
{
- private StringBuilder m_buf = new StringBuilder();
+ private StringBuilder m_buf = new();
/// <summary>
/// Initializes a new instance of the <see cref="StringAppender" /> class.
@@ -68,9 +68,6 @@
/// This appender requires a <see cref="Layout"/> to be set.
/// </summary>
/// <value><c>true</c></value>
- protected override bool RequiresLayout
- {
- get { return true; }
- }
+ protected override bool RequiresLayout => true;
}
}
\ No newline at end of file
diff --git a/src/log4net.Tests/Appender/TraceAppenderTest.cs b/src/log4net.Tests/Appender/TraceAppenderTest.cs
index a164f74..2381525 100644
--- a/src/log4net.Tests/Appender/TraceAppenderTest.cs
+++ b/src/log4net.Tests/Appender/TraceAppenderTest.cs
@@ -55,7 +55,6 @@
categoryTraceListener.Category);
}
-#if !NETSTANDARD1_3 // "LocationInfo can't get method names on NETSTANDARD1_3 due to unavailable stack frame APIs"
[Test]
public void MethodNameCategoryTest()
{
@@ -81,7 +80,6 @@
System.Reflection.MethodInfo.GetCurrentMethod().Name,
categoryTraceListener.Category);
}
-#endif
}
public class CategoryTraceListener : TraceListener
diff --git a/src/log4net.Tests/Context/LogicalThreadContextTest.cs b/src/log4net.Tests/Context/LogicalThreadContextTest.cs
index ca8a7c1..b4861e0 100644
--- a/src/log4net.Tests/Context/LogicalThreadContextTest.cs
+++ b/src/log4net.Tests/Context/LogicalThreadContextTest.cs
@@ -17,7 +17,6 @@
//
#endregion
-#if NET_4_5 || NETSTANDARD
using System;
using System.Threading.Tasks;
using System.Linq;
@@ -30,6 +29,8 @@
using NUnit.Framework;
+#nullable enable
+
namespace log4net.Tests.Context
{
/// <summary>
@@ -254,7 +255,7 @@
stringAppender.Reset();
string testValueForCurrentContext = "Outer";
- string[] strings = null;
+ string[]? strings;
using (LogicalThreadContext.Stacks[Utils.PROPERTY_KEY].Push(testValueForCurrentContext))
{
log1.Info("TestMessage");
@@ -305,10 +306,12 @@
log.Info("TestMessage");
}
- static async Task<string> SomeWorkStack(string stackName)
+ private static async Task<string> SomeWorkStack(string stackName)
{
- StringAppender stringAppender = new StringAppender();
- stringAppender.Layout = new PatternLayout("%property{" + Utils.PROPERTY_KEY + "}");
+ var stringAppender = new StringAppender
+ {
+ Layout = new PatternLayout("%property{" + Utils.PROPERTY_KEY + "}")
+ };
ILoggerRepository rep = LogManager.CreateRepository(Guid.NewGuid().ToString());
BasicConfigurator.Configure(rep, stringAppender);
@@ -340,5 +343,4 @@
}
}
}
-}
-#endif
+}
\ No newline at end of file
diff --git a/src/log4net.Tests/Context/ThreadContextTest.cs b/src/log4net.Tests/Context/ThreadContextTest.cs
index b34af13..a01ca03 100644
--- a/src/log4net.Tests/Context/ThreadContextTest.cs
+++ b/src/log4net.Tests/Context/ThreadContextTest.cs
@@ -21,6 +21,8 @@
using System;
using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
using System.Threading;
using log4net.Config;
using log4net.Layout;
@@ -28,17 +30,12 @@
using log4net.Tests.Appender;
using log4net.Util;
using NUnit.Framework;
-using static NExpect.Expectations;
-using NExpect;
namespace log4net.Tests.Context
{
/// <summary>
/// Used for internal unit testing the <see cref="ThreadContext"/> class.
/// </summary>
- /// <remarks>
- /// Used for internal unit testing the <see cref="ThreadContext"/> class.
- /// </remarks>
[TestFixture]
public class ThreadContextTest
{
@@ -198,36 +195,36 @@
stringAppender.Reset();
}
- private static string TestBackgroundThreadContextPropertyRepository;
-
[Test]
public void TestBackgroundThreadContextProperty()
{
StringAppender stringAppender = new StringAppender();
stringAppender.Layout = new PatternLayout("%property{DateTimeTodayToString}");
- ILoggerRepository rep = LogManager.CreateRepository(TestBackgroundThreadContextPropertyRepository =
- "TestBackgroundThreadContextPropertyRepository" + Guid.NewGuid().ToString());
+ string testBackgroundThreadContextPropertyRepository =
+ "TestBackgroundThreadContextPropertyRepository" + Guid.NewGuid();
+ ILoggerRepository rep = LogManager.CreateRepository(testBackgroundThreadContextPropertyRepository);
BasicConfigurator.Configure(rep, stringAppender);
- Thread thread = new Thread(new ThreadStart(ExecuteBackgroundThread));
- thread.Start();
+ Thread thread = new Thread(ExecuteBackgroundThread);
+ thread.Start(testBackgroundThreadContextPropertyRepository);
Thread.CurrentThread.Join(2000);
}
- private static void ExecuteBackgroundThread()
+ private static void ExecuteBackgroundThread(object context)
{
- ILog log = LogManager.GetLogger(TestBackgroundThreadContextPropertyRepository, "ExecuteBackGroundThread");
- ThreadContext.Properties["DateTimeTodayToString"] = DateTime.Today.ToString();
+ string testBackgroundThreadContextPropertyRepository = (string)context;
+ ILog log = LogManager.GetLogger(testBackgroundThreadContextPropertyRepository, "ExecuteBackGroundThread");
+ ThreadContext.Properties["DateTimeTodayToString"] = DateTime.Today.ToString(CultureInfo.InvariantCulture);
log.Info("TestMessage");
Repository.Hierarchy.Hierarchy hierarchyLoggingRepository =
(Repository.Hierarchy.Hierarchy)log.Logger.Repository;
- StringAppender stringAppender = (StringAppender)hierarchyLoggingRepository.Root.Appenders[0];
+ StringAppender stringAppender = (StringAppender)hierarchyLoggingRepository!.Root.Appenders[0];
- Assert.AreEqual(DateTime.Today.ToString(), stringAppender.GetString());
+ Assert.AreEqual(DateTime.Today.ToString(CultureInfo.InvariantCulture), stringAppender.GetString());
}
[Test]
@@ -238,7 +235,7 @@
var flags = new List<FlagContainer>();
// Act
- for (var i = 0; i < 256; i++)
+ for (var i = 0; i < Math.Max(64, 4 * Environment.ProcessorCount); i++)
{
var t = new Thread(SpinAndCheck);
var flag = new FlagContainer();
@@ -252,9 +249,7 @@
t.Join();
}
- // Assert
- Expect(flags)
- .To.Contain.All.Matched.By(o => o.Flag == false);
+ Assert.IsTrue(flags.All(o => !o.Flag));
}
public class FlagContainer
@@ -264,7 +259,7 @@
private void SpinAndCheck(object obj)
{
- var container = obj as FlagContainer;
+ var container = (FlagContainer)obj;
var threadid = Thread.CurrentThread.ManagedThreadId;
for (var i = 0; i < 100000; i++)
{
diff --git a/src/log4net.Tests/Core/DefaultRepositorySelectorTest.cs b/src/log4net.Tests/Core/DefaultRepositorySelectorTest.cs
new file mode 100644
index 0000000..a052592
--- /dev/null
+++ b/src/log4net.Tests/Core/DefaultRepositorySelectorTest.cs
@@ -0,0 +1,186 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using log4net.Appender;
+using log4net.Core;
+using log4net.ObjectRenderer;
+using log4net.Plugin;
+using log4net.Repository;
+using log4net.Util;
+using NUnit.Framework;
+
+namespace log4net.Tests.Core
+{
+ [TestFixture]
+ public class DefaultRepositorySelectorTest
+ {
+ private const string RepositoryName = "MyRepository";
+
+ [Test]
+ public void CreateRepository_ExplicitType()
+ {
+ var selector = new DefaultRepositorySelector(typeof(MockLoggerRepository));
+ int numCreatedCallbacks = 0;
+ selector.LoggerRepositoryCreatedEvent += (_, _) => numCreatedCallbacks++;
+
+ Assert.IsFalse(selector.ExistsRepository(RepositoryName));
+ ILoggerRepository[] allRepositories = selector.GetAllRepositories();
+ Assert.AreEqual(0, allRepositories.Length);
+ Assert.AreEqual(0, numCreatedCallbacks);
+ Assert.Throws<LogException>(() => selector.GetRepository(RepositoryName));
+
+ ILoggerRepository logRep = selector.CreateRepository(RepositoryName, typeof(MockLoggerRepository));
+ Assert.IsTrue(selector.ExistsRepository(RepositoryName));
+ allRepositories = selector.GetAllRepositories();
+ Assert.AreEqual(1, allRepositories.Length);
+ Assert.AreSame(logRep, allRepositories[0]);
+ Assert.AreEqual(1, numCreatedCallbacks);
+ Assert.IsInstanceOf<MockLoggerRepository>(logRep);
+ ILoggerRepository rep2 = selector.GetRepository(RepositoryName);
+ Assert.AreSame(logRep, rep2);
+
+ try
+ {
+ selector.CreateRepository(RepositoryName, typeof(MockLoggerRepository));
+ Assert.Fail("Should have thrown exception on redefinition.");
+ }
+ catch (LogException logEx)
+ {
+ Assert.IsTrue(logEx.Message.Contains("already defined"));
+ }
+ }
+
+ [Test]
+ public void CreateRepository_AssemblyAndType_NoReadAssemblyAttributes()
+ {
+ var selector = new DefaultRepositorySelector(typeof(MockLoggerRepository));
+ int numCreatedCallbacks = 0;
+ selector.LoggerRepositoryCreatedEvent += (_, _) => numCreatedCallbacks++;
+
+ ILoggerRepository logRep = selector.CreateRepository(typeof(MockLoggerRepository).Assembly,
+ typeof(MockLoggerRepository), RepositoryName, readAssemblyAttributes: false);
+ Assert.IsTrue(selector.ExistsRepository(RepositoryName));
+ ILoggerRepository[] allRepositories = selector.GetAllRepositories();
+ Assert.AreEqual(1, allRepositories.Length);
+ Assert.AreSame(logRep, allRepositories[0]);
+ Assert.AreEqual(1, numCreatedCallbacks);
+ Assert.IsInstanceOf<MockLoggerRepository>(logRep);
+ }
+
+ [Test]
+ public void CreateRepository_AssemblyWithNullType_NoReadAssemblyAttributes()
+ {
+ var selector = new DefaultRepositorySelector(typeof(MockLoggerRepository));
+
+ ILoggerRepository logRep = selector.CreateRepository(typeof(MockLoggerRepository2).Assembly, repositoryType: null,
+ RepositoryName, readAssemblyAttributes: false);
+ Assert.IsInstanceOf<MockLoggerRepository>(logRep, "Should have instantiated the default logger type specified in the selector constructor");
+ }
+
+ [Test]
+ public void CreateRepository_AssemblyWithNullType_ReadAssemblyAttributes()
+ {
+ var selector = new DefaultRepositorySelector(typeof(MockLoggerRepository));
+
+ ILoggerRepository logRep = selector.CreateRepository(typeof(MockLoggerRepository2).Assembly, repositoryType: null,
+ RepositoryName, readAssemblyAttributes: true);
+ Assert.IsInstanceOf<MockLoggerRepository>(logRep, "Should have instantiated default logger type");
+ Assert.AreEqual("MyRepository", logRep.Name);
+ }
+
+ [Test]
+ public void CreateRepositoryAndAlias()
+ {
+ var selector = new DefaultRepositorySelector(typeof(MockLoggerRepository));
+ int numCreatedCallbacks = 0;
+ selector.LoggerRepositoryCreatedEvent += (_, _) => numCreatedCallbacks++;
+
+ ILoggerRepository logRep = selector.CreateRepository(RepositoryName, typeof(MockLoggerRepository));
+ selector.AliasRepository("alias1", logRep);
+
+ var otherTypeLogRep = new MockLoggerRepository2();
+ Assert.Throws<InvalidOperationException>(() => selector.AliasRepository("alias1", otherTypeLogRep));
+ Assert.Throws<InvalidOperationException>(() => selector.AliasRepository(RepositoryName, otherTypeLogRep));
+
+ Assert.IsTrue(selector.ExistsRepository(RepositoryName));
+ Assert.IsFalse(selector.ExistsRepository("alias1"));
+ ILoggerRepository[] allRepositories = selector.GetAllRepositories();
+ Assert.AreEqual(1, allRepositories.Length);
+ Assert.AreSame(logRep, allRepositories[0]);
+ Assert.AreEqual(1, numCreatedCallbacks);
+ }
+ }
+
+ internal class MockLoggerRepository : ILoggerRepository
+ {
+ public MockLoggerRepository()
+ {
+ PluginMap = new(this);
+ }
+
+ public string Name { get; set; } = nameof(MockLoggerRepository);
+ public RendererMap RendererMap { get; } = new();
+ public PluginMap PluginMap { get; }
+ public LevelMap LevelMap { get; } = new();
+ public Level Threshold { get; set; } = Level.All;
+ public ILogger Exists(string name)
+ {
+ throw new NotImplementedException();
+ }
+
+ public ILogger[] GetCurrentLoggers()
+ {
+ throw new NotImplementedException();
+ }
+
+ public ILogger GetLogger(string name)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void Shutdown()
+ {
+ }
+
+ public void ResetConfiguration()
+ {
+ }
+
+ public void Log(LoggingEvent logEvent)
+ {
+ }
+ public bool Configured { get; set; }
+ public ICollection ConfigurationMessages { get; set; } = new List<string>();
+#pragma warning disable CS0067 // Unused event
+ public event LoggerRepositoryShutdownEventHandler? ShutdownEvent;
+ public event LoggerRepositoryConfigurationResetEventHandler? ConfigurationReset;
+ public event LoggerRepositoryConfigurationChangedEventHandler? ConfigurationChanged;
+#pragma warning restore CS0067
+ public PropertiesDictionary Properties { get; } = new();
+ public IAppender[] GetAppenders()
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ internal class MockLoggerRepository2 : MockLoggerRepository;
+}
diff --git a/src/log4net.Tests/Core/EvaluatorTest.cs b/src/log4net.Tests/Core/EvaluatorTest.cs
index 30a31de..9ddabd9 100644
--- a/src/log4net.Tests/Core/EvaluatorTest.cs
+++ b/src/log4net.Tests/Core/EvaluatorTest.cs
@@ -70,7 +70,6 @@
Assert.AreEqual(3, m_countingAppender.Counter, "Test 3 events flushed on Info message.");
}
-#if !NETSTANDARD1_3
[Test]
public void TestExceptionEvaluator()
{
@@ -139,6 +138,5 @@
logger.Log(typeof(EvaluatorTest), Level.Warn, "Warn message logged", new ApplicationException());
Assert.AreEqual(0, m_countingAppender.Counter, "Test 3 events buffered");
}
-#endif
}
-}
+}
\ No newline at end of file
diff --git a/src/log4net.Tests/Core/FixingTest.cs b/src/log4net.Tests/Core/FixingTest.cs
index 1431ce0..7f23c5d 100644
--- a/src/log4net.Tests/Core/FixingTest.cs
+++ b/src/log4net.Tests/Core/FixingTest.cs
@@ -24,13 +24,9 @@
using log4net.Core;
using NUnit.Framework;
-using static NExpect.Expectations;
-using NExpect;
namespace log4net.Tests.Core
{
- /// <summary>
- /// </<summary>
[TestFixture]
public class FixingTest
{
@@ -75,8 +71,7 @@
// Assert
foreach (var flag in allFlags)
{
- Expect(FixFlags.All & flag)
- .To.Equal(flag, () => $"FixFlags.All does not contain {flag}");
+ Assert.AreEqual(flag, FixFlags.All & flag, $"FixFlags.All does not contain {flag}");
}
}
@@ -160,16 +155,14 @@
{
Assert.AreEqual("ReallySimpleApp", loggingEventData.Domain, "Domain is incorrect");
Assert.AreEqual("System.Exception: This is the exception", loggingEvent.GetExceptionString(), "Exception is incorrect");
- Assert.AreEqual(null, loggingEventData.Identity, "Identity is incorrect");
+ Assert.IsNull(loggingEventData.Identity, "Identity is incorrect");
Assert.AreEqual(Level.Warn, loggingEventData.Level, "Level is incorrect");
-#if !NETSTANDARD1_3 // NETSTANDARD1_3: LocationInfo can't get method names
Assert.AreEqual("get_LocationInformation", loggingEvent.LocationInformation.MethodName, "Location Info is incorrect");
-#endif
Assert.AreEqual("log4net.Tests.Core.FixingTest", loggingEventData.LoggerName, "LoggerName is incorrect");
Assert.AreEqual(LogManager.GetRepository(TEST_REPOSITORY), loggingEvent.Repository, "Repository is incorrect");
Assert.AreEqual(Thread.CurrentThread.Name, loggingEventData.ThreadName, "ThreadName is incorrect");
// This test is redundant as loggingEventData.TimeStamp is a value type and cannot be null
- // Assert.IsNotNull(loggingEventData.TimeStampUtc, "TimeStamp is incorrect");
+ //Assert.IsNotNull(loggingEventData.TimeStampUtc, "TimeStamp is incorrect");
Assert.AreEqual("TestUser", loggingEventData.UserName, "UserName is incorrect");
Assert.AreEqual("Logging event works", loggingEvent.RenderedMessage, "Message is incorrect");
}
diff --git a/src/log4net.Tests/Core/LevelMapTest.cs b/src/log4net.Tests/Core/LevelMapTest.cs
new file mode 100644
index 0000000..5e77ebd
--- /dev/null
+++ b/src/log4net.Tests/Core/LevelMapTest.cs
@@ -0,0 +1,71 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+using log4net.Core;
+using log4net.Tests.Layout;
+
+using NUnit.Framework;
+
+#nullable enable
+
+namespace log4net.Tests.Core
+{
+ /// <summary>
+ /// Used for internal unit testing the <see cref="PatternLayoutTest"/> class.
+ /// </summary>
+ /// <remarks>
+ /// Used for internal unit testing the <see cref="PatternLayoutTest"/> class.
+ /// </remarks>
+ [TestFixture]
+ public class LevelMapTest
+ {
+ [Test]
+ public void LevelMapCreateClear()
+ {
+ var map = new LevelMap();
+ LevelCollection allLevels = map.AllLevels;
+ Assert.AreEqual(0, allLevels.Count);
+ Assert.IsNull(map["nonexistent"]);
+
+ map.Add("level1234", 1234, "displayName");
+ allLevels = map.AllLevels;
+ Assert.AreEqual(1, allLevels.Count);
+ Assert.AreEqual("level1234", allLevels[0].Name);
+ Assert.AreEqual("displayName", allLevels[0].DisplayName);
+ Assert.AreEqual(1234, allLevels[0].Value);
+ Level? level1234 = map["level1234"];
+ Assert.IsNotNull(level1234);
+ Assert.AreSame(level1234, allLevels[0]);
+
+ Level lookupLevel = map.LookupWithDefault(level1234!);
+ Assert.AreSame(level1234, lookupLevel);
+
+ var otherLevel = new Level(5678, "level5678", "display");
+ lookupLevel = map.LookupWithDefault(otherLevel);
+ Assert.AreSame(otherLevel, lookupLevel);
+ Assert.AreSame(otherLevel, map["LEVEL5678"]);
+
+ map.Clear();
+ allLevels = map.AllLevels;
+ Assert.AreEqual(0, allLevels.Count);
+ Assert.IsNull(map["level1234"]);
+ Assert.IsNull(map["LEVEL5678"]);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/log4net.Tests/Core/StringFormatTest.cs b/src/log4net.Tests/Core/StringFormatTest.cs
index 7aaf9b1..d13d37b 100644
--- a/src/log4net.Tests/Core/StringFormatTest.cs
+++ b/src/log4net.Tests/Core/StringFormatTest.cs
@@ -40,7 +40,6 @@
[TestFixture]
public class StringFormatTest
{
-#if !NETSTANDARD1_3
private CultureInfo _currentCulture;
private CultureInfo _currentUICulture;
@@ -60,7 +59,6 @@
System.Threading.Thread.CurrentThread.CurrentCulture = _currentCulture;
System.Threading.Thread.CurrentThread.CurrentUICulture = _currentUICulture;
}
-#endif
[Test]
public void TestFormatString()
diff --git a/src/log4net.Tests/DateFormatter/AbsoluteTimeDateFormatterTest.cs b/src/log4net.Tests/DateFormatter/AbsoluteTimeDateFormatterTest.cs
index 083dbf7..35c6845 100644
--- a/src/log4net.Tests/DateFormatter/AbsoluteTimeDateFormatterTest.cs
+++ b/src/log4net.Tests/DateFormatter/AbsoluteTimeDateFormatterTest.cs
@@ -18,6 +18,7 @@
#endregion
using System;
+using System.Globalization;
using System.IO;
using System.Text;
using log4net.DateFormatter;
@@ -25,81 +26,95 @@
namespace log4net.Tests.DateFormatter
{
-
- [TestFixture]
- public class AbsoluteTimeDateFormatterTest
+ [TestFixture]
+ public class AbsoluteTimeDateFormatterTest
+ {
+ [TearDown]
+ public void ResetCounts()
{
-
- [TearDown]
- public void resetCounts()
- {
- FormatterOne.invocations = 0;
- }
-
- [Test]
- public void CacheWorksForSameTicks()
- {
- StringWriter sw = new StringWriter();
- FormatterOne f1 = new FormatterOne();
- FormatterOne f2 = new FormatterOne();
- DateTime dt = DateTime.Now;
- f1.FormatDate(dt, sw);
- f2.FormatDate(dt, sw);
- Assert.AreEqual(1, FormatterOne.invocations);
- }
-
- [Test]
- public void CacheWorksForSameSecond()
- {
- StringWriter sw = new StringWriter();
- FormatterOne f1 = new FormatterOne();
- FormatterOne f2 = new FormatterOne();
- DateTime dt1 = DateTime.Today;
- DateTime dt2 = dt1.AddMilliseconds(600);
- f1.FormatDate(dt1, sw);
- f2.FormatDate(dt2, sw);
- Assert.AreEqual(1, FormatterOne.invocations);
- }
-
- [Test]
- public void CacheExpiresWhenCrossingSecond()
- {
- StringWriter sw = new StringWriter();
- FormatterOne f1 = new FormatterOne();
- FormatterOne f2 = new FormatterOne();
- DateTime dt1 = DateTime.Today.AddMinutes(1);
- DateTime dt2 = dt1.AddMilliseconds(1100);
- f1.FormatDate(dt1, sw);
- f2.FormatDate(dt2, sw);
- Assert.AreEqual(2, FormatterOne.invocations);
- }
-
- [Test]
- public void CacheIsLocalToSubclass()
- {
- StringWriter sw = new StringWriter();
- FormatterOne f1 = new FormatterOne();
- FormatterTwo f2 = new FormatterTwo();
- DateTime dt1 = DateTime.Today.AddMinutes(10);
- f1.FormatDate(dt1, sw);
- f2.FormatDate(dt1, sw);
- Assert.AreEqual(2, FormatterOne.invocations);
- }
+ FormatterOne.Invocations = 0;
}
- internal class FormatterOne : AbsoluteTimeDateFormatter
+ [Test]
+ public void CacheWorksForSameTicks()
{
- internal static int invocations = 0;
-
- override protected void FormatDateWithoutMillis(DateTime dateToFormat,
- StringBuilder buffer)
- {
- invocations++;
- }
-
+ StringWriter sw = new StringWriter();
+ FormatterOne f1 = new FormatterOne();
+ FormatterOne f2 = new FormatterOne();
+ DateTime dt = DateTime.Now;
+ f1.FormatDate(dt, sw);
+ f2.FormatDate(dt, sw);
+ Assert.AreEqual(1, FormatterOne.Invocations);
}
- internal class FormatterTwo : FormatterOne
+ [Test]
+ public void CacheWorksForSameSecond()
{
+ StringWriter sw = new StringWriter();
+ FormatterOne f1 = new FormatterOne();
+ FormatterOne f2 = new FormatterOne();
+ DateTime dt1 = DateTime.Today;
+ DateTime dt2 = dt1.AddMilliseconds(600);
+ f1.FormatDate(dt1, sw);
+ f2.FormatDate(dt2, sw);
+ Assert.AreEqual(1, FormatterOne.Invocations);
}
+
+ [Test]
+ public void CacheExpiresWhenCrossingSecond()
+ {
+ StringWriter sw = new StringWriter();
+ FormatterOne f1 = new FormatterOne();
+ FormatterOne f2 = new FormatterOne();
+ DateTime dt1 = DateTime.Today.AddMinutes(1);
+ DateTime dt2 = dt1.AddMilliseconds(1100);
+ f1.FormatDate(dt1, sw);
+ f2.FormatDate(dt2, sw);
+ Assert.AreEqual(2, FormatterOne.Invocations);
+ }
+
+ [Test]
+ public void CacheIsLocalToSubclass()
+ {
+ StringWriter sw = new StringWriter();
+ FormatterOne f1 = new FormatterOne();
+ FormatterTwo f2 = new FormatterTwo();
+ DateTime dt1 = DateTime.Today.AddMinutes(10);
+ f1.FormatDate(dt1, sw);
+ f2.FormatDate(dt1, sw);
+ Assert.AreEqual(2, FormatterOne.Invocations);
+ }
+
+ [Test]
+ public void TestFormattingResults()
+ {
+ var formatter = new AbsoluteTimeDateFormatter();
+ var sb = new StringBuilder();
+ using var writer = new StringWriter(sb, CultureInfo.InvariantCulture);
+
+ // Tests for prepended 0 characters for 2-digit and 3-digit portions.
+ formatter.FormatDate(new DateTime(1970, 1, 1, 1, 1, 1).AddMilliseconds(1), writer);
+ Assert.AreEqual("01:01:01,001", sb.ToString());
+ sb.Clear();
+
+ // Non-zero-prepend case.
+ formatter.FormatDate(new DateTime(2100, 12, 30, 11, 59, 59).AddMilliseconds(100), writer);
+ Assert.AreEqual("11:59:59,100", sb.ToString());
+ sb.Clear();
+ }
+ }
+
+ internal class FormatterOne : AbsoluteTimeDateFormatter
+ {
+ internal static int Invocations;
+
+ override protected void FormatDateWithoutMillis(DateTime dateToFormat, StringBuilder buffer)
+ {
+ Invocations++;
+ }
+ }
+
+ internal class FormatterTwo : FormatterOne
+ {
+ }
}
diff --git a/src/log4net.Tests/DateFormatter/DateTimeDateFormatterTest.cs b/src/log4net.Tests/DateFormatter/DateTimeDateFormatterTest.cs
new file mode 100644
index 0000000..ac428ec
--- /dev/null
+++ b/src/log4net.Tests/DateFormatter/DateTimeDateFormatterTest.cs
@@ -0,0 +1,59 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+using System;
+using System.Globalization;
+using System.IO;
+using System.Text;
+using log4net.DateFormatter;
+using NUnit.Framework;
+
+namespace log4net.Tests.DateFormatter
+{
+ [TestFixture]
+ public class DateTimeDateFormatterTest
+ {
+ [Test]
+ public void TestFormattingResults()
+ {
+ var sb = new StringBuilder();
+ using var writer = new StringWriter(sb, CultureInfo.InvariantCulture);
+
+ // Tests for prepended 0 characters for 2-digit and 3-digit portions.
+ var formatter = new DateTimeDateFormatter();
+ formatter.FormatDate(new DateTime(1970, 1, 1, 1, 1, 1).AddMilliseconds(1), writer);
+ Assert.AreEqual("01 Jan 1970 01:01:01,001", sb.ToString());
+ sb.Clear();
+
+ // Non-zero-prepend case.
+ var formatter2 = new DifferentTypeNameDateTimeDateFormatter();
+ formatter2.FormatDate(new DateTime(2100, 12, 30, 11, 59, 59).AddMilliseconds(100), writer);
+ Assert.AreEqual("30 Dec 2100 11:59:59,100", sb.ToString());
+ sb.Clear();
+ }
+
+ /// <summary>
+ /// Internal caching of datetime strings is by datetime class name. Avoid waiting
+ /// by adding another type name.
+ /// </summary>
+ private sealed class DifferentTypeNameDateTimeDateFormatter : DateTimeDateFormatter
+ {
+ }
+ }
+}
diff --git a/src/log4net.Tests/Hierarchy/Hierarchy.cs b/src/log4net.Tests/Hierarchy/HierarchyTest.cs
similarity index 95%
rename from src/log4net.Tests/Hierarchy/Hierarchy.cs
rename to src/log4net.Tests/Hierarchy/HierarchyTest.cs
index 94dd017..bddebf4 100644
--- a/src/log4net.Tests/Hierarchy/Hierarchy.cs
+++ b/src/log4net.Tests/Hierarchy/HierarchyTest.cs
@@ -67,7 +67,7 @@
CountingAppender beta = new CountingAppender();
Repository.Hierarchy.Hierarchy hierarchy =
- (Repository.Hierarchy.Hierarchy)Utils.GetRepository();
+ (Repository.Hierarchy.Hierarchy)LogManager.GetRepository();
hierarchy.Root.AddAppender(alpha);
hierarchy.Root.AddAppender(beta);
@@ -86,11 +86,7 @@
CountingAppender alpha = new CountingAppender();
CountingAppender beta = new CountingAppender();
-#if NETSTANDARD1_3
- BasicConfigurator.Configure(Utils.GetRepository(), alpha, beta);
-#else
- BasicConfigurator.Configure(alpha, beta);
-#endif
+ BasicConfigurator.Configure(LogManager.GetRepository(), alpha, beta);
ILog log = LogManager.GetLogger(GetType());
log.Debug("Hello World");
diff --git a/src/log4net.Tests/Hierarchy/Logger.cs b/src/log4net.Tests/Hierarchy/Logger.cs
deleted file mode 100644
index 3d383f7..0000000
--- a/src/log4net.Tests/Hierarchy/Logger.cs
+++ /dev/null
@@ -1,320 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System.Collections;
-#if NETSTANDARD1_3
-using System.Reflection;
-#endif
-
-using log4net.Core;
-using log4net.Repository.Hierarchy;
-using log4net.Tests.Appender;
-
-using NUnit.Framework;
-
-namespace log4net.Tests.Hierarchy
-{
- /// <summary>
- /// Used for internal unit testing the <see cref="Logger"/> class.
- /// </summary>
- /// <remarks>
- /// Internal unit test. Uses the NUnit test harness.
- /// </remarks>
- [TestFixture]
- public class LoggerTest
- {
- private Logger log;
-
- // A short message.
- private static string MSG = "M";
-
- /// <summary>
- /// Any initialization that happens before each test can
- /// go here
- /// </summary>
- [SetUp]
- public void SetUp()
- {
- }
-
- /// <summary>
- /// Any steps that happen after each test go here
- /// </summary>
- [TearDown]
- public void TearDown()
- {
- // Regular users should not use the clear method lightly!
- Utils.GetRepository().ResetConfiguration();
- Utils.GetRepository().Shutdown();
- ((Repository.Hierarchy.Hierarchy)Utils.GetRepository()).Clear();
- }
-
- /// <summary>
- /// Add an appender and see if it can be retrieved.
- /// </summary>
- [Test]
- public void TestAppender1()
- {
- log = (Logger)Utils.GetLogger("test").Logger;
- CountingAppender a1 = new CountingAppender();
- a1.Name = "testAppender1";
- log.AddAppender(a1);
-
- IEnumerator enumAppenders = ((IEnumerable)log.Appenders).GetEnumerator();
- Assert.IsTrue(enumAppenders.MoveNext());
- CountingAppender aHat = (CountingAppender)enumAppenders.Current;
- Assert.AreEqual(a1, aHat);
- }
-
- /// <summary>
- /// Add an appender X, Y, remove X and check if Y is the only
- /// remaining appender.
- /// </summary>
- [Test]
- public void TestAppender2()
- {
- CountingAppender a1 = new CountingAppender();
- a1.Name = "testAppender2.1";
- CountingAppender a2 = new CountingAppender();
- a2.Name = "testAppender2.2";
-
- log = (Logger)Utils.GetLogger("test").Logger;
- log.AddAppender(a1);
- log.AddAppender(a2);
-
- CountingAppender aHat = (CountingAppender)log.GetAppender(a1.Name);
- Assert.AreEqual(a1, aHat);
-
- aHat = (CountingAppender)log.GetAppender(a2.Name);
- Assert.AreEqual(a2, aHat);
-
- log.RemoveAppender("testAppender2.1");
-
- IEnumerator enumAppenders = ((IEnumerable)log.Appenders).GetEnumerator();
- Assert.IsTrue(enumAppenders.MoveNext());
- aHat = (CountingAppender)enumAppenders.Current;
- Assert.AreEqual(a2, aHat);
- Assert.IsTrue(!enumAppenders.MoveNext());
-
- aHat = (CountingAppender)log.GetAppender(a2.Name);
- Assert.AreEqual(a2, aHat);
- }
-
- /// <summary>
- /// Test if logger a.b inherits its appender from a.
- /// </summary>
- [Test]
- public void TestAdditivity1()
- {
- Logger a = (Logger)Utils.GetLogger("a").Logger;
- Logger ab = (Logger)Utils.GetLogger("a.b").Logger;
- CountingAppender ca = new CountingAppender();
-
- a.AddAppender(ca);
- a.Repository.Configured = true;
-
- Assert.AreEqual(ca.Counter, 0);
- ab.Log(Level.Debug, MSG, null);
- Assert.AreEqual(ca.Counter, 1);
- ab.Log(Level.Info, MSG, null);
- Assert.AreEqual(ca.Counter, 2);
- ab.Log(Level.Warn, MSG, null);
- Assert.AreEqual(ca.Counter, 3);
- ab.Log(Level.Error, MSG, null);
- Assert.AreEqual(ca.Counter, 4);
- }
-
- /// <summary>
- /// Test multiple additivity.
- /// </summary>
- [Test]
- public void TestAdditivity2()
- {
- Logger a = (Logger)Utils.GetLogger("a").Logger;
- Logger ab = (Logger)Utils.GetLogger("a.b").Logger;
- Logger abc = (Logger)Utils.GetLogger("a.b.c").Logger;
- Logger x = (Logger)Utils.GetLogger("x").Logger;
-
- CountingAppender ca1 = new CountingAppender();
- CountingAppender ca2 = new CountingAppender();
-
- a.AddAppender(ca1);
- abc.AddAppender(ca2);
- a.Repository.Configured = true;
-
- Assert.AreEqual(ca1.Counter, 0);
- Assert.AreEqual(ca2.Counter, 0);
-
- ab.Log(Level.Debug, MSG, null);
- Assert.AreEqual(ca1.Counter, 1);
- Assert.AreEqual(ca2.Counter, 0);
-
- abc.Log(Level.Debug, MSG, null);
- Assert.AreEqual(ca1.Counter, 2);
- Assert.AreEqual(ca2.Counter, 1);
-
- x.Log(Level.Debug, MSG, null);
- Assert.AreEqual(ca1.Counter, 2);
- Assert.AreEqual(ca2.Counter, 1);
- }
-
- /// <summary>
- /// Test additivity flag.
- /// </summary>
- [Test]
- public void TestAdditivity3()
- {
- Logger root = ((Repository.Hierarchy.Hierarchy)Utils.GetRepository()).Root;
- Logger a = (Logger)Utils.GetLogger("a").Logger;
- Logger ab = (Logger)Utils.GetLogger("a.b").Logger;
- Logger abc = (Logger)Utils.GetLogger("a.b.c").Logger;
-
- CountingAppender caRoot = new CountingAppender();
- CountingAppender caA = new CountingAppender();
- CountingAppender caABC = new CountingAppender();
-
- root.AddAppender(caRoot);
- a.AddAppender(caA);
- abc.AddAppender(caABC);
- a.Repository.Configured = true;
-
- Assert.AreEqual(caRoot.Counter, 0);
- Assert.AreEqual(caA.Counter, 0);
- Assert.AreEqual(caABC.Counter, 0);
-
- ab.Additivity = false;
-
- a.Log(Level.Debug, MSG, null);
- Assert.AreEqual(caRoot.Counter, 1);
- Assert.AreEqual(caA.Counter, 1);
- Assert.AreEqual(caABC.Counter, 0);
-
- ab.Log(Level.Debug, MSG, null);
- Assert.AreEqual(caRoot.Counter, 1);
- Assert.AreEqual(caA.Counter, 1);
- Assert.AreEqual(caABC.Counter, 0);
-
- abc.Log(Level.Debug, MSG, null);
- Assert.AreEqual(caRoot.Counter, 1);
- Assert.AreEqual(caA.Counter, 1);
- Assert.AreEqual(caABC.Counter, 1);
- }
-
- /// <summary>
- /// Test the ability to disable a level of message
- /// </summary>
- [Test]
- public void TestDisable1()
- {
- CountingAppender caRoot = new CountingAppender();
- Logger root = ((Repository.Hierarchy.Hierarchy)Utils.GetRepository()).Root;
- root.AddAppender(caRoot);
-
- Repository.Hierarchy.Hierarchy h = ((Repository.Hierarchy.Hierarchy)Utils.GetRepository());
- h.Threshold = Level.Info;
- h.Configured = true;
-
- Assert.AreEqual(caRoot.Counter, 0);
-
- root.Log(Level.Debug, MSG, null);
- Assert.AreEqual(caRoot.Counter, 0);
- root.Log(Level.Info, MSG, null);
- Assert.AreEqual(caRoot.Counter, 1);
- root.Log(Level.Warn, MSG, null);
- Assert.AreEqual(caRoot.Counter, 2);
- root.Log(Level.Warn, MSG, null);
- Assert.AreEqual(caRoot.Counter, 3);
-
- h.Threshold = Level.Warn;
- root.Log(Level.Debug, MSG, null);
- Assert.AreEqual(caRoot.Counter, 3);
- root.Log(Level.Info, MSG, null);
- Assert.AreEqual(caRoot.Counter, 3);
- root.Log(Level.Warn, MSG, null);
- Assert.AreEqual(caRoot.Counter, 4);
- root.Log(Level.Error, MSG, null);
- Assert.AreEqual(caRoot.Counter, 5);
- root.Log(Level.Error, MSG, null);
- Assert.AreEqual(caRoot.Counter, 6);
-
- h.Threshold = Level.Off;
- root.Log(Level.Debug, MSG, null);
- Assert.AreEqual(caRoot.Counter, 6);
- root.Log(Level.Info, MSG, null);
- Assert.AreEqual(caRoot.Counter, 6);
- root.Log(Level.Warn, MSG, null);
- Assert.AreEqual(caRoot.Counter, 6);
- root.Log(Level.Error, MSG, null);
- Assert.AreEqual(caRoot.Counter, 6);
- root.Log(Level.Fatal, MSG, null);
- Assert.AreEqual(caRoot.Counter, 6);
- root.Log(Level.Fatal, MSG, null);
- Assert.AreEqual(caRoot.Counter, 6);
- }
-
- /// <summary>
- /// Tests the Exists method of the Logger class
- /// </summary>
- [Test]
- public void TestExists()
- {
- object a = Utils.GetLogger("a");
- object a_b = Utils.GetLogger("a.b");
- object a_b_c = Utils.GetLogger("a.b.c");
-
- object t;
-#if NETSTANDARD1_3
- Assert.IsNull(LogManager.Exists(GetType().GetTypeInfo().Assembly, "xx"));
- t = LogManager.Exists(GetType().GetTypeInfo().Assembly, "a");
- Assert.AreSame(a, t);
- t = LogManager.Exists(GetType().GetTypeInfo().Assembly, "a.b");
- Assert.AreSame(a_b, t);
- t = LogManager.Exists(GetType().GetTypeInfo().Assembly, "a.b.c");
- Assert.AreSame(a_b_c, t);
-#else
- t = LogManager.Exists("xx");
- Assert.IsNull(t);
- t = LogManager.Exists("a");
- Assert.AreSame(a, t);
- t = LogManager.Exists("a.b");
- Assert.AreSame(a_b, t);
- t = LogManager.Exists("a.b.c");
- Assert.AreSame(a_b_c, t);
-#endif
- }
-
- /// <summary>
- /// Tests the chained level for a hierarchy
- /// </summary>
- [Test]
- public void TestHierarchy1()
- {
- Repository.Hierarchy.Hierarchy h = new Repository.Hierarchy.Hierarchy();
- h.Root.Level = Level.Error;
-
- Logger a0 = (Logger)h.GetLogger("a");
- Assert.AreEqual("a", a0.Name);
- Assert.IsNull(a0.Level);
- Assert.AreSame(Level.Error, a0.EffectiveLevel);
-
- Logger a1 = (Logger)h.GetLogger("a");
- Assert.AreSame(a0, a1);
- }
- }
-}
\ No newline at end of file
diff --git a/src/log4net.Tests/Hierarchy/LoggerTest.cs b/src/log4net.Tests/Hierarchy/LoggerTest.cs
new file mode 100644
index 0000000..6dbd233
--- /dev/null
+++ b/src/log4net.Tests/Hierarchy/LoggerTest.cs
@@ -0,0 +1,349 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+using System;
+using System.Collections;
+using log4net.Appender;
+using log4net.Core;
+using log4net.Repository.Hierarchy;
+using log4net.Tests.Appender;
+
+using NUnit.Framework;
+
+#nullable enable
+
+namespace log4net.Tests.Hierarchy
+{
+ /// <summary>
+ /// Used for internal unit testing the <see cref="Logger"/> class.
+ /// </summary>
+ /// <remarks>
+ /// Internal unit test. Uses the NUnit test harness.
+ /// </remarks>
+ [TestFixture]
+ public sealed class LoggerTest
+ {
+ private Logger? log;
+
+ // A short message.
+ private static string MSG = "M";
+
+ /// <summary>
+ /// Any steps that happen after each test go here
+ /// </summary>
+ [TearDown]
+ public void TearDown()
+ {
+ // Regular users should not use the clear method lightly!
+ LogManager.GetRepository().ResetConfiguration();
+ LogManager.GetRepository().Shutdown();
+ ((Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).Clear();
+ }
+
+ /// <summary>
+ /// Add an appender and see if it can be retrieved.
+ /// </summary>
+ [Test]
+ public void TestAppender1()
+ {
+ log = (Logger)LogManager.GetLogger("test").Logger;
+ var a1 = new CountingAppender { Name = "testAppender1" };
+ log.AddAppender(a1);
+
+ IEnumerator enumAppenders = ((IEnumerable)log.Appenders).GetEnumerator();
+ try
+ {
+ Assert.IsTrue(enumAppenders.MoveNext());
+ var aHat = (CountingAppender?)enumAppenders.Current;
+ Assert.IsNotNull(aHat);
+ Assert.AreEqual(a1, aHat);
+ }
+ finally
+ {
+ if (enumAppenders is IDisposable disposable)
+ {
+ disposable.Dispose();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Add an appender X, Y, remove X and check if Y is the only
+ /// remaining appender.
+ /// </summary>
+ [Test]
+ public void TestAppender2()
+ {
+ var a1 = new CountingAppender { Name = "testAppender2.1" };
+ var a2 = new CountingAppender { Name = "testAppender2.2" };
+
+ log = (Logger)LogManager.GetLogger("test").Logger;
+ log.AddAppender(a1);
+ log.AddAppender(a2);
+ Assert.AreEqual(2, log.Appenders.Count);
+
+ var aHat = (CountingAppender?)log.GetAppender(a1.Name);
+ Assert.AreEqual(a1, aHat);
+
+ aHat = (CountingAppender?)log.GetAppender(a2.Name);
+ Assert.IsNotNull(aHat);
+ Assert.AreEqual(a2, aHat);
+
+ // By name.
+ IAppender? removedAppender = log.RemoveAppender("testAppender2.1");
+ Assert.AreSame(a1, removedAppender);
+ Assert.AreEqual(1, log.Appenders.Count);
+
+ IEnumerator enumAppenders = ((IEnumerable)log.Appenders).GetEnumerator();
+ try
+ {
+ Assert.IsTrue(enumAppenders.MoveNext());
+ aHat = (CountingAppender?)enumAppenders.Current;
+ Assert.IsNotNull(aHat);
+ Assert.AreSame(a2, aHat);
+ Assert.IsFalse(enumAppenders.MoveNext());
+ }
+ finally
+ {
+ if (enumAppenders is IDisposable disposable)
+ {
+ disposable.Dispose();
+ }
+ }
+
+ aHat = (CountingAppender?)log.GetAppender(a2.Name);
+ Assert.IsNotNull(aHat);
+ Assert.AreSame(a2, aHat);
+
+ // By appender.
+ removedAppender = log.RemoveAppender(a2);
+ Assert.AreSame(a2, removedAppender);
+ Assert.AreEqual(0, log.Appenders.Count);
+
+ enumAppenders = ((IEnumerable)log.Appenders).GetEnumerator();
+ try
+ {
+ Assert.IsFalse(enumAppenders.MoveNext());
+ }
+ finally
+ {
+ if (enumAppenders is IDisposable disposable)
+ {
+ disposable.Dispose();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Test if logger a.b inherits its appender from a.
+ /// </summary>
+ [Test]
+ public void TestAdditivity1()
+ {
+ Logger a = (Logger)LogManager.GetLogger("a").Logger;
+ Logger ab = (Logger)LogManager.GetLogger("a.b").Logger;
+ var ca = new CountingAppender();
+
+ a.AddAppender(ca);
+ Assert.IsNotNull(a.Repository);
+ a.Repository!.Configured = true;
+
+ Assert.AreEqual(0, ca.Counter);
+ ab.Log(Level.Debug, MSG, null);
+ Assert.AreEqual(1, ca.Counter);
+ ab.Log(Level.Info, MSG, null);
+ Assert.AreEqual(2, ca.Counter);
+ ab.Log(Level.Warn, MSG, null);
+ Assert.AreEqual(3, ca.Counter);
+ ab.Log(Level.Error, MSG, null);
+ Assert.AreEqual(4, ca.Counter);
+ }
+
+ /// <summary>
+ /// Test multiple additivity.
+ /// </summary>
+ [Test]
+ public void TestAdditivity2()
+ {
+ Logger a = (Logger)LogManager.GetLogger("a").Logger;
+ Logger ab = (Logger)LogManager.GetLogger("a.b").Logger;
+ Logger abc = (Logger)LogManager.GetLogger("a.b.c").Logger;
+ Logger x = (Logger)LogManager.GetLogger("x").Logger;
+
+ var ca1 = new CountingAppender();
+ var ca2 = new CountingAppender();
+
+ a.AddAppender(ca1);
+ abc.AddAppender(ca2);
+ Assert.IsNotNull(a.Repository);
+ a.Repository!.Configured = true;
+
+ Assert.AreEqual(0, ca1.Counter);
+ Assert.AreEqual(0, ca2.Counter);
+
+ ab.Log(Level.Debug, MSG, null);
+ Assert.AreEqual(1, ca1.Counter);
+ Assert.AreEqual(0, ca2.Counter);
+
+ abc.Log(Level.Debug, MSG, null);
+ Assert.AreEqual(2, ca1.Counter);
+ Assert.AreEqual(1, ca2.Counter);
+
+ x.Log(Level.Debug, MSG, null);
+ Assert.AreEqual(2, ca1.Counter);
+ Assert.AreEqual(1, ca2.Counter);
+ }
+
+ /// <summary>
+ /// Test additivity flag.
+ /// </summary>
+ [Test]
+ public void TestAdditivity3()
+ {
+ Logger root = ((Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).Root;
+ Logger a = (Logger)LogManager.GetLogger("a").Logger;
+ Logger ab = (Logger)LogManager.GetLogger("a.b").Logger;
+ Logger abc = (Logger)LogManager.GetLogger("a.b.c").Logger;
+
+ var caRoot = new CountingAppender();
+ var caA = new CountingAppender();
+ var caABC = new CountingAppender();
+
+ root.AddAppender(caRoot);
+ a.AddAppender(caA);
+ abc.AddAppender(caABC);
+ Assert.IsNotNull(a.Repository);
+ a.Repository!.Configured = true;
+
+ Assert.AreEqual(0, caRoot.Counter);
+ Assert.AreEqual(0, caA.Counter);
+ Assert.AreEqual(0, caABC.Counter);
+
+ ab.Additivity = false;
+
+ a.Log(Level.Debug, MSG, null);
+ Assert.AreEqual(1, caRoot.Counter);
+ Assert.AreEqual(1, caA.Counter);
+ Assert.AreEqual(0, caABC.Counter);
+
+ ab.Log(Level.Debug, MSG, null);
+ Assert.AreEqual(1, caRoot.Counter);
+ Assert.AreEqual(1, caA.Counter);
+ Assert.AreEqual(0, caABC.Counter);
+
+ abc.Log(Level.Debug, MSG, null);
+ Assert.AreEqual(1, caRoot.Counter);
+ Assert.AreEqual(1, caA.Counter);
+ Assert.AreEqual(1, caABC.Counter);
+ }
+
+ /// <summary>
+ /// Test the ability to disable a level of message
+ /// </summary>
+ [Test]
+ public void TestDisable1()
+ {
+ var caRoot = new CountingAppender();
+ Logger root = ((Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).Root;
+ root.AddAppender(caRoot);
+
+ Repository.Hierarchy.Hierarchy h = ((Repository.Hierarchy.Hierarchy)LogManager.GetRepository());
+ h.Threshold = Level.Info;
+ h.Configured = true;
+
+ Assert.AreEqual(0, caRoot.Counter);
+
+ root.Log(Level.Debug, MSG, null);
+ Assert.AreEqual(0, caRoot.Counter);
+ root.Log(Level.Info, MSG, null);
+ Assert.AreEqual(1, caRoot.Counter);
+ root.Log(Level.Warn, MSG, null);
+ Assert.AreEqual(2, caRoot.Counter);
+ root.Log(Level.Warn, MSG, null);
+ Assert.AreEqual(3, caRoot.Counter);
+
+ h.Threshold = Level.Warn;
+ root.Log(Level.Debug, MSG, null);
+ Assert.AreEqual(3, caRoot.Counter);
+ root.Log(Level.Info, MSG, null);
+ Assert.AreEqual(3, caRoot.Counter);
+ root.Log(Level.Warn, MSG, null);
+ Assert.AreEqual(4, caRoot.Counter);
+ root.Log(Level.Error, MSG, null);
+ Assert.AreEqual(5, caRoot.Counter);
+ root.Log(Level.Error, MSG, null);
+ Assert.AreEqual(6, caRoot.Counter);
+
+ h.Threshold = Level.Off;
+ root.Log(Level.Debug, MSG, null);
+ Assert.AreEqual(6, caRoot.Counter);
+ root.Log(Level.Info, MSG, null);
+ Assert.AreEqual(6, caRoot.Counter);
+ root.Log(Level.Warn, MSG, null);
+ Assert.AreEqual(6, caRoot.Counter);
+ root.Log(Level.Error, MSG, null);
+ Assert.AreEqual(6, caRoot.Counter);
+ root.Log(Level.Fatal, MSG, null);
+ Assert.AreEqual(6, caRoot.Counter);
+ root.Log(Level.Fatal, MSG, null);
+ Assert.AreEqual(6, caRoot.Counter);
+ }
+
+ /// <summary>
+ /// Tests the Exists method of the Logger class
+ /// </summary>
+ [Test]
+ public void TestExists()
+ {
+ ILog a = LogManager.GetLogger("a");
+ Assert.IsNotNull(a);
+ ILog a_b = LogManager.GetLogger("a.b");
+ Assert.IsNotNull(a_b);
+ ILog a_b_c = LogManager.GetLogger("a.b.c");
+ Assert.IsNotNull(a_b_c);
+
+ ILog? t = LogManager.Exists("xx");
+ Assert.IsNull(t);
+ t = LogManager.Exists("a");
+ Assert.AreSame(a, t);
+ t = LogManager.Exists("a.b");
+ Assert.AreSame(a_b, t);
+ t = LogManager.Exists("a.b.c");
+ Assert.AreSame(a_b_c, t);
+ }
+
+ /// <summary>
+ /// Tests the chained level for a hierarchy
+ /// </summary>
+ [Test]
+ public void TestHierarchy1()
+ {
+ var h = new Repository.Hierarchy.Hierarchy();
+ h.Root.Level = Level.Error;
+
+ Logger a0 = (Logger)h.GetLogger("a");
+ Assert.AreEqual("a", a0.Name);
+ Assert.IsNull(a0.Level);
+ Assert.AreSame(Level.Error, a0.EffectiveLevel);
+
+ Logger a1 = (Logger)h.GetLogger("a");
+ Assert.AreSame(a0, a1);
+ }
+ }
+}
diff --git a/src/log4net.Tests/Layout/PatternLayoutTest.cs b/src/log4net.Tests/Layout/PatternLayoutTest.cs
index ebfbfd7..9804020 100644
--- a/src/log4net.Tests/Layout/PatternLayoutTest.cs
+++ b/src/log4net.Tests/Layout/PatternLayoutTest.cs
@@ -19,9 +19,7 @@
using System;
using System.IO;
-#if !NETSTANDARD1_3
using System.Globalization;
-#endif
using log4net.Config;
using log4net.Core;
@@ -44,7 +42,6 @@
[TestFixture]
public class PatternLayoutTest
{
-#if !NETSTANDARD1_3
private CultureInfo _currentCulture;
private CultureInfo _currentUICulture;
@@ -66,7 +63,6 @@
System.Threading.Thread.CurrentThread.CurrentCulture = _currentCulture;
System.Threading.Thread.CurrentThread.CurrentUICulture = _currentUICulture;
}
-#endif
protected virtual PatternLayout NewPatternLayout()
{
@@ -106,7 +102,6 @@
stringAppender.Reset();
}
-#if !NETSTANDARD1_3
[Test]
public void TestStackTracePattern()
{
@@ -122,7 +117,6 @@
StringAssert.EndsWith("PatternLayoutTest.TestStackTracePattern", stringAppender.GetString(), "stack trace value set");
stringAppender.Reset();
}
-#endif
[Test]
public void TestGlobalPropertiesPattern()
diff --git a/src/log4net.Tests/Layout/XmlLayoutTest.cs b/src/log4net.Tests/Layout/XmlLayoutTest.cs
index 6160dc5..2fca89e 100644
--- a/src/log4net.Tests/Layout/XmlLayoutTest.cs
+++ b/src/log4net.Tests/Layout/XmlLayoutTest.cs
@@ -34,9 +34,8 @@
namespace log4net.Tests.Layout
{
[TestFixture]
- public class XmlLayoutTest
+ public sealed class XmlLayoutTest
{
-#if !NETSTANDARD1_3
private CultureInfo _currentCulture;
private CultureInfo _currentUICulture;
@@ -56,7 +55,6 @@
System.Threading.Thread.CurrentThread.CurrentCulture = _currentCulture;
System.Threading.Thread.CurrentThread.CurrentUICulture = _currentUICulture;
}
-#endif
/// <summary>
/// Build a basic <see cref="LoggingEventData"/> object with some default values.
@@ -82,25 +80,26 @@
private static string CreateEventNode(string message)
{
- return String.Format("<event logger=\"TestLogger\" timestamp=\"{0}\" level=\"INFO\" thread=\"TestThread\" domain=\"Tests\" identity=\"TestRunner\" username=\"TestRunner\"><message>{1}</message></event>" + Environment.NewLine,
-#if NET_2_0 || MONO_2_0 || MONO_3_5 || MONO_4_0 || NETSTANDARD
- XmlConvert.ToString(DateTime.Today, XmlDateTimeSerializationMode.Local),
+ return string.Format("<{0}event logger=\"TestLogger\" timestamp=\"{2}\" level=\"INFO\" thread=\"TestThread\" domain=\"Tests\" identity=\"TestRunner\" username=\"TestRunner\"{1}><{0}message>{3}</{0}message></{0}event>" +
+ Environment.NewLine,
+#if NETCOREAPP
+ "log4net:", @" xmlns:log4net=""log4net""",
#else
- XmlConvert.ToString(DateTime.Today),
+ string.Empty, string.Empty,
#endif
- message);
+ XmlConvert.ToString(DateTime.Today, XmlDateTimeSerializationMode.Local),
+ message);
}
private static string CreateEventNode(string key, string value)
{
- return String.Format("<event logger=\"TestLogger\" timestamp=\"{0}\" level=\"INFO\" thread=\"TestThread\" domain=\"Tests\" identity=\"TestRunner\" username=\"TestRunner\"><message>Test message</message><properties><data name=\"{1}\" value=\"{2}\" /></properties></event>" + Environment.NewLine,
-#if NET_2_0 || MONO_2_0 || MONO_3_5 || MONO_4_0 || NETSTANDARD
- XmlConvert.ToString(DateTime.Today, XmlDateTimeSerializationMode.Local),
+ return string.Format("<{0}event logger=\"TestLogger\" timestamp=\"{2}\" level=\"INFO\" thread=\"TestThread\" domain=\"Tests\" identity=\"TestRunner\" username=\"TestRunner\"{1}><{0}message>Test message</{0}message><{0}properties><{0}data name=\"{3}\" value=\"{4}\" /></{0}properties></{0}event>" + Environment.NewLine,
+#if NETCOREAPP
+ "log4net:", @" xmlns:log4net=""log4net""",
#else
- XmlConvert.ToString(DateTime.Today),
+ string.Empty, string.Empty,
#endif
- key,
- value);
+ XmlConvert.ToString(DateTime.Today, XmlDateTimeSerializationMode.Local), key, value);
}
[Test]
@@ -305,7 +304,6 @@
Assert.AreEqual(expected, stringAppender.GetString());
}
-#if NET_4_0 || MONO_4_0 || NETSTANDARD
[Test]
public void BracketsInStackTracesKeepLogWellFormed()
{
@@ -357,14 +355,15 @@
};
bar(42);
- var log = stringAppender.GetString();
-#if NETSTANDARD1_3
- var startOfExceptionText = log.IndexOf("<exception>", StringComparison.Ordinal) + 11;
- var endOfExceptionText = log.IndexOf("</exception>", StringComparison.Ordinal);
+#if NETCOREAPP
+ const string nodeName = "log4net:exception";
#else
- var startOfExceptionText = log.IndexOf("<exception>", StringComparison.InvariantCulture) + 11;
- var endOfExceptionText = log.IndexOf("</exception>", StringComparison.InvariantCulture);
+ const string nodeName = "exception";
#endif
+
+ var log = stringAppender.GetString();
+ var startOfExceptionText = log.IndexOf("<" + nodeName + ">", StringComparison.InvariantCulture) + nodeName.Length + 2;
+ var endOfExceptionText = log.IndexOf("</" + nodeName + ">", StringComparison.InvariantCulture);
var sub = log.Substring(startOfExceptionText, endOfExceptionText - startOfExceptionText);
if (sub.StartsWith("<![CDATA["))
{
@@ -376,6 +375,5 @@
StringAssert.DoesNotContain(">", sub);
}
}
-#endif
}
}
\ No newline at end of file
diff --git a/src/log4net.Tests/NUnitTestRunnerInitializer.cs b/src/log4net.Tests/NUnitTestRunnerInitializer.cs
index 08b4215..5d3d8bc 100644
--- a/src/log4net.Tests/NUnitTestRunnerInitializer.cs
+++ b/src/log4net.Tests/NUnitTestRunnerInitializer.cs
@@ -1,4 +1,23 @@
-namespace log4net.Tests
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+namespace log4net.Tests
{
using System.IO;
diff --git a/src/log4net.Tests/Signing.cs b/src/log4net.Tests/Signing.cs
index 93d4556..0bf4e95 100644
--- a/src/log4net.Tests/Signing.cs
+++ b/src/log4net.Tests/Signing.cs
@@ -1,7 +1,24 @@
-using log4net.Repository;
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+using log4net.Repository;
using NUnit.Framework;
-using NExpect;
-using static NExpect.Expectations;
namespace log4net.Tests
{
@@ -15,9 +32,7 @@
var asm = typeof(LoggerRepositorySkeleton).Assembly;
// Act
var result = asm.GetName().GetPublicKey();
- // Assert
- Expect(result)
- .Not.To.Be.Empty();
+ Assert.AreNotEqual(0, result.Length);
}
}
}
\ No newline at end of file
diff --git a/src/log4net.Tests/Util/CyclicBufferTest.cs b/src/log4net.Tests/Util/CyclicBufferTest.cs
index 0d81c48..9125d0c 100644
--- a/src/log4net.Tests/Util/CyclicBufferTest.cs
+++ b/src/log4net.Tests/Util/CyclicBufferTest.cs
@@ -29,9 +29,6 @@
/// <summary>
/// Used for internal unit testing the <see cref="PropertiesDictionary"/> class.
/// </summary>
- /// <remarks>
- /// Used for internal unit testing the <see cref="PropertiesDictionary"/> class.
- /// </remarks>
[TestFixture]
public class CyclicBufferTest
{
@@ -52,13 +49,12 @@
LoggingEvent event1 = new LoggingEvent(null, null, null, null, null, null);
LoggingEvent event2 = new LoggingEvent(null, null, null, null, null, null);
- LoggingEvent discardedEvent = cb.Append(event1);
+ LoggingEvent? discardedEvent = cb.Append(event1);
- Assert.IsNull(discardedEvent, "No event should be discarded untill the buffer is full");
+ Assert.IsNull(discardedEvent, "No event should be discarded until the buffer is full");
Assert.AreEqual(1, cb.Length, "Buffer should have length 1");
Assert.AreEqual(1, cb.MaxSize, "Buffer should still have max size 1");
-
discardedEvent = cb.Append(event2);
Assert.AreSame(event1, discardedEvent, "Expect event1 to now be discarded");
@@ -67,7 +63,7 @@
LoggingEvent[] discardedEvents = cb.PopAll();
- Assert.AreEqual(1, discardedEvents.Length, "Poped events length should be 1");
+ Assert.AreEqual(1, discardedEvents.Length, "Popped events length should be 1");
Assert.AreSame(event2, discardedEvents[0], "Expect event2 to now be popped");
Assert.AreEqual(0, cb.Length, "Buffer should be back to length 0");
Assert.AreEqual(1, cb.MaxSize, "Buffer should really really still have max size 1");
@@ -85,7 +81,7 @@
LoggingEvent event2 = new LoggingEvent(null, null, null, null, null, null);
LoggingEvent event3 = new LoggingEvent(null, null, null, null, null, null);
- LoggingEvent discardedEvent;
+ LoggingEvent? discardedEvent;
discardedEvent = cb.Append(event1);
Assert.IsNull(discardedEvent, "No event should be discarded after append 1");
@@ -100,7 +96,7 @@
LoggingEvent[] discardedEvents = cb.PopAll();
- Assert.AreEqual(1, discardedEvents.Length, "Poped events length should be 1");
+ Assert.AreEqual(1, discardedEvents.Length, "Popped events length should be 1");
Assert.AreSame(event3, discardedEvents[0], "Expect event3 to now be popped");
Assert.AreEqual(0, cb.Length, "Buffer should be back to length 0");
Assert.AreEqual(2, cb.MaxSize, "Buffer should really really still have max size 2");
diff --git a/src/log4net.Tests/Util/EnvironmentPatternConverterTest.cs b/src/log4net.Tests/Util/EnvironmentPatternConverterTest.cs
index da11594..0368371 100644
--- a/src/log4net.Tests/Util/EnvironmentPatternConverterTest.cs
+++ b/src/log4net.Tests/Util/EnvironmentPatternConverterTest.cs
@@ -19,18 +19,15 @@
*
*/
-// .NET Compact Framework 1.0 has no support for Environment.GetEnvironmentVariable()
-// .NET Framework version 1.0 / 1.1 do not have support for SetEnvironmentVariable which is used in these tests.
-#if !NETCF && (NET_2_0 || NETSTANDARD2_0)
-
using System;
using System.IO;
+using log4net.Util.PatternStringConverters;
using NUnit.Framework;
namespace log4net.Tests.Util
{
[TestFixture]
- public class EnvironmentPatternConverterTest
+ public sealed class EnvironmentPatternConverterTest
{
private const string ENVIRONMENT_VARIABLE_NAME = "LOG4NET_TEST_TEMP";
const string SYSTEM_LEVEL_VALUE = "SystemLevelEnvironmentValue";
@@ -40,6 +37,8 @@
[Test]
public void SystemLevelEnvironmentVariable()
{
+ if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Linux))
+ return;
EnvironmentPatternConverter converter = new EnvironmentPatternConverter();
try
{
@@ -63,6 +62,8 @@
[Test]
public void UserLevelEnvironmentVariable()
{
+ if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Linux))
+ return;
EnvironmentPatternConverter converter = new EnvironmentPatternConverter();
Environment.SetEnvironmentVariable(ENVIRONMENT_VARIABLE_NAME, USER_LEVEL_VALUE, EnvironmentVariableTarget.User);
@@ -91,28 +92,5 @@
Environment.SetEnvironmentVariable(ENVIRONMENT_VARIABLE_NAME, null);
}
-
- private class EnvironmentPatternConverter
- {
- private object target = null;
-
- public EnvironmentPatternConverter()
- {
- target = Utils.CreateInstance("log4net.Util.PatternStringConverters.EnvironmentPatternConverter,log4net");
- }
-
- public string Option
- {
- get { return Utils.GetProperty(target, "Option") as string; }
- set { Utils.SetProperty(target, "Option", value); }
- }
-
- public void Convert(TextWriter writer, object state)
- {
- Utils.InvokeMethod(target, "Convert", writer, state);
- }
- }
}
-}
-
-#endif
+}
\ No newline at end of file
diff --git a/src/log4net.Tests/Util/LogLogTest.cs b/src/log4net.Tests/Util/LogLogTest.cs
index d9fcf4f..4aed3a2 100644
--- a/src/log4net.Tests/Util/LogLogTest.cs
+++ b/src/log4net.Tests/Util/LogLogTest.cs
@@ -19,7 +19,7 @@
*
*/
-using System.Collections;
+using System.Collections.Generic;
using System.Diagnostics;
using log4net.Util;
using NUnit.Framework;
@@ -71,7 +71,7 @@
[Test]
public void LogReceivedAdapter()
{
- ArrayList messages = new ArrayList();
+ var messages = new List<LogLog>();
using (new LogLog.LogReceivedAdapter(messages))
{
@@ -86,26 +86,21 @@
public class TraceListenerCounter : TraceListener
{
- private int count = 0;
-
- public override void Write(string message)
+ public override void Write(string? message)
{
- count++;
+ Count++;
}
- public override void WriteLine(string message)
+ public override void WriteLine(string? message)
{
Write(message);
}
public void Reset()
{
- count = 0;
+ Count = 0;
}
- public int Count
- {
- get { return count; }
- }
+ public int Count { get; private set; }
}
}
diff --git a/src/log4net.Tests/Util/PatternConverterTest.cs b/src/log4net.Tests/Util/PatternConverterTest.cs
index e8830f3..6a5a238 100644
--- a/src/log4net.Tests/Util/PatternConverterTest.cs
+++ b/src/log4net.Tests/Util/PatternConverterTest.cs
@@ -131,62 +131,33 @@
{
private static PropertyKeyCountPatternLayoutConverter mostRecentInstance;
- public PropertyKeyCountPatternLayoutConverter()
- {
- mostRecentInstance = this;
- }
+ public PropertyKeyCountPatternLayoutConverter() => mostRecentInstance = this;
- protected override void Convert(TextWriter writer, LoggingEvent loggingEvent)
- {
- writer.Write(Properties.GetKeys().Length);
- }
+ protected override void Convert(TextWriter writer, LoggingEvent loggingEvent) => writer.Write(Properties.GetKeys().Length);
- public static PropertyKeyCountPatternLayoutConverter MostRecentInstance
- {
- get { return mostRecentInstance; }
- }
+ public static PropertyKeyCountPatternLayoutConverter MostRecentInstance => mostRecentInstance;
}
public class PropertyKeyCountPatternConverter : PatternConverter
{
private static PropertyKeyCountPatternConverter mostRecentInstance;
- public PropertyKeyCountPatternConverter()
- {
- mostRecentInstance = this;
- }
+ public PropertyKeyCountPatternConverter() => mostRecentInstance = this;
- protected override void Convert(TextWriter writer, object state)
- {
- writer.Write(Properties.GetKeys().Length);
- }
+ public override void Convert(TextWriter writer, object state)
+ => writer.Write(Properties.GetKeys().Length);
- public static PropertyKeyCountPatternConverter MostRecentInstance
- {
- get { return mostRecentInstance; }
- }
+ public static PropertyKeyCountPatternConverter MostRecentInstance => mostRecentInstance;
}
public class PatternStringAppender : StringAppender
{
private static PatternStringAppender mostRecentInstace;
- private PatternString setting;
+ public PatternStringAppender() => mostRecentInstace = this;
- public PatternStringAppender()
- {
- mostRecentInstace = this;
- }
+ public PatternString Setting { get; set; }
- public PatternString Setting
- {
- get { return setting; }
- set { setting = value; }
- }
-
- public static PatternStringAppender MostRecentInstace
- {
- get { return mostRecentInstace; }
- }
+ public static PatternStringAppender MostRecentInstace => mostRecentInstace;
}
}
diff --git a/src/log4net.Tests/Util/PatternStringTest.cs b/src/log4net.Tests/Util/PatternStringTest.cs
index 3f5d52e..b418ffe 100644
--- a/src/log4net.Tests/Util/PatternStringTest.cs
+++ b/src/log4net.Tests/Util/PatternStringTest.cs
@@ -19,7 +19,7 @@
*
*/
-#if NET_2_0
+#if NET462_OR_GREATER
using System;
using log4net.Util;
@@ -112,4 +112,4 @@
}
}
}
-#endif
+#endif
\ No newline at end of file
diff --git a/src/log4net.Tests/Util/PropertiesDictionaryTest.cs b/src/log4net.Tests/Util/PropertiesDictionaryTest.cs
index 8f12f60..861b7ac 100644
--- a/src/log4net.Tests/Util/PropertiesDictionaryTest.cs
+++ b/src/log4net.Tests/Util/PropertiesDictionaryTest.cs
@@ -17,8 +17,9 @@
//
#endregion
-#if NETFRAMEWORK
+#if NET462_OR_GREATER
+using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
@@ -49,6 +50,8 @@
Assert.AreEqual(10, pd.Count, "Dictionary should have 10 items");
+ Assert.IsNull(pd["notThere"], "Getter should act as IDictionary not IDictionary<TKey, TValue>");
+
// Serialize the properties into a memory stream
BinaryFormatter formatter = new BinaryFormatter();
MemoryStream memory = new MemoryStream();
diff --git a/src/log4net.Tests/Util/RandomStringPatternConverterTest.cs b/src/log4net.Tests/Util/RandomStringPatternConverterTest.cs
index adb3e40..fa4ccf3 100644
--- a/src/log4net.Tests/Util/RandomStringPatternConverterTest.cs
+++ b/src/log4net.Tests/Util/RandomStringPatternConverterTest.cs
@@ -18,7 +18,7 @@
#endregion
using System.IO;
-
+using log4net.Util.PatternStringConverters;
using NUnit.Framework;
namespace log4net.Tests.Util
@@ -60,31 +60,5 @@
string string2 = sw.ToString();
Assert.IsTrue(string1 != string2, "strings should be different");
}
-
- private class RandomStringPatternConverter
- {
- private object target = null;
-
- public RandomStringPatternConverter()
- {
- target = Utils.CreateInstance("log4net.Util.PatternStringConverters.RandomStringPatternConverter,log4net");
- }
-
- public string Option
- {
- get { return Utils.GetProperty(target, "Option") as string; }
- set { Utils.SetProperty(target, "Option", value); }
- }
-
- public void Convert(TextWriter writer, object state)
- {
- Utils.InvokeMethod(target, "Convert", writer, state);
- }
-
- public void ActivateOptions()
- {
- Utils.InvokeMethod(target, "ActivateOptions");
- }
- }
}
}
\ No newline at end of file
diff --git a/src/log4net.Tests/Util/SystemInfoTest.cs b/src/log4net.Tests/Util/SystemInfoTest.cs
index 34d57e4..f4c0c66 100644
--- a/src/log4net.Tests/Util/SystemInfoTest.cs
+++ b/src/log4net.Tests/Util/SystemInfoTest.cs
@@ -23,10 +23,8 @@
using NUnit.Framework;
-#if NET_4_0 || MONO_4_0 || NETSTANDARD
using System.Linq.Expressions;
using System.Reflection;
-#endif
namespace log4net.Tests.Util
{
@@ -37,7 +35,6 @@
public class SystemInfoTest
{
-#if NET_4_0 || MONO_4_0 || NETSTANDARD
/// <summary>
/// It's "does not throw not supported exception" NOT
/// "returns 'Dynamic Assembly' string for dynamic assemblies" by purpose.
@@ -65,13 +62,8 @@
public static string TestAssemblyLocationInfoMethod()
{
-#if NETSTANDARD1_3
- return SystemInfo.AssemblyLocationInfo(typeof(SystemInfoTest).GetTypeInfo().Assembly);
-#else
return SystemInfo.AssemblyLocationInfo(Assembly.GetCallingAssembly());
-#endif
}
-#endif
[Test]
public void TestGetTypeFromStringFullyQualified()
@@ -88,7 +80,6 @@
Assert.AreSame(typeof(SystemInfoTest), t, "Test explicit case in-sensitive type load lower");
}
-#if !NETSTANDARD1_3
[Test]
[Platform(Include = "Win")]
public void TestGetTypeFromStringCaseInsensitiveOnAssemblyName()
@@ -101,7 +92,6 @@
t = GetTypeFromString("log4net.tests.util.systeminfotest,log4net.tests", false, true);
Assert.AreSame(typeof(SystemInfoTest), t, "Test explicit case in-sensitive type load lower");
}
-#endif
[Test]
public void TestGetTypeFromStringRelative()
@@ -118,7 +108,6 @@
Assert.AreSame(typeof(SystemInfoTest), t, "Test explicit case in-sensitive type load lower");
}
-#if !NETSTANDARD1_3
[Test]
public void TestGetTypeFromStringSearch()
{
@@ -135,7 +124,6 @@
t = GetTypeFromString("log4net.util.systeminfo", false, true);
Assert.AreSame(typeof(SystemInfo), t, "Test explicit case in-sensitive type load lower");
}
-#endif
[Test]
public void TestGetTypeFromStringFails1()
@@ -164,11 +152,7 @@
// are exposed for NETSTANDARD1_3.
private Type GetTypeFromString(string typeName, bool throwOnError, bool ignoreCase)
{
-#if NETSTANDARD1_3
- return SystemInfo.GetTypeFromString(GetType().GetTypeInfo().Assembly, typeName, throwOnError, ignoreCase);
-#else
return SystemInfo.GetTypeFromString(typeName, throwOnError, ignoreCase);
-#endif
}
[Test]
diff --git a/src/log4net.Tests/Utils.cs b/src/log4net.Tests/Utils.cs
index 5264ad5..1caee5a 100644
--- a/src/log4net.Tests/Utils.cs
+++ b/src/log4net.Tests/Utils.cs
@@ -17,131 +17,20 @@
//
#endregion
-using log4net.Repository;
-using System;
-using System.Reflection;
-
namespace log4net.Tests
{
/// <summary>
/// Summary description for Class1.
/// </summary>
- public class Utils
+ public static class Utils
{
- private Utils()
- {
- }
-
- public static object CreateInstance(string targetType)
- {
- return CreateInstance(Type.GetType(targetType, true, true));
- }
-
- public static object CreateInstance(Type targetType)
- {
-#if NETSTANDARD1_3
-
- return targetType.GetConstructor(new Type[0]).Invoke(null);
-#else
- return targetType.GetConstructor(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, new Type[0], null).Invoke(null);
-#endif
- }
-
- public static object InvokeMethod(object target, string name, params object[] args)
- {
-#if NETSTANDARD1_3
- return target.GetType().GetTypeInfo().GetDeclaredMethod(name).Invoke(target, args);
-#else
- return target.GetType().GetMethod(name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance, null, GetTypesArray(args), null).Invoke(target, args);
-#endif
- }
-
- public static object InvokeMethod(Type target, string name, params object[] args)
- {
-#if NETSTANDARD1_3
- return target.GetTypeInfo().GetDeclaredMethod(name).Invoke(null, args);
-#else
- return target.GetMethod(name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static, null, GetTypesArray(args), null).Invoke(null, args);
-#endif
- }
-
- public static object GetField(object target, string name)
- {
- return target.GetType().GetField(name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance).GetValue(target);
- }
-
- public static void SetField(object target, string name, object val)
- {
- target.GetType().GetField(name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance).SetValue(target, val);
- }
-
- public static object GetProperty(object target, string name)
- {
- return target.GetType().GetProperty(name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance).GetValue(target, null);
- }
-
- public static void SetProperty(object target, string name, object val)
- {
- target.GetType().GetProperty(name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance).SetValue(target, val, null);
- }
-
- public static object GetProperty(object target, string name, params object[] index)
- {
- return target.GetType().GetProperty(name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance).GetValue(target, index);
- }
-
- public static void SetProperty(object target, string name, object val, params object[] index)
- {
- target.GetType().GetProperty(name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance).SetValue(target, val, index);
- }
-
- private static Type[] GetTypesArray(object[] args)
- {
- Type[] types = new Type[args.Length];
-
- for (int i = 0; i < args.Length; i++)
- {
- if (args[i] == null)
- {
- types[i] = typeof(object);
- }
- else
- {
- types[i] = args[i].GetType();
- }
- }
-
- return types;
- }
-
internal const string PROPERTY_KEY = "prop1";
internal static void RemovePropertyFromAllContexts()
{
GlobalContext.Properties.Remove(PROPERTY_KEY);
ThreadContext.Properties.Remove(PROPERTY_KEY);
-#if !NETCF
LogicalThreadContext.Properties.Remove(PROPERTY_KEY);
-#endif
- }
-
- // Wrappers because repository/logger retrieval APIs require an Assembly argument on NETSTANDARD1_3
- internal static ILog GetLogger(string name)
- {
-#if NETSTANDARD1_3
- return LogManager.GetLogger(typeof(Utils).GetTypeInfo().Assembly, name);
-#else
- return LogManager.GetLogger(name);
-#endif
- }
-
- internal static ILoggerRepository GetRepository()
- {
-#if NETSTANDARD1_3
- return LogManager.GetRepository(typeof(Utils).GetTypeInfo().Assembly);
-#else
- return LogManager.GetRepository();
-#endif
}
}
-}
\ No newline at end of file
+}
diff --git a/src/log4net.Tests/log4net.Tests.csproj b/src/log4net.Tests/log4net.Tests.csproj
index 23090bb..83d7ce3 100644
--- a/src/log4net.Tests/log4net.Tests.csproj
+++ b/src/log4net.Tests/log4net.Tests.csproj
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFrameworks>net462;net7.0</TargetFrameworks>
+ <TargetFrameworks>net462;net8.0</TargetFrameworks>
<NoWarn>NETSDK1138;CS1701</NoWarn>
<ProjectType>Local</ProjectType>
<DefaultClientScript>JScript</DefaultClientScript>
@@ -19,12 +19,10 @@
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
- <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
- <AssemblyOriginatorKeyFile>..\..\log4net.snk</AssemblyOriginatorKeyFile>
<OutputPath>bin\$(Configuration)</OutputPath>
<Configurations>Debug;Release</Configurations>
<Platforms>AnyCPU</Platforms>
@@ -38,18 +36,6 @@
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
</PropertyGroup>
- <PropertyGroup Condition="'$(TargetFramework)'=='net462'">
- <DefineConstants>$(DefineConstants);NET_2_0;NET_4_0;NET_4_5</DefineConstants>
- </PropertyGroup>
- <PropertyGroup Condition="'$(TargetFramework)'=='netcoreapp1.0'">
- <DefineConstants>$(DefineConstants);NETSTANDARD;NETSTANDARD1_3</DefineConstants>
- </PropertyGroup>
- <PropertyGroup Condition="'$(TargetFramework)'=='netcoreapp2.1'">
- <DefineConstants>$(DefineConstants);NETSTANDARD;NETSTANDARD2_0</DefineConstants>
- </PropertyGroup>
- <PropertyGroup Condition="'$(TargetFramework)'=='netcoreapp3.1'">
- <DefineConstants>$(DefineConstants);NETSTANDARD;NETSTANDARD2_0</DefineConstants>
- </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)'=='Debug' ">
<DefineConstants>TRACE;DEBUG;$(DefineConstants)</DefineConstants>
</PropertyGroup>
@@ -64,33 +50,22 @@
<ProjectReference Include="..\log4net\log4net.csproj" />
</ItemGroup>
<ItemGroup>
- <PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="4.0.1">
+ <PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="4.9.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
- <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
- <PackageReference Include="NExpect" Version="1.0.273" />
<PackageReference Include="Quackers.TestLogger" Version="1.0.24" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net462'">
<Reference Include="System.Configuration" />
<Reference Include="System.Runtime.Remoting" />
</ItemGroup>
- <ItemGroup Condition="'$(TargetFramework)'=='netcoreapp1.0'">
- <PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
- <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
- </ItemGroup>
- <ItemGroup Condition="'$(TargetFramework)'=='netcoreapp2.1'">
- <PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
- <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
- </ItemGroup>
- <ItemGroup Condition="'$(TargetFramework)'=='netcoreapp3.1'">
- <PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
- <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
+ <ItemGroup Condition="'$(TargetFramework)'=='net8.0'">
+ <PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
+ <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
</ItemGroup>
<ItemGroup>
- <Compile Remove="DateFormatter\AbsoluteTimeDateFormatterTest.cs" />
<Compile Remove="Hierarchy\XmlHierarchyConfiguratorTest.cs" />
</ItemGroup>
<Import Project="../MonoForFramework.targets" />
diff --git a/src/log4net.sln b/src/log4net.sln
index c109361..1f69274 100644
--- a/src/log4net.sln
+++ b/src/log4net.sln
@@ -1,46 +1,29 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2012
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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.
-#
-#
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "log4net", "log4net\log4net.csproj", "{181FE707-E161-4722-9F38-6AAAB6FAA106}"
+# Visual Studio Version 17
+VisualStudioVersion = 17.9.34622.214
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "log4net", "log4net\log4net.csproj", "{181FE707-E161-4722-9F38-6AAAB6FAA106}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "log4net.Tests", "log4net.Tests\log4net.Tests.csproj", "{B0530F10-0238-49A9-93B0-8EF412E90BCF}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "log4net.Tests", "log4net.Tests\log4net.Tests.csproj", "{B0530F10-0238-49A9-93B0-8EF412E90BCF}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "integration-testing", "integration-testing", "{8953473C-EEE8-4740-993D-B8E10FA876CD}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "log4net-672", "integration-testing\log4net-672\log4net-672.csproj", "{9050922E-E22E-4FF5-A1B0-2F21745C6882}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "log4net-672", "integration-testing\log4net-672\log4net-672.csproj", "{9050922E-E22E-4FF5-A1B0-2F21745C6882}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "log4net-611-main", "integration-testing\log4net-611-main\log4net-611-main.csproj", "{2087EDC5-689F-406C-947C-06C5F321CA8C}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "log4net-611-main", "integration-testing\log4net-611-main\log4net-611-main.csproj", "{2087EDC5-689F-406C-947C-06C5F321CA8C}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "log4net-611-lib", "integration-testing\log4net-611-lib\log4net-611-lib.csproj", "{D818035F-0345-49EF-9AB9-021583986CE2}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "log4net-611-lib", "integration-testing\log4net-611-lib\log4net-611-lib.csproj", "{D818035F-0345-49EF-9AB9-021583986CE2}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "log4net-673", "integration-testing\log4net-673\log4net-673.csproj", "{169118A6-CAC3-4E83-ABEE-9E884B75B294}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "log4net-673", "integration-testing\log4net-673\log4net-673.csproj", "{169118A6-CAC3-4E83-ABEE-9E884B75B294}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "log4net-681", "integration-testing\log4net-681\log4net-681.csproj", "{A4F9E417-2250-4075-9118-B4FF1C58B6C5}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "log4net-681", "integration-testing\log4net-681\log4net-681.csproj", "{A4F9E417-2250-4075-9118-B4FF1C58B6C5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".config", ".config", "{78CDAF4E-3F9F-4D00-A494-FFAE30E7EF0E}"
ProjectSection(SolutionItems) = preProject
..\.asf.yaml = ..\.asf.yaml
..\.gitignore = ..\.gitignore
..\.zarro-defaults = ..\.zarro-defaults
+ Directory.Build.props = Directory.Build.props
..\package.json = ..\package.json
..\pom.xml = ..\pom.xml
EndProjectSection
@@ -52,6 +35,11 @@
..\.github\workflows\git-broadcast.yml = ..\.github\workflows\git-broadcast.yml
EndProjectSection
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CE38DCC5-1BE9-4DEE-ADF4-854689B4028C}"
+ ProjectSection(SolutionItems) = preProject
+ ..\.editorconfig = ..\.editorconfig
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -98,4 +86,7 @@
{A4F9E417-2250-4075-9118-B4FF1C58B6C5} = {8953473C-EEE8-4740-993D-B8E10FA876CD}
{92B16708-35B8-4E60-AF44-CF6D797FB63B} = {3EE6A25B-2DF9-4825-A784-EE32EEA0BE58}
EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {532DE291-8626-4FE3-B255-78515D744BCF}
+ EndGlobalSection
EndGlobal
diff --git a/src/log4net/Appender/AdoNetAppender.cs b/src/log4net/Appender/AdoNetAppender.cs
index cad90c5..e79fea0 100644
--- a/src/log4net/Appender/AdoNetAppender.cs
+++ b/src/log4net/Appender/AdoNetAppender.cs
@@ -17,24 +17,18 @@
//
#endregion
-// SSCLI 1.0 has no support for ADO.NET
-#if !SSCLI
-
using System;
-using System.Collections;
-#if !NETSTANDARD1_3
+using System.Collections.Generic;
using System.Configuration;
-#endif
using System.Data;
using System.IO;
-#if NETSTANDARD1_3
-using System.Reflection;
-#endif
using log4net.Util;
using log4net.Layout;
using log4net.Core;
+#nullable enable
+
namespace log4net.Appender
{
/// <summary>
@@ -129,8 +123,6 @@
/// <author>Lance Nehring</author>
public class AdoNetAppender : BufferingAppenderSkeleton
{
- #region Public Instance Constructors
-
/// <summary>
/// Initializes a new instance of the <see cref="AdoNetAppender" /> class.
/// </summary>
@@ -141,15 +133,10 @@
{
ConnectionType = "System.Data.OleDb.OleDbConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
UseTransactions = true;
- CommandType = System.Data.CommandType.Text;
- m_parameters = new ArrayList();
+ CommandType = CommandType.Text;
ReconnectOnError = false;
}
- #endregion // Public Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
/// Gets or sets the database connection string that is used to connect to
/// the database.
@@ -172,32 +159,17 @@
/// <example>Connection string for MS Access via OLE DB:
/// <code>"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Work\cvs_root\log4net-1.2\access.mdb;User Id=;Password=;"</code>
/// </example>
- public string ConnectionString
- {
- get { return m_connectionString; }
- set { m_connectionString = value; }
- }
+ public string? ConnectionString { get; set; }
/// <summary>
/// The appSettings key from App.Config that contains the connection string.
/// </summary>
- public string AppSettingsKey
- {
- get { return m_appSettingsKey; }
- set { m_appSettingsKey = value; }
- }
+ public string? AppSettingsKey { get; set; }
/// <summary>
/// The connectionStrings key from App.Config that contains the connection string.
/// </summary>
- /// <remarks>
- /// This property requires at least .NET 2.0.
- /// </remarks>
- public string ConnectionStringName
- {
- get { return m_connectionStringName; }
- set { m_connectionStringName = value; }
- }
+ public string? ConnectionStringName { get; set; }
/// <summary>
/// Gets or sets the type name of the <see cref="IDbConnection"/> connection
@@ -232,11 +204,7 @@
/// <a href="http://msdn.microsoft.com/downloads">http://msdn.microsoft.com/downloads</a>
/// search for <b>.NET Managed Provider for Oracle</b>.
/// </example>
- public string ConnectionType
- {
- get { return m_connectionType; }
- set { m_connectionType = value; }
- }
+ public string ConnectionType { get; set; }
/// <summary>
/// Gets or sets the command text that is used to insert logging events
@@ -260,11 +228,7 @@
/// <see cref="GetLogStatement(LoggingEvent)"/>.
/// </para>
/// </remarks>
- public string CommandText
- {
- get { return m_commandText; }
- set { m_commandText = value; }
- }
+ public string? CommandText { get; set; }
/// <summary>
/// Gets or sets the command type to execute.
@@ -284,11 +248,7 @@
/// The default value is <see cref="System.Data.CommandType.Text"/> (<c>System.Data.CommandType.Text</c>).
/// </para>
/// </remarks>
- public CommandType CommandType
- {
- get { return m_commandType; }
- set { m_commandType = value; }
- }
+ public CommandType CommandType { get; set; }
/// <summary>
/// Should transactions be used to insert logging events in the database.
@@ -308,11 +268,7 @@
/// an explicit transaction.
/// </para>
/// </remarks>
- public bool UseTransactions
- {
- get { return m_useTransactions; }
- set { m_useTransactions = value; }
- }
+ public bool UseTransactions { get; set; }
/// <summary>
/// Gets or sets the <see cref="SecurityContext"/> used to call the NetSend method.
@@ -328,11 +284,7 @@
/// of the current thread.
/// </para>
/// </remarks>
- public SecurityContext SecurityContext
- {
- get { return m_securityContext; }
- set { m_securityContext = value; }
- }
+ public SecurityContext? SecurityContext { get; set; }
/// <summary>
/// Should this appender try to reconnect to the database on error.
@@ -358,15 +310,7 @@
/// Until the connection can be reestablished this potential delay may occur multiple times.
/// </note>
/// </remarks>
- public bool ReconnectOnError
- {
- get { return m_reconnectOnError; }
- set { m_reconnectOnError = value; }
- }
-
- #endregion // Public Instance Properties
-
- #region Protected Instance Properties
+ public bool ReconnectOnError { get; set; }
/// <summary>
/// Gets or sets the underlying <see cref="IDbConnection" />.
@@ -381,15 +325,7 @@
/// underlying <see cref="IDbConnection" /> returned from <see cref="Connection" /> if
/// you require access beyond that which <see cref="AdoNetAppender" /> provides.
/// </remarks>
- protected IDbConnection Connection
- {
- get { return m_dbConnection; }
- set { m_dbConnection = value; }
- }
-
- #endregion // Protected Instance Properties
-
- #region Implementation of IOptionHandler
+ protected IDbConnection? Connection { get; set; }
/// <summary>
/// Initialize the appender based on the options set
@@ -411,18 +347,11 @@
{
base.ActivateOptions();
- if (SecurityContext == null)
- {
- SecurityContext = SecurityContextProvider.DefaultProvider.CreateSecurityContext(this);
- }
+ SecurityContext ??= SecurityContextProvider.DefaultProvider.CreateSecurityContext(this);
InitializeDatabaseConnection();
}
- #endregion
-
- #region Override implementation of AppenderSkeleton
-
/// <summary>
/// Override the parent method to close the database
/// </summary>
@@ -434,13 +363,9 @@
protected override void OnClose()
{
base.OnClose();
- DiposeConnection();
+ DisposeConnection();
}
- #endregion
-
- #region Override implementation of BufferingAppenderSkeleton
-
/// <summary>
/// Inserts the events into the database.
/// </summary>
@@ -455,7 +380,7 @@
{
if (ReconnectOnError && (Connection == null || Connection.State != ConnectionState.Open))
{
- LogLog.Debug(declaringType, "Attempting to reconnect to database. Current Connection State: " + ((Connection == null) ? SystemInfo.NullText : Connection.State.ToString()));
+ LogLog.Debug(declaringType, $"Attempting to reconnect to database. Current Connection State: {((Connection == null) ? SystemInfo.NullText : Connection.State.ToString())}");
InitializeDatabaseConnection();
}
@@ -501,10 +426,6 @@
}
}
- #endregion // Override implementation of BufferingAppenderSkeleton
-
- #region Public Instance Methods
-
/// <summary>
/// Adds a parameter to the command.
/// </summary>
@@ -519,11 +440,6 @@
m_parameters.Add(parameter);
}
-
- #endregion // Public Instance Methods
-
- #region Protected Instance Methods
-
/// <summary>
/// Writes the events to the database using the transaction specified.
/// </summary>
@@ -536,12 +452,11 @@
/// property for more information.
/// </para>
/// </remarks>
- protected virtual void SendBuffer(IDbTransaction dbTran, LoggingEvent[] events)
+ protected virtual void SendBuffer(IDbTransaction? dbTran, LoggingEvent[] events)
{
- // string.IsNotNullOrWhiteSpace() does not exist in ancient .NET frameworks
- if (CommandText != null && CommandText.Trim() != "")
+ if (!string.IsNullOrWhiteSpace(CommandText))
{
- using (IDbCommand dbCmd = Connection.CreateCommand())
+ using (IDbCommand dbCmd = Connection!.CreateCommand())
{
// Set the command string
dbCmd.CommandText = CommandText;
@@ -588,7 +503,7 @@
else
{
// create a new command
- using (IDbCommand dbCmd = Connection.CreateCommand())
+ using (IDbCommand dbCmd = Connection!.CreateCommand())
{
if (dbTran != null)
{
@@ -600,7 +515,7 @@
// Get the command text from the Layout
string logStatement = GetLogStatement(e);
- LogLog.Debug(declaringType, "LogStatement [" + logStatement + "]");
+ LogLog.Debug(declaringType, $"LogStatement [{logStatement}]");
dbCmd.CommandText = logStatement;
dbCmd.ExecuteNonQuery();
@@ -670,9 +585,6 @@
/// Resolves the connection string from the ConnectionString, ConnectionStringName, or AppSettingsKey
/// property.
/// </summary>
- /// <remarks>
- /// ConnectiongStringName is only supported on .NET 2.0 and higher.
- /// </remarks>
/// <param name="connectionStringContext">Additional information describing the connection string.</param>
/// <returns>A connection string used to connect to the database.</returns>
protected virtual string ResolveConnectionString(out string connectionStringContext)
@@ -683,10 +595,9 @@
return ConnectionString;
}
-#if !NETSTANDARD1_3
if (!String.IsNullOrEmpty(ConnectionStringName))
{
- ConnectionStringSettings settings = ConfigurationManager.ConnectionStrings[ConnectionStringName];
+ ConnectionStringSettings settings = ConfigurationManager.ConnectionStrings[ConnectionStringName!];
if (settings != null)
{
connectionStringContext = "ConnectionStringName";
@@ -694,20 +605,19 @@
}
else
{
- throw new LogException("Unable to find [" + ConnectionStringName + "] ConfigurationManager.ConnectionStrings item");
+ throw new LogException($"Unable to find [{ConnectionStringName}] ConfigurationManager.ConnectionStrings item");
}
}
-#endif
if (AppSettingsKey != null && AppSettingsKey.Length > 0)
{
connectionStringContext = "AppSettingsKey";
- string appSettingsConnectionString = SystemInfo.GetAppSetting(AppSettingsKey);
- if (appSettingsConnectionString == null || appSettingsConnectionString.Length == 0)
+ string? appSettingsConnectionString = SystemInfo.GetAppSetting(AppSettingsKey);
+ if (string.IsNullOrEmpty(appSettingsConnectionString))
{
- throw new LogException("Unable to find [" + AppSettingsKey + "] AppSettings key.");
+ throw new LogException($"Unable to find [{AppSettingsKey}] AppSettings key.");
}
- return appSettingsConnectionString;
+ return appSettingsConnectionString!;
}
connectionStringContext = "Unable to resolve connection string from ConnectionString, ConnectionStrings, or AppSettings.";
@@ -733,24 +643,19 @@
{
try
{
-#if NETSTANDARD1_3
- // NETSTANDARD1_3 requires comma separated ConnectionType like `System.Data.SqlClient.SqlConnection, System.Data` to work properly.
- return SystemInfo.GetTypeFromString((Assembly)null, ConnectionType, true, false);
-#else
- return SystemInfo.GetTypeFromString(ConnectionType, true, false);
-#endif
+ if (SystemInfo.GetTypeFromString(ConnectionType, true, false) is Type t)
+ {
+ return t;
+ }
+ throw new InvalidOperationException($"Connection type {ConnectionType} was not found in any assembly");
}
catch (Exception ex)
{
- ErrorHandler.Error("Failed to load connection type [" + ConnectionType + "]", ex);
+ ErrorHandler.Error($"Failed to load connection type [{ConnectionType}]", ex);
throw;
}
}
- #endregion // Protected Instance Methods
-
- #region Private Instance Methods
-
/// <summary>
/// Connects to the database.
/// </summary>
@@ -761,14 +666,14 @@
try
{
- DiposeConnection();
+ DisposeConnection();
// Set the connection string
resolvedConnectionString = ResolveConnectionString(out connectionStringContext);
Connection = CreateConnection(ResolveConnectionType(), resolvedConnectionString);
- using (SecurityContext.Impersonate(this))
+ using (SecurityContext?.Impersonate(this))
{
// Open the database connection
Connection.Open();
@@ -777,7 +682,7 @@
catch (Exception e)
{
// Sadly, your connection string is bad.
- ErrorHandler.Error("Could not open database connection [" + resolvedConnectionString + "]. Connection string context [" + connectionStringContext + "].", e);
+ ErrorHandler.Error($"Could not open database connection [{resolvedConnectionString}]. Connection string context [{connectionStringContext}].", e);
Connection = null;
}
@@ -789,7 +694,7 @@
/// <remarks>
/// Calls the IDbConnection's <see cref="IDbConnection.Close"/> method.
/// </remarks>
- private void DiposeConnection()
+ private void DisposeConnection()
{
if (Connection != null)
{
@@ -805,10 +710,6 @@
}
}
- #endregion // Private Instance Methods
-
- #region Protected Instance Fields
-
/// <summary>
/// The list of <see cref="AdoNetAppenderParameter"/> objects.
/// </summary>
@@ -817,66 +718,7 @@
/// The list of <see cref="AdoNetAppenderParameter"/> objects.
/// </para>
/// </remarks>
- protected ArrayList m_parameters;
-
- #endregion // Protected Instance Fields
-
- #region Private Instance Fields
-
- /// <summary>
- /// The security context to use for privileged calls
- /// </summary>
- private SecurityContext m_securityContext;
-
- /// <summary>
- /// The <see cref="IDbConnection" /> that will be used
- /// to insert logging events into a database.
- /// </summary>
- private IDbConnection m_dbConnection;
-
- /// <summary>
- /// Database connection string.
- /// </summary>
- private string m_connectionString;
-
- /// <summary>
- /// The appSettings key from App.Config that contains the connection string.
- /// </summary>
- private string m_appSettingsKey;
-
- /// <summary>
- /// The connectionStrings key from App.Config that contains the connection string.
- /// </summary>
- private string m_connectionStringName;
-
- /// <summary>
- /// String type name of the <see cref="IDbConnection"/> type name.
- /// </summary>
- private string m_connectionType;
-
- /// <summary>
- /// The text of the command.
- /// </summary>
- private string m_commandText;
-
- /// <summary>
- /// The command type.
- /// </summary>
- private CommandType m_commandType;
-
- /// <summary>
- /// Indicates whether to use transactions when writing to the database.
- /// </summary>
- private bool m_useTransactions;
-
- /// <summary>
- /// Indicates whether to reconnect when a connection is lost.
- /// </summary>
- private bool m_reconnectOnError;
-
- #endregion // Private Instance Fields
-
- #region Private Static Fields
+ protected List<AdoNetAppenderParameter> m_parameters = new();
/// <summary>
/// The fully qualified type of the AdoNetAppender class.
@@ -886,8 +728,6 @@
/// log message.
/// </remarks>
private static readonly Type declaringType = typeof(AdoNetAppender);
-
- #endregion Private Static Fields
}
/// <summary>
@@ -905,8 +745,6 @@
/// </remarks>
public class AdoNetAppenderParameter
{
- #region Public Instance Constructors
-
/// <summary>
/// Initializes a new instance of the <see cref="AdoNetAppenderParameter" /> class.
/// </summary>
@@ -920,10 +758,6 @@
Size = 0;
}
- #endregion // Public Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
/// Gets or sets the name of this parameter.
/// </summary>
@@ -937,11 +771,7 @@
/// or prepared statement.
/// </para>
/// </remarks>
- public string ParameterName
- {
- get { return m_parameterName; }
- set { m_parameterName = value; }
- }
+ public string? ParameterName { get; set; }
/// <summary>
/// Gets or sets the database type for this parameter.
@@ -963,7 +793,7 @@
/// <seealso cref="IDataParameter.DbType" />
public DbType DbType
{
- get { return m_dbType; }
+ get => m_dbType;
set
{
m_dbType = value;
@@ -987,11 +817,7 @@
/// </para>
/// </remarks>
/// <seealso cref="IDbDataParameter.Precision" />
- public byte Precision
- {
- get { return m_precision; }
- set { m_precision = value; }
- }
+ public byte Precision { get; set; }
/// <summary>
/// Gets or sets the scale for this parameter.
@@ -1009,11 +835,7 @@
/// </para>
/// </remarks>
/// <seealso cref="IDbDataParameter.Scale" />
- public byte Scale
- {
- get { return m_scale; }
- set { m_scale = value; }
- }
+ public byte Scale { get; set; }
/// <summary>
/// Gets or sets the size for this parameter.
@@ -1034,11 +856,7 @@
/// </para>
/// </remarks>
/// <seealso cref="IDbDataParameter.Size" />
- public int Size
- {
- get { return m_size; }
- set { m_size = value; }
- }
+ public int Size { get; set; }
/// <summary>
/// Gets or sets the <see cref="IRawLayout"/> to use to
@@ -1060,15 +878,7 @@
/// for use in the property.
/// </para>
/// </remarks>
- public IRawLayout Layout
- {
- get { return m_layout; }
- set { m_layout = value; }
- }
-
- #endregion // Public Instance Properties
-
- #region Public Instance Methods
+ public IRawLayout? Layout { get; set; }
/// <summary>
/// Prepare the specified database command object.
@@ -1126,26 +936,14 @@
IDbDataParameter param = (IDbDataParameter)command.Parameters[ParameterName];
// Format the value
- object formattedValue = Layout.Format(loggingEvent);
+ object? formattedValue = Layout?.Format(loggingEvent);
// If the value is null then convert to a DBNull
- if (formattedValue == null)
- {
- formattedValue = DBNull.Value;
- }
+ formattedValue ??= DBNull.Value;
param.Value = formattedValue;
}
- #endregion // Public Instance Methods
-
- #region Private Instance Fields
-
- /// <summary>
- /// The name of this parameter.
- /// </summary>
- private string m_parameterName;
-
/// <summary>
/// The database type for this parameter.
/// </summary>
@@ -1155,30 +953,5 @@
/// Flag to infer type rather than use the DbType
/// </summary>
private bool m_inferType = true;
-
- /// <summary>
- /// The precision for this parameter.
- /// </summary>
- private byte m_precision;
-
- /// <summary>
- /// The scale for this parameter.
- /// </summary>
- private byte m_scale;
-
- /// <summary>
- /// The size for this parameter.
- /// </summary>
- private int m_size;
-
- /// <summary>
- /// The <see cref="IRawLayout"/> to use to render the
- /// logging event into an object for this parameter.
- /// </summary>
- private IRawLayout m_layout;
-
- #endregion // Private Instance Fields
}
-}
-
-#endif // !SSCLI
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/src/log4net/Appender/AnsiColorTerminalAppender.cs b/src/log4net/Appender/AnsiColorTerminalAppender.cs
index da8cc08..f1d602a 100644
--- a/src/log4net/Appender/AnsiColorTerminalAppender.cs
+++ b/src/log4net/Appender/AnsiColorTerminalAppender.cs
@@ -19,10 +19,8 @@
using System;
using System.Text;
-using System.Globalization;
using log4net.Core;
-using log4net.Layout;
using log4net.Util;
namespace log4net.Appender
@@ -81,7 +79,7 @@
/// <item><term>Purple</term><description></description></item>
/// <item><term>Cyan</term><description></description></item>
/// </list>
- /// These color values cannot be combined together to make new colors.
+ /// These color values cannot be combined to make new colors.
/// </para>
/// <para>
/// The attributes can be any combination of the following:
@@ -94,7 +92,7 @@
/// <item><term>Hidden</term><description>output is hidden</description></item>
/// <item><term>Strikethrough</term><description>message has a line through it</description></item>
/// </list>
- /// While any of these attributes may be combined together not all combinations
+ /// While any of these attributes may be combined not all combinations
/// work well together, for example setting both <i>Bright</i> and <i>Dim</i> attributes makes
/// no sense.
/// </para>
@@ -103,20 +101,12 @@
/// <author>Nicko Cadell</author>
public class AnsiColorTerminalAppender : AppenderSkeleton
{
- #region Colors Enum
-
/// <summary>
- /// The enum of possible display attributes
+ /// The enum of possible display attributes that can be combined to form the ANSI color attributes.
/// </summary>
- /// <remarks>
- /// <para>
- /// The following flags can be combined together to
- /// form the ANSI color attributes.
- /// </para>
- /// </remarks>
/// <seealso cref="AnsiColorTerminalAppender" />
[Flags]
- public enum AnsiAttributes : int
+ public enum AnsiAttributes
{
/// <summary>
/// text is bright
@@ -165,13 +155,8 @@
/// The enum of possible foreground or background color values for
/// use with the color mapping method
/// </summary>
- /// <remarks>
- /// <para>
- /// The output can be in one for the following ANSI colors.
- /// </para>
- /// </remarks>
/// <seealso cref="AnsiColorTerminalAppender" />
- public enum AnsiColor : int
+ public enum AnsiColor
{
/// <summary>
/// color is black
@@ -214,10 +199,6 @@
White = 7
}
- #endregion
-
- #region Public Instance Constructors
-
/// <summary>
/// Initializes a new instance of the <see cref="AnsiColorTerminalAppender" /> class.
/// </summary>
@@ -229,26 +210,12 @@
{
}
- #endregion Public Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
- /// Target is the value of the console output stream.
+ /// Gets the console output stream, one of <c>"Console.Out"</c> or <c>"Console.Error"</c>.
/// </summary>
- /// <value>
- /// Target is the value of the console output stream.
- /// This is either <c>"Console.Out"</c> or <c>"Console.Error"</c>.
- /// </value>
- /// <remarks>
- /// <para>
- /// Target is the value of the console output stream.
- /// This is either <c>"Console.Out"</c> or <c>"Console.Error"</c>.
- /// </para>
- /// </remarks>
public virtual string Target
{
- get { return m_writeToErrorStream ? ConsoleError : ConsoleOut; }
+ get => m_writeToErrorStream ? ConsoleError : ConsoleOut;
set
{
string trimmedTargetName = value.Trim();
@@ -265,44 +232,32 @@
}
/// <summary>
- /// Add a mapping of level to color
+ /// Adds a mapping of level to foreground and background colors.
/// </summary>
/// <param name="mapping">The mapping to add</param>
- /// <remarks>
- /// <para>
- /// Add a <see cref="LevelColors"/> mapping to this appender.
- /// Each mapping defines the foreground and background colours
- /// for a level.
- /// </para>
- /// </remarks>
public void AddMapping(LevelColors mapping)
{
m_levelMapping.Add(mapping);
}
- #endregion Public Instance Properties
-
- #region Override implementation of AppenderSkeleton
-
/// <summary>
- /// This method is called by the <see cref="M:AppenderSkeleton.DoAppend(LoggingEvent)"/> method.
+ /// Writes the event to the console.
/// </summary>
/// <param name="loggingEvent">The event to log.</param>
/// <remarks>
/// <para>
- /// Writes the event to the console.
+ /// This method is called by the <see cref="M:AppenderSkeleton.DoAppend(LoggingEvent)"/> method.
/// </para>
/// <para>
/// The format of the output will depend on the appender's layout.
/// </para>
/// </remarks>
- protected override void Append(log4net.Core.LoggingEvent loggingEvent)
+ protected override void Append(LoggingEvent loggingEvent)
{
string loggingMessage = RenderLoggingEvent(loggingEvent);
// see if there is a specified lookup.
- LevelColors levelColors = m_levelMapping.Lookup(loggingEvent.Level) as LevelColors;
- if (levelColors != null)
+ if (m_levelMapping.Lookup(loggingEvent.Level) is LevelColors levelColors)
{
// Prepend the Ansi Color code
loggingMessage = levelColors.CombinedColor + loggingMessage;
@@ -311,7 +266,7 @@
// on most terminals there are weird effects if we don't clear the background color
// before the new line. This checks to see if it ends with a newline, and if
// so, inserts the clear codes before the newline, otherwise the clear codes
- // are inserted afterwards.
+ // are inserted afterward.
if (loggingMessage.Length > 1)
{
if (loggingMessage.EndsWith("\r\n") || loggingMessage.EndsWith("\n\r"))
@@ -324,7 +279,7 @@
}
else
{
- loggingMessage = loggingMessage + PostEventCodes;
+ loggingMessage += PostEventCodes;
}
}
else
@@ -335,14 +290,10 @@
}
else
{
- loggingMessage = loggingMessage + PostEventCodes;
+ loggingMessage += PostEventCodes;
}
}
-#if NETCF_1_0
- // Write to the output stream
- Console.Write(loggingMessage);
-#else
if (m_writeToErrorStream)
{
// Write to the error stream
@@ -353,89 +304,50 @@
// Write to the output stream
Console.Write(loggingMessage);
}
-#endif
}
/// <summary>
/// This appender requires a <see cref="Layout"/> to be set.
/// </summary>
- /// <value><c>true</c></value>
- /// <remarks>
- /// <para>
- /// This appender requires a <see cref="Layout"/> to be set.
- /// </para>
- /// </remarks>
- protected override bool RequiresLayout
- {
- get { return true; }
- }
+ protected override bool RequiresLayout => true;
/// <summary>
- /// Initialize the options for this appender
+ /// Initializes the level to color mappings set on this appender.
/// </summary>
- /// <remarks>
- /// <para>
- /// Initialize the level to color mappings set on this appender.
- /// </para>
- /// </remarks>
public override void ActivateOptions()
{
base.ActivateOptions();
m_levelMapping.ActivateOptions();
}
- #endregion Override implementation of AppenderSkeleton
-
- #region Public Static Fields
-
/// <summary>
/// The <see cref="AnsiColorTerminalAppender.Target"/> to use when writing to the Console
/// standard output stream.
/// </summary>
- /// <remarks>
- /// <para>
- /// The <see cref="AnsiColorTerminalAppender.Target"/> to use when writing to the Console
- /// standard output stream.
- /// </para>
- /// </remarks>
public const string ConsoleOut = "Console.Out";
/// <summary>
/// The <see cref="AnsiColorTerminalAppender.Target"/> to use when writing to the Console
/// standard error output stream.
/// </summary>
- /// <remarks>
- /// <para>
- /// The <see cref="AnsiColorTerminalAppender.Target"/> to use when writing to the Console
- /// standard error output stream.
- /// </para>
- /// </remarks>
public const string ConsoleError = "Console.Error";
- #endregion Public Static Fields
-
- #region Private Instances Fields
-
/// <summary>
/// Flag to write output to the error stream rather than the standard output stream
/// </summary>
- private bool m_writeToErrorStream = false;
+ private bool m_writeToErrorStream;
/// <summary>
/// Mapping from level object to color value
/// </summary>
- private LevelMapping m_levelMapping = new LevelMapping();
+ private readonly LevelMapping m_levelMapping = new();
/// <summary>
/// Ansi code to reset terminal
/// </summary>
private const string PostEventCodes = "\x1b[0m";
- #endregion Private Instances Fields
-
- #region LevelColors LevelMapping Entry
-
/// <summary>
/// A class to act as a mapping between the level that a logging call is made at and
/// the color it should be displayed as.
@@ -447,11 +359,6 @@
/// </remarks>
public class LevelColors : LevelMappingEntry
{
- private AnsiColor m_foreColor;
- private AnsiColor m_backColor;
- private AnsiAttributes m_attributes;
- private string m_combinedColor = "";
-
/// <summary>
/// The mapped foreground color for the specified level
/// </summary>
@@ -461,49 +368,25 @@
/// The mapped foreground color for the specified level
/// </para>
/// </remarks>
- public AnsiColor ForeColor
- {
- get { return m_foreColor; }
- set { m_foreColor = value; }
- }
+ public AnsiColor ForeColor { get; set; }
/// <summary>
- /// The mapped background color for the specified level
+ /// The mapped background color for the specified level. Required property.
+ /// </summary>
+ public AnsiColor BackColor { get; set; }
+
+ /// <summary>
+ /// The color attributes for the specified level.
+ /// </summary>
+ public AnsiAttributes Attributes { get; set; }
+
+ /// <summary>
+ /// Initializes the options for the object
/// </summary>
/// <remarks>
/// <para>
- /// Required property.
- /// The mapped background color for the specified level
- /// </para>
- /// </remarks>
- public AnsiColor BackColor
- {
- get { return m_backColor; }
- set { m_backColor = value; }
- }
-
- /// <summary>
- /// The color attributes for the specified level
- /// </summary>
- /// <remarks>
- /// <para>
- /// Required property.
- /// The color attributes for the specified level
- /// </para>
- /// </remarks>
- public AnsiAttributes Attributes
- {
- get { return m_attributes; }
- set { m_attributes = value; }
- }
-
- /// <summary>
- /// Initialize the options for the object
- /// </summary>
- /// <remarks>
- /// <para>
- /// Combine the <see cref="ForeColor"/> and <see cref="BackColor"/> together
- /// and append the attributes.
+ /// Combines the <see cref="ForeColor"/> and <see cref="BackColor"/> together
+ /// and appends the attributes.
/// </para>
/// </remarks>
public override void ActivateOptions()
@@ -515,60 +398,55 @@
// Reset any existing codes
buf.Append("\x1b[0;");
- int lightAdjustment = ((m_attributes & AnsiAttributes.Light) > 0) ? 60 : 0;
+ int lightAdjustment = ((Attributes & AnsiAttributes.Light) > 0) ? 60 : 0;
// set the foreground color
- buf.Append(30 + lightAdjustment + (int)m_foreColor);
+ buf.Append(30 + lightAdjustment + (int)ForeColor);
buf.Append(';');
// set the background color
- buf.Append(40 + lightAdjustment + (int)m_backColor);
+ buf.Append(40 + lightAdjustment + (int)BackColor);
// set the attributes
- if ((m_attributes & AnsiAttributes.Bright) > 0)
+ if ((Attributes & AnsiAttributes.Bright) > 0)
{
buf.Append(";1");
}
- if ((m_attributes & AnsiAttributes.Dim) > 0)
+ if ((Attributes & AnsiAttributes.Dim) > 0)
{
buf.Append(";2");
}
- if ((m_attributes & AnsiAttributes.Underscore) > 0)
+ if ((Attributes & AnsiAttributes.Underscore) > 0)
{
buf.Append(";4");
}
- if ((m_attributes & AnsiAttributes.Blink) > 0)
+ if ((Attributes & AnsiAttributes.Blink) > 0)
{
buf.Append(";5");
}
- if ((m_attributes & AnsiAttributes.Reverse) > 0)
+ if ((Attributes & AnsiAttributes.Reverse) > 0)
{
buf.Append(";7");
}
- if ((m_attributes & AnsiAttributes.Hidden) > 0)
+ if ((Attributes & AnsiAttributes.Hidden) > 0)
{
buf.Append(";8");
}
- if ((m_attributes & AnsiAttributes.Strikethrough) > 0)
+ if ((Attributes & AnsiAttributes.Strikethrough) > 0)
{
buf.Append(";9");
}
buf.Append('m');
- m_combinedColor = buf.ToString();
+ CombinedColor = buf.ToString();
}
/// <summary>
/// The combined <see cref="ForeColor"/>, <see cref="BackColor"/> and
/// <see cref="Attributes"/> suitable for setting the ansi terminal color.
/// </summary>
- internal string CombinedColor
- {
- get { return m_combinedColor; }
- }
+ internal string CombinedColor { get; private set; } = string.Empty;
}
-
- #endregion // LevelColors LevelMapping Entry
}
}
diff --git a/src/log4net/Appender/AppenderCollection.cs b/src/log4net/Appender/AppenderCollection.cs
index 768f318..c22fa87 100644
--- a/src/log4net/Appender/AppenderCollection.cs
+++ b/src/log4net/Appender/AppenderCollection.cs
@@ -17,8 +17,10 @@
//
#endregion
+using log4net.Util;
using System;
using System.Collections;
+using System.Collections.Generic;
namespace log4net.Appender
{
@@ -26,81 +28,36 @@
/// A strongly-typed collection of <see cref="IAppender"/> objects.
/// </summary>
/// <author>Nicko Cadell</author>
- public class AppenderCollection : ICollection, IList, IEnumerable
-#if !NETSTANDARD1_3
- , ICloneable
-#endif
+ public class AppenderCollection : IList, ICloneable, ICollection<IAppender>
{
- #region Interfaces
- /// <summary>
- /// Supports type-safe iteration over a <see cref="AppenderCollection"/>.
- /// </summary>
- /// <exclude/>
- public interface IAppenderCollectionEnumerator
- {
- /// <summary>
- /// Gets the current element in the collection.
- /// </summary>
- IAppender Current { get; }
-
- /// <summary>
- /// Advances the enumerator to the next element in the collection.
- /// </summary>
- /// <returns>
- /// <c>true</c> if the enumerator was successfully advanced to the next element;
- /// <c>false</c> if the enumerator has passed the end of the collection.
- /// </returns>
- /// <exception cref="InvalidOperationException">
- /// The collection was modified after the enumerator was created.
- /// </exception>
- bool MoveNext();
-
- /// <summary>
- /// Sets the enumerator to its initial position, before the first element in the collection.
- /// </summary>
- void Reset();
- }
- #endregion
-
private const int DEFAULT_CAPACITY = 16;
- #region Implementation (data)
-
private IAppender[] m_array;
- private int m_count = 0;
- private int m_version = 0;
-
- #endregion
-
- #region Static Wrappers
+ private int m_count;
+ private int m_version;
/// <summary>
/// Creates a read-only wrapper for a <c>AppenderCollection</c> instance.
/// </summary>
- /// <param name="list">list to create a readonly wrapper arround</param>
+ /// <param name="list">list to create a readonly wrapper around</param>
/// <returns>
/// An <c>AppenderCollection</c> wrapper that is read-only.
/// </returns>
public static AppenderCollection ReadOnly(AppenderCollection list)
{
- if (list == null) throw new ArgumentNullException("list");
+ if (list is null)
+ {
+ throw new ArgumentNullException(nameof(list));
+ }
return new ReadOnlyAppenderCollection(list);
}
- #endregion
-
- #region Static Fields
-
/// <summary>
/// An empty readonly static AppenderCollection
/// </summary>
public static readonly AppenderCollection EmptyCollection = ReadOnly(new AppenderCollection(0));
- #endregion
-
- #region Constructors
-
/// <summary>
/// Initializes a new instance of the <c>AppenderCollection</c> class
/// that is empty and has the default initial capacity.
@@ -171,24 +128,16 @@
/// <summary>
/// Allow subclasses to avoid our default constructors
/// </summary>
- /// <param name="tag"></param>
/// <exclude/>
- protected internal AppenderCollection(Tag tag)
+ protected internal AppenderCollection(Tag _)
{
- m_array = null;
+ m_array = Array.Empty<IAppender>();
}
- #endregion
-
- #region Operations (type-safe ICollection)
-
/// <summary>
/// Gets the number of elements actually contained in the <c>AppenderCollection</c>.
/// </summary>
- public virtual int Count
- {
- get { return m_count; }
- }
+ public virtual int Count => m_count;
/// <summary>
/// Copies the entire <c>AppenderCollection</c> to a one-dimensional
@@ -197,7 +146,7 @@
/// <param name="array">The one-dimensional <see cref="IAppender"/> array to copy to.</param>
public virtual void CopyTo(IAppender[] array)
{
- this.CopyTo(array, 0);
+ CopyTo(array, 0);
}
/// <summary>
@@ -210,7 +159,7 @@
{
if (m_count > array.GetUpperBound(0) + 1 - start)
{
- throw new System.ArgumentException("Destination array was not long enough.");
+ throw new ArgumentException("Destination array was not long enough.");
}
Array.Copy(m_array, 0, array, start, m_count);
@@ -220,22 +169,12 @@
/// Gets a value indicating whether access to the collection is synchronized (thread-safe).
/// </summary>
/// <returns>false, because the backing type is an array, which is never thread-safe.</returns>
- public virtual bool IsSynchronized
- {
- get { return false; }
- }
+ public virtual bool IsSynchronized => false;
/// <summary>
/// Gets an object that can be used to synchronize access to the collection.
/// </summary>
- public virtual object SyncRoot
- {
- get { return m_array; }
- }
-
- #endregion
-
- #region Operations (type-safe IList)
+ public virtual object SyncRoot => m_array;
/// <summary>
/// Gets or sets the <see cref="IAppender"/> at the specified index.
@@ -265,8 +204,9 @@
/// Adds a <see cref="IAppender"/> to the end of the <c>AppenderCollection</c>.
/// </summary>
/// <param name="item">The <see cref="IAppender"/> to be added to the end of the <c>AppenderCollection</c>.</param>
- /// <returns>The index at which the value has been added.</returns>
- public virtual int Add(IAppender item)
+ public virtual void Add(IAppender item) => InternalAdd(item);
+
+ private int InternalAdd(IAppender item)
{
if (m_count == m_array.Length)
{
@@ -275,10 +215,10 @@
m_array[m_count] = item;
m_version++;
-
return m_count++;
}
+
/// <summary>
/// Removes all elements from the <c>AppenderCollection</c>.
/// </summary>
@@ -295,7 +235,7 @@
/// <returns>A new <see cref="AppenderCollection"/> with a shallow copy of the collection data.</returns>
public virtual object Clone()
{
- AppenderCollection newCol = new AppenderCollection(m_count);
+ var newCol = new AppenderCollection(m_count);
Array.Copy(m_array, 0, newCol.m_array, 0, m_count);
newCol.m_count = m_count;
newCol.m_version = m_version;
@@ -374,19 +314,21 @@
/// Removes the first occurrence of a specific <see cref="IAppender"/> from the <c>AppenderCollection</c>.
/// </summary>
/// <param name="item">The <see cref="IAppender"/> to remove from the <c>AppenderCollection</c>.</param>
+ /// <returns>True if the item was removed.</returns>
/// <exception cref="ArgumentException">
/// The specified <see cref="IAppender"/> was not found in the <c>AppenderCollection</c>.
/// </exception>
- public virtual void Remove(IAppender item)
+ public virtual bool Remove(IAppender item)
{
int i = IndexOf(item);
if (i < 0)
{
- throw new System.ArgumentException("Cannot remove the specified item because it was not found in the specified Collection.");
+ throw new ArgumentException("Cannot remove the specified item because it was not found in the specified Collection.");
}
++m_version;
RemoveAt(i);
+ return true;
}
/// <summary>
@@ -421,46 +363,29 @@
/// Gets a value indicating whether the collection has a fixed size.
/// </summary>
/// <value>true if the collection has a fixed size; otherwise, false. The default is false</value>
- public virtual bool IsFixedSize
- {
- get { return false; }
- }
+ public virtual bool IsFixedSize => false;
/// <summary>
/// Gets a value indicating whether the IList is read-only.
/// </summary>
/// <value>true if the collection is read-only; otherwise, false. The default is false</value>
- public virtual bool IsReadOnly
- {
- get { return false; }
- }
-
- #endregion
-
- #region Operations (type-safe IEnumerable)
+ public virtual bool IsReadOnly => false;
/// <summary>
/// Returns an enumerator that can iterate through the <c>AppenderCollection</c>.
/// </summary>
/// <returns>An <see cref="Enumerator"/> for the entire <c>AppenderCollection</c>.</returns>
- public virtual IAppenderCollectionEnumerator GetEnumerator()
+ public virtual IEnumerator<IAppender> GetEnumerator()
{
return new Enumerator(this);
}
- #endregion
-
- #region Public helpers (just to mimic some nice features of ArrayList)
-
/// <summary>
/// Gets or sets the number of elements the <c>AppenderCollection</c> can contain.
/// </summary>
public virtual int Capacity
{
- get
- {
- return m_array.Length;
- }
+ get => m_array.Length;
set
{
if (value < m_count)
@@ -547,7 +472,7 @@
/// </summary>
public virtual void TrimToSize()
{
- this.Capacity = m_count;
+ Capacity = m_count;
}
/// <summary>
@@ -556,7 +481,7 @@
/// <returns>the array</returns>
public virtual IAppender[] ToArray()
{
- IAppender[] resultArray = new IAppender[m_count];
+ var resultArray = new IAppender[m_count];
if (m_count > 0)
{
Array.Copy(m_array, 0, resultArray, 0, m_count);
@@ -564,49 +489,31 @@
return resultArray;
}
- #endregion
-
- #region Implementation (helpers)
-
/// <exception cref="ArgumentOutOfRangeException">
/// <para><paramref name="i"/> is less than zero</para>
/// <para>-or-</para>
/// <para><paramref name="i"/> is equal to or greater than <see cref="AppenderCollection.Count"/>.</para>
/// </exception>
- private void ValidateIndex(int i)
- {
- ValidateIndex(i, false);
- }
-
- /// <exception cref="ArgumentOutOfRangeException">
- /// <para><paramref name="i"/> is less than zero</para>
- /// <para>-or-</para>
- /// <para><paramref name="i"/> is equal to or greater than <see cref="AppenderCollection.Count"/>.</para>
- /// </exception>
- private void ValidateIndex(int i, bool allowEqualEnd)
+ private void ValidateIndex(int i, bool allowEqualEnd = false)
{
int max = (allowEqualEnd) ? (m_count) : (m_count - 1);
if (i < 0 || i > max)
{
- throw log4net.Util.SystemInfo.CreateArgumentOutOfRangeException("i", (object)i, "Index was out of range. Must be non-negative and less than the size of the collection. [" + (object)i + "] Specified argument was out of the range of valid values.");
+ throw Util.SystemInfo.CreateArgumentOutOfRangeException(nameof(i), i, $"Index was out of range. Must be non-negative and less than the size of the collection. [{i}] Specified argument was out of the range of valid values.");
}
}
private void EnsureCapacity(int min)
{
- int newCapacity = ((m_array.Length == 0) ? DEFAULT_CAPACITY : m_array.Length * 2);
+ int newCapacity = (m_array.Length == 0) ? DEFAULT_CAPACITY : m_array.Length * 2;
if (newCapacity < min)
{
newCapacity = min;
}
- this.Capacity = newCapacity;
+ Capacity = newCapacity;
}
- #endregion
-
- #region Implementation (ICollection)
-
void ICollection.CopyTo(Array array, int start)
{
if (m_count > 0)
@@ -615,79 +522,70 @@
}
}
- #endregion
-
- #region Implementation (IList)
-
object IList.this[int i]
{
- get { return (object)this[i]; }
- set { this[i] = (IAppender)value; }
+ get => this[i];
+ set => this[i] = (IAppender)value;
}
- int IList.Add(object x)
+ int IList.Add(object? x)
{
- return this.Add((IAppender)x);
+ if (x is IAppender appender)
+ {
+ return InternalAdd(appender);
+ }
+
+ return -1;
}
- bool IList.Contains(object x)
+ bool IList.Contains(object? x)
{
- return this.Contains((IAppender)x);
+ if (x is IAppender appender)
+ {
+ return Contains(appender);
+ }
+
+ return false;
}
int IList.IndexOf(object x)
{
- return this.IndexOf((IAppender)x);
+ return IndexOf((IAppender)x);
}
void IList.Insert(int pos, object x)
{
- this.Insert(pos, (IAppender)x);
+ Insert(pos, (IAppender)x);
}
void IList.Remove(object x)
{
- this.Remove((IAppender)x);
+ Remove((IAppender)x);
}
void IList.RemoveAt(int pos)
{
- this.RemoveAt(pos);
+ RemoveAt(pos);
}
- #endregion
-
- #region Implementation (IEnumerable)
-
IEnumerator IEnumerable.GetEnumerator()
{
- return (IEnumerator)(this.GetEnumerator());
+ return GetEnumerator();
}
- #endregion
-
- #region Nested enumerator class
-
/// <summary>
/// Supports simple iteration over a <see cref="AppenderCollection"/>.
/// </summary>
/// <exclude/>
- private sealed class Enumerator : IEnumerator, IAppenderCollectionEnumerator
+ private sealed class Enumerator : IEnumerator<IAppender>
{
- #region Implementation (data)
-
private readonly AppenderCollection m_collection;
private int m_index;
- private int m_version;
-
- #endregion
-
- #region Construction
+ private readonly int m_version;
/// <summary>
/// Initializes a new instance of the <c>Enumerator</c> class.
/// </summary>
- /// <param name="tc"></param>
internal Enumerator(AppenderCollection tc)
{
m_collection = tc;
@@ -695,17 +593,10 @@
m_version = tc.m_version;
}
- #endregion
-
- #region Operations (type-safe IEnumerator)
-
/// <summary>
/// Gets the current element in the collection.
/// </summary>
- public IAppender Current
- {
- get { return m_collection[m_index]; }
- }
+ public IAppender Current => m_collection[m_index];
/// <summary>
/// Advances the enumerator to the next element in the collection.
@@ -721,7 +612,7 @@
{
if (m_version != m_collection.m_version)
{
- throw new System.InvalidOperationException("Collection was modified; enumeration operation may not execute.");
+ throw new InvalidOperationException("Collection was modified; enumeration operation may not execute.");
}
++m_index;
@@ -735,42 +626,24 @@
{
m_index = -1;
}
- #endregion
- #region Implementation (IEnumerator)
+ object IEnumerator.Current => Current;
- object IEnumerator.Current
+ public void Dispose()
{
- get { return this.Current; }
}
-
- #endregion
}
- #endregion
-
- #region Nested Read Only Wrapper class
-
/// <exclude/>
private sealed class ReadOnlyAppenderCollection : AppenderCollection, ICollection
{
- #region Implementation (data)
-
private readonly AppenderCollection m_collection;
- #endregion
-
- #region Construction
-
internal ReadOnlyAppenderCollection(AppenderCollection list) : base(Tag.Default)
{
m_collection = list;
}
- #endregion
-
- #region Type-safe ICollection
-
public override void CopyTo(IAppender[] array)
{
m_collection.CopyTo(array);
@@ -786,120 +659,79 @@
((ICollection)m_collection).CopyTo(array, start);
}
- public override int Count
- {
- get { return m_collection.Count; }
- }
+ public override int Count => m_collection.Count;
- public override bool IsSynchronized
- {
- get { return m_collection.IsSynchronized; }
- }
+ public override bool IsSynchronized => m_collection.IsSynchronized;
- public override object SyncRoot
- {
- get { return this.m_collection.SyncRoot; }
- }
-
- #endregion
-
- #region Type-safe IList
+ public override object SyncRoot => m_collection.SyncRoot;
public override IAppender this[int i]
{
- get { return m_collection[i]; }
- set { throw new NotSupportedException("This is a Read Only Collection and can not be modified"); }
+ get => m_collection[i];
+ set => throw SystemInfo.CreateReadOnlyCollectionNotModifiableException();
}
- public override int Add(IAppender x)
+ public override void Add(IAppender x)
{
- throw new NotSupportedException("This is a Read Only Collection and can not be modified");
+ throw SystemInfo.CreateReadOnlyCollectionNotModifiableException();
}
public override void Clear()
{
- throw new NotSupportedException("This is a Read Only Collection and can not be modified");
+ throw SystemInfo.CreateReadOnlyCollectionNotModifiableException();
}
- public override bool Contains(IAppender x)
- {
- return m_collection.Contains(x);
- }
+ public override bool Contains(IAppender x) => m_collection.Contains(x);
- public override int IndexOf(IAppender x)
- {
- return m_collection.IndexOf(x);
- }
+ public override int IndexOf(IAppender x) => m_collection.IndexOf(x);
public override void Insert(int pos, IAppender x)
{
- throw new NotSupportedException("This is a Read Only Collection and can not be modified");
+ throw SystemInfo.CreateReadOnlyCollectionNotModifiableException();
}
- public override void Remove(IAppender x)
+ public override bool Remove(IAppender x)
{
- throw new NotSupportedException("This is a Read Only Collection and can not be modified");
+ throw SystemInfo.CreateReadOnlyCollectionNotModifiableException();
}
public override void RemoveAt(int pos)
{
- throw new NotSupportedException("This is a Read Only Collection and can not be modified");
+ throw SystemInfo.CreateReadOnlyCollectionNotModifiableException();
}
- public override bool IsFixedSize
- {
- get { return true; }
- }
+ public override bool IsFixedSize => true;
- public override bool IsReadOnly
- {
- get { return true; }
- }
+ public override bool IsReadOnly => true;
- #endregion
-
- #region Type-safe IEnumerable
-
- public override IAppenderCollectionEnumerator GetEnumerator()
+ public override IEnumerator<IAppender> GetEnumerator()
{
return m_collection.GetEnumerator();
}
- #endregion
-
- #region Public Helpers
-
// (just to mimic some nice features of ArrayList)
public override int Capacity
{
- get { return m_collection.Capacity; }
- set { throw new NotSupportedException("This is a Read Only Collection and can not be modified"); }
+ get => m_collection.Capacity;
+ set => throw SystemInfo.CreateReadOnlyCollectionNotModifiableException();
}
public override int AddRange(AppenderCollection x)
{
- throw new NotSupportedException("This is a Read Only Collection and can not be modified");
+ throw SystemInfo.CreateReadOnlyCollectionNotModifiableException();
}
public override int AddRange(IAppender[] x)
{
- throw new NotSupportedException("This is a Read Only Collection and can not be modified");
+ throw SystemInfo.CreateReadOnlyCollectionNotModifiableException();
}
- public override IAppender[] ToArray()
- {
- return m_collection.ToArray();
- }
+ public override IAppender[] ToArray() => m_collection.ToArray();
public override void TrimToSize()
{
- throw new NotSupportedException("This is a Read Only Collection and can not be modified");
+ throw SystemInfo.CreateReadOnlyCollectionNotModifiableException();
}
-
- #endregion
}
-
- #endregion
}
-
}
diff --git a/src/log4net/Appender/AppenderSkeleton.cs b/src/log4net/Appender/AppenderSkeleton.cs
index 29354c9..8b4594c 100644
--- a/src/log4net/Appender/AppenderSkeleton.cs
+++ b/src/log4net/Appender/AppenderSkeleton.cs
@@ -19,8 +19,7 @@
using System;
using System.IO;
-using System.Collections;
-
+using System.Collections.Generic;
using log4net.Filter;
using log4net.Util;
using log4net.Layout;
@@ -46,8 +45,6 @@
/// <author>Gert Driesen</author>
public abstract class AppenderSkeleton : IAppender, IBulkAppender, IOptionHandler, IFlushable
{
- #region Protected Instance Constructors
-
/// <summary>
/// Default constructor
/// </summary>
@@ -59,10 +56,6 @@
m_errorHandler = new OnlyOnceErrorHandler(this.GetType().Name);
}
- #endregion Protected Instance Constructors
-
- #region Finalizer
-
/// <summary>
/// Finalizes this appender by calling the implementation's
/// <see cref="Close"/> method.
@@ -79,15 +72,11 @@
// There is no point in closing twice.
if (!m_closed)
{
- LogLog.Debug(declaringType, "Finalizing appender named [" + m_name + "].");
+ LogLog.Debug(declaringType, "Finalizing appender named [" + Name + "].");
Close();
}
}
- #endregion Finalizer
-
- #region Public Instance Properties
-
/// <summary>
/// Gets or sets the threshold <see cref="Level"/> of this appender.
/// </summary>
@@ -105,11 +94,7 @@
/// string, such as "DEBUG", "INFO" and so on.
/// </para>
/// </remarks>
- public Level Threshold
- {
- get { return m_threshold; }
- set { m_threshold = value; }
- }
+ public Level? Threshold { get; set; }
/// <summary>
/// Gets or sets the <see cref="IErrorHandler"/> for this appender.
@@ -123,12 +108,12 @@
/// </remarks>
public virtual IErrorHandler ErrorHandler
{
- get { return this.m_errorHandler; }
+ get => m_errorHandler;
set
{
- lock (this)
+ lock (LockObj)
{
- if (value == null)
+ if (value is null)
{
// We do not throw exception here since the cause is probably a
// bad config file.
@@ -145,17 +130,14 @@
/// <summary>
/// The filter chain.
/// </summary>
- /// <value>The head of the filter chain filter chain.</value>
+ /// <value>The head of the filter chain.</value>
/// <remarks>
/// <para>
/// Returns the head Filter. The Filters are organized in a linked list
/// and so all Filters on this Appender are available through the result.
/// </para>
/// </remarks>
- public virtual IFilter FilterHead
- {
- get { return m_headFilter; }
- }
+ public virtual IFilter? FilterHead { get; private set; }
/// <summary>
/// Gets or sets the <see cref="ILayout"/> for this appender.
@@ -167,15 +149,7 @@
/// </para>
/// </remarks>
/// <seealso cref="RequiresLayout"/>
- public virtual ILayout Layout
- {
- get { return m_layout; }
- set { m_layout = value; }
- }
-
- #endregion
-
- #region Implementation of IOptionHandler
+ public virtual ILayout? Layout { get; set; }
/// <summary>
/// Initialize the appender based on the options set
@@ -197,27 +171,13 @@
{
}
- #endregion Implementation of IOptionHandler
-
- #region Implementation of IAppender
-
/// <summary>
- /// Gets or sets the name of this appender.
+ /// Gets or sets the name that uniquely identifies this appender.
/// </summary>
- /// <value>The name of the appender.</value>
- /// <remarks>
- /// <para>
- /// The name uniquely identifies the appender.
- /// </para>
- /// </remarks>
- public string Name
- {
- get { return m_name; }
- set { m_name = value; }
- }
+ public string? Name { get; set; }
/// <summary>
- /// Closes the appender and release resources.
+ /// Closes the appender and releases resources.
/// </summary>
/// <remarks>
/// <para>
@@ -236,7 +196,7 @@
public void Close()
{
// This lock prevents the appender being closed while it is still appending
- lock (this)
+ lock (LockObj)
{
if (!m_closed)
{
@@ -294,11 +254,11 @@
// this, the message may be broken up into elements from
// multiple thread contexts (like get the wrong thread ID).
- lock (this)
+ lock (LockObj)
{
if (m_closed)
{
- ErrorHandler.Error("Attempted to append to closed appender named [" + m_name + "].");
+ ErrorHandler.Error($"Attempted to append to closed appender named [{Name}].");
return;
}
@@ -314,24 +274,13 @@
if (FilterEvent(loggingEvent) && PreAppendCheck())
{
- this.Append(loggingEvent);
+ Append(loggingEvent);
}
}
catch (Exception ex)
{
ErrorHandler.Error("Failed in DoAppend", ex);
}
-#if !MONO && !NET_2_0 && !NETSTANDARD
- // on .NET 2.0 (and higher) and Mono (all profiles),
- // exceptions that do not derive from System.Exception will be
- // wrapped in a RuntimeWrappedException by the runtime, and as
- // such will be catched by the catch clause above
- catch
- {
- // Catch handler for non System.Exception types
- ErrorHandler.Error("Failed in DoAppend (unknown exception)");
- }
-#endif
finally
{
m_recursiveGuard = false;
@@ -339,10 +288,6 @@
}
}
- #endregion Implementation of IAppender
-
- #region Implementation of IBulkAppender
-
/// <summary>
/// Performs threshold checks and invokes filters before
/// delegating actual logging to the subclasses specific
@@ -391,11 +336,11 @@
// this, the message may be broken up into elements from
// multiple thread contexts (like get the wrong thread ID).
- lock (this)
+ lock (LockObj)
{
if (m_closed)
{
- ErrorHandler.Error("Attempted to append to closed appender named [" + m_name + "].");
+ ErrorHandler.Error("Attempted to append to closed appender named [" + Name + "].");
return;
}
@@ -409,7 +354,7 @@
{
m_recursiveGuard = true;
- ArrayList filteredEvents = new ArrayList(loggingEvents.Length);
+ var filteredEvents = new List<LoggingEvent>(loggingEvents.Length);
foreach (LoggingEvent loggingEvent in loggingEvents)
{
@@ -421,24 +366,13 @@
if (filteredEvents.Count > 0 && PreAppendCheck())
{
- this.Append((LoggingEvent[])filteredEvents.ToArray(typeof(LoggingEvent)));
+ Append(filteredEvents);
}
}
catch (Exception ex)
{
ErrorHandler.Error("Failed in Bulk DoAppend", ex);
}
-#if !MONO && !NET_2_0 && !NETSTANDARD
- // on .NET 2.0 (and higher) and Mono (all profiles),
- // exceptions that do not derive from System.Exception will be
- // wrapped in a RuntimeWrappedException by the runtime, and as
- // such will be catched by the catch clause above
- catch
- {
- // Catch handler for non System.Exception types
- ErrorHandler.Error("Failed in Bulk DoAppend (unknown exception)");
- }
-#endif
finally
{
m_recursiveGuard = false;
@@ -446,8 +380,6 @@
}
}
- #endregion Implementation of IBulkAppender
-
/// <summary>
/// Test if the logging event should we output by this appender
/// </summary>
@@ -486,9 +418,9 @@
return false;
}
- IFilter f = this.FilterHead;
+ IFilter? f = FilterHead;
- while (f != null)
+ while (f is not null)
{
switch (f.Decide(loggingEvent))
{
@@ -508,8 +440,6 @@
return true;
}
- #region Public Instance Methods
-
/// <summary>
/// Adds a filter to the end of the filter chain.
/// </summary>
@@ -525,18 +455,18 @@
/// </remarks>
public virtual void AddFilter(IFilter filter)
{
- if (filter == null)
+ if (filter is null)
{
- throw new ArgumentNullException("filter param must not be null");
+ throw new ArgumentNullException(nameof(filter));
}
- if (m_headFilter == null)
+ if (FilterHead is null)
{
- m_headFilter = m_tailFilter = filter;
+ FilterHead = m_tailFilter = filter;
}
else
{
- m_tailFilter.Next = filter;
+ m_tailFilter!.Next = filter;
m_tailFilter = filter;
}
}
@@ -551,13 +481,9 @@
/// </remarks>
public virtual void ClearFilters()
{
- m_headFilter = m_tailFilter = null;
+ FilterHead = m_tailFilter = null;
}
- #endregion Public Instance Methods
-
- #region Protected Instance Methods
-
/// <summary>
/// Checks if the message level is below this appender's threshold.
/// </summary>
@@ -571,9 +497,9 @@
/// <c>true</c> if the <paramref name="level"/> meets the <see cref="Threshold"/>
/// requirements of this appender.
/// </returns>
- protected virtual bool IsAsSevereAsThreshold(Level level)
+ protected virtual bool IsAsSevereAsThreshold(Level? level)
{
- return ((m_threshold == null) || level >= m_threshold);
+ return ((Threshold is null) || level >= Threshold);
}
/// <summary>
@@ -624,7 +550,7 @@
/// method for each element in the bulk array.
/// </para>
/// <para>
- /// A sub class that can better process a bulk array of events should
+ /// A subclass that can better process a bulk array of events should
/// override this method in addition to <see cref="M:Append(LoggingEvent)"/>.
/// </para>
/// </remarks>
@@ -637,6 +563,28 @@
}
/// <summary>
+ /// Appends logging events.
+ /// </summary>
+ /// <param name="loggingEvents">The logging events</param>
+ /// <remarks>
+ /// <para>
+ /// This base class implementation calls the <see cref="M:Append(LoggingEvent)"/>
+ /// method for each element in the bulk array.
+ /// </para>
+ /// <para>
+ /// A subclass that can better process a bulk array of events should
+ /// override this method in addition to <see cref="M:Append(LoggingEvent)"/>.
+ /// </para>
+ /// </remarks>
+ protected virtual void Append(IEnumerable<LoggingEvent> loggingEvents)
+ {
+ foreach (LoggingEvent loggingEvent in loggingEvents)
+ {
+ Append(loggingEvent);
+ }
+ }
+
+ /// <summary>
/// Called before <see cref="M:Append(LoggingEvent)"/> as a precondition.
/// </summary>
/// <remarks>
@@ -656,9 +604,9 @@
/// <returns><c>true</c> if the call to <see cref="M:Append(LoggingEvent)"/> should proceed.</returns>
protected virtual bool PreAppendCheck()
{
- if ((m_layout == null) && RequiresLayout)
+ if ((Layout is null) && RequiresLayout)
{
- ErrorHandler.Error("AppenderSkeleton: No layout set for the appender named [" + m_name + "].");
+ ErrorHandler.Error($"AppenderSkeleton: No layout set for the appender named [{Name}].");
return false;
}
@@ -691,14 +639,11 @@
/// </remarks>
protected string RenderLoggingEvent(LoggingEvent loggingEvent)
{
- // Create the render writer on first use
- if (m_renderWriter == null)
+ lock (LockObj)
{
- m_renderWriter = new ReusableStringWriter(System.Globalization.CultureInfo.InvariantCulture);
- }
+ // Create the render writer on first use
+ m_renderWriter ??= new ReusableStringWriter(System.Globalization.CultureInfo.InvariantCulture);
- lock (m_renderWriter)
- {
// Reset the writer so we can reuse it
m_renderWriter.Reset(c_renderBufferMaxCapacity, c_renderBufferSize);
@@ -732,30 +677,30 @@
/// </remarks>
protected void RenderLoggingEvent(TextWriter writer, LoggingEvent loggingEvent)
{
- if (m_layout == null)
+ if (Layout is null)
{
throw new InvalidOperationException("A layout must be set");
}
- if (m_layout.IgnoresException)
+ if (Layout.IgnoresException)
{
string exceptionStr = loggingEvent.GetExceptionString();
if (exceptionStr != null && exceptionStr.Length > 0)
{
// render the event and the exception
- m_layout.Format(writer, loggingEvent);
+ Layout.Format(writer, loggingEvent);
writer.WriteLine(exceptionStr);
}
else
{
// there is no exception to render
- m_layout.Format(writer, loggingEvent);
+ Layout.Format(writer, loggingEvent);
}
}
else
{
// The layout will render the exception
- m_layout.Format(writer, loggingEvent);
+ Layout.Format(writer, loggingEvent);
}
}
@@ -775,12 +720,7 @@
/// <returns>
/// <c>true</c> if the appender requires a layout object, otherwise <c>false</c>.
/// </returns>
- protected virtual bool RequiresLayout
- {
- get { return false; }
- }
-
- #endregion
+ protected virtual bool RequiresLayout => false;
/// <summary>
/// Flushes any buffered log data.
@@ -789,75 +729,25 @@
/// This implementation doesn't flush anything and always returns true
/// </remarks>
/// <returns><c>True</c> if all logging events were flushed successfully, else <c>false</c>.</returns>
- public virtual bool Flush(int millisecondsTimeout)
- {
- return true;
- }
-
- #region Private Instance Fields
-
- /// <summary>
- /// The layout of this appender.
- /// </summary>
- /// <remarks>
- /// See <see cref="Layout"/> for more information.
- /// </remarks>
- private ILayout m_layout;
-
- /// <summary>
- /// The name of this appender.
- /// </summary>
- /// <remarks>
- /// See <see cref="Name"/> for more information.
- /// </remarks>
- private string m_name;
-
- /// <summary>
- /// The level threshold of this appender.
- /// </summary>
- /// <remarks>
- /// <para>
- /// There is no level threshold filtering by default.
- /// </para>
- /// <para>
- /// See <see cref="Threshold"/> for more information.
- /// </para>
- /// </remarks>
- private Level m_threshold;
+ public virtual bool Flush(int millisecondsTimeout) => true;
/// <summary>
/// It is assumed and enforced that errorHandler is never null.
/// </summary>
/// <remarks>
/// <para>
- /// It is assumed and enforced that errorHandler is never null.
- /// </para>
- /// <para>
/// See <see cref="ErrorHandler"/> for more information.
/// </para>
/// </remarks>
private IErrorHandler m_errorHandler;
/// <summary>
- /// The first filter in the filter chain.
- /// </summary>
- /// <remarks>
- /// <para>
- /// Set to <c>null</c> initially.
- /// </para>
- /// <para>
- /// See <see cref="IFilter"/> for more information.
- /// </para>
- /// </remarks>
- private IFilter m_headFilter;
-
- /// <summary>
/// The last filter in the filter chain.
/// </summary>
/// <remarks>
/// See <see cref="IFilter"/> for more information.
/// </remarks>
- private IFilter m_tailFilter;
+ private IFilter? m_tailFilter;
/// <summary>
/// Flag indicating if this appender is closed.
@@ -865,21 +755,22 @@
/// <remarks>
/// See <see cref="Close"/> for more information.
/// </remarks>
- private bool m_closed = false;
+ private bool m_closed;
/// <summary>
/// The guard prevents an appender from repeatedly calling its own DoAppend method
/// </summary>
- private bool m_recursiveGuard = false;
+ private bool m_recursiveGuard;
+
+ /// <summary>
+ /// Used for locking actions by this appender.
+ /// </summary>
+ protected object LockObj { get; } = new();
/// <summary>
/// StringWriter used to render events
/// </summary>
- private ReusableStringWriter m_renderWriter = null;
-
- #endregion Private Instance Fields
-
- #region Constants
+ private ReusableStringWriter? m_renderWriter;
/// <summary>
/// Initial buffer size
@@ -891,10 +782,6 @@
/// </summary>
private const int c_renderBufferMaxCapacity = 1024;
- #endregion
-
- #region Private Static Fields
-
/// <summary>
/// The fully qualified type of the AppenderSkeleton class.
/// </summary>
@@ -903,7 +790,5 @@
/// log message.
/// </remarks>
private static readonly Type declaringType = typeof(AppenderSkeleton);
-
- #endregion Private Static Fields
}
}
diff --git a/src/log4net/Appender/AspNetTraceAppender.cs b/src/log4net/Appender/AspNetTraceAppender.cs
index c478a49..658b478 100644
--- a/src/log4net/Appender/AspNetTraceAppender.cs
+++ b/src/log4net/Appender/AspNetTraceAppender.cs
@@ -1,4 +1,4 @@
-#if NET_2_0
+#if NET462_OR_GREATER
#region Apache License
//
// Licensed to the Apache Software Foundation (ASF) under one or more
@@ -18,10 +18,6 @@
//
#endregion
-// .NET Compact Framework 1.0 has no support for ASP.NET
-// SSCLI 1.0 has no support for ASP.NET
-#if !NETCF && !SSCLI && !CLIENT_PROFILE
-
using System.Web;
using log4net.Layout;
@@ -54,52 +50,27 @@
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
/// <author>Ron Grabowski</author>
- public class AspNetTraceAppender : AppenderSkeleton
+ public class AspNetTraceAppender : AppenderSkeleton
{
- #region Public Instances Constructors
-
/// <summary>
- /// Initializes a new instance of the <see cref="AspNetTraceAppender" /> class.
- /// </summary>
- /// <remarks>
- /// <para>
- /// Default constructor.
- /// </para>
- /// </remarks>
- public AspNetTraceAppender()
- {
- }
-
- #endregion // Public Instances Constructors
-
- #region Override implementation of AppenderSkeleton
-
- /// <summary>
- /// Write the logging event to the ASP.NET trace
+ /// Write the logging event to the ASP.NET trace <c>HttpContext.Current.Trace</c>.
/// </summary>
/// <param name="loggingEvent">the event to log</param>
- /// <remarks>
- /// <para>
- /// Write the logging event to the ASP.NET trace
- /// <c>HttpContext.Current.Trace</c>
- /// (<see cref="TraceContext"/>).
- /// </para>
- /// </remarks>
- protected override void Append(LoggingEvent loggingEvent)
+ protected override void Append(LoggingEvent loggingEvent)
{
// check if log4net is running in the context of an ASP.NET application
- if (HttpContext.Current != null)
+ if (HttpContext.Current is not null)
{
// check if tracing is enabled for the current context
- if (HttpContext.Current.Trace.IsEnabled)
+ if (HttpContext.Current.Trace.IsEnabled)
{
- if (loggingEvent.Level >= Level.Warn)
+ if (loggingEvent.Level >= Level.Warn)
{
- HttpContext.Current.Trace.Warn(m_category.Format(loggingEvent), RenderLoggingEvent(loggingEvent));
+ HttpContext.Current.Trace.Warn(Category.Format(loggingEvent), RenderLoggingEvent(loggingEvent));
}
- else
+ else
{
- HttpContext.Current.Trace.Write(m_category.Format(loggingEvent), RenderLoggingEvent(loggingEvent));
+ HttpContext.Current.Trace.Write(Category.Format(loggingEvent), RenderLoggingEvent(loggingEvent));
}
}
}
@@ -108,20 +79,7 @@
/// <summary>
/// This appender requires a <see cref="Layout"/> to be set.
/// </summary>
- /// <value><c>true</c></value>
- /// <remarks>
- /// <para>
- /// This appender requires a <see cref="Layout"/> to be set.
- /// </para>
- /// </remarks>
- protected override bool RequiresLayout
- {
- get { return true; }
- }
-
- #endregion // Override implementation of AppenderSkeleton
-
- #region Public Instance Properties
+ protected override bool RequiresLayout => true;
/// <summary>
/// The category parameter sent to the Trace method.
@@ -131,27 +89,8 @@
/// Defaults to %logger which will use the logger name of the current
/// <see cref="LoggingEvent"/> as the category parameter.
/// </para>
- /// <para>
- /// </para>
/// </remarks>
- public PatternLayout Category
- {
- get { return m_category; }
- set { m_category = value; }
- }
-
- #endregion
-
- #region Private Instance Fields
-
- /// <summary>
- /// Defaults to %logger
- /// </summary>
- private PatternLayout m_category = new PatternLayout("%logger");
-
- #endregion
+ public PatternLayout Category { get; set; } = new("%logger");
}
}
-
-#endif // !NETCF && !SSCLI
-#endif // NET_2_0
+#endif
diff --git a/src/log4net/Appender/BufferingAppenderSkeleton.cs b/src/log4net/Appender/BufferingAppenderSkeleton.cs
index 5af27c8..352c7e3 100644
--- a/src/log4net/Appender/BufferingAppenderSkeleton.cs
+++ b/src/log4net/Appender/BufferingAppenderSkeleton.cs
@@ -22,6 +22,7 @@
using log4net.Util;
using log4net.Core;
+using System.Collections.Generic;
namespace log4net.Appender
{
@@ -71,8 +72,6 @@
/// <author>Gert Driesen</author>
public abstract class BufferingAppenderSkeleton : AppenderSkeleton
{
- #region Protected Instance Constructors
-
/// <summary>
/// Initializes a new instance of the <see cref="BufferingAppenderSkeleton" /> class.
/// </summary>
@@ -100,15 +99,11 @@
/// <see cref="BufferSize"/> is set to zero, i.e. when no buffering occurs.
/// </para>
/// </remarks>
- protected BufferingAppenderSkeleton(bool eventMustBeFixed) : base()
+ protected BufferingAppenderSkeleton(bool eventMustBeFixed)
{
m_eventMustBeFixed = eventMustBeFixed;
}
- #endregion Protected Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
/// Gets or sets a value that indicates whether the appender is lossy.
/// </summary>
@@ -119,7 +114,7 @@
/// <para>
/// This appender uses a buffer to store logging events before
/// delivering them. A triggering event causes the whole buffer
- /// to be send to the remote sink. If the buffer overruns before
+ /// to be sent to the remote sink. If the buffer overruns before
/// a triggering event then logging events could be lost. Set
/// <see cref="Lossy"/> to <c>false</c> to prevent logging events
/// from being lost.
@@ -127,11 +122,7 @@
/// <para>If <see cref="Lossy"/> is set to <c>true</c> then an
/// <see cref="Evaluator"/> must be specified.</para>
/// </remarks>
- public bool Lossy
- {
- get { return m_lossy; }
- set { m_lossy = value; }
- }
+ public bool Lossy { get; set; }
/// <summary>
/// Gets or sets the size of the cyclic buffer used to hold the
@@ -156,11 +147,7 @@
/// be buffered.
/// </para>
/// </remarks>
- public int BufferSize
- {
- get { return m_bufferSize; }
- set { m_bufferSize = value; }
- }
+ public int BufferSize { get; set; } = DEFAULT_BUFFER_SIZE;
/// <summary>
/// Gets or sets the <see cref="ITriggeringEventEvaluator"/> that causes the
@@ -179,11 +166,7 @@
/// <para>If <see cref="Lossy"/> is set to <c>true</c> then an
/// <see cref="Evaluator"/> must be specified.</para>
/// </remarks>
- public ITriggeringEventEvaluator Evaluator
- {
- get { return m_evaluator; }
- set { m_evaluator = value; }
- }
+ public ITriggeringEventEvaluator? Evaluator { get; set; }
/// <summary>
/// Gets or sets the value of the <see cref="ITriggeringEventEvaluator"/> to use.
@@ -198,11 +181,7 @@
/// be sent (see <see cref="M:SendBuffer(LoggingEvent[])"/>).
/// </para>
/// </remarks>
- public ITriggeringEventEvaluator LossyEvaluator
- {
- get { return m_lossyEvaluator; }
- set { m_lossyEvaluator = value; }
- }
+ public ITriggeringEventEvaluator? LossyEvaluator { get; set; }
/// <summary>
/// Gets or sets a value indicating if only part of the logging event data
@@ -224,22 +203,12 @@
[Obsolete("Use Fix property")]
public virtual bool OnlyFixPartialEventData
{
- get { return (Fix == FixFlags.Partial); }
- set
- {
- if (value)
- {
- Fix = FixFlags.Partial;
- }
- else
- {
- Fix = FixFlags.All;
- }
- }
+ get => Fix == FixFlags.Partial;
+ set => Fix = value ? FixFlags.Partial : FixFlags.All;
}
/// <summary>
- /// Gets or sets a the fields that will be fixed in the event
+ /// Gets or sets the fields that will be fixed in the event
/// </summary>
/// <value>
/// The event fields that will be fixed before the event is buffered
@@ -252,15 +221,7 @@
/// </para>
/// </remarks>
/// <seealso cref="LoggingEvent.Fix"/>
- public virtual FixFlags Fix
- {
- get { return m_fixFlags; }
- set { m_fixFlags = value; }
- }
-
- #endregion Public Instance Properties
-
- #region Public Methods
+ public virtual FixFlags Fix { get; set; } = FixFlags.All;
/// <summary>
/// Flushes any buffered log data.
@@ -313,27 +274,27 @@
/// </remarks>
public virtual void Flush(bool flushLossyBuffer)
{
- // This method will be called outside of the AppenderSkeleton DoAppend() method
+ // This method will be called outside the AppenderSkeleton DoAppend() method
// therefore it needs to be protected by its own lock. This will block any
// Appends while the buffer is flushed.
- lock (this)
+ lock (LockObj)
{
- if (m_cb != null && m_cb.Length > 0)
+ if (m_cb is not null && m_cb.Length > 0)
{
- if (m_lossy)
+ if (Lossy)
{
// If we are allowed to eagerly flush from the lossy buffer
if (flushLossyBuffer)
{
- if (m_lossyEvaluator != null)
+ if (LossyEvaluator is not null)
{
// Test the contents of the buffer against the lossy evaluator
LoggingEvent[] bufferedEvents = m_cb.PopAll();
- ArrayList filteredEvents = new ArrayList(bufferedEvents.Length);
+ var filteredEvents = new List<LoggingEvent>(bufferedEvents.Length);
foreach (LoggingEvent loggingEvent in bufferedEvents)
{
- if (m_lossyEvaluator.IsTriggeringEvent(loggingEvent))
+ if (LossyEvaluator.IsTriggeringEvent(loggingEvent))
{
filteredEvents.Add(loggingEvent);
}
@@ -342,7 +303,7 @@
// Send the events that meet the lossy evaluator criteria
if (filteredEvents.Count > 0)
{
- SendBuffer((LoggingEvent[])filteredEvents.ToArray(typeof(LoggingEvent)));
+ SendBuffer(filteredEvents.ToArray());
}
}
else
@@ -361,10 +322,6 @@
}
}
- #endregion Public Methods
-
- #region Implementation of IOptionHandler
-
/// <summary>
/// Initialize the appender based on the options set
/// </summary>
@@ -388,14 +345,14 @@
// If the appender is in Lossy mode then we will
// only send the buffer when the Evaluator triggers
// therefore check we have an evaluator.
- if (m_lossy && m_evaluator == null)
+ if (Lossy && Evaluator is null)
{
- ErrorHandler.Error("Appender [" + Name + "] is Lossy but has no Evaluator. The buffer will never be sent!");
+ ErrorHandler.Error($"Appender [{Name}] is Lossy but has no Evaluator. The buffer will never be sent!");
}
- if (m_bufferSize > 1)
+ if (BufferSize > 1)
{
- m_cb = new CyclicBuffer(m_bufferSize);
+ m_cb = new CyclicBuffer(BufferSize);
}
else
{
@@ -403,10 +360,6 @@
}
}
- #endregion Implementation of IOptionHandler
-
- #region Override implementation of AppenderSkeleton
-
/// <summary>
/// Close this appender instance.
/// </summary>
@@ -459,21 +412,21 @@
// sent immediately because there is not enough space in the buffer
// to buffer up more than 1 event. Therefore as a special case
// we don't use the buffer at all.
- if (m_cb == null || m_bufferSize <= 1)
+ if (m_cb is null || BufferSize <= 1)
{
- // Only send the event if we are in non lossy mode or the event is a triggering event
- if ((!m_lossy) ||
- (m_evaluator != null && m_evaluator.IsTriggeringEvent(loggingEvent)) ||
- (m_lossyEvaluator != null && m_lossyEvaluator.IsTriggeringEvent(loggingEvent)))
+ // Only send the event if we are in non-lossy mode or the event is a triggering event
+ if ((!Lossy) ||
+ (Evaluator is not null && Evaluator.IsTriggeringEvent(loggingEvent)) ||
+ (LossyEvaluator is not null && LossyEvaluator.IsTriggeringEvent(loggingEvent)))
{
if (m_eventMustBeFixed)
{
// Derive class expects fixed events
- loggingEvent.Fix = this.Fix;
+ loggingEvent.Fix = Fix;
}
// Not buffering events, send immediately
- SendBuffer(new LoggingEvent[] { loggingEvent });
+ SendBuffer(new[] { loggingEvent });
}
}
else
@@ -481,15 +434,15 @@
// Because we are caching the LoggingEvent beyond the
// lifetime of the Append() method we must fix any
// volatile data in the event.
- loggingEvent.Fix = this.Fix;
+ loggingEvent.Fix = Fix;
// Add to the buffer, returns the event discarded from the buffer if there is no space remaining after the append
LoggingEvent discardedLoggingEvent = m_cb.Append(loggingEvent);
- if (discardedLoggingEvent != null)
+ if (discardedLoggingEvent is not null)
{
// Buffer is full and has had to discard an event
- if (!m_lossy)
+ if (!Lossy)
{
// Not lossy, must send all events
SendFromBuffer(discardedLoggingEvent, m_cb);
@@ -497,21 +450,21 @@
else
{
// Check if the discarded event should not be logged
- if (m_lossyEvaluator == null || !m_lossyEvaluator.IsTriggeringEvent(discardedLoggingEvent))
+ if (LossyEvaluator is null || !LossyEvaluator.IsTriggeringEvent(discardedLoggingEvent))
{
// Clear the discarded event as we should not forward it
discardedLoggingEvent = null;
}
// Check if the event should trigger the whole buffer to be sent
- if (m_evaluator != null && m_evaluator.IsTriggeringEvent(loggingEvent))
+ if (Evaluator is not null && Evaluator.IsTriggeringEvent(loggingEvent))
{
SendFromBuffer(discardedLoggingEvent, m_cb);
}
- else if (discardedLoggingEvent != null)
+ else if (discardedLoggingEvent is not null)
{
// Just send the discarded event
- SendBuffer(new LoggingEvent[] { discardedLoggingEvent });
+ SendBuffer(new[] { discardedLoggingEvent });
}
}
}
@@ -520,7 +473,7 @@
// Buffer is not yet full
// Check if the event should trigger the whole buffer to be sent
- if (m_evaluator != null && m_evaluator.IsTriggeringEvent(loggingEvent))
+ if (Evaluator is not null && Evaluator.IsTriggeringEvent(loggingEvent))
{
SendFromBuffer(null, m_cb);
}
@@ -528,31 +481,27 @@
}
}
- #endregion Override implementation of AppenderSkeleton
-
- #region Protected Instance Methods
-
/// <summary>
/// Sends the contents of the buffer.
/// </summary>
/// <param name="firstLoggingEvent">The first logging event.</param>
- /// <param name="buffer">The buffer containing the events that need to be send.</param>
+ /// <param name="buffer">The buffer containing the events that need to be sent.</param>
/// <remarks>
/// <para>
/// The subclass must override <see cref="M:SendBuffer(LoggingEvent[])"/>.
/// </para>
/// </remarks>
- protected virtual void SendFromBuffer(LoggingEvent firstLoggingEvent, CyclicBuffer buffer)
+ protected virtual void SendFromBuffer(LoggingEvent? firstLoggingEvent, CyclicBuffer buffer)
{
LoggingEvent[] bufferEvents = buffer.PopAll();
- if (firstLoggingEvent == null)
+ if (firstLoggingEvent is null)
{
SendBuffer(bufferEvents);
}
else if (bufferEvents.Length == 0)
{
- SendBuffer(new LoggingEvent[] { firstLoggingEvent });
+ SendBuffer(new[] { firstLoggingEvent });
}
else
{
@@ -565,12 +514,10 @@
}
}
- #endregion Protected Instance Methods
-
/// <summary>
/// Sends the events.
/// </summary>
- /// <param name="events">The events that need to be send.</param>
+ /// <param name="events">The events that need to be sent.</param>
/// <remarks>
/// <para>
/// The subclass must override this method to process the buffered events.
@@ -578,8 +525,6 @@
/// </remarks>
protected abstract void SendBuffer(LoggingEvent[] events);
- #region Private Static Fields
-
/// <summary>
/// The default buffer size.
/// </summary>
@@ -589,71 +534,14 @@
/// </remarks>
private const int DEFAULT_BUFFER_SIZE = 512;
- #endregion Private Static Fields
-
- #region Private Instance Fields
-
- /// <summary>
- /// The size of the cyclic buffer used to hold the logging events.
- /// </summary>
- /// <remarks>
- /// Set to <see cref="DEFAULT_BUFFER_SIZE"/> by default.
- /// </remarks>
- private int m_bufferSize = DEFAULT_BUFFER_SIZE;
-
/// <summary>
/// The cyclic buffer used to store the logging events.
/// </summary>
- private CyclicBuffer m_cb;
-
- /// <summary>
- /// The triggering event evaluator that causes the buffer to be sent immediately.
- /// </summary>
- /// <remarks>
- /// The object that is used to determine if an event causes the entire
- /// buffer to be sent immediately. This field can be <c>null</c>, which
- /// indicates that event triggering is not to be done. The evaluator
- /// can be set using the <see cref="Evaluator"/> property. If this appender
- /// has the <see cref="m_lossy"/> (<see cref="Lossy"/> property) set to
- /// <c>true</c> then an <see cref="Evaluator"/> must be set.
- /// </remarks>
- private ITriggeringEventEvaluator m_evaluator;
-
- /// <summary>
- /// Indicates if the appender should overwrite events in the cyclic buffer
- /// when it becomes full, or if the buffer should be flushed when the
- /// buffer is full.
- /// </summary>
- /// <remarks>
- /// If this field is set to <c>true</c> then an <see cref="Evaluator"/> must
- /// be set.
- /// </remarks>
- private bool m_lossy = false;
-
- /// <summary>
- /// The triggering event evaluator filters discarded events.
- /// </summary>
- /// <remarks>
- /// The object that is used to determine if an event that is discarded should
- /// really be discarded or if it should be sent to the appenders.
- /// This field can be <c>null</c>, which indicates that all discarded events will
- /// be discarded.
- /// </remarks>
- private ITriggeringEventEvaluator m_lossyEvaluator;
-
- /// <summary>
- /// Value indicating which fields in the event should be fixed
- /// </summary>
- /// <remarks>
- /// By default all fields are fixed
- /// </remarks>
- private FixFlags m_fixFlags = FixFlags.All;
+ private CyclicBuffer? m_cb;
/// <summary>
/// The events delivered to the subclass must be fixed.
/// </summary>
private readonly bool m_eventMustBeFixed;
-
- #endregion Private Instance Fields
}
}
diff --git a/src/log4net/Appender/BufferingForwardingAppender.cs b/src/log4net/Appender/BufferingForwardingAppender.cs
index 360c8f9..8150a89 100644
--- a/src/log4net/Appender/BufferingForwardingAppender.cs
+++ b/src/log4net/Appender/BufferingForwardingAppender.cs
@@ -20,7 +20,6 @@
using System;
using log4net.Util;
-using log4net.Layout;
using log4net.Core;
namespace log4net.Appender
@@ -44,24 +43,6 @@
/// <author>Gert Driesen</author>
public class BufferingForwardingAppender : BufferingAppenderSkeleton, IAppenderAttachable
{
- #region Public Instance Constructors
-
- /// <summary>
- /// Initializes a new instance of the <see cref="BufferingForwardingAppender" /> class.
- /// </summary>
- /// <remarks>
- /// <para>
- /// Default constructor.
- /// </para>
- /// </remarks>
- public BufferingForwardingAppender()
- {
- }
-
- #endregion Public Instance Constructors
-
- #region Override implementation of AppenderSkeleton
-
/// <summary>
/// Closes the appender and releases resources.
/// </summary>
@@ -77,26 +58,19 @@
protected override void OnClose()
{
// Remove all the attached appenders
- lock (this)
+ lock (LockObj)
{
// Delegate to base, which will flush buffers
base.OnClose();
- if (m_appenderAttachedImpl != null)
- {
- m_appenderAttachedImpl.RemoveAllAppenders();
- }
+ m_appenderAttachedImpl?.RemoveAllAppenders();
}
}
- #endregion Override implementation of AppenderSkeleton
-
- #region Override implementation of BufferingAppenderSkeleton
-
/// <summary>
/// Send the events.
/// </summary>
- /// <param name="events">The events that need to be send.</param>
+ /// <param name="events">The events that need to be sent.</param>
/// <remarks>
/// <para>
/// Forwards the events to the attached appenders.
@@ -104,17 +78,13 @@
/// </remarks>
protected override void SendBuffer(LoggingEvent[] events)
{
- // Pass the logging event on to the attached appenders
- if (m_appenderAttachedImpl != null)
+ lock (LockObj)
{
- m_appenderAttachedImpl.AppendLoopOnAppenders(events);
+ // Pass the logging event on to the attached appenders
+ m_appenderAttachedImpl?.AppendLoopOnAppenders(events);
}
}
- #endregion Override implementation of BufferingAppenderSkeleton
-
- #region Implementation of IAppenderAttachable
-
/// <summary>
/// Adds an <see cref="IAppender" /> to the list of appenders of this
/// instance.
@@ -128,16 +98,13 @@
/// </remarks>
public virtual void AddAppender(IAppender newAppender)
{
- if (newAppender == null)
+ if (newAppender is null)
{
- throw new ArgumentNullException("newAppender");
+ throw new ArgumentNullException(nameof(newAppender));
}
- lock (this)
+ lock (LockObj)
{
- if (m_appenderAttachedImpl == null)
- {
- m_appenderAttachedImpl = new log4net.Util.AppenderAttachedImpl();
- }
+ m_appenderAttachedImpl ??= new AppenderAttachedImpl();
m_appenderAttachedImpl.AddAppender(newAppender);
}
}
@@ -157,9 +124,9 @@
{
get
{
- lock (this)
+ lock (LockObj)
{
- if (m_appenderAttachedImpl == null)
+ if (m_appenderAttachedImpl is null)
{
return AppenderCollection.EmptyCollection;
}
@@ -178,16 +145,11 @@
/// <returns>
/// The appender with the specified name, or <c>null</c>.
/// </returns>
- /// <remarks>
- /// <para>
- /// Get the named appender attached to this buffering appender.
- /// </para>
- /// </remarks>
- public virtual IAppender GetAppender(string name)
+ public virtual IAppender? GetAppender(string? name)
{
- lock (this)
+ lock (LockObj)
{
- if (m_appenderAttachedImpl == null || name == null)
+ if (m_appenderAttachedImpl is null || name is null)
{
return null;
}
@@ -206,9 +168,9 @@
/// </remarks>
public virtual void RemoveAllAppenders()
{
- lock (this)
+ lock (LockObj)
{
- if (m_appenderAttachedImpl != null)
+ if (m_appenderAttachedImpl is not null)
{
m_appenderAttachedImpl.RemoveAllAppenders();
m_appenderAttachedImpl = null;
@@ -226,11 +188,11 @@
/// If you are discarding the appender you must call
/// <see cref="IAppender.Close"/> on the appender removed.
/// </remarks>
- public virtual IAppender RemoveAppender(IAppender appender)
+ public virtual IAppender? RemoveAppender(IAppender? appender)
{
- lock (this)
+ lock (LockObj)
{
- if (appender != null && m_appenderAttachedImpl != null)
+ if (appender is not null && m_appenderAttachedImpl is not null)
{
return m_appenderAttachedImpl.RemoveAppender(appender);
}
@@ -248,11 +210,11 @@
/// If you are discarding the appender you must call
/// <see cref="IAppender.Close"/> on the appender removed.
/// </remarks>
- public virtual IAppender RemoveAppender(string name)
+ public virtual IAppender? RemoveAppender(string? name)
{
- lock (this)
+ lock (LockObj)
{
- if (name != null && m_appenderAttachedImpl != null)
+ if (name is not null && m_appenderAttachedImpl is not null)
{
return m_appenderAttachedImpl.RemoveAppender(name);
}
@@ -260,15 +222,9 @@
return null;
}
- #endregion Implementation of IAppenderAttachable
-
- #region Private Instance Fields
-
/// <summary>
/// Implementation of the <see cref="IAppenderAttachable"/> interface
/// </summary>
- private AppenderAttachedImpl m_appenderAttachedImpl;
-
- #endregion Private Instance Fields
+ private AppenderAttachedImpl? m_appenderAttachedImpl;
}
}
diff --git a/src/log4net/Appender/ColoredConsoleAppender.cs b/src/log4net/Appender/ColoredConsoleAppender.cs
index 00a07d2..078fc61 100644
--- a/src/log4net/Appender/ColoredConsoleAppender.cs
+++ b/src/log4net/Appender/ColoredConsoleAppender.cs
@@ -17,22 +17,11 @@
//
#endregion
-// MONO 1.0 Beta mcs does not like #if !A && !B && !C syntax
-
-#if !NETSTANDARD1_3 // netstandard doesn't support System.Security.Permissions
-// .NET Compact Framework 1.0 has no support for Win32 Console API's
-#if !NETCF
-// .Mono 1.0 has no support for Win32 Console API's
-#if !MONO
-// SSCLI 1.0 has no support for Win32 Console API's
-#if !SSCLI
-// We don't want framework or platform specific code in the CLI version of log4net
-#if !CLI_1_0
-
using System;
-using System.Globalization;
+using System.IO;
using System.Runtime.InteropServices;
+using log4net.Core;
using log4net.Layout;
using log4net.Util;
@@ -95,20 +84,17 @@
/// <author>Nicko Cadell</author>
public class ColoredConsoleAppender : AppenderSkeleton
{
- #region Colors Enum
-
/// <summary>
/// The enum of possible color values for use with the color mapping method
/// </summary>
/// <remarks>
/// <para>
- /// The following flags can be combined together to
- /// form the colors.
+ /// The following flags can be combined to form the colors.
/// </para>
/// </remarks>
/// <seealso cref="ColoredConsoleAppender" />
[Flags]
- public enum Colors : int
+ public enum Colors
{
/// <summary>
/// color is blue
@@ -151,10 +137,6 @@
HighIntensity = 0x0008,
}
- #endregion // Colors Enum
-
- #region Public Instance Constructors
-
/// <summary>
/// Initializes a new instance of the <see cref="ColoredConsoleAppender" /> class.
/// </summary>
@@ -198,10 +180,6 @@
m_writeToErrorStream = writeToErrorStream;
}
- #endregion // Public Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
/// Target is the value of the console output stream.
/// This is either <c>"Console.Out"</c> or <c>"Console.Error"</c>.
@@ -218,20 +196,8 @@
/// </remarks>
public virtual string Target
{
- get { return m_writeToErrorStream ? ConsoleError : ConsoleOut; }
- set
- {
- string v = value.Trim();
-
- if (string.Compare(ConsoleError, v, true, CultureInfo.InvariantCulture) == 0)
- {
- m_writeToErrorStream = true;
- }
- else
- {
- m_writeToErrorStream = false;
- }
- }
+ get => m_writeToErrorStream ? ConsoleError : ConsoleOut;
+ set => m_writeToErrorStream = StringComparer.OrdinalIgnoreCase.Equals(ConsoleError, value.Trim());
}
/// <summary>
@@ -250,10 +216,6 @@
m_levelMapping.Add(mapping);
}
- #endregion // Public Instance Properties
-
- #region Override implementation of AppenderSkeleton
-
/// <summary>
/// This method is called by the <see cref="M:AppenderSkeleton.DoAppend(log4net.Core.LoggingEvent)"/> method.
/// </summary>
@@ -266,32 +228,19 @@
/// The format of the output will depend on the appender's layout.
/// </para>
/// </remarks>
-#if NET_4_0 || MONO_4_0 || NETSTANDARD
[System.Security.SecuritySafeCritical]
-#endif
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, UnmanagedCode = true)]
- protected override void Append(log4net.Core.LoggingEvent loggingEvent)
+ protected override void Append(LoggingEvent loggingEvent)
{
- if (m_consoleOutputWriter != null)
+ if (m_consoleOutputWriter is not null)
{
- IntPtr consoleHandle = IntPtr.Zero;
- if (m_writeToErrorStream)
- {
- // Write to the error stream
- consoleHandle = GetStdHandle(STD_ERROR_HANDLE);
- }
- else
- {
- // Write to the output stream
- consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);
- }
+ IntPtr consoleHandle = GetStdHandle(m_writeToErrorStream ? STD_ERROR_HANDLE : STD_OUTPUT_HANDLE);
// Default to white on black
ushort colorInfo = (ushort)Colors.White;
// see if there is a specified lookup
- LevelColors levelColors = m_levelMapping.Lookup(loggingEvent.Level) as LevelColors;
- if (levelColors != null)
+ if (m_levelMapping.Lookup(loggingEvent.Level) is LevelColors levelColors)
{
colorInfo = levelColors.CombinedColor;
}
@@ -300,8 +249,7 @@
string strLoggingMessage = RenderLoggingEvent(loggingEvent);
// get the current console color - to restore later
- CONSOLE_SCREEN_BUFFER_INFO bufferInfo;
- GetConsoleScreenBufferInfo(consoleHandle, out bufferInfo);
+ GetConsoleScreenBufferInfo(consoleHandle, out CONSOLE_SCREEN_BUFFER_INFO bufferInfo);
// set the console colors
SetConsoleTextAttribute(consoleHandle, colorInfo);
@@ -416,55 +364,29 @@
/// <summary>
/// This appender requires a <see cref="Layout"/> to be set.
/// </summary>
- /// <value><c>true</c></value>
- /// <remarks>
- /// <para>
- /// This appender requires a <see cref="Layout"/> to be set.
- /// </para>
- /// </remarks>
- protected override bool RequiresLayout
- {
- get { return true; }
- }
+ protected override bool RequiresLayout => true;
/// <summary>
- /// Initialize the options for this appender
+ /// Initializes the options for this appender.
/// </summary>
- /// <remarks>
- /// <para>
- /// Initialize the level to color mappings set on this appender.
- /// </para>
- /// </remarks>
-#if NET_4_0 || MONO_4_0 || NETSTANDARD
[System.Security.SecuritySafeCritical]
-#endif
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, UnmanagedCode = true)]
public override void ActivateOptions()
{
base.ActivateOptions();
m_levelMapping.ActivateOptions();
- System.IO.Stream consoleOutputStream = null;
-
// Use the Console methods to open a Stream over the console std handle
- if (m_writeToErrorStream)
- {
- // Write to the error stream
- consoleOutputStream = Console.OpenStandardError();
- }
- else
- {
- // Write to the output stream
- consoleOutputStream = Console.OpenStandardOutput();
- }
+ Stream consoleOutputStream = m_writeToErrorStream ? Console.OpenStandardError() : Console.OpenStandardOutput();
- // Lookup the codepage encoding for the console
+ // Look up the codepage encoding for the console
System.Text.Encoding consoleEncoding = System.Text.Encoding.GetEncoding(GetConsoleOutputCP());
// Create a writer around the console stream
- m_consoleOutputWriter = new System.IO.StreamWriter(consoleOutputStream, consoleEncoding, 0x100);
-
- m_consoleOutputWriter.AutoFlush = true;
+ m_consoleOutputWriter = new StreamWriter(consoleOutputStream, consoleEncoding, 0x100)
+ {
+ AutoFlush = true
+ };
// SuppressFinalize on m_consoleOutputWriter because all it will do is flush
// and close the file handle. Because we have set AutoFlush the additional flush
@@ -473,47 +395,27 @@
GC.SuppressFinalize(m_consoleOutputWriter);
}
- #endregion // Override implementation of AppenderSkeleton
-
- #region Public Static Fields
-
/// <summary>
/// The <see cref="ColoredConsoleAppender.Target"/> to use when writing to the Console
/// standard output stream.
/// </summary>
- /// <remarks>
- /// <para>
- /// The <see cref="ColoredConsoleAppender.Target"/> to use when writing to the Console
- /// standard output stream.
- /// </para>
- /// </remarks>
public const string ConsoleOut = "Console.Out";
/// <summary>
/// The <see cref="ColoredConsoleAppender.Target"/> to use when writing to the Console
/// standard error output stream.
/// </summary>
- /// <remarks>
- /// <para>
- /// The <see cref="ColoredConsoleAppender.Target"/> to use when writing to the Console
- /// standard error output stream.
- /// </para>
- /// </remarks>
public const string ConsoleError = "Console.Error";
- #endregion // Public Static Fields
-
- #region Private Instances Fields
-
/// <summary>
/// Flag to write output to the error stream rather than the standard output stream
/// </summary>
- private bool m_writeToErrorStream = false;
+ private bool m_writeToErrorStream;
/// <summary>
/// Mapping from level object to color value
/// </summary>
- private LevelMapping m_levelMapping = new LevelMapping();
+ private readonly LevelMapping m_levelMapping = new();
/// <summary>
/// The console output stream writer to write to
@@ -523,38 +425,29 @@
/// This writer is not thread safe.
/// </para>
/// </remarks>
- private System.IO.StreamWriter m_consoleOutputWriter = null;
-
- #endregion // Private Instances Fields
-
- #region Win32 Methods
+ private StreamWriter? m_consoleOutputWriter;
[DllImport("Kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
+ [DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
private static extern int GetConsoleOutputCP();
[DllImport("Kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
+ [DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
private static extern bool SetConsoleTextAttribute(
IntPtr consoleHandle,
ushort attributes);
[DllImport("Kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
+ [DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
private static extern bool GetConsoleScreenBufferInfo(
IntPtr consoleHandle,
out CONSOLE_SCREEN_BUFFER_INFO bufferInfo);
- // [DllImport("Kernel32.dll", SetLastError=true, CharSet=CharSet.Unicode)]
- // private static extern bool WriteConsoleW(
- // IntPtr hConsoleHandle,
- // [MarshalAs(UnmanagedType.LPWStr)] string strBuffer,
- // UInt32 bufferLen,
- // out UInt32 written,
- // IntPtr reserved);
-
- //private const UInt32 STD_INPUT_HANDLE = unchecked((UInt32)(-10));
private const UInt32 STD_OUTPUT_HANDLE = unchecked((UInt32)(-11));
private const UInt32 STD_ERROR_HANDLE = unchecked((UInt32)(-12));
[DllImport("Kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
+ [DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
private static extern IntPtr GetStdHandle(
UInt32 type);
@@ -584,10 +477,6 @@
public COORD dwMaximumWindowSize;
}
- #endregion // Win32 Methods
-
- #region LevelColors LevelMapping Entry
-
/// <summary>
/// A class to act as a mapping between the level that a logging call is made at and
/// the color it should be displayed as.
@@ -599,39 +488,15 @@
/// </remarks>
public class LevelColors : LevelMappingEntry
{
- private Colors m_foreColor;
- private Colors m_backColor;
- private ushort m_combinedColor = 0;
-
/// <summary>
/// The mapped foreground color for the specified level
/// </summary>
- /// <remarks>
- /// <para>
- /// Required property.
- /// The mapped foreground color for the specified level.
- /// </para>
- /// </remarks>
- public Colors ForeColor
- {
- get { return m_foreColor; }
- set { m_foreColor = value; }
- }
+ public Colors ForeColor { get; set; }
/// <summary>
/// The mapped background color for the specified level
/// </summary>
- /// <remarks>
- /// <para>
- /// Required property.
- /// The mapped background color for the specified level.
- /// </para>
- /// </remarks>
- public Colors BackColor
- {
- get { return m_backColor; }
- set { m_backColor = value; }
- }
+ public Colors BackColor { get; set; }
/// <summary>
/// Initialize the options for the object
@@ -644,25 +509,14 @@
public override void ActivateOptions()
{
base.ActivateOptions();
- m_combinedColor = (ushort)((int)m_foreColor + (((int)m_backColor) << 4));
+ CombinedColor = (ushort)((int)ForeColor + (((int)BackColor) << 4));
}
/// <summary>
/// The combined <see cref="ForeColor"/> and <see cref="BackColor"/> suitable for
/// setting the console color.
/// </summary>
- internal ushort CombinedColor
- {
- get { return m_combinedColor; }
- }
+ internal ushort CombinedColor { get; private set; }
}
-
- #endregion // LevelColors LevelMapping Entry
}
-}
-
-#endif // !CLI_1_0
-#endif // !SSCLI
-#endif // !MONO
-#endif // !NETCF
-#endif // !NETSTANDARD1_3
+}
\ No newline at end of file
diff --git a/src/log4net/Appender/ConsoleAppender.cs b/src/log4net/Appender/ConsoleAppender.cs
index a7299ee..3dc07f1 100644
--- a/src/log4net/Appender/ConsoleAppender.cs
+++ b/src/log4net/Appender/ConsoleAppender.cs
@@ -18,7 +18,6 @@
#endregion
using System;
-using System.Globalization;
using log4net.Layout;
using log4net.Core;
@@ -52,8 +51,6 @@
/// <author>Gert Driesen</author>
public class ConsoleAppender : AppenderSkeleton
{
- #region Public Instance Constructors
-
/// <summary>
/// Initializes a new instance of the <see cref="ConsoleAppender" /> class.
/// </summary>
@@ -97,10 +94,6 @@
m_writeToErrorStream = writeToErrorStream;
}
- #endregion Public Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
/// Target is the value of the console output stream.
/// This is either <c>"Console.Out"</c> or <c>"Console.Error"</c>.
@@ -117,26 +110,10 @@
/// </remarks>
public virtual string Target
{
- get { return m_writeToErrorStream ? ConsoleError : ConsoleOut; }
- set
- {
- string v = value.Trim();
-
- if (SystemInfo.EqualsIgnoringCase(ConsoleError, v))
- {
- m_writeToErrorStream = true;
- }
- else
- {
- m_writeToErrorStream = false;
- }
- }
+ get => m_writeToErrorStream ? ConsoleError : ConsoleOut;
+ set => m_writeToErrorStream = SystemInfo.EqualsIgnoringCase(ConsoleError, value.Trim());
}
- #endregion Public Instance Properties
-
- #region Override implementation of AppenderSkeleton
-
/// <summary>
/// This method is called by the <see cref="M:AppenderSkeleton.DoAppend(LoggingEvent)"/> method.
/// </summary>
@@ -151,10 +128,6 @@
/// </remarks>
protected override void Append(LoggingEvent loggingEvent)
{
-#if NETCF_1_0
- // Write to the output stream
- Console.Write(RenderLoggingEvent(loggingEvent));
-#else
if (m_writeToErrorStream)
{
// Write to the error stream
@@ -165,57 +138,25 @@
// Write to the output stream
Console.Write(RenderLoggingEvent(loggingEvent));
}
-#endif
}
/// <summary>
/// This appender requires a <see cref="Layout"/> to be set.
/// </summary>
- /// <value><c>true</c></value>
- /// <remarks>
- /// <para>
- /// This appender requires a <see cref="Layout"/> to be set.
- /// </para>
- /// </remarks>
- protected override bool RequiresLayout
- {
- get { return true; }
- }
-
- #endregion Override implementation of AppenderSkeleton
-
- #region Public Static Fields
+ protected override bool RequiresLayout => true;
/// <summary>
/// The <see cref="ConsoleAppender.Target"/> to use when writing to the Console
/// standard output stream.
/// </summary>
- /// <remarks>
- /// <para>
- /// The <see cref="ConsoleAppender.Target"/> to use when writing to the Console
- /// standard output stream.
- /// </para>
- /// </remarks>
public const string ConsoleOut = "Console.Out";
/// <summary>
/// The <see cref="ConsoleAppender.Target"/> to use when writing to the Console
/// standard error output stream.
/// </summary>
- /// <remarks>
- /// <para>
- /// The <see cref="ConsoleAppender.Target"/> to use when writing to the Console
- /// standard error output stream.
- /// </para>
- /// </remarks>
public const string ConsoleError = "Console.Error";
- #endregion Public Static Fields
-
- #region Private Instances Fields
-
- private bool m_writeToErrorStream = false;
-
- #endregion Private Instances Fields
+ private bool m_writeToErrorStream;
}
}
diff --git a/src/log4net/Appender/DebugAppender.cs b/src/log4net/Appender/DebugAppender.cs
index 9aa9e97..807a178 100644
--- a/src/log4net/Appender/DebugAppender.cs
+++ b/src/log4net/Appender/DebugAppender.cs
@@ -42,8 +42,6 @@
/// <author>Nicko Cadell</author>
public class DebugAppender : AppenderSkeleton
{
- #region Public Instance Constructors
-
/// <summary>
/// Initializes a new instance of the <see cref="DebugAppender" />.
/// </summary>
@@ -72,11 +70,6 @@
Layout = layout;
}
- #endregion Public Instance Constructors
-
- #region Public Instance Properties
-
-#if !NETSTANDARD1_3 // System.Diagnostics.Debug has no Flush() in netstandard1.3
/// <summary>
/// Gets or sets a value that indicates whether the appender will
/// flush at the end of each write.
@@ -95,12 +88,7 @@
/// price to pay even for a 20% performance gain.
/// </para>
/// </remarks>
- public bool ImmediateFlush
- {
- get { return m_immediateFlush; }
- set { m_immediateFlush = value; }
- }
-#endif // !NETSTANDARD1_3
+ public bool ImmediateFlush { get; set; } = true;
/// <summary>
/// Formats the category parameter sent to the Debug method.
@@ -110,18 +98,9 @@
/// Defaults to a <see cref="Layout.PatternLayout"/> with %logger as the pattern which will use the logger name of the current
/// <see cref="LoggingEvent"/> as the category parameter.
/// </para>
- /// <para>
- /// </para>
/// </remarks>
- public PatternLayout Category
- {
- get { return m_category; }
- set { m_category = value; }
- }
+ public PatternLayout Category { get; set; } = new("%logger");
- #endregion Public Instance Properties
-
-#if !NETSTANDARD1_3
/// <summary>
/// Flushes any buffered log data.
/// </summary>
@@ -130,28 +109,17 @@
public override bool Flush(int millisecondsTimeout)
{
// Nothing to do if ImmediateFlush is true
- if (m_immediateFlush) return true;
+ if (ImmediateFlush)
+ {
+ return true;
+ }
// System.Diagnostics.Debug is thread-safe, so no need for lock(this).
System.Diagnostics.Debug.Flush();
return true;
}
-#endif
- #region Override implementation of AppenderSkeleton
-
-#if NETSTANDARD1_3
- /// <summary>
- /// Writes the logging event to the <see cref="System.Diagnostics.Debug"/> system.
- /// </summary>
- /// <param name="loggingEvent">The event to log.</param>
- /// <remarks>
- /// <para>
- /// Writes the logging event to the <see cref="System.Diagnostics.Debug"/> system.
- /// </para>
- /// </remarks>
-#else
/// <summary>
/// Writes the logging event to the <see cref="System.Diagnostics.Debug"/> system.
/// </summary>
@@ -163,19 +131,18 @@
/// is called.
/// </para>
/// </remarks>
-#endif
protected override void Append(LoggingEvent loggingEvent)
{
//
// Write the string to the Debug system
//
- if (m_category == null)
+ if (Category is null)
{
System.Diagnostics.Debug.Write(RenderLoggingEvent(loggingEvent));
}
else
{
- string category = m_category.Format(loggingEvent);
+ string category = Category.Format(loggingEvent);
if (string.IsNullOrEmpty(category))
{
System.Diagnostics.Debug.Write(RenderLoggingEvent(loggingEvent));
@@ -185,59 +152,18 @@
System.Diagnostics.Debug.Write(RenderLoggingEvent(loggingEvent), category);
}
}
-#if !NETSTANDARD1_3
//
// Flush the Debug system if needed
//
- if (m_immediateFlush)
+ if (ImmediateFlush)
{
System.Diagnostics.Debug.Flush();
}
-#endif
}
/// <summary>
/// This appender requires a <see cref="Layout"/> to be set.
/// </summary>
- /// <value><c>true</c></value>
- /// <remarks>
- /// <para>
- /// This appender requires a <see cref="Layout"/> to be set.
- /// </para>
- /// </remarks>
- protected override bool RequiresLayout
- {
- get { return true; }
- }
-
- #endregion Override implementation of AppenderSkeleton
-
- #region Private Instance Fields
-
-#if !NETSTANDARD1_3
- /// <summary>
- /// Immediate flush means that the underlying writer or output stream
- /// will be flushed at the end of each append operation.
- /// </summary>
- /// <remarks>
- /// <para>
- /// Immediate flush is slower but ensures that each append request is
- /// actually written. If <see cref="ImmediateFlush"/> is set to
- /// <c>false</c>, then there is a good chance that the last few
- /// logs events are not actually written to persistent media if and
- /// when the application crashes.
- /// </para>
- /// <para>
- /// The default value is <c>true</c>.</para>
- /// </remarks>
- private bool m_immediateFlush = true;
-#endif
-
- /// <summary>
- /// Defaults to a <see cref="Layout.PatternLayout"/> with %logger as the pattern.
- /// </summary>
- private PatternLayout m_category = new PatternLayout("%logger");
-
- #endregion Private Instance Fields
+ protected override bool RequiresLayout => true;
}
-}
+}
\ No newline at end of file
diff --git a/src/log4net/Appender/EventLogAppender.cs b/src/log4net/Appender/EventLogAppender.cs
index f87a7bc..41d99fc 100644
--- a/src/log4net/Appender/EventLogAppender.cs
+++ b/src/log4net/Appender/EventLogAppender.cs
@@ -17,18 +17,10 @@
//
#endregion
-// MONO 1.0 Beta mcs does not like #if !A && !B && !C syntax
-
// netstandard doesn't support EventLog
-#if NET_2_0
-// .NET Compact Framework 1.0 has no support for EventLog
-#if !NETCF
-// SSCLI 1.0 has no support for EventLog
-#if !SSCLI
-
+#if NET462_OR_GREATER
using System;
using System.Diagnostics;
-using System.Globalization;
using log4net.Util;
using log4net.Layout;
@@ -88,8 +80,6 @@
/// <author>Thomas Voss</author>
public class EventLogAppender : AppenderSkeleton
{
- #region Public Instance Constructors
-
/// <summary>
/// Initializes a new instance of the <see cref="EventLogAppender" /> class.
/// </summary>
@@ -100,9 +90,9 @@
/// </remarks>
public EventLogAppender()
{
- m_applicationName = System.Threading.Thread.GetDomain().FriendlyName;
- m_logName = "Application"; // Defaults to application log
- m_machineName = "."; // Only log on the local machine
+ ApplicationName = System.Threading.Thread.GetDomain().FriendlyName;
+ LogName = "Application"; // Defaults to application log
+ MachineName = "."; // Only log on the local machine
}
/// <summary>
@@ -121,10 +111,6 @@
Layout = layout;
}
- #endregion // Public Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
/// The name of the log where messages will be stored.
/// </summary>
@@ -143,11 +129,7 @@
/// used to group together events into a single log.
/// </para>
/// </remarks>
- public string LogName
- {
- get { return m_logName; }
- set { m_logName = value; }
- }
+ public string LogName { get; set; }
/// <summary>
/// Property used to set the Application name. This appears in the
@@ -159,11 +141,7 @@
/// <remarks>
/// Sets the event log source property.
/// </remarks>
- public string ApplicationName
- {
- get { return m_applicationName; }
- set { m_applicationName = value; }
- }
+ public string ApplicationName { get; set; }
/// <summary>
/// This property is used to return the name of the computer to use
@@ -178,11 +156,7 @@
/// This property cannot be changed. It is currently set to '.'
/// i.e. the local machine. This may be changed in future.
/// </remarks>
- public string MachineName
- {
- get { return m_machineName; }
- set { /* Currently we do not allow the machine name to be changed */; }
- }
+ public string MachineName { get; }
/// <summary>
/// Add a mapping of level to <see cref="EventLogEntryType"/> - done by the config file
@@ -216,11 +190,7 @@
/// of the current thread.
/// </para>
/// </remarks>
- public SecurityContext SecurityContext
- {
- get { return m_securityContext; }
- set { m_securityContext = value; }
- }
+ public SecurityContext? SecurityContext { get; set; }
/// <summary>
/// Gets or sets the <c>EventId</c> to use unless one is explicitly specified via the <c>LoggingEvent</c>'s properties.
@@ -256,9 +226,6 @@
get { return m_category; }
set { m_category = value; }
}
- #endregion // Public Instance Properties
-
- #region Implementation of IOptionHandler
/// <summary>
/// Initialize the appender based on the options set
@@ -282,63 +249,60 @@
{
base.ActivateOptions();
- if (m_securityContext == null)
- {
- m_securityContext = SecurityContextProvider.DefaultProvider.CreateSecurityContext(this);
- }
+ SecurityContext ??= SecurityContextProvider.DefaultProvider.CreateSecurityContext(this);
- bool sourceAlreadyExists = false;
- string currentLogName = null;
+ bool sourceAlreadyExists;
+ string? currentLogName = null;
using (SecurityContext.Impersonate(this))
{
- sourceAlreadyExists = EventLog.SourceExists(m_applicationName);
+ sourceAlreadyExists = EventLog.SourceExists(ApplicationName);
if (sourceAlreadyExists)
{
- currentLogName = EventLog.LogNameFromSourceName(m_applicationName, m_machineName);
+ currentLogName = EventLog.LogNameFromSourceName(ApplicationName, MachineName);
}
}
- if (sourceAlreadyExists && currentLogName != m_logName)
+ if (sourceAlreadyExists && currentLogName != LogName)
{
- LogLog.Debug(declaringType, "Changing event source [" + m_applicationName + "] from log [" + currentLogName + "] to log [" + m_logName + "]");
+ LogLog.Debug(declaringType, $"Changing event source [{ApplicationName}] from log [{currentLogName}] to log [{LogName}]");
}
else if (!sourceAlreadyExists)
{
- LogLog.Debug(declaringType, "Creating event source Source [" + m_applicationName + "] in log " + m_logName + "]");
+ LogLog.Debug(declaringType, $"Creating event source Source [{ApplicationName}] in log {LogName}]");
}
- string registeredLogName = null;
+ string? registeredLogName = null;
using (SecurityContext.Impersonate(this))
{
- if (sourceAlreadyExists && currentLogName != m_logName)
+ if (sourceAlreadyExists && currentLogName != LogName)
{
//
// Re-register this to the current application if the user has changed
// the application / logfile association
//
- EventLog.DeleteEventSource(m_applicationName, m_machineName);
- CreateEventSource(m_applicationName, m_logName, m_machineName);
+ EventLog.DeleteEventSource(ApplicationName, MachineName);
+ CreateEventSource(ApplicationName, LogName, MachineName);
- registeredLogName = EventLog.LogNameFromSourceName(m_applicationName, m_machineName);
+ registeredLogName = EventLog.LogNameFromSourceName(ApplicationName, MachineName);
}
else if (!sourceAlreadyExists)
{
- CreateEventSource(m_applicationName, m_logName, m_machineName);
+ CreateEventSource(ApplicationName, LogName, MachineName);
- registeredLogName = EventLog.LogNameFromSourceName(m_applicationName, m_machineName);
+ registeredLogName = EventLog.LogNameFromSourceName(ApplicationName, MachineName);
}
}
m_levelMapping.ActivateOptions();
- LogLog.Debug(declaringType, "Source [" + m_applicationName + "] is registered to log [" + registeredLogName + "]");
+ LogLog.Debug(declaringType, "Source [" + ApplicationName + "] is registered to log [" + registeredLogName + "]");
}
catch (System.Security.SecurityException ex)
{
ErrorHandler.Error("Caught a SecurityException trying to access the EventLog. Most likely the event source "
- + m_applicationName
+ + ApplicationName
+ " doesn't exist and must be created by a local administrator. Will disable EventLogAppender."
+ " See http://logging.apache.org/log4net/release/faq.html#trouble-EventLog",
ex);
@@ -346,27 +310,16 @@
}
}
- #endregion // Implementation of IOptionHandler
-
/// <summary>
/// Create an event log source
/// </summary>
- /// <remarks>
- /// Uses different API calls under NET_2_0
- /// </remarks>
private static void CreateEventSource(string source, string logName, string machineName)
{
-#if NET_2_0
EventSourceCreationData eventSourceCreationData = new EventSourceCreationData(source, logName);
eventSourceCreationData.MachineName = machineName;
EventLog.CreateEventSource(eventSourceCreationData);
-#else
- EventLog.CreateEventSource(source, logName, machineName);
-#endif
}
- #region Override implementation of AppenderSkeleton
-
/// <summary>
/// This method is called by the <see cref="M:AppenderSkeleton.DoAppend(LoggingEvent)"/>
/// method.
@@ -392,30 +345,28 @@
// Look for the EventID property
object eventIDPropertyObj = loggingEvent.LookupProperty("EventID");
- if (eventIDPropertyObj != null)
+ if (eventIDPropertyObj is not null)
{
- if (eventIDPropertyObj is int)
+ if (eventIDPropertyObj is int eventIdInt)
{
- eventID = (int)eventIDPropertyObj;
+ eventID = eventIdInt;
}
else
{
- string eventIDPropertyString = eventIDPropertyObj as string;
- if (eventIDPropertyString == null)
+ if (eventIDPropertyObj is not string eventIDPropertyString)
{
eventIDPropertyString = eventIDPropertyObj.ToString();
}
- if (eventIDPropertyString != null && eventIDPropertyString.Length > 0)
+ if (eventIDPropertyString.Length > 0)
{
// Read the string property into a number
- int intVal;
- if (SystemInfo.TryParse(eventIDPropertyString, out intVal))
+ if (SystemInfo.TryParse(eventIDPropertyString, out int intVal))
{
eventID = intVal;
}
else
{
- ErrorHandler.Error("Unable to parse event ID property [" + eventIDPropertyString + "].");
+ ErrorHandler.Error($"Unable to parse event ID property [{eventIDPropertyString}].");
}
}
}
@@ -423,31 +374,29 @@
short category = m_category;
// Look for the Category property
- object categoryPropertyObj = loggingEvent.LookupProperty("Category");
- if (categoryPropertyObj != null)
+ if (loggingEvent.LookupProperty("Category") is object categoryPropertyObj)
{
- if (categoryPropertyObj is short)
+ if (categoryPropertyObj is short shortValue)
{
- category = (short)categoryPropertyObj;
+ category = shortValue;
}
else
{
- string categoryPropertyString = categoryPropertyObj as string;
- if (categoryPropertyString == null)
+ if (categoryPropertyObj is not string categoryPropertyString)
{
categoryPropertyString = categoryPropertyObj.ToString();
}
- if (categoryPropertyString != null && categoryPropertyString.Length > 0)
+
+ if (categoryPropertyString.Length > 0)
{
// Read the string property into a number
- short shortVal;
- if (SystemInfo.TryParse(categoryPropertyString, out shortVal))
+ if (SystemInfo.TryParse(categoryPropertyString, out short shortVal))
{
category = shortVal;
}
else
{
- ErrorHandler.Error("Unable to parse event category property [" + categoryPropertyString + "].");
+ ErrorHandler.Error($"Unable to parse event category property [{categoryPropertyString}].");
}
}
}
@@ -466,14 +415,14 @@
EventLogEntryType entryType = GetEntryType(loggingEvent.Level);
- using (SecurityContext.Impersonate(this))
+ using (SecurityContext?.Impersonate(this))
{
- EventLog.WriteEntry(m_applicationName, eventTxt, entryType, eventID, category);
+ EventLog.WriteEntry(ApplicationName, eventTxt, entryType, eventID, category);
}
}
catch (Exception ex)
{
- ErrorHandler.Error("Unable to write to event log [" + m_logName + "] using source [" + m_applicationName + "]", ex);
+ ErrorHandler.Error($"Unable to write to event log [{LogName}] using source [{ApplicationName}]", ex);
}
}
@@ -481,19 +430,7 @@
/// This appender requires a <see cref="Layout"/> to be set.
/// </summary>
/// <value><c>true</c></value>
- /// <remarks>
- /// <para>
- /// This appender requires a <see cref="Layout"/> to be set.
- /// </para>
- /// </remarks>
- protected override bool RequiresLayout
- {
- get { return true; }
- }
-
- #endregion // Override implementation of AppenderSkeleton
-
- #region Protected Instance Methods
+ protected override bool RequiresLayout => true;
/// <summary>
/// Get the equivalent <see cref="EventLogEntryType"/> for a <see cref="Level"/> <paramref name="level"/>
@@ -506,22 +443,21 @@
/// <see cref="Level"/> this is a one way mapping. There is
/// a loss of information during the conversion.
/// </remarks>
- protected virtual EventLogEntryType GetEntryType(Level level)
+ public virtual EventLogEntryType GetEntryType(Level? level)
{
// see if there is a specified lookup.
- Level2EventLogEntryType entryType = m_levelMapping.Lookup(level) as Level2EventLogEntryType;
- if (entryType != null)
+ if (m_levelMapping.Lookup(level) is Level2EventLogEntryType entryType)
{
return entryType.EventLogEntryType;
}
// Use default behavior
-
if (level >= Level.Error)
{
return EventLogEntryType.Error;
}
- else if (level == Level.Warn)
+
+ if (level == Level.Warn)
{
return EventLogEntryType.Warning;
}
@@ -530,51 +466,20 @@
return EventLogEntryType.Information;
}
- #endregion // Protected Instance Methods
-
- #region Private Instance Fields
-
- /// <summary>
- /// The log name is the section in the event logs where the messages
- /// are stored.
- /// </summary>
- private string m_logName;
-
- /// <summary>
- /// Name of the application to use when logging. This appears in the
- /// application column of the event log named by <see cref="m_logName"/>.
- /// </summary>
- private string m_applicationName;
-
- /// <summary>
- /// The name of the machine which holds the event log. This is
- /// currently only allowed to be '.' i.e. the current machine.
- /// </summary>
- private string m_machineName;
-
/// <summary>
/// Mapping from level object to EventLogEntryType
/// </summary>
- private LevelMapping m_levelMapping = new LevelMapping();
-
- /// <summary>
- /// The security context to use for privileged calls
- /// </summary>
- private SecurityContext m_securityContext;
+ private readonly LevelMapping m_levelMapping = new();
/// <summary>
/// The event ID to use unless one is explicitly specified via the <c>LoggingEvent</c>'s properties.
/// </summary>
- private int m_eventId = 0;
+ private int m_eventId;
/// <summary>
/// The event category to use unless one is explicitly specified via the <c>LoggingEvent</c>'s properties.
/// </summary>
- private short m_category = 0;
-
- #endregion // Private Instance Fields
-
- #region Level2EventLogEntryType LevelMapping Entry
+ private short m_category;
/// <summary>
/// A class to act as a mapping between the level that a logging call is made at and
@@ -587,28 +492,12 @@
/// </remarks>
public class Level2EventLogEntryType : LevelMappingEntry
{
- private EventLogEntryType m_entryType;
-
/// <summary>
/// The <see cref="EventLogEntryType"/> for this entry
/// </summary>
- /// <remarks>
- /// <para>
- /// Required property.
- /// The <see cref="EventLogEntryType"/> for this entry
- /// </para>
- /// </remarks>
- public EventLogEntryType EventLogEntryType
- {
- get { return m_entryType; }
- set { m_entryType = value; }
- }
+ public EventLogEntryType EventLogEntryType { get; set; }
}
- #endregion // LevelColors LevelMapping Entry
-
- #region Private Static Fields
-
/// <summary>
/// The fully qualified type of the EventLogAppender class.
/// </summary>
@@ -682,14 +571,11 @@
private static int GetMaxEventLogMessageSize()
{
if (Environment.OSVersion.Platform == PlatformID.Win32NT && Environment.OSVersion.Version.Major >= 6)
+ {
return MAX_EVENTLOG_MESSAGE_SIZE_VISTA_OR_NEWER;
+ }
return MAX_EVENTLOG_MESSAGE_SIZE_DEFAULT;
}
-
- #endregion Private Static Fields
}
}
-
-#endif // !SSCLI
-#endif // !NETCF
-#endif // NET_2_0
+#endif // NET462_OR_GREATER
\ No newline at end of file
diff --git a/src/log4net/Appender/FileAppender.cs b/src/log4net/Appender/FileAppender.cs
index 14a3e35..802b1fc 100644
--- a/src/log4net/Appender/FileAppender.cs
+++ b/src/log4net/Appender/FileAppender.cs
@@ -21,21 +21,18 @@
using System;
using System.IO;
-#if !NETCF && !NETSTANDARD1_3
using System.Runtime.Serialization;
-#endif
using System.Text;
using System.Threading;
using log4net.Util;
using log4net.Layout;
using log4net.Core;
-#if NET_4_5 || NETSTANDARD
using System.Threading.Tasks;
-#endif
+
+#nullable enable
namespace log4net.Appender
{
-#if !NETCF
/// <summary>
/// Appends logging events to a file.
/// </summary>
@@ -72,7 +69,7 @@
/// is to obtain an exclusive write lock on the file until this appender is closed.
/// The alternative models only hold a
/// write lock while the appender is writing a logging event (<see cref="FileAppender.MinimalLock"/>)
- /// or synchronize by using a named system wide Mutex (<see cref="FileAppender.InterProcessLock"/>).
+ /// or synchronize by using a named system-wide Mutex (<see cref="FileAppender.InterProcessLock"/>).
/// </para>
/// <para>
/// All locking strategies have issues and you should seriously consider using a different strategy that
@@ -84,68 +81,15 @@
/// <author>Rodrigo B. de Oliveira</author>
/// <author>Douglas de la Torre</author>
/// <author>Niall Daley</author>
-#else
- /// <summary>
- /// Appends logging events to a file.
- /// </summary>
- /// <remarks>
- /// <para>
- /// Logging events are sent to the file specified by
- /// the <see cref="File"/> property.
- /// </para>
- /// <para>
- /// The file can be opened in either append or overwrite mode
- /// by specifying the <see cref="AppendToFile"/> property.
- /// If the file path is relative it is taken as relative from
- /// the application base directory. The file encoding can be
- /// specified by setting the <see cref="Encoding"/> property.
- /// </para>
- /// <para>
- /// The layout's <see cref="ILayout.Header"/> and <see cref="ILayout.Footer"/>
- /// values will be written each time the file is opened and closed
- /// respectively. If the <see cref="AppendToFile"/> property is <see langword="true"/>
- /// then the file may contain multiple copies of the header and footer.
- /// </para>
- /// <para>
- /// This appender will first try to open the file for writing when <see cref="ActivateOptions"/>
- /// is called. This will typically be during configuration.
- /// If the file cannot be opened for writing the appender will attempt
- /// to open the file again each time a message is logged to the appender.
- /// If the file cannot be opened for writing when a message is logged then
- /// the message will be discarded by this appender.
- /// </para>
- /// <para>
- /// The <see cref="FileAppender"/> supports pluggable file locking models via
- /// the <see cref="LockingModel"/> property.
- /// The default behavior, implemented by <see cref="FileAppender.ExclusiveLock"/>
- /// is to obtain an exclusive write lock on the file until this appender is closed.
- /// The alternative model only holds a
- /// write lock while the appender is writing a logging event (<see cref="FileAppender.MinimalLock"/>).
- /// </para>
- /// <para>
- /// All locking strategies have issues and you should seriously consider using a different strategy that
- /// avoids having multiple processes logging to the same file.
- /// </para>
- /// </remarks>
- /// <author>Nicko Cadell</author>
- /// <author>Gert Driesen</author>
- /// <author>Rodrigo B. de Oliveira</author>
- /// <author>Douglas de la Torre</author>
- /// <author>Niall Daley</author>
-#endif
public class FileAppender : TextWriterAppender
{
- #region LockingStream Inner Class
-
/// <summary>
/// Write only <see cref="Stream"/> that uses the <see cref="LockingModelBase"/>
/// to manage access to an underlying resource.
/// </summary>
private sealed class LockingStream : Stream, IDisposable
{
-#if !NETCR
[Serializable]
-#endif
public sealed class LockStateException : LogException
{
public LockStateException(string message)
@@ -161,146 +105,80 @@
{
}
-#if !NETCR && !NETSTANDARD1_3
private LockStateException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
-#endif
}
- private Stream m_realStream = null;
+ private Stream? m_realStream;
private readonly LockingModelBase m_lockingModel;
- private int m_lockLevel = 0;
+ private int m_lockLevel;
public LockingStream(LockingModelBase locking)
- : base()
{
- if (locking == null)
+ if (locking is null)
{
- throw new ArgumentException("Locking model may not be null", "locking");
+ throw new ArgumentNullException(nameof(locking));
}
m_lockingModel = locking;
}
- #region Override Implementation of Stream
-
-#if NETSTANDARD
protected override void Dispose(bool disposing)
{
m_lockingModel.CloseFile();
base.Dispose(disposing);
}
-#else
- private int m_readTotal = -1;
-
- // Methods
- public override IAsyncResult BeginRead(byte[] buffer,
- int offset,
- int count,
- AsyncCallback callback,
- object state)
- {
- AssertLocked();
- IAsyncResult ret = m_realStream.BeginRead(buffer, offset, count, callback, state);
- m_readTotal = EndRead(ret);
- return ret;
- }
-
- /// <summary>
- /// True asynchronous writes are not supported, the implementation forces a synchronous write.
- /// </summary>
- public override IAsyncResult BeginWrite(byte[] buffer,
- int offset,
- int count,
- AsyncCallback callback,
- object state)
- {
- AssertLocked();
- IAsyncResult ret = m_realStream.BeginWrite(buffer, offset, count, callback, state);
- EndWrite(ret);
- return ret;
- }
-
- public override void Close()
- {
- m_lockingModel.CloseFile();
- }
-
- public override int EndRead(IAsyncResult asyncResult)
- {
- AssertLocked();
- return m_readTotal;
- }
-
- public override void EndWrite(IAsyncResult asyncResult)
- {
- //No-op, it has already been handled
- }
-#endif
-
-#if NET_4_5 || NETSTANDARD
public override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
- AssertLocked();
- return m_realStream.ReadAsync(buffer, offset, count, cancellationToken);
+ return AssertLocked().ReadAsync(buffer, offset, count, cancellationToken);
}
public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
- AssertLocked();
+ AssertLocked();
return base.WriteAsync(buffer, offset, count, cancellationToken);
}
-#endif
public override void Flush()
{
- AssertLocked();
- m_realStream.Flush();
+ AssertLocked().Flush();
}
public override int Read(byte[] buffer, int offset, int count)
{
- return m_realStream.Read(buffer, offset, count);
+ return AssertLocked().Read(buffer, offset, count);
}
public override int ReadByte()
{
- return m_realStream.ReadByte();
+ return AssertLocked().ReadByte();
}
public override long Seek(long offset, SeekOrigin origin)
{
- AssertLocked();
- return m_realStream.Seek(offset, origin);
+ return AssertLocked().Seek(offset, origin);
}
public override void SetLength(long value)
{
- AssertLocked();
- m_realStream.SetLength(value);
+ AssertLocked().SetLength(value);
}
void IDisposable.Dispose()
{
-#if NETSTANDARD
Dispose(true);
-#else
- Close();
-#endif
}
public override void Write(byte[] buffer, int offset, int count)
{
- AssertLocked();
- m_realStream.Write(buffer, offset, count);
+ AssertLocked().Write(buffer, offset, count);
}
public override void WriteByte(byte value)
{
- AssertLocked();
- m_realStream.WriteByte(value);
+ AssertLocked().WriteByte(value);
}
// Properties
@@ -313,8 +191,7 @@
{
get
{
- AssertLocked();
- return m_realStream.CanSeek;
+ return AssertLocked().CanSeek;
}
}
@@ -322,8 +199,7 @@
{
get
{
- AssertLocked();
- return m_realStream.CanWrite;
+ return AssertLocked().CanWrite;
}
}
@@ -331,8 +207,7 @@
{
get
{
- AssertLocked();
- return m_realStream.Length;
+ return AssertLocked().Length;
}
}
@@ -340,26 +215,22 @@
{
get
{
- AssertLocked();
- return m_realStream.Position;
+ return AssertLocked().Position;
}
set
{
- AssertLocked();
- m_realStream.Position = value;
+ AssertLocked().Position = value;
}
}
- #endregion Override Implementation of Stream
-
- #region Locking Methods
-
- private void AssertLocked()
+ private Stream AssertLocked()
{
- if (m_realStream == null)
+ if (m_realStream is null)
{
throw new LockStateException("The file is not currently locked");
}
+
+ return m_realStream;
}
public bool AcquireLock()
@@ -373,7 +244,7 @@
m_realStream = m_lockingModel.AcquireLock();
}
- if (m_realStream != null)
+ if (m_realStream is not null)
{
m_lockLevel++;
ret = true;
@@ -396,14 +267,8 @@
}
}
}
-
- #endregion Locking Methods
}
- #endregion LockingStream Inner Class
-
- #region Locking Models
-
/// <summary>
/// Locking model base class
/// </summary>
@@ -414,8 +279,6 @@
/// </remarks>
public abstract class LockingModelBase
{
- private FileAppender m_appender = null;
-
/// <summary>
/// Open the output file
/// </summary>
@@ -455,23 +318,23 @@
/// <summary>
/// Acquire the lock on the file
/// </summary>
- /// <returns>A stream that is ready to be written to.</returns>
+ /// <returns>A stream that is ready to be written to, or null if there is no active stream because uninitialized or error.</returns>
/// <remarks>
/// <para>
- /// Acquire the lock on the file in preparation for writing to it.
- /// Return a stream pointing to the file. <see cref="ReleaseLock"/>
- /// must be called to release the lock on the output file.
+ /// Acquire the lock on the file in preparation for writing to it.
+ /// Returns a stream pointing to the file. <see cref="ReleaseLock"/>
+ /// must be called to release the lock on the output file when the return
+ /// value is not null.
/// </para>
/// </remarks>
- public abstract Stream AcquireLock();
+ public abstract Stream? AcquireLock();
/// <summary>
- /// Release the lock on the file
+ /// Releases the lock on the file
/// </summary>
/// <remarks>
/// <para>
- /// Release the lock on the file. No further writes will be made to the
- /// stream until <see cref="AcquireLock"/> is called again.
+ /// No further writes will be made to the stream until <see cref="AcquireLock"/> is called again.
/// </para>
/// </remarks>
public abstract void ReleaseLock();
@@ -495,11 +358,7 @@
/// called.
/// </para>
/// </remarks>
- public FileAppender CurrentAppender
- {
- get { return m_appender; }
- set { m_appender = value; }
- }
+ public FileAppender? CurrentAppender { get; set; }
/// <summary>
/// Helper method that creates a FileStream under CurrentAppender's SecurityContext.
@@ -510,7 +369,7 @@
/// </para>
/// <para>
/// If the directory portion of the <paramref name="filename"/> does not exist, it is created
- /// via Directory.CreateDirecctory.
+ /// via Directory.CreateDirectory.
/// </para>
/// </remarks>
/// <param name="filename"></param>
@@ -520,14 +379,14 @@
protected Stream CreateStream(string filename, bool append, FileShare fileShare)
{
filename = Environment.ExpandEnvironmentVariables(filename);
- using (CurrentAppender.SecurityContext.Impersonate(this))
+ using (CurrentAppender?.SecurityContext?.Impersonate(this))
{
// Ensure that the directory structure exists
- string directoryFullName = Path.GetDirectoryName(filename);
+ string? directoryFullName = Path.GetDirectoryName(filename);
// Only create the directory if it does not exist
// doing this check here resolves some permissions failures
- if (!Directory.Exists(directoryFullName))
+ if (directoryFullName is not null && !Directory.Exists(directoryFullName))
{
Directory.CreateDirectory(directoryFullName);
}
@@ -548,7 +407,7 @@
/// <param name="stream"></param>
protected void CloseStream(Stream stream)
{
- using (CurrentAppender.SecurityContext.Impersonate(this))
+ using (CurrentAppender?.SecurityContext?.Impersonate(this))
{
stream.Dispose();
}
@@ -566,7 +425,7 @@
/// </remarks>
public class ExclusiveLock : LockingModelBase
{
- private Stream m_stream = null;
+ private Stream? m_stream;
/// <summary>
/// Open the file specified and prepare for logging.
@@ -590,7 +449,7 @@
}
catch (Exception e1)
{
- CurrentAppender.ErrorHandler.Error("Unable to acquire lock on file " + filename + ". " +
+ CurrentAppender?.ErrorHandler.Error("Unable to acquire lock on file " + filename + ". " +
e1.Message);
}
}
@@ -605,8 +464,11 @@
/// </remarks>
public override void CloseFile()
{
- CloseStream(m_stream);
- m_stream = null;
+ if (m_stream is not null)
+ {
+ CloseStream(m_stream);
+ m_stream = null;
+ }
}
/// <summary>
@@ -618,9 +480,9 @@
/// Does nothing. The lock is already taken
/// </para>
/// </remarks>
- public override Stream AcquireLock()
+ public override Stream? AcquireLock()
{
- return m_stream;
+ return m_stream;
}
/// <summary>
@@ -666,9 +528,9 @@
/// </remarks>
public class MinimalLock : LockingModelBase
{
- private string m_filename;
+ private string? m_filename;
private bool m_append;
- private Stream m_stream = null;
+ private Stream? m_stream;
/// <summary>
/// Prepares to open the file when the first message is logged.
@@ -714,19 +576,26 @@
/// must be called to release the lock on the output file.
/// </para>
/// </remarks>
- public override Stream AcquireLock()
+ public override Stream? AcquireLock()
{
- if (m_stream == null)
+ if (m_stream is null)
{
- try
+ if (m_filename is not null)
{
- m_stream = CreateStream(m_filename, m_append, FileShare.Read);
- m_append = true;
+ try
+ {
+ m_stream = CreateStream(m_filename, m_append, FileShare.Read);
+ m_append = true;
+ }
+ catch (Exception e1)
+ {
+ CurrentAppender?.ErrorHandler.Error("Unable to acquire lock on file " + m_filename + ". " +
+ e1.Message);
+ }
}
- catch (Exception e1)
+ else
{
- CurrentAppender.ErrorHandler.Error("Unable to acquire lock on file " + m_filename + ". " +
- e1.Message);
+ CurrentAppender?.ErrorHandler.Error($"Unable to acquire lock because {nameof(OpenFile)} has not been called");
}
}
@@ -744,8 +613,11 @@
/// </remarks>
public override void ReleaseLock()
{
- CloseStream(m_stream);
- m_stream = null;
+ if (m_stream is not null)
+ {
+ CloseStream(m_stream);
+ m_stream = null;
+ }
}
/// <summary>
@@ -765,7 +637,6 @@
}
}
-#if !NETCF
/// <summary>
/// Provides cross-process file locking.
/// </summary>
@@ -773,9 +644,9 @@
/// <author>Steve Wranovsky</author>
public class InterProcessLock : LockingModelBase
{
- private Mutex m_mutex = null;
- private Stream m_stream = null;
- private int m_recursiveWatch = 0;
+ private Mutex? m_mutex;
+ private Stream? m_stream;
+ private int m_recursiveWatch;
/// <summary>
/// Open the file specified and prepare for logging.
@@ -791,9 +662,7 @@
/// -<see cref="ReleaseLock"/> and <see cref="CloseFile"/>.
/// </para>
/// </remarks>
-#if NET_4_0 || MONO_4_0 || NETSTANDARD
[System.Security.SecuritySafeCritical]
-#endif
public override void OpenFile(string filename, bool append, Encoding encoding)
{
try
@@ -802,7 +671,7 @@
}
catch (Exception e1)
{
- CurrentAppender.ErrorHandler.Error("Unable to acquire lock on file " + filename + ". " +
+ CurrentAppender?.ErrorHandler.Error("Unable to acquire lock on file " + filename + ". " +
e1.Message);
}
}
@@ -819,8 +688,11 @@
{
try
{
- CloseStream(m_stream);
- m_stream = null;
+ if (m_stream is not null)
+ {
+ CloseStream(m_stream);
+ m_stream = null;
+ }
}
finally
{
@@ -837,9 +709,9 @@
/// Does nothing. The lock is already taken
/// </para>
/// </remarks>
- public override Stream AcquireLock()
+ public override Stream? AcquireLock()
{
- if (m_mutex != null)
+ if (m_mutex is not null)
{
// TODO: add timeout?
m_mutex.WaitOne();
@@ -848,7 +720,7 @@
m_recursiveWatch++;
// should always be true (and fast) for FileStream
- if (m_stream != null)
+ if (m_stream is not null)
{
if (m_stream.CanSeek)
{
@@ -862,7 +734,7 @@
}
else
{
- CurrentAppender.ErrorHandler.Error(
+ CurrentAppender?.ErrorHandler.Error(
"Programming error, no mutex available to acquire lock! From here on things will be dangerous!");
}
@@ -874,7 +746,7 @@
/// </summary>
public override void ReleaseLock()
{
- if (m_mutex != null)
+ if (m_mutex is not null)
{
if (m_recursiveWatch > 0)
{
@@ -884,7 +756,7 @@
}
else
{
- CurrentAppender.ErrorHandler.Error("Programming error, no mutex available to release the lock!");
+ CurrentAppender?.ErrorHandler.Error("Programming error, no mutex available to release the lock!");
}
}
@@ -893,18 +765,28 @@
/// </summary>
public override void ActivateOptions()
{
- if (m_mutex == null)
+ if (m_mutex is null)
{
- string mutexFriendlyFilename = CurrentAppender.File
- .Replace("\\", "_")
- .Replace(":", "_")
- .Replace("/", "_");
+ if (CurrentAppender is not null)
+ {
+ if (CurrentAppender.File is not null)
+ {
+ string mutexFriendlyFilename = CurrentAppender.File
+ .Replace("\\", "_")
+ .Replace(":", "_")
+ .Replace("/", "_");
- m_mutex = new Mutex(false, mutexFriendlyFilename);
+ m_mutex = new Mutex(false, mutexFriendlyFilename);
+ }
+ else
+ {
+ CurrentAppender.ErrorHandler.Error($"Current appender has no file name, {nameof(OpenFile)} not called or it encountered an error");
+ }
+ }
}
else
{
- CurrentAppender.ErrorHandler.Error("Programming error, mutex already initialized!");
+ CurrentAppender?.ErrorHandler.Error("Programming error, mutex already initialized!");
}
}
@@ -913,22 +795,17 @@
/// </summary>
public override void OnClose()
{
- if (m_mutex != null)
+ if (m_mutex is not null)
{
-#if NET_4_0 || MONO_4_0 || NETSTANDARD
m_mutex.Dispose();
-#else
- m_mutex.Close();
-#endif
m_mutex = null;
}
else
{
- CurrentAppender.ErrorHandler.Error("Programming error, mutex not initialized!");
+ CurrentAppender?.ErrorHandler.Error("Programming error, mutex not initialized!");
}
}
}
-#endif
/// <summary>
/// Hold no lock on the output file
@@ -941,7 +818,7 @@
/// </remarks>
public class NoLock : LockingModelBase
{
- private Stream m_stream = null;
+ private Stream? m_stream;
/// <summary>
/// Open the file specified and prepare for logging.
@@ -966,7 +843,7 @@
}
catch (Exception e1)
{
- CurrentAppender.ErrorHandler.Error(
+ CurrentAppender?.ErrorHandler.Error(
$"Unable to acquire lock on file {filename}. {e1.Message}"
);
}
@@ -982,8 +859,11 @@
/// </remarks>
public override void CloseFile()
{
- CloseStream(m_stream);
- m_stream = null;
+ if (m_stream is not null)
+ {
+ CloseStream(m_stream);
+ m_stream = null;
+ }
}
/// <summary>
@@ -995,7 +875,7 @@
/// Does nothing. The lock is already taken
/// </para>
/// </remarks>
- public override Stream AcquireLock()
+ public override Stream? AcquireLock()
{
return m_stream;
}
@@ -1044,10 +924,6 @@
defaultLockingModelType = typeof(TLockingModel);
}
- #endregion Locking Models
-
- #region Public Instance Constructors
-
/// <summary>
/// Default constructor
/// </summary>
@@ -1097,10 +973,6 @@
{
}
- #endregion Public Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
/// Gets or sets the path to the file that logging will be written to.
/// </summary>
@@ -1113,7 +985,7 @@
/// the application base directory.
/// </para>
/// </remarks>
- public virtual string File
+ public virtual string? File
{
get { return m_fileName; }
set { m_fileName = value; }
@@ -1133,11 +1005,7 @@
/// </para>
/// The default value is true.
/// </remarks>
- public bool AppendToFile
- {
- get { return m_appendToFile; }
- set { m_appendToFile = value; }
- }
+ public bool AppendToFile { get; set; } = true;
/// <summary>
/// Gets or sets <see cref="Encoding"/> used to write to the file.
@@ -1151,11 +1019,7 @@
/// which is the encoding for the system's current ANSI code page.
/// </para>
/// </remarks>
- public Encoding Encoding
- {
- get { return m_encoding; }
- set { m_encoding = value; }
- }
+ public Encoding Encoding { get; set; } = Encoding.GetEncoding(0);
/// <summary>
/// Gets or sets the <see cref="SecurityContext"/> used to write to the file.
@@ -1171,34 +1035,8 @@
/// of the current thread.
/// </para>
/// </remarks>
- public SecurityContext SecurityContext
- {
- get { return m_securityContext; }
- set { m_securityContext = value; }
- }
+ public SecurityContext? SecurityContext { get; set; }
-#if NETCF
- /// <summary>
- /// Gets or sets the <see cref="FileAppender.LockingModel"/> used to handle locking of the file.
- /// </summary>
- /// <value>
- /// The <see cref="FileAppender.LockingModel"/> used to lock the file.
- /// </value>
- /// <remarks>
- /// <para>
- /// Gets or sets the <see cref="FileAppender.LockingModel"/> used to handle locking of the file.
- /// </para>
- /// <para>
- /// There are two built in locking models, <see cref="FileAppender.ExclusiveLock"/> and <see cref="FileAppender.MinimalLock"/>.
- /// The first locks the file from the start of logging to the end, the
- /// second locks only for the minimal amount of time when logging each message
- /// and the last synchronizes processes using a named system wide Mutex.
- /// </para>
- /// <para>
- /// The default locking model is the <see cref="FileAppender.ExclusiveLock"/>.
- /// </para>
- /// </remarks>
-#else
/// <summary>
/// Gets or sets the <see cref="FileAppender.LockingModel"/> used to handle locking of the file.
/// </summary>
@@ -1213,22 +1051,13 @@
/// There are three built in locking models, <see cref="FileAppender.ExclusiveLock"/>, <see cref="FileAppender.MinimalLock"/> and <see cref="FileAppender.InterProcessLock"/> .
/// The first locks the file from the start of logging to the end, the
/// second locks only for the minimal amount of time when logging each message
- /// and the last synchronizes processes using a named system wide Mutex.
+ /// and the last synchronizes processes using a named system-wide Mutex.
/// </para>
/// <para>
/// The default locking model is the <see cref="FileAppender.ExclusiveLock"/>.
/// </para>
/// </remarks>
-#endif
- public FileAppender.LockingModelBase LockingModel
- {
- get { return m_lockingModel; }
- set { m_lockingModel = value; }
- }
-
- #endregion Public Instance Properties
-
- #region Override implementation of AppenderSkeleton
+ public LockingModelBase LockingModel { get; set; } = (LockingModelBase)Activator.CreateInstance(defaultLockingModelType);
/// <summary>
/// Activate the options on the file appender.
@@ -1253,27 +1082,19 @@
{
base.ActivateOptions();
- if (m_securityContext == null)
- {
- m_securityContext = SecurityContextProvider.DefaultProvider.CreateSecurityContext(this);
- }
+ SecurityContext ??= SecurityContextProvider.DefaultProvider.CreateSecurityContext(this);
- if (m_lockingModel == null)
- {
- m_lockingModel = (LockingModelBase)Activator.CreateInstance(defaultLockingModelType);
- }
+ LockingModel.CurrentAppender = this;
+ LockingModel.ActivateOptions();
- m_lockingModel.CurrentAppender = this;
- m_lockingModel.ActivateOptions();
-
- if (m_fileName != null)
+ if (m_fileName is not null)
{
using (SecurityContext.Impersonate(this))
{
m_fileName = ConvertToFullPath(m_fileName.Trim());
}
- SafeOpenFile(m_fileName, m_appendToFile);
+ SafeOpenFile(m_fileName, AppendToFile);
}
else
{
@@ -1282,10 +1103,6 @@
}
}
- #endregion Override implementation of AppenderSkeleton
-
- #region Override implementation of TextWriterAppender
-
/// <summary>
/// Closes any previously opened file and calls the parent's <see cref="TextWriterAppender.Reset"/>.
/// </summary>
@@ -1306,7 +1123,7 @@
protected override void OnClose()
{
base.OnClose();
- m_lockingModel?.OnClose();
+ LockingModel.OnClose();
}
/// <summary>
@@ -1320,7 +1137,10 @@
/// </remarks>
protected override void PrepareWriter()
{
- SafeOpenFile(m_fileName, m_appendToFile);
+ if (m_fileName is not null)
+ {
+ SafeOpenFile(m_fileName, AppendToFile);
+ }
}
/// <summary>
@@ -1339,7 +1159,7 @@
/// </remarks>
protected override void Append(LoggingEvent loggingEvent)
{
- if (m_stream.AcquireLock())
+ if (m_stream is not null && m_stream.AcquireLock())
{
try
{
@@ -1365,7 +1185,7 @@
/// </remarks>
protected override void Append(LoggingEvent[] loggingEvents)
{
- if (m_stream.AcquireLock())
+ if (m_stream is not null && m_stream.AcquireLock())
{
try
{
@@ -1388,7 +1208,7 @@
/// </remarks>
protected override void WriteFooter()
{
- if (m_stream != null)
+ if (m_stream is not null)
{
//WriteFooter can be called even before a file is opened
m_stream.AcquireLock();
@@ -1413,7 +1233,7 @@
/// </remarks>
protected override void WriteHeader()
{
- if (m_stream != null)
+ if (m_stream is not null)
{
if (m_stream.AcquireLock())
{
@@ -1439,7 +1259,7 @@
/// </remarks>
protected override void CloseWriter()
{
- if (m_stream != null)
+ if (m_stream is not null)
{
m_stream.AcquireLock();
try
@@ -1453,10 +1273,6 @@
}
}
- #endregion Override implementation of TextWriterAppender
-
- #region Public Instance Methods
-
/// <summary>
/// Closes the previously opened file.
/// </summary>
@@ -1471,10 +1287,6 @@
WriteFooterAndCloseWriter();
}
- #endregion Public Instance Methods
-
- #region Protected Instance Methods
-
/// <summary>
/// Sets and <i>opens</i> the file where the log output will go. The specified file must be writable.
/// </summary>
@@ -1494,8 +1306,7 @@
}
catch (Exception e)
{
- ErrorHandler.Error("OpenFile(" + fileName + "," + append + ") call failed.", e,
- ErrorCode.FileOpenFailure);
+ ErrorHandler.Error($"OpenFile({fileName},{append}) call failed.", e, ErrorCode.FileOpenFailure);
}
}
@@ -1519,8 +1330,8 @@
if (LogLog.IsErrorEnabled)
{
// Internal check that the fileName passed in is a rooted path
- bool isPathRooted = false;
- using (SecurityContext.Impersonate(this))
+ bool isPathRooted;
+ using (SecurityContext?.Impersonate(this))
{
isPathRooted = Path.IsPathRooted(fileName);
}
@@ -1540,13 +1351,13 @@
// Save these for later, allowing retries if file open fails
m_fileName = fileName;
- m_appendToFile = append;
+ AppendToFile = append;
LockingModel.CurrentAppender = this;
- LockingModel.OpenFile(fileName, append, m_encoding);
+ LockingModel.OpenFile(fileName, append, Encoding);
m_stream = new LockingStream(LockingModel);
- if (m_stream != null)
+ if (m_stream is not null)
{
m_stream.AcquireLock();
try
@@ -1574,7 +1385,7 @@
/// <see cref="M:SetQWForFiles(TextWriter)"/> method.
/// </para>
/// <para>
- /// This method can be overridden by sub classes that want to wrap the
+ /// This method can be overridden by subclasses that want to wrap the
/// <see cref="Stream"/> in some way, for example to encrypt the output
/// data using a <c>System.Security.Cryptography.CryptoStream</c>.
/// </para>
@@ -1582,7 +1393,7 @@
protected virtual void SetQWForFiles(Stream fileStream)
{
#pragma warning disable CA2000 // Dispose objects before losing scope
- StreamWriter writer = new StreamWriter(fileStream, m_encoding);
+ StreamWriter writer = new(fileStream, Encoding);
#pragma warning restore CA2000 // Dispose objects before losing scope
SetQWForFiles(writer);
}
@@ -1593,7 +1404,7 @@
/// <param name="writer">the writer over the file stream that has been opened for writing</param>
/// <remarks>
/// <para>
- /// This method can be overridden by sub classes that want to
+ /// This method can be overridden by subclasses that want to
/// wrap the <see cref="TextWriter"/> in some way.
/// </para>
/// </remarks>
@@ -1602,10 +1413,6 @@
QuietWriter = new QuietTextWriter(writer, ErrorHandler);
}
- #endregion Protected Instance Methods
-
- #region Protected Static Methods
-
/// <summary>
/// Convert a path into a fully qualified path.
/// </summary>
@@ -1624,44 +1431,15 @@
return SystemInfo.ConvertToFullPath(path);
}
- #endregion Protected Static Methods
-
- #region Private Instance Fields
-
- /// <summary>
- /// Flag to indicate if we should append to the file
- /// or overwrite the file. The default is to append.
- /// </summary>
- private bool m_appendToFile = true;
-
/// <summary>
/// The name of the log file.
/// </summary>
- private string m_fileName = null;
-
- /// <summary>
- /// The encoding to use for the file stream.
- /// </summary>
- private Encoding m_encoding = Encoding.GetEncoding(0);
-
- /// <summary>
- /// The security context to use for privileged calls
- /// </summary>
- private SecurityContext m_securityContext;
+ private string? m_fileName;
/// <summary>
/// The stream to log to. Has added locking semantics
/// </summary>
- private FileAppender.LockingStream m_stream = null;
-
- /// <summary>
- /// The locking model to use
- /// </summary>
- private FileAppender.LockingModelBase m_lockingModel;
-
- #endregion Private Instance Fields
-
- #region Private Static Fields
+ private LockingStream? m_stream;
/// <summary>
/// The fully qualified type of the FileAppender class.
@@ -1671,7 +1449,5 @@
/// log message.
/// </remarks>
private static readonly Type declaringType = typeof(FileAppender);
-
- #endregion Private Static Fields
}
}
\ No newline at end of file
diff --git a/src/log4net/Appender/ForwardingAppender.cs b/src/log4net/Appender/ForwardingAppender.cs
index 57d2907..6868871 100644
--- a/src/log4net/Appender/ForwardingAppender.cs
+++ b/src/log4net/Appender/ForwardingAppender.cs
@@ -20,7 +20,6 @@
using System;
using log4net.Util;
-using log4net.Layout;
using log4net.Core;
namespace log4net.Appender
@@ -38,24 +37,6 @@
/// <author>Gert Driesen</author>
public class ForwardingAppender : AppenderSkeleton, IAppenderAttachable
{
- #region Public Instance Constructors
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ForwardingAppender" /> class.
- /// </summary>
- /// <remarks>
- /// <para>
- /// Default constructor.
- /// </para>
- /// </remarks>
- public ForwardingAppender()
- {
- }
-
- #endregion Public Instance Constructors
-
- #region Override implementation of AppenderSkeleton
-
/// <summary>
/// Closes the appender and releases resources.
/// </summary>
@@ -73,10 +54,7 @@
// Remove all the attached appenders
lock (this)
{
- if (m_appenderAttachedImpl != null)
- {
- m_appenderAttachedImpl.RemoveAllAppenders();
- }
+ m_appenderAttachedImpl?.RemoveAllAppenders();
}
}
@@ -91,11 +69,8 @@
/// </remarks>
protected override void Append(LoggingEvent loggingEvent)
{
- // Pass the logging event on the the attached appenders
- if (m_appenderAttachedImpl != null)
- {
- m_appenderAttachedImpl.AppendLoopOnAppenders(loggingEvent);
- }
+ // Pass the logging event on to the attached appenders
+ m_appenderAttachedImpl?.AppendLoopOnAppenders(loggingEvent);
}
/// <summary>
@@ -109,17 +84,10 @@
/// </remarks>
protected override void Append(LoggingEvent[] loggingEvents)
{
- // Pass the logging event on the the attached appenders
- if (m_appenderAttachedImpl != null)
- {
- m_appenderAttachedImpl.AppendLoopOnAppenders(loggingEvents);
- }
+ // Pass the logging event on to the attached appenders
+ m_appenderAttachedImpl?.AppendLoopOnAppenders(loggingEvents);
}
- #endregion Override implementation of AppenderSkeleton
-
- #region Implementation of IAppenderAttachable
-
/// <summary>
/// Adds an <see cref="IAppender" /> to the list of appenders of this
/// instance.
@@ -133,16 +101,13 @@
/// </remarks>
public virtual void AddAppender(IAppender newAppender)
{
- if (newAppender == null)
+ if (newAppender is null)
{
- throw new ArgumentNullException("newAppender");
+ throw new ArgumentNullException(nameof(newAppender));
}
lock (this)
{
- if (m_appenderAttachedImpl == null)
- {
- m_appenderAttachedImpl = new log4net.Util.AppenderAttachedImpl();
- }
+ m_appenderAttachedImpl ??= new AppenderAttachedImpl();
m_appenderAttachedImpl.AddAppender(newAppender);
}
}
@@ -164,14 +129,7 @@
{
lock (this)
{
- if (m_appenderAttachedImpl == null)
- {
- return AppenderCollection.EmptyCollection;
- }
- else
- {
- return m_appenderAttachedImpl.Appenders;
- }
+ return m_appenderAttachedImpl?.Appenders ?? AppenderCollection.EmptyCollection;
}
}
}
@@ -188,11 +146,11 @@
/// Get the named appender attached to this appender.
/// </para>
/// </remarks>
- public virtual IAppender GetAppender(string name)
+ public virtual IAppender? GetAppender(string? name)
{
lock (this)
{
- if (m_appenderAttachedImpl == null || name == null)
+ if (m_appenderAttachedImpl is null || name is null)
{
return null;
}
@@ -213,7 +171,7 @@
{
lock (this)
{
- if (m_appenderAttachedImpl != null)
+ if (m_appenderAttachedImpl is not null)
{
m_appenderAttachedImpl.RemoveAllAppenders();
m_appenderAttachedImpl = null;
@@ -231,11 +189,11 @@
/// If you are discarding the appender you must call
/// <see cref="IAppender.Close"/> on the appender removed.
/// </remarks>
- public virtual IAppender RemoveAppender(IAppender appender)
+ public virtual IAppender? RemoveAppender(IAppender? appender)
{
lock (this)
{
- if (appender != null && m_appenderAttachedImpl != null)
+ if (appender is not null && m_appenderAttachedImpl is not null)
{
return m_appenderAttachedImpl.RemoveAppender(appender);
}
@@ -253,11 +211,11 @@
/// If you are discarding the appender you must call
/// <see cref="IAppender.Close"/> on the appender removed.
/// </remarks>
- public virtual IAppender RemoveAppender(string name)
+ public virtual IAppender? RemoveAppender(string? name)
{
lock (this)
{
- if (name != null && m_appenderAttachedImpl != null)
+ if (name is not null && m_appenderAttachedImpl is not null)
{
return m_appenderAttachedImpl.RemoveAppender(name);
}
@@ -265,15 +223,9 @@
return null;
}
- #endregion Implementation of IAppenderAttachable
-
- #region Private Instance Fields
-
/// <summary>
/// Implementation of the <see cref="IAppenderAttachable"/> interface
/// </summary>
- private AppenderAttachedImpl m_appenderAttachedImpl;
-
- #endregion Private Instance Fields
+ private AppenderAttachedImpl? m_appenderAttachedImpl;
}
}
diff --git a/src/log4net/Appender/IFlushable.cs b/src/log4net/Appender/IFlushable.cs
index 65c7bbf..661a2d9 100644
--- a/src/log4net/Appender/IFlushable.cs
+++ b/src/log4net/Appender/IFlushable.cs
@@ -49,11 +49,11 @@
/// </para>
/// <para>
/// The <paramref name="millisecondsTimeout"/> parameter is only relevant for appenders that process logging events asynchronously,
- /// such as <see cref="RemotingAppender"/>.
+ /// such as RemotingAppender.
/// </para>
/// </remarks>
/// <param name="millisecondsTimeout">The maximum time to wait for logging events to be flushed.</param>
/// <returns><c>True</c> if all logging events were flushed successfully, else <c>false</c>.</returns>
bool Flush(int millisecondsTimeout);
}
-}
+}
\ No newline at end of file
diff --git a/src/log4net/Appender/LocalSyslogAppender.cs b/src/log4net/Appender/LocalSyslogAppender.cs
index 549d2ee..57ef375 100644
--- a/src/log4net/Appender/LocalSyslogAppender.cs
+++ b/src/log4net/Appender/LocalSyslogAppender.cs
@@ -17,17 +17,13 @@
//
#endregion
-// .NET Compact Framework 1.0 has no support for Marshal.StringToHGlobalAnsi
-// SSCLI 1.0 has no support for Marshal.StringToHGlobalAnsi
-#if !NETCF && !SSCLI
-
using System;
using System.Runtime.InteropServices;
using log4net.Core;
using log4net.Util;
-namespace log4net.Appender
+namespace log4net.Appender
{
/// <summary>
/// Logs events to a local syslog service.
@@ -62,10 +58,8 @@
/// </remarks>
/// <author>Rob Lyon</author>
/// <author>Nicko Cadell</author>
- public class LocalSyslogAppender : AppenderSkeleton
+ public class LocalSyslogAppender : AppenderSkeleton
{
- #region Enumerations
-
/// <summary>
/// syslog severities
/// </summary>
@@ -251,41 +245,18 @@
Local7 = 23
}
- #endregion // Enumerations
-
- #region Public Instance Constructors
-
- /// <summary>
- /// Initializes a new instance of the <see cref="LocalSyslogAppender" /> class.
- /// </summary>
- /// <remarks>
- /// This instance of the <see cref="LocalSyslogAppender" /> class is set up to write
- /// to a local syslog service.
- /// </remarks>
- public LocalSyslogAppender()
- {
- }
-
- #endregion // Public Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
/// Message identity
/// </summary>
/// <remarks>
/// <para>
/// An identifier is specified with each log message. This can be specified
- /// by setting the <see cref="Identity"/> property. The identity (also know
+ /// by setting the <see cref="Identity"/> property. The identity (also known
/// as the tag) must not contain white space. The default value for the
/// identity is the application name (from <see cref="SystemInfo.ApplicationFriendlyName"/>).
/// </para>
/// </remarks>
- public string Identity
- {
- get { return m_identity; }
- set { m_identity = value; }
- }
+ public string? Identity { get; set; }
/// <summary>
/// Syslog facility
@@ -295,13 +266,7 @@
/// facilities is predefined and cannot be extended. The default value
/// is <see cref="SyslogFacility.User"/>.
/// </remarks>
- public SyslogFacility Facility
- {
- get { return m_facility; }
- set { m_facility = value; }
- }
-
- #endregion // Public Instance Properties
+ public SyslogFacility Facility { get; set; } = SyslogFacility.User;
/// <summary>
/// Add a mapping of level to severity
@@ -317,8 +282,6 @@
m_levelMapping.Add(mapping);
}
- #region IOptionHandler Implementation
-
/// <summary>
/// Initialize the appender based on the options set.
/// </summary>
@@ -335,21 +298,15 @@
/// <see cref="ActivateOptions"/> must be called again.
/// </para>
/// </remarks>
-#if NET_4_0 || MONO_4_0 || NETSTANDARD
[System.Security.SecuritySafeCritical]
-#endif
public override void ActivateOptions()
{
base.ActivateOptions();
-
+
m_levelMapping.ActivateOptions();
- string identString = m_identity;
- if (identString == null)
- {
- // Set to app name by default
- identString = SystemInfo.ApplicationFriendlyName;
- }
+ // Set to app name by default
+ string? identString = Identity ?? SystemInfo.ApplicationFriendlyName;
// create the native heap ansi string. Note this is a copy of our string
// so we do not need to hold on to the string itself, holding on to the
@@ -357,13 +314,9 @@
m_handleToIdentity = Marshal.StringToHGlobalAnsi(identString);
// open syslog
- openlog(m_handleToIdentity, 1, m_facility);
+ openlog(m_handleToIdentity, 1, Facility);
}
- #endregion // IOptionHandler Implementation
-
- #region AppenderSkeleton Implementation
-
/// <summary>
/// This method is called by the <see cref="M:AppenderSkeleton.DoAppend(LoggingEvent)"/> method.
/// </summary>
@@ -376,15 +329,11 @@
/// The format of the output will depend on the appender's layout.
/// </para>
/// </remarks>
-#if NET_4_0 || MONO_4_0 || NETSTANDARD
[System.Security.SecuritySafeCritical]
-#endif
-#if !NETSTANDARD1_3
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, UnmanagedCode = true)]
-#endif
- protected override void Append(LoggingEvent loggingEvent)
+ protected override void Append(LoggingEvent loggingEvent)
{
- int priority = GeneratePriority(m_facility, GetSeverity(loggingEvent.Level));
+ int priority = GeneratePriority(Facility, GetSeverity(loggingEvent.Level));
string message = RenderLoggingEvent(loggingEvent);
// Call the local libc syslog method
@@ -400,9 +349,7 @@
/// Close the syslog when the appender is closed
/// </para>
/// </remarks>
-#if NET_4_0 || MONO_4_0 || NETSTANDARD
[System.Security.SecuritySafeCritical]
-#endif
protected override void OnClose()
{
base.OnClose();
@@ -416,7 +363,7 @@
{
// Ignore dll not found at this point
}
-
+
if (m_handleToIdentity != IntPtr.Zero)
{
// free global ident
@@ -427,75 +374,52 @@
/// <summary>
/// This appender requires a <see cref="AppenderSkeleton.Layout"/> to be set.
/// </summary>
- /// <value><c>true</c></value>
- /// <remarks>
- /// <para>
- /// This appender requires a <see cref="AppenderSkeleton.Layout"/> to be set.
- /// </para>
- /// </remarks>
- protected override bool RequiresLayout
- {
- get { return true; }
- }
-
- #endregion // AppenderSkeleton Implementation
-
- #region Protected Members
+ protected override bool RequiresLayout => true;
/// <summary>
/// Translates a log4net level to a syslog severity.
/// </summary>
/// <param name="level">A log4net level.</param>
/// <returns>A syslog severity.</returns>
- /// <remarks>
- /// <para>
- /// Translates a log4net level to a syslog severity.
- /// </para>
- /// </remarks>
- protected virtual SyslogSeverity GetSeverity(Level level)
+ protected virtual SyslogSeverity GetSeverity(Level? level)
{
- LevelSeverity levelSeverity = m_levelMapping.Lookup(level) as LevelSeverity;
- if (levelSeverity != null)
+ if (m_levelMapping.Lookup(level) is LevelSeverity levelSeverity)
{
return levelSeverity.Severity;
}
//
- // Fallback to sensible default values
+ // Fall back to sensible default values
//
- if (level >= Level.Alert)
+ if (level >= Level.Alert)
{
return SyslogSeverity.Alert;
- }
- else if (level >= Level.Critical)
+ }
+ else if (level >= Level.Critical)
{
return SyslogSeverity.Critical;
- }
- else if (level >= Level.Error)
+ }
+ else if (level >= Level.Error)
{
return SyslogSeverity.Error;
- }
- else if (level >= Level.Warn)
+ }
+ else if (level >= Level.Warn)
{
return SyslogSeverity.Warning;
- }
- else if (level >= Level.Notice)
+ }
+ else if (level >= Level.Notice)
{
return SyslogSeverity.Notice;
- }
- else if (level >= Level.Info)
+ }
+ else if (level >= Level.Info)
{
return SyslogSeverity.Informational;
- }
+ }
// Default setting
return SyslogSeverity.Debug;
}
- #endregion // Protected Members
-
- #region Public Static Members
-
/// <summary>
/// Generate a syslog priority.
/// </summary>
@@ -507,20 +431,6 @@
return ((int)facility * 8) + (int)severity;
}
- #endregion // Public Static Members
-
- #region Private Instances Fields
-
- /// <summary>
- /// The facility. The default facility is <see cref="SyslogFacility.User"/>.
- /// </summary>
- private SyslogFacility m_facility = SyslogFacility.User;
-
- /// <summary>
- /// The message identity
- /// </summary>
- private string m_identity;
-
/// <summary>
/// Marshaled handle to the identity string. We have to hold on to the
/// string as the <c>openlog</c> and <c>syslog</c> APIs just hold the
@@ -531,12 +441,8 @@
/// <summary>
/// Mapping from level object to syslog severity
/// </summary>
- private LevelMapping m_levelMapping = new LevelMapping();
-
- #endregion // Private Instances Fields
-
- #region External Members
-
+ private readonly LevelMapping m_levelMapping = new();
+
/// <summary>
/// Open connection to system logger.
/// </summary>
@@ -555,7 +461,7 @@
/// string to <c>"%s"</c>.
/// </para>
/// </remarks>
- [DllImport("libc", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
+ [DllImport("libc", CharSet=CharSet.Ansi, CallingConvention=CallingConvention.Cdecl)]
private static extern void syslog(int priority, string format, string message);
/// <summary>
@@ -564,42 +470,16 @@
[DllImport("libc")]
private static extern void closelog();
- #endregion // External Members
-
- #region LevelSeverity LevelMapping Entry
-
/// <summary>
/// A class to act as a mapping between the level that a logging call is made at and
/// the syslog severity that is should be logged at.
/// </summary>
- /// <remarks>
- /// <para>
- /// A class to act as a mapping between the level that a logging call is made at and
- /// the syslog severity that is should be logged at.
- /// </para>
- /// </remarks>
public class LevelSeverity : LevelMappingEntry
{
- private SyslogSeverity m_severity;
-
/// <summary>
/// The mapped syslog severity for the specified level
/// </summary>
- /// <remarks>
- /// <para>
- /// Required property.
- /// The mapped syslog severity for the specified level
- /// </para>
- /// </remarks>
- public SyslogSeverity Severity
- {
- get { return m_severity; }
- set { m_severity = value; }
- }
+ public SyslogSeverity Severity { get; set; }
}
-
- #endregion // LevelSeverity LevelMapping Entry
}
-}
-
-#endif
+}
\ No newline at end of file
diff --git a/src/log4net/Appender/ManagedColoredConsoleAppender.cs b/src/log4net/Appender/ManagedColoredConsoleAppender.cs
index 263ce17..79ba07b 100644
--- a/src/log4net/Appender/ManagedColoredConsoleAppender.cs
+++ b/src/log4net/Appender/ManagedColoredConsoleAppender.cs
@@ -1,10 +1,10 @@
-#region Apache License
+#region Apache License
//
-// Licensed to the Apache Software Foundation (ASF) under one or more
+// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
+// this work for additional information regarding copyright ownership.
// The ASF licenses this file to you under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
+// (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
@@ -18,20 +18,13 @@
#endregion
// Compatibility:
-// http://msdn.microsoft.com/en-us/library/system.console.foregroundcolor.aspx
-// Disable for unsupported targets
-#if !NETCF
-#if !SSCLI
-#if !CLI_1_0
-#if !MONO_1_0
-#if !NET_1_0
-#if !NET_1_1
+// http://msdn.microsoft.com/en-us/library/system.console.foregroundcolor.aspx
// The original ColoredConsoleAppender was written before the .NET framework
// (and Mono) had built-in support for console colors so it was written using
// Win32 API calls. The AnsiColorTerminalAppender, while it works, isn't
// understood by the Windows command prompt.
-// This is a replacement for both that uses the new (.NET 2) Console colors
+// This is a replacement for both that uses the new Console colors
// and works on both platforms.
// On Mono/Linux (at least), setting the background color to 'Black' is
@@ -41,21 +34,22 @@
// default color is treated as transparent while 'Black' isn't.
// For this reason, we always reset the colors and only set those
// explicitly specified in the configuration (Console.BackgroundColor
-// isn't set if ommited).
+// isn't set if omitted).
using System;
+using System.IO;
+using log4net.Core;
using log4net.Util;
namespace log4net.Appender
{
/// <summary>
- /// Appends colorful logging events to the console, using the .NET 2
- /// built-in capabilities.
+ /// Appends colorful logging events to the console, using .NET built-in capabilities.
/// </summary>
/// <remarks>
/// <para>
/// ManagedColoredConsoleAppender appends log events to the standard output stream
- /// or the error output stream using a layout specified by the
+ /// or the error output stream using a layout specified by the
/// user. It also allows the color of a specific type of message to be set.
/// </para>
/// <para>
@@ -68,23 +62,23 @@
/// specified to map logging levels to colors. For example:
/// </para>
/// <code lang="XML" escaped="true">
- /// <mapping>
- /// <level value="ERROR" />
- /// <foreColor value="DarkRed" />
- /// <backColor value="White" />
- /// </mapping>
- /// <mapping>
- /// <level value="WARN" />
- /// <foreColor value="Yellow" />
- /// </mapping>
- /// <mapping>
- /// <level value="INFO" />
- /// <foreColor value="White" />
- /// </mapping>
- /// <mapping>
- /// <level value="DEBUG" />
- /// <foreColor value="Blue" />
- /// </mapping>
+ /// <mapping>
+ /// <level value="ERROR" />
+ /// <foreColor value="DarkRed" />
+ /// <backColor value="White" />
+ /// </mapping>
+ /// <mapping>
+ /// <level value="WARN" />
+ /// <foreColor value="Yellow" />
+ /// </mapping>
+ /// <mapping>
+ /// <level value="INFO" />
+ /// <foreColor value="White" />
+ /// </mapping>
+ /// <mapping>
+ /// <level value="DEBUG" />
+ /// <foreColor value="Blue" />
+ /// </mapping>
/// </code>
/// <para>
/// The Level is the standard log4net logging level while
@@ -101,47 +95,13 @@
public class ManagedColoredConsoleAppender : AppenderSkeleton
{
/// <summary>
- /// Initializes a new instance of the <see cref="ManagedColoredConsoleAppender" /> class.
- /// </summary>
- /// <remarks>
- /// The instance of the <see cref="ManagedColoredConsoleAppender" /> class is set up to write
- /// to the standard output stream.
- /// </remarks>
- public ManagedColoredConsoleAppender()
- {
- }
-
- #region Public Instance Properties
- /// <summary>
- /// Target is the value of the console output stream.
+ /// Gets or sets the console output stream.
/// This is either <c>"Console.Out"</c> or <c>"Console.Error"</c>.
/// </summary>
- /// <value>
- /// Target is the value of the console output stream.
- /// This is either <c>"Console.Out"</c> or <c>"Console.Error"</c>.
- /// </value>
- /// <remarks>
- /// <para>
- /// Target is the value of the console output stream.
- /// This is either <c>"Console.Out"</c> or <c>"Console.Error"</c>.
- /// </para>
- /// </remarks>
public virtual string Target
{
- get { return m_writeToErrorStream ? ConsoleError : ConsoleOut; }
- set
- {
- string v = value.Trim();
-
- if (SystemInfo.EqualsIgnoringCase(ConsoleError, v))
- {
- m_writeToErrorStream = true;
- }
- else
- {
- m_writeToErrorStream = false;
- }
- }
+ get => m_writeToErrorStream ? ConsoleError : ConsoleOut;
+ set => m_writeToErrorStream = SystemInfo.EqualsIgnoringCase(ConsoleError, value.Trim());
}
/// <summary>
@@ -150,7 +110,6 @@
/// <param name="mapping">The mapping to add</param>
/// <remarks>
/// <para>
- /// Add a <see cref="LevelColors"/> mapping to this appender.
/// Each mapping defines the foreground and background colors
/// for a level.
/// </para>
@@ -159,43 +118,39 @@
{
m_levelMapping.Add(mapping);
}
- #endregion // Public Instance Properties
- #region Override implementation of AppenderSkeleton
/// <summary>
- /// This method is called by the <see cref="M:AppenderSkeleton.DoAppend(log4net.Core.LoggingEvent)"/> method.
+ /// Writes the event to the console.
/// </summary>
/// <param name="loggingEvent">The event to log.</param>
/// <remarks>
/// <para>
- /// Writes the event to the console.
+ /// This method is called by the <see cref="M:AppenderSkeleton.DoAppend(log4net.Core.LoggingEvent)"/> method.
/// </para>
/// <para>
/// The format of the output will depend on the appender's layout.
/// </para>
/// </remarks>
- protected override void Append(log4net.Core.LoggingEvent loggingEvent)
+ protected override void Append(LoggingEvent loggingEvent)
{
- System.IO.TextWriter writer;
+ TextWriter writer = m_writeToErrorStream ? Console.Error : Console.Out;
- if (m_writeToErrorStream)
- writer = Console.Error;
- else
- writer = Console.Out;
-
- // Reset color
Console.ResetColor();
- // see if there is a specified lookup
- LevelColors levelColors = m_levelMapping.Lookup(loggingEvent.Level) as LevelColors;
- if (levelColors != null)
+ // See if there is a specified lookup
+ if (m_levelMapping.Lookup(loggingEvent.Level) is LevelColors levelColors)
{
- // if the backColor has been explicitly set
+ // If the backColor has been explicitly set
if (levelColors.HasBackColor)
+ {
Console.BackgroundColor = levelColors.BackColor;
- // if the foreColor has been explicitly set
+ }
+
+ // If the foreColor has been explicitly set
if (levelColors.HasForeColor)
+ {
Console.ForegroundColor = levelColors.ForeColor;
+ }
}
// Render the event to a string
@@ -210,141 +165,70 @@
/// <summary>
/// This appender requires a <see cref="Layout"/> to be set.
/// </summary>
- /// <value><c>true</c></value>
- /// <remarks>
- /// <para>
- /// This appender requires a <see cref="Layout"/> to be set.
- /// </para>
- /// </remarks>
- protected override bool RequiresLayout
- {
- get { return true; }
- }
+ protected override bool RequiresLayout => true;
/// <summary>
- /// Initialize the options for this appender
+ /// Initializes the options for this appender.
/// </summary>
- /// <remarks>
- /// <para>
- /// Initialize the level to color mappings set on this appender.
- /// </para>
- /// </remarks>
public override void ActivateOptions()
{
base.ActivateOptions();
m_levelMapping.ActivateOptions();
}
- #endregion // Override implementation of AppenderSkeleton
- #region Public Static Fields
/// <summary>
- /// The <see cref="ManagedColoredConsoleAppender.Target"/> to use when writing to the Console
+ /// The <see cref="ManagedColoredConsoleAppender.Target"/> to use when writing to the Console
/// standard output stream.
/// </summary>
- /// <remarks>
- /// <para>
- /// The <see cref="ManagedColoredConsoleAppender.Target"/> to use when writing to the Console
- /// standard output stream.
- /// </para>
- /// </remarks>
public const string ConsoleOut = "Console.Out";
/// <summary>
- /// The <see cref="ManagedColoredConsoleAppender.Target"/> to use when writing to the Console
+ /// The <see cref="ManagedColoredConsoleAppender.Target"/> to use when writing to the Console
/// standard error output stream.
/// </summary>
- /// <remarks>
- /// <para>
- /// The <see cref="ManagedColoredConsoleAppender.Target"/> to use when writing to the Console
- /// standard error output stream.
- /// </para>
- /// </remarks>
public const string ConsoleError = "Console.Error";
- #endregion // Public Static Fields
- #region Private Instances Fields
/// <summary>
/// Flag to write output to the error stream rather than the standard output stream
/// </summary>
- private bool m_writeToErrorStream = false;
+ private bool m_writeToErrorStream;
/// <summary>
/// Mapping from level object to color value
/// </summary>
- private LevelMapping m_levelMapping = new LevelMapping();
- #endregion // Private Instances Fields
+ private readonly LevelMapping m_levelMapping = new();
- #region LevelColors LevelMapping Entry
/// <summary>
/// A class to act as a mapping between the level that a logging call is made at and
/// the color it should be displayed as.
/// </summary>
- /// <remarks>
- /// <para>
- /// Defines the mapping between a level and the color it should be displayed in.
- /// </para>
- /// </remarks>
public class LevelColors : LevelMappingEntry
{
/// <summary>
/// The mapped foreground color for the specified level
/// </summary>
- /// <remarks>
- /// <para>
- /// Required property.
- /// The mapped foreground color for the specified level.
- /// </para>
- /// </remarks>
public ConsoleColor ForeColor
{
- get { return (this.foreColor); }
+ get => m_foreColor;
// Keep a flag that the color has been set
// and is no longer the default.
- set { this.foreColor = value; this.hasForeColor = true; }
+ set { m_foreColor = value; HasForeColor = true; }
}
- private ConsoleColor foreColor;
- private bool hasForeColor;
- internal bool HasForeColor
- {
- get
- {
- return hasForeColor;
- }
- }
+ private ConsoleColor m_foreColor;
+ internal bool HasForeColor { get; private set; }
/// <summary>
- /// The mapped background color for the specified level
+ /// Gets or sets the mapped background color for the specified level
/// </summary>
- /// <remarks>
- /// <para>
- /// Required property.
- /// The mapped background color for the specified level.
- /// </para>
- /// </remarks>
public ConsoleColor BackColor
{
- get { return (this.backColor); }
+ get => m_backColor;
// Keep a flag that the color has been set
// and is no longer the default.
- set { this.backColor = value; this.hasBackColor = true; }
+ set { m_backColor = value; HasBackColor = true; }
}
- private ConsoleColor backColor;
- private bool hasBackColor;
- internal bool HasBackColor
- {
- get
- {
- return hasBackColor;
- }
- }
+ private ConsoleColor m_backColor;
+ internal bool HasBackColor { get; private set; }
}
- #endregion // LevelColors LevelMapping Entry
}
}
-
-#endif
-#endif
-#endif // !MONO_1_0
-#endif // !CLI_1_0
-#endif // !SSCLI
-#endif // !NETCF
diff --git a/src/log4net/Appender/MemoryAppender.cs b/src/log4net/Appender/MemoryAppender.cs
index 486a410..a8773cb 100644
--- a/src/log4net/Appender/MemoryAppender.cs
+++ b/src/log4net/Appender/MemoryAppender.cs
@@ -18,8 +18,7 @@
#endregion
using System;
-using System.Collections;
-
+using System.Collections.Generic;
using log4net.Core;
namespace log4net.Appender
@@ -56,39 +55,15 @@
/// <author>Gert Driesen</author>
public class MemoryAppender : AppenderSkeleton
{
- #region Public Instance Constructors
-
- /// <summary>
- /// Initializes a new instance of the <see cref="MemoryAppender" /> class.
- /// </summary>
- /// <remarks>
- /// <para>
- /// Default constructor.
- /// </para>
- /// </remarks>
- public MemoryAppender() : base()
- {
- m_eventsList = new ArrayList();
- }
-
- #endregion Protected Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
/// Gets the events that have been logged.
/// </summary>
/// <returns>The events that have been logged</returns>
- /// <remarks>
- /// <para>
- /// Gets the events that have been logged.
- /// </para>
- /// </remarks>
public virtual LoggingEvent[] GetEvents()
{
- lock (m_eventsList.SyncRoot)
+ lock (m_lockObj)
{
- return (LoggingEvent[])m_eventsList.ToArray(typeof(LoggingEvent));
+ return m_eventsList.ToArray();
}
}
@@ -112,18 +87,8 @@
[Obsolete("Use Fix property")]
public virtual bool OnlyFixPartialEventData
{
- get { return (Fix == FixFlags.Partial); }
- set
- {
- if (value)
- {
- Fix = FixFlags.Partial;
- }
- else
- {
- Fix = FixFlags.All;
- }
- }
+ get => Fix == FixFlags.Partial;
+ set => Fix = value ? FixFlags.Partial : FixFlags.All;
}
/// <summary>
@@ -136,15 +101,7 @@
/// for details.
/// </para>
/// </remarks>
- public virtual FixFlags Fix
- {
- get { return m_fixFlags; }
- set { m_fixFlags = value; }
- }
-
- #endregion Public Instance Properties
-
- #region Override implementation of AppenderSkeleton
+ public virtual FixFlags Fix { get; set; } = FixFlags.All;
/// <summary>
/// This method is called by the <see cref="M:AppenderSkeleton.DoAppend(LoggingEvent)"/> method.
@@ -158,18 +115,14 @@
// Because we are caching the LoggingEvent beyond the
// lifetime of the Append() method we must fix any
// volatile data in the event.
- loggingEvent.Fix = this.Fix;
+ loggingEvent.Fix = Fix;
- lock (m_eventsList.SyncRoot)
+ lock (m_lockObj)
{
m_eventsList.Add(loggingEvent);
}
}
- #endregion Override implementation of AppenderSkeleton
-
- #region Public Instance Methods
-
/// <summary>
/// Clear the list of events
/// </summary>
@@ -178,7 +131,7 @@
/// </remarks>
public virtual void Clear()
{
- lock (m_eventsList.SyncRoot)
+ lock (m_lockObj)
{
m_eventsList.Clear();
}
@@ -188,38 +141,21 @@
/// Gets the events that have been logged and clears the list of events.
/// </summary>
/// <returns>The events that have been logged</returns>
- /// <remarks>
- /// <para>
- /// Gets the events that have been logged and clears the list of events.
- /// </para>
- /// </remarks>
public virtual LoggingEvent[] PopAllEvents()
{
- lock (m_eventsList.SyncRoot)
+ lock (m_lockObj)
{
- LoggingEvent[] tmp = (LoggingEvent[])m_eventsList.ToArray(typeof(LoggingEvent));
+ LoggingEvent[] tmp = m_eventsList.ToArray();
m_eventsList.Clear();
return tmp;
}
}
- #endregion Public Instance Methods
-
- #region Protected Instance Fields
-
/// <summary>
/// The list of events that have been appended.
/// </summary>
- protected ArrayList m_eventsList;
+ protected List<LoggingEvent> m_eventsList = new();
- /// <summary>
- /// Value indicating which fields in the event should be fixed
- /// </summary>
- /// <remarks>
- /// By default all fields are fixed
- /// </remarks>
- protected FixFlags m_fixFlags = FixFlags.All;
-
- #endregion Protected Instance Fields
+ private readonly object m_lockObj = new();
}
}
diff --git a/src/log4net/Appender/NetSendAppender.cs b/src/log4net/Appender/NetSendAppender.cs
index 1c0d0ae..267913e 100644
--- a/src/log4net/Appender/NetSendAppender.cs
+++ b/src/log4net/Appender/NetSendAppender.cs
@@ -17,24 +17,12 @@
//
#endregion
-// MONO 1.0 Beta mcs does not like #if !A && !B && !C syntax
-
-// .NET Compact Framework 1.0 has no support for Win32 NetMessageBufferSend API
-#if !NETCF
-// MONO 1.0 has no support for Win32 NetMessageBufferSend API
-#if !MONO
-// SSCLI 1.0 has no support for Win32 NetMessageBufferSend API
-#if !SSCLI
-// We don't want framework or platform specific code in the CLI version of log4net
-#if !CLI_1_0
-
using System;
using System.Runtime.InteropServices;
using log4net.Util;
using log4net.Core;
-
namespace log4net.Appender
{
/// <summary>
@@ -140,32 +128,6 @@
/// <author>Gert Driesen</author>
public class NetSendAppender : AppenderSkeleton
{
- #region Member Variables
-
- /// <summary>
- /// The DNS or NetBIOS name of the server on which the function is to execute.
- /// </summary>
- private string m_server;
-
- /// <summary>
- /// The sender of the network message.
- /// </summary>
- private string m_sender;
-
- /// <summary>
- /// The message alias to which the message should be sent.
- /// </summary>
- private string m_recipient;
-
- /// <summary>
- /// The security context to use for privileged calls
- /// </summary>
- private SecurityContext m_securityContext;
-
- #endregion
-
- #region Constructors
-
/// <summary>
/// Initializes the appender.
/// </summary>
@@ -176,10 +138,6 @@
{
}
- #endregion
-
- #region Properties
-
/// <summary>
/// Gets or sets the sender of the message.
/// </summary>
@@ -189,11 +147,7 @@
/// <remarks>
/// If this property is not specified, the message is sent from the local computer.
/// </remarks>
- public string Sender
- {
- get { return m_sender; }
- set { m_sender = value; }
- }
+ public string? Sender { get; set; }
/// <summary>
/// Gets or sets the message alias to which the message should be sent.
@@ -204,11 +158,7 @@
/// <remarks>
/// This property should always be specified in order to send a message.
/// </remarks>
- public string Recipient
- {
- get { return m_recipient; }
- set { m_recipient = value; }
- }
+ public string? Recipient { get; set; }
/// <summary>
/// Gets or sets the DNS or NetBIOS name of the remote server on which the function is to execute.
@@ -224,11 +174,7 @@
/// If this property is not specified, the local computer is used.
/// </para>
/// </remarks>
- public string Server
- {
- get { return m_server; }
- set { m_server = value; }
- }
+ public string? Server { get; set; }
/// <summary>
/// Gets or sets the <see cref="SecurityContext"/> used to call the NetSend method.
@@ -244,15 +190,7 @@
/// of the current thread.
/// </para>
/// </remarks>
- public SecurityContext SecurityContext
- {
- get { return m_securityContext; }
- set { m_securityContext = value; }
- }
-
- #endregion
-
- #region Implementation of IOptionHandler
+ public SecurityContext? SecurityContext { get; set; }
/// <summary>
/// Initialize the appender based on the options set.
@@ -278,21 +216,14 @@
{
base.ActivateOptions();
- if (this.Recipient == null)
+ if (Recipient is null)
{
- throw new ArgumentNullException("Recipient", "The required property 'Recipient' was not specified.");
+ throw new ArgumentNullException(nameof(Recipient), "The required property 'Recipient' was not specified.");
}
- if (m_securityContext == null)
- {
- m_securityContext = SecurityContextProvider.DefaultProvider.CreateSecurityContext(this);
- }
+ SecurityContext ??= SecurityContextProvider.DefaultProvider.CreateSecurityContext(this);
}
- #endregion
-
- #region Override implementation of AppenderSkeleton
-
/// <summary>
/// This method is called by the <see cref="M:AppenderSkeleton.DoAppend(LoggingEvent)"/> method.
/// </summary>
@@ -302,23 +233,19 @@
/// Sends the event using a network message.
/// </para>
/// </remarks>
-#if NET_4_0 || MONO_4_0 || NETSTANDARD
[System.Security.SecuritySafeCritical]
-#endif
-#if !NETSTANDARD1_3
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, UnmanagedCode = true)]
-#endif
protected override void Append(LoggingEvent loggingEvent)
{
- NativeError nativeError = null;
+ NativeError? nativeError = null;
// Render the event in the callers security context
string renderedLoggingEvent = RenderLoggingEvent(loggingEvent);
- using (m_securityContext.Impersonate(this))
+ using (SecurityContext?.Impersonate(this))
{
// Send the message
- int returnValue = NetMessageBufferSend(this.Server, this.Recipient, this.Sender, renderedLoggingEvent, renderedLoggingEvent.Length * Marshal.SystemDefaultCharSize);
+ int returnValue = NetMessageBufferSend(Server, Recipient!, Sender, renderedLoggingEvent, renderedLoggingEvent.Length * Marshal.SystemDefaultCharSize);
// Log the error if the message could not be sent
if (returnValue != 0)
@@ -328,30 +255,17 @@
}
}
- if (nativeError != null)
+ if (nativeError is not null)
{
// Handle the error over to the ErrorHandler
- ErrorHandler.Error(nativeError.ToString() + " (Params: Server=" + this.Server + ", Recipient=" + this.Recipient + ", Sender=" + this.Sender + ")");
+ ErrorHandler.Error($"{nativeError} (Params: Server={Server}, Recipient={Recipient}, Sender={Sender})");
}
}
/// <summary>
/// This appender requires a <see cref="Layout"/> to be set.
/// </summary>
- /// <value><c>true</c></value>
- /// <remarks>
- /// <para>
- /// This appender requires a <see cref="Layout"/> to be set.
- /// </para>
- /// </remarks>
- protected override bool RequiresLayout
- {
- get { return true; }
- }
-
- #endregion
-
- #region Stubs For Native Function Calls
+ protected override bool RequiresLayout => true;
/// <summary>
/// Sends a buffer of information to a registered message alias.
@@ -408,18 +322,12 @@
/// </para>
/// </returns>
[DllImport("netapi32.dll", SetLastError = true)]
+ [DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
protected static extern int NetMessageBufferSend(
- [MarshalAs(UnmanagedType.LPWStr)] string serverName,
+ [MarshalAs(UnmanagedType.LPWStr)] string? serverName,
[MarshalAs(UnmanagedType.LPWStr)] string msgName,
- [MarshalAs(UnmanagedType.LPWStr)] string fromName,
+ [MarshalAs(UnmanagedType.LPWStr)] string? fromName,
[MarshalAs(UnmanagedType.LPWStr)] string buffer,
int bufferSize);
-
- #endregion
}
}
-
-#endif // !CLI_1_0
-#endif // !SSCLI
-#endif // !MONO
-#endif // !NETCF
\ No newline at end of file
diff --git a/src/log4net/Appender/OutputDebugStringAppender.cs b/src/log4net/Appender/OutputDebugStringAppender.cs
index 5580532..fed17f6 100644
--- a/src/log4net/Appender/OutputDebugStringAppender.cs
+++ b/src/log4net/Appender/OutputDebugStringAppender.cs
@@ -17,13 +17,6 @@
//
#endregion
-// MONO 1.0 has no support for Win32 OutputDebugString API
-#if !MONO
-// SSCLI 1.0 has no support for Win32 OutputDebugString API
-#if !SSCLI
-// We don't want framework or platform specific code in the CLI version of log4net
-#if !CLI_1_0
-
using System.Runtime.InteropServices;
using log4net.Core;
@@ -33,56 +26,19 @@
/// <summary>
/// Appends log events to the OutputDebugString system.
/// </summary>
- /// <remarks>
- /// <para>
- /// OutputDebugStringAppender appends log events to the
- /// OutputDebugString system.
- /// </para>
- /// <para>
- /// The string is passed to the native <c>OutputDebugString</c>
- /// function.
- /// </para>
- /// </remarks>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
public class OutputDebugStringAppender : AppenderSkeleton
{
- #region Public Instance Constructors
-
/// <summary>
- /// Initializes a new instance of the <see cref="OutputDebugStringAppender" /> class.
- /// </summary>
- /// <remarks>
- /// <para>
- /// Default constructor.
- /// </para>
- /// </remarks>
- public OutputDebugStringAppender()
- {
- }
-
- #endregion // Public Instance Constructors
-
- #region Override implementation of AppenderSkeleton
-
- /// <summary>
- /// Write the logging event to the output debug string API
+ /// Writes the logging event to the output debug string API
/// </summary>
/// <param name="loggingEvent">the event to log</param>
- /// <remarks>
- /// <para>
- /// Write the logging event to the output debug string API
- /// </para>
- /// </remarks>
-#if NET_4_0 || MONO_4_0 || NETSTANDARD
[System.Security.SecuritySafeCritical]
-#endif
-#if !NETCF && !NETSTANDARD1_3
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, UnmanagedCode = true)]
-#endif
protected override void Append(LoggingEvent loggingEvent)
{
-#if NETSTANDARD
+#if NETSTANDARD2_0_OR_GREATER
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
throw new System.PlatformNotSupportedException("OutputDebugString is only available on Windows");
@@ -95,41 +51,18 @@
/// <summary>
/// This appender requires a <see cref="Layout"/> to be set.
/// </summary>
- /// <value><c>true</c></value>
- /// <remarks>
- /// <para>
- /// This appender requires a <see cref="Layout"/> to be set.
- /// </para>
- /// </remarks>
- protected override bool RequiresLayout
- {
- get { return true; }
- }
-
- #endregion // Override implementation of AppenderSkeleton
-
- #region Protected Static Methods
+ protected override bool RequiresLayout => true;
/// <summary>
/// Stub for OutputDebugString native method
/// </summary>
/// <param name="message">the string to output</param>
- /// <remarks>
- /// <para>
- /// Stub for OutputDebugString native method
- /// </para>
- /// </remarks>
-#if NETCF || NETSTANDARD
+#if NETSTANDARD2_0_OR_GREATER
[DllImport("CoreDll.dll")]
#else
[DllImport("Kernel32.dll")]
#endif
+ [DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
protected static extern void OutputDebugString(string message);
-
- #endregion // Protected Static Methods
- }
-}
-
-#endif // !CLI_1_0
-#endif // !SSCLI
-#endif // !MONO
+ }
+}
\ No newline at end of file
diff --git a/src/log4net/Appender/RemoteSyslogAppender.cs b/src/log4net/Appender/RemoteSyslogAppender.cs
index 83e8de0..1db4805 100644
--- a/src/log4net/Appender/RemoteSyslogAppender.cs
+++ b/src/log4net/Appender/RemoteSyslogAppender.cs
@@ -20,7 +20,6 @@
using System;
using log4net.Core;
-using log4net.Appender;
using log4net.Util;
using log4net.Layout;
using System.Text;
@@ -33,7 +32,7 @@
/// <remarks>
/// <para>
/// The BSD syslog protocol is used to remotely log to
- /// a syslog daemon. The syslogd listens for for messages
+ /// a syslog daemon. The syslogd listens for messages
/// on UDP port 514.
/// </para>
/// <para>
@@ -52,7 +51,7 @@
/// hostname or IP address to any messages received.
/// </para>
/// <para>
- /// Syslog messages must have a facility and and a severity. The severity
+ /// Syslog messages must have a facility and a severity. The severity
/// is derived from the Level of the logging event.
/// The facility must be chosen from the set of defined syslog
/// <see cref="SyslogFacility"/> values. The facilities list is predefined
@@ -60,7 +59,7 @@
/// </para>
/// <para>
/// An identifier is specified with each log message. This can be specified
- /// by setting the <see cref="Identity"/> property. The identity (also know
+ /// by setting the <see cref="Identity"/> property. The identity (also known
/// as the tag) must not contain white space. The default value for the
/// identity is the application name (from <see cref="LoggingEvent.Domain"/>).
/// </para>
@@ -74,8 +73,6 @@
/// </summary>
private const int DefaultSyslogPort = 514;
- #region Enumerations
-
/// <summary>
/// syslog severities
/// </summary>
@@ -258,10 +255,6 @@
Local7 = 23
}
- #endregion Enumerations
-
- #region Public Instance Constructors
-
/// <summary>
/// Initializes a new instance of the <see cref="RemoteSyslogAppender" /> class.
/// </summary>
@@ -272,31 +265,23 @@
public RemoteSyslogAppender()
{
// syslog udp defaults
- this.RemotePort = DefaultSyslogPort;
- this.RemoteAddress = System.Net.IPAddress.Parse("127.0.0.1");
- this.Encoding = System.Text.Encoding.ASCII;
+ RemotePort = DefaultSyslogPort;
+ RemoteAddress = System.Net.IPAddress.Parse("127.0.0.1");
+ Encoding = Encoding.ASCII;
}
- #endregion Public Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
/// Message identity
/// </summary>
/// <remarks>
/// <para>
/// An identifier is specified with each log message. This can be specified
- /// by setting the <see cref="Identity"/> property. The identity (also know
+ /// by setting the <see cref="Identity"/> property. The identity (also known
/// as the tag) must not contain white space. The default value for the
/// identity is the application name (from <see cref="LoggingEvent.Domain"/>).
/// </para>
/// </remarks>
- public PatternLayout Identity
- {
- get { return m_identity; }
- set { m_identity = value; }
- }
+ public PatternLayout? Identity { get; set; }
/// <summary>
/// Syslog facility
@@ -306,13 +291,7 @@
/// facilities is predefined and cannot be extended. The default value
/// is <see cref="SyslogFacility.User"/>.
/// </remarks>
- public SyslogFacility Facility
- {
- get { return m_facility; }
- set { m_facility = value; }
- }
-
- #endregion Public Instance Properties
+ public SyslogFacility Facility { get; set; } = SyslogFacility.User;
/// <summary>
/// Add a mapping of level to severity
@@ -328,15 +307,13 @@
m_levelMapping.Add(mapping);
}
- #region AppenderSkeleton Implementation
-
/// <summary>
- /// This method is called by the <see cref="M:AppenderSkeleton.DoAppend(LoggingEvent)"/> method.
+ /// Writes the event to a remote syslog daemon.
/// </summary>
/// <param name="loggingEvent">The event to log.</param>
/// <remarks>
/// <para>
- /// Writes the event to a remote syslog daemon.
+ /// This method is called by the <see cref="M:AppenderSkeleton.DoAppend(LoggingEvent)"/> method.
/// </para>
/// <para>
/// The format of the output will depend on the appender's layout.
@@ -347,14 +324,13 @@
try
{
// Priority
- int priority = GeneratePriority(m_facility, GetSeverity(loggingEvent.Level));
+ int priority = GeneratePriority(Facility, GetSeverity(loggingEvent.Level));
// Identity
string identity;
-
- if (m_identity != null)
+ if (Identity is not null)
{
- identity = m_identity.Format(loggingEvent);
+ identity = Identity.Format(loggingEvent);
}
else
{
@@ -364,7 +340,6 @@
// Message. The message goes after the tag/identity
string message = RenderLoggingEvent(loggingEvent);
- byte[] buffer;
int i = 0;
StringBuilder builder = new StringBuilder();
@@ -386,22 +361,15 @@
AppendMessage(message, ref i, builder);
// Grab as a byte array
- buffer = this.Encoding.GetBytes(builder.ToString());
+ byte[] buffer = Encoding.GetBytes(builder.ToString());
-#if NET_4_5 || NETSTANDARD
Client.SendAsync(buffer, buffer.Length, RemoteEndPoint).Wait();
-#else
- this.Client.Send(buffer, buffer.Length, this.RemoteEndPoint);
-#endif
}
}
catch (Exception e)
{
ErrorHandler.Error(
- "Unable to send logging event to remote syslog " +
- this.RemoteAddress.ToString() +
- " on port " +
- this.RemotePort + ".",
+ $"Unable to send logging event to remote syslog {RemoteAddress} on port {RemotePort}.",
e,
ErrorCode.WriteFailure);
}
@@ -420,12 +388,12 @@
char c = message[characterIndex];
// Accept only visible ASCII characters and space. See RFC 3164 section 4.1.3
- if (((int)c >= 32) && ((int)c <= 126))
+ if ((c >= ' ') && (c <= 126))
{
builder.Append(c);
}
// If character is newline, break and send the current line
- else if ((c == '\r') || (c == '\n'))
+ else if (c is '\r' or '\n')
{
// Check the next character to handle \r\n or \n\r
if ((message.Length > characterIndex + 1) && ((message[characterIndex + 1] == '\r') || (message[characterIndex + 1] == '\n')))
@@ -452,10 +420,6 @@
m_levelMapping.ActivateOptions();
}
- #endregion AppenderSkeleton Implementation
-
- #region Protected Members
-
/// <summary>
/// Translates a log4net level to a syslog severity.
/// </summary>
@@ -466,10 +430,9 @@
/// Translates a log4net level to a syslog severity.
/// </para>
/// </remarks>
- protected virtual SyslogSeverity GetSeverity(Level level)
+ protected virtual SyslogSeverity GetSeverity(Level? level)
{
- LevelSeverity levelSeverity = m_levelMapping.Lookup(level) as LevelSeverity;
- if (levelSeverity != null)
+ if (m_levelMapping.Lookup(level) is LevelSeverity levelSeverity)
{
return levelSeverity.Severity;
}
@@ -506,10 +469,6 @@
return SyslogSeverity.Debug;
}
- #endregion Protected Members
-
- #region Public Static Members
-
/// <summary>
/// Generate a syslog priority.
/// </summary>
@@ -525,12 +484,12 @@
{
if (facility < SyslogFacility.Kernel || facility > SyslogFacility.Local7)
{
- throw new ArgumentException("SyslogFacility out of range", "facility");
+ throw new ArgumentException($"{nameof(SyslogFacility)} out of range", nameof(facility));
}
if (severity < SyslogSeverity.Emergency || severity > SyslogSeverity.Debug)
{
- throw new ArgumentException("SyslogSeverity out of range", "severity");
+ throw new ArgumentException($"{nameof(SyslogSeverity)} out of range", nameof(severity));
}
unchecked
@@ -539,68 +498,32 @@
}
}
- #endregion Public Static Members
-
- #region Private Instances Fields
-
- /// <summary>
- /// The facility. The default facility is <see cref="SyslogFacility.User"/>.
- /// </summary>
- private SyslogFacility m_facility = SyslogFacility.User;
-
- /// <summary>
- /// The message identity
- /// </summary>
- private PatternLayout m_identity;
-
/// <summary>
/// Mapping from level object to syslog severity
/// </summary>
- private LevelMapping m_levelMapping = new LevelMapping();
+ private readonly LevelMapping m_levelMapping = new();
/// <summary>
- /// Initial buffer size
- /// </summary>
- private const int c_renderBufferSize = 256;
-
- /// <summary>
- /// Maximum buffer size before it is recycled
- /// </summary>
- private const int c_renderBufferMaxCapacity = 1024;
-
- #endregion Private Instances Fields
-
- #region LevelSeverity LevelMapping Entry
- /// <summary>
/// A class to act as a mapping between the level that a logging call is made at and
- /// the syslog severity that is should be logged at.
+ /// the syslog severity that it should be logged at.
/// </summary>
/// <remarks>
/// <para>
/// A class to act as a mapping between the level that a logging call is made at and
- /// the syslog severity that is should be logged at.
+ /// the syslog severity that it should be logged at.
/// </para>
/// </remarks>
public class LevelSeverity : LevelMappingEntry
{
- private SyslogSeverity m_severity;
-
/// <summary>
/// The mapped syslog severity for the specified level
/// </summary>
/// <remarks>
/// <para>
/// Required property.
- /// The mapped syslog severity for the specified level
/// </para>
/// </remarks>
- public SyslogSeverity Severity
- {
- get { return m_severity; }
- set { m_severity = value; }
- }
+ public SyslogSeverity Severity { get; set; }
}
-
- #endregion // LevelSeverity LevelMapping Entry
}
-}
+}
\ No newline at end of file
diff --git a/src/log4net/Appender/RemotingAppender.cs b/src/log4net/Appender/RemotingAppender.cs
index 69a0b6b..930791b 100644
--- a/src/log4net/Appender/RemotingAppender.cs
+++ b/src/log4net/Appender/RemotingAppender.cs
@@ -17,18 +17,15 @@
//
#endregion
-// .NET Compact Framework 1.0 && netstandard has no support for System.Runtime.Remoting
-#if NET_2_0
+// netstandard has no support for System.Runtime.Remoting
+#if NET462_OR_GREATER
using System;
using System.Collections;
+using System.Runtime.Remoting.Messaging;
using System.Threading;
-using System.Runtime.Remoting.Messaging;
-
-using log4net.Layout;
using log4net.Core;
-using log4net.Util;
namespace log4net.Appender
{
@@ -49,7 +46,7 @@
/// Once the buffer is full the events are still not sent immediately.
/// They are scheduled to be sent using a pool thread. The effect is that
/// the send occurs asynchronously. This is very important for a
- /// number of non obvious reasons. The remoting infrastructure will
+ /// number of non-obvious reasons. The remoting infrastructure will
/// flow thread local variables (stored in the <see cref="CallContext"/>),
/// if they are marked as <see cref="ILogicalThreadAffinative"/>, across the
/// remoting boundary. If the server is not contactable then
@@ -63,7 +60,7 @@
/// Because the events are sent asynchronously using pool threads it is possible to close
/// this appender before all the queued events have been sent.
/// When closing the appender attempts to wait until all the queued events have been sent, but
- /// this will timeout after 30 seconds regardless.</para>
+ /// this will time out after 30 seconds regardless.</para>
/// <para>
/// If this appender is being closed because the <see cref="AppDomain.ProcessExit"/>
/// event has fired it may not be possible to send all the queued events. During process
@@ -71,7 +68,7 @@
/// event handler is allowed to run for. If the runtime terminates the threads before
/// the queued events have been sent then they will be lost. To ensure that all events
/// are sent the appender must be closed before the application exits. See
- /// <see cref="log4net.Core.LoggerManager.Shutdown"/> for details on how to shutdown
+ /// <see cref="log4net.Core.LoggerManager.Shutdown"/> for details on how to shut down
/// log4net programmatically.</para>
/// </remarks>
/// <seealso cref="IRemoteLoggingSink" />
@@ -80,8 +77,6 @@
/// <author>Daniel Cazzulino</author>
public class RemotingAppender : BufferingAppenderSkeleton
{
- #region Public Instance Constructors
-
/// <summary>
/// Initializes a new instance of the <see cref="RemotingAppender" /> class.
/// </summary>
@@ -94,10 +89,6 @@
{
}
- #endregion Public Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
/// Gets or sets the URL of the well-known object that will accept
/// the logging events.
@@ -112,15 +103,7 @@
/// interface.
/// </para>
/// </remarks>
- public string Sink
- {
- get { return m_sinkUrl; }
- set { m_sinkUrl = value; }
- }
-
- #endregion Public Instance Properties
-
- #region Implementation of IOptionHandler
+ public string? Sink { get; set; }
/// <summary>
/// Initialize the appender based on the options set
@@ -138,30 +121,29 @@
/// <see cref="ActivateOptions"/> must be called again.
/// </para>
/// </remarks>
-#if NET_4_0 || MONO_4_0
- [System.Security.SecuritySafeCritical]
-#endif
+ [System.Security.SecuritySafeCritical]
public override void ActivateOptions()
{
+ if (Sink is null)
+ {
+ throw new ArgumentNullException($"The {nameof(Sink)} property is not set");
+ }
+
base.ActivateOptions();
IDictionary channelProperties = new Hashtable();
channelProperties["typeFilterLevel"] = "Full";
- m_sinkObj = (IRemoteLoggingSink)Activator.GetObject(typeof(IRemoteLoggingSink), m_sinkUrl, channelProperties);
+ m_sinkObj = (IRemoteLoggingSink)Activator.GetObject(typeof(IRemoteLoggingSink), Sink, channelProperties);
}
- #endregion
-
- #region Override implementation of BufferingAppenderSkeleton
-
/// <summary>
/// Send the contents of the buffer to the remote sink.
/// </summary>
/// <remarks>
/// The events are not sent immediately. They are scheduled to be sent
/// using a pool thread. The effect is that the send occurs asynchronously.
- /// This is very important for a number of non obvious reasons. The remoting
+ /// This is very important for a number of non-obvious reasons. The remoting
/// infrastructure will flow thread local variables (stored in the <see cref="CallContext"/>),
/// if they are marked as <see cref="ILogicalThreadAffinative"/>, across the
/// remoting boundary. If the server is not contactable then
@@ -179,12 +161,12 @@
BeginAsyncSend();
// Send the events
- if (!ThreadPool.QueueUserWorkItem(new WaitCallback(SendBufferCallback), events))
+ if (!ThreadPool.QueueUserWorkItem(SendBufferCallback, events))
{
// Cancel the async send
EndAsyncSend();
- ErrorHandler.Error("RemotingAppender [" + Name + "] failed to ThreadPool.QueueUserWorkItem logging events in SendBuffer.");
+ ErrorHandler.Error($"RemotingAppender [{Name}] failed to ThreadPool.QueueUserWorkItem logging events in SendBuffer.");
}
}
@@ -200,7 +182,7 @@
/// sent.</para>
/// <para>
/// This method attempts to wait until all the queued events have been sent, but this
- /// method will timeout after 30 seconds regardless.</para>
+ /// method will time out after 30 seconds regardless.</para>
/// <para>
/// If the appender is being closed because the <see cref="AppDomain.ProcessExit"/>
/// event has fired it may not be possible to send all the queued events. During process
@@ -214,7 +196,7 @@
// Wait for the work queue to become empty before closing, timeout 30 seconds
if (!m_workQueueEmptyEvent.WaitOne(30 * 1000, false))
{
- ErrorHandler.Error("RemotingAppender [" + Name + "] failed to send all queued events before close, in OnClose.");
+ ErrorHandler.Error($"RemotingAppender [{Name}] failed to send all queued events before close, in OnClose.");
}
}
@@ -229,8 +211,6 @@
return m_workQueueEmptyEvent.WaitOne(millisecondsTimeout, false);
}
- #endregion
-
/// <summary>
/// A work item is being queued into the thread pool
/// </summary>
@@ -272,7 +252,7 @@
LoggingEvent[] events = (LoggingEvent[])state;
// Send the events
- m_sinkObj.LogEvents(events);
+ m_sinkObj?.LogEvents(events);
}
catch (Exception ex)
{
@@ -284,22 +264,15 @@
}
}
- #region Private Instance Fields
-
- /// <summary>
- /// The URL of the remote sink.
- /// </summary>
- private string m_sinkUrl;
-
/// <summary>
/// The local proxy (.NET remoting) for the remote logging sink.
/// </summary>
- private IRemoteLoggingSink m_sinkObj;
+ private IRemoteLoggingSink? m_sinkObj;
/// <summary>
/// The number of queued callbacks currently waiting or executing
/// </summary>
- private int m_queuedCallbackCount = 0;
+ private int m_queuedCallbackCount;
/// <summary>
/// Event used to signal when there are no queued work items
@@ -308,9 +281,7 @@
/// This event is set when there are no queued work items. In this
/// state it is safe to close the appender.
/// </remarks>
- private ManualResetEvent m_workQueueEmptyEvent = new ManualResetEvent(true);
-
- #endregion Private Instance Fields
+ private readonly ManualResetEvent m_workQueueEmptyEvent = new(true);
/// <summary>
/// Interface used to deliver <see cref="LoggingEvent"/> objects to a remote sink.
@@ -336,4 +307,4 @@
}
}
-#endif // NET_2_0
\ No newline at end of file
+#endif // NET462_OR_GREATER
\ No newline at end of file
diff --git a/src/log4net/Appender/RollingFileAppender.DateTime.cs b/src/log4net/Appender/RollingFileAppender.DateTime.cs
new file mode 100644
index 0000000..4a69fb5
--- /dev/null
+++ b/src/log4net/Appender/RollingFileAppender.DateTime.cs
@@ -0,0 +1,84 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+using System;
+
+#nullable enable
+
+namespace log4net.Appender
+{
+ public partial class RollingFileAppender
+ {
+ /// <summary>
+ /// This interface is used to supply Date/Time information to the <see cref="RollingFileAppender"/>.
+ /// </summary>
+ /// <remarks>
+ /// This interface is used to supply Date/Time information to the <see cref="RollingFileAppender"/>.
+ /// Used primarily to allow test classes to plug themselves in so they can
+ /// supply test date/times.
+ /// </remarks>
+ public interface IDateTime
+ {
+ /// <summary>
+ /// Gets the <i>current</i> time.
+ /// </summary>
+ /// <value>The <i>current</i> time.</value>
+ /// <remarks>
+ /// <para>
+ /// Gets the <i>current</i> time.
+ /// </para>
+ /// </remarks>
+ DateTime Now { get; }
+ }
+
+ /// <summary>
+ /// Default implementation of <see cref="IDateTime"/> that returns the current time.
+ /// </summary>
+ private sealed class LocalDateTime : IDateTime
+ {
+ /// <summary>
+ /// Gets the <b>current</b> time.
+ /// </summary>
+ /// <value>The <b>current</b> time.</value>
+ /// <remarks>
+ /// <para>
+ /// Gets the <b>current</b> time.
+ /// </para>
+ /// </remarks>
+ public DateTime Now => DateTime.Now;
+ }
+
+ /// <summary>
+ /// Implementation of <see cref="IDateTime"/> that returns the current time as the coordinated universal time (UTC).
+ /// </summary>
+ private sealed class UniversalDateTime : IDateTime
+ {
+ /// <summary>
+ /// Gets the <b>current</b> time.
+ /// </summary>
+ /// <value>The <b>current</b> time.</value>
+ /// <remarks>
+ /// <para>
+ /// Gets the <b>current</b> time.
+ /// </para>
+ /// </remarks>
+ public DateTime Now => DateTime.UtcNow;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/log4net/Appender/RollingFileAppender.cs b/src/log4net/Appender/RollingFileAppender.cs
index aaf0b33..40b2dff 100644
--- a/src/log4net/Appender/RollingFileAppender.cs
+++ b/src/log4net/Appender/RollingFileAppender.cs
@@ -18,18 +18,21 @@
#endregion
using System;
-using System.Collections;
+using System.Collections.Generic;
using System.Globalization;
using System.IO;
using log4net.Util;
using log4net.Core;
using System.Threading;
+using System.ComponentModel;
+
+#nullable enable
namespace log4net.Appender
{
#if CONFIRM_WIN32_FILE_SHAREMODES
- // The following sounds good, and I though it was the case, but after
+ // The following sounds good, and I thought it was the case, but after
// further testing on Windows I have not been able to confirm it.
/// On the Windows platform if another process has a write lock on the file
@@ -123,10 +126,8 @@
/// <author>Aspi Havewala</author>
/// <author>Douglas de la Torre</author>
/// <author>Edward Smit</author>
- public class RollingFileAppender : FileAppender
+ public partial class RollingFileAppender : FileAppender
{
- #region Public Enums
-
/// <summary>
/// Style of rolling to use
/// </summary>
@@ -170,10 +171,6 @@
Composite = 3
}
- #endregion
-
- #region Protected Enums
-
/// <summary>
/// The code assumes that the following 'time' constants are in a increasing sequence.
/// </summary>
@@ -182,7 +179,8 @@
/// The code assumes that the following 'time' constants are in a increasing sequence.
/// </para>
/// </remarks>
- protected enum RollPoint
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public enum RollPoint
{
/// <summary>
/// Roll the log not based on the date
@@ -220,10 +218,6 @@
TopOfMonth = 5
}
- #endregion Protected Enums
-
- #region Public Instance Constructors
-
/// <summary>
/// Initializes a new instance of the <see cref="RollingFileAppender" /> class.
/// </summary>
@@ -233,76 +227,39 @@
/// </para>
/// </remarks>
public RollingFileAppender()
- {
- }
+ { }
/// <summary>
/// Cleans up all resources used by this appender.
/// </summary>
~RollingFileAppender()
{
-#if !NETCF
- if (m_mutexForRolling != null)
- {
-#if NET_4_0 || MONO_4_0 || NETSTANDARD
- m_mutexForRolling.Dispose();
-#else
- m_mutexForRolling.Close();
-#endif
- m_mutexForRolling = null;
- }
-#endif
+ Interlocked.Exchange(ref m_mutexForRolling, null)?.Dispose();
}
- #endregion Public Instance Constructors
-
- #region Public Instance Properties
-
-#if !NET_1_0 && !CLI_1_0 && !NETCF
/// <summary>
/// Gets or sets the strategy for determining the current date and time. The default
/// implementation is to use LocalDateTime which internally calls through to DateTime.Now.
/// DateTime.UtcNow may be used on frameworks newer than .NET 1.0 by specifying
- /// <see cref="RollingFileAppender.UniversalDateTime"/>.
+ /// <see cref="UniversalDateTime"/>.
/// </summary>
/// <value>
- /// An implementation of the <see cref="RollingFileAppender.IDateTime"/> interface which returns the current date and time.
+ /// An implementation of the <see cref="IDateTime"/> interface which returns the current date and time.
/// </value>
/// <remarks>
/// <para>
- /// Gets or sets the <see cref="RollingFileAppender.IDateTime"/> used to return the current date and time.
+ /// Gets or sets the <see cref="IDateTime"/> used to return the current date and time.
/// </para>
/// <para>
/// There are two built strategies for determining the current date and time,
- /// <see cref="RollingFileAppender.LocalDateTime"/>
- /// and <see cref="RollingFileAppender.UniversalDateTime"/>.
+ /// <see cref="LocalDateTime"/>
+ /// and <see cref="UniversalDateTime"/>.
/// </para>
/// <para>
- /// The default strategy is <see cref="RollingFileAppender.LocalDateTime"/>.
+ /// The default strategy is <see cref="LocalDateTime"/>.
/// </para>
/// </remarks>
-#else
- /// <summary>
- /// Gets or sets the strategy for determining the current date and time. The default
- /// implementation is to use LocalDateTime which internally calls through to DateTime.Now.
- /// </summary>
- /// <value>
- /// An implementation of the <see cref="RollingFileAppender.IDateTime"/> interface which returns the current date and time.
- /// </value>
- /// <remarks>
- /// <para>
- /// Gets or sets the <see cref="RollingFileAppender.IDateTime"/> used to return the current date and time.
- /// </para>
- /// <para>
- /// The default strategy is <see cref="RollingFileAppender.LocalDateTime"/>.
- /// </para>
- /// </remarks>
-#endif
- public IDateTime DateTimeStrategy
- {
- get { return m_dateTime; }
- set { m_dateTime = value; }
- }
+ public IDateTime DateTimeStrategy { get; set; } = new LocalDateTime();
/// <summary>
/// Gets or sets the date pattern to be used for generating file names
@@ -315,18 +272,15 @@
/// <remarks>
/// <para>
/// Takes a string in the same format as expected by
- /// <see cref="log4net.DateFormatter.SimpleDateFormatter" />.
+ /// <see cref="DateFormatter.SimpleDateFormatter" />.
+ /// May be set to null to disable date formatting.
/// </para>
/// <para>
/// This property determines the rollover schedule when rolling over
/// on date.
/// </para>
/// </remarks>
- public string DatePattern
- {
- get { return m_datePattern; }
- set { m_datePattern = value; }
- }
+ public string? DatePattern { get; set; } = ".yyyy-MM-dd";
/// <summary>
/// Gets or sets the maximum number of backup files that are kept before
@@ -351,11 +305,7 @@
/// <b>not</b> the total.
/// </para>
/// </remarks>
- public int MaxSizeRollBackups
- {
- get { return m_maxSizeRollBackups; }
- set { m_maxSizeRollBackups = value; }
- }
+ public int MaxSizeRollBackups { get; set; } = 0;
/// <summary>
/// Gets or sets the maximum size that the output file is allowed to reach
@@ -376,11 +326,7 @@
/// The default maximum file size is 10MB (10*1024*1024).
/// </para>
/// </remarks>
- public long MaxFileSize
- {
- get { return m_maxFileSize; }
- set { m_maxFileSize = value; }
- }
+ public long MaxFileSize { get; set; } = 10 * 1024 * 1024;
/// <summary>
/// Gets or sets the maximum size that the output file is allowed to reach
@@ -410,8 +356,8 @@
/// </remarks>
public string MaximumFileSize
{
- get { return m_maxFileSize.ToString(NumberFormatInfo.InvariantInfo); }
- set { m_maxFileSize = OptionConverter.ToFileSize(value, m_maxFileSize + 1); }
+ get => MaxFileSize.ToString(NumberFormatInfo.InvariantInfo);
+ set => MaxFileSize = OptionConverter.ToFileSize(value, MaxFileSize + 1);
}
/// <summary>
@@ -437,11 +383,7 @@
/// </para>
/// <para>The default file count direction is -1.</para>
/// </remarks>
- public int CountDirection
- {
- get { return m_countDirection; }
- set { m_countDirection = value; }
- }
+ public int CountDirection { get; set; } = -1;
/// <summary>
/// Gets or sets the rolling style.
@@ -460,7 +402,7 @@
/// </remarks>
public RollingMode RollingStyle
{
- get { return m_rollingStyle; }
+ get => m_rollingStyle;
set
{
m_rollingStyle = value;
@@ -500,16 +442,12 @@
/// <remarks>
/// <para>
/// By default file.log is rolled to file.log.yyyy-MM-dd or file.log.curSizeRollBackup.
- /// However, under Windows the new file name will loose any program associations as the
+ /// However, under Windows the new file name will lose any program associations as the
/// extension is changed. Optionally file.log can be renamed to file.yyyy-MM-dd.log or
/// file.curSizeRollBackup.log to maintain any program associations.
/// </para>
/// </remarks>
- public bool PreserveLogFileNameExtension
- {
- get { return m_preserveLogFileNameExtension; }
- set { m_preserveLogFileNameExtension = value; }
- }
+ public bool PreserveLogFileNameExtension { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to always log to
@@ -530,15 +468,7 @@
/// much faster as the appender it won't have to rename all the backups!
/// </para>
/// </remarks>
- public bool StaticLogFileName
- {
- get { return m_staticLogFileName; }
- set { m_staticLogFileName = value; }
- }
-
- #endregion Public Instance Properties
-
- #region Private Static Fields
+ public bool StaticLogFileName { get; set; } = true;
/// <summary>
/// The fully qualified type of the RollingFileAppender class.
@@ -549,15 +479,11 @@
/// </remarks>
private static readonly Type declaringType = typeof(RollingFileAppender);
- #endregion Private Static Fields
-
- #region Override implementation of FileAppender
-
/// <summary>
/// Sets the quiet writer being used.
/// </summary>
/// <remarks>
- /// This method can be overridden by sub classes.
+ /// This method can be overridden by subclasses.
/// </remarks>
/// <param name="writer">the writer to set</param>
protected override void SetQWForFiles(TextWriter writer)
@@ -612,18 +538,13 @@
protected virtual void AdjustFileBeforeAppend()
{
// reuse the file appenders locking model to lock the rolling
-#if !NETCF
try
{
// if rolling should be locked, acquire the lock
- if (m_mutexForRolling != null)
- {
- m_mutexForRolling.WaitOne();
- }
-#endif
+ m_mutexForRolling?.WaitOne();
if (m_rollDate)
{
- var n = m_dateTime.Now;
+ var n = DateTimeStrategy.Now;
if (n >= m_nextCheck)
{
m_now = n;
@@ -635,22 +556,17 @@
if (m_rollSize)
{
- if ((File != null) && ((CountingQuietTextWriter)QuietWriter).Count >= m_maxFileSize)
+ if ((File is not null) && ((CountingQuietTextWriter)QuietWriter!).Count >= MaxFileSize)
{
RollOverSize();
}
}
-#if !NETCF
}
finally
{
// if rolling should be locked, release the lock
- if (m_mutexForRolling != null)
- {
- m_mutexForRolling.ReleaseMutex();
- }
+ m_mutexForRolling?.ReleaseMutex();
}
-#endif
}
/// <summary>
@@ -673,7 +589,7 @@
long currentCount = 0;
if (append)
{
- using (SecurityContext.Impersonate(this))
+ using (SecurityContext?.Impersonate(this))
{
if (System.IO.File.Exists(fileName))
{
@@ -689,14 +605,14 @@
// If not Appending to an existing file we should have rolled the file out of the
// way. Therefore we should not be over-writing an existing file.
// The only exception is if we are not allowed to roll the existing file away.
- if (m_maxSizeRollBackups != 0 && FileExists(fileName))
+ if (MaxSizeRollBackups != 0 && FileExists(fileName))
{
- LogLog.Error(declaringType, "RollingFileAppender: INTERNAL ERROR. Append is False but OutputFile [" + fileName + "] already exists.");
+ LogLog.Error(declaringType, $"RollingFileAppender: INTERNAL ERROR. Append is False but OutputFile [{fileName}] already exists.");
}
}
}
- if (!m_staticLogFileName)
+ if (!StaticLogFileName)
{
m_scheduledFilename = fileName;
}
@@ -705,7 +621,7 @@
base.OpenFile(fileName, append);
// Set the file size onto the counting writer
- ((CountingQuietTextWriter)QuietWriter).Count = currentCount;
+ ((CountingQuietTextWriter)QuietWriter!).Count = currentCount;
}
}
@@ -723,81 +639,66 @@
/// </remarks>
protected string GetNextOutputFileName(string fileName)
{
- if (!m_staticLogFileName)
+ if (!StaticLogFileName)
{
fileName = fileName.Trim();
if (m_rollDate)
{
- fileName = CombinePath(fileName, m_now.ToString(m_datePattern, DateTimeFormatInfo.InvariantInfo));
+ fileName = CombinePath(fileName, m_now.ToString(DatePattern, DateTimeFormatInfo.InvariantInfo));
}
- if (m_countDirection >= 0)
+ if (CountDirection >= 0)
{
- fileName = CombinePath(fileName, "." + m_curSizeRollBackups);
+ fileName = CombinePath(fileName, $".{CurrentSizeRollBackups}");
}
}
return fileName;
}
- #endregion
-
- #region Initialize Options
-
/// <summary>
- /// Determines curSizeRollBackups (only within the current roll point)
+ /// Determines curSizeRollBackups (only within the current roll point)
/// </summary>
private void DetermineCurSizeRollBackups()
{
- m_curSizeRollBackups = 0;
+ CurrentSizeRollBackups = 0;
- string fullPath = null;
- string fileName = null;
+ string? fullPath;
+ string? fileName;
- using (SecurityContext.Impersonate(this))
+ using (SecurityContext?.Impersonate(this))
{
- fullPath = Path.GetFullPath(m_baseFileName);
+ fullPath = Path.GetFullPath(m_baseFileName!);
fileName = Path.GetFileName(fullPath);
}
- var arrayFiles = GetExistingFiles(fullPath);
+ List<string> arrayFiles = GetExistingFiles(fullPath);
InitializeRollBackups(fileName, arrayFiles);
- LogLog.Debug(declaringType, "curSizeRollBackups starts at [" + m_curSizeRollBackups + "]");
+ LogLog.Debug(declaringType, $"curSizeRollBackups starts at [{CurrentSizeRollBackups}]");
}
/// <summary>
/// Generates a wildcard pattern that can be used to find all files
/// that are similar to the base file name.
/// </summary>
- /// <param name="baseFileName"></param>
- /// <returns></returns>
private string GetWildcardPatternForFile(string baseFileName)
{
- if (m_preserveLogFileNameExtension)
- {
- return Path.GetFileNameWithoutExtension(baseFileName) + "*" + Path.GetExtension(baseFileName);
- }
- else
- {
- return baseFileName + '*';
- }
+ if (PreserveLogFileNameExtension)
+ return $"{Path.GetFileNameWithoutExtension(baseFileName)}*{Path.GetExtension(baseFileName)}";
+ return $"{baseFileName}*";
}
/// <summary>
- /// Builds a list of filenames for all files matching the base filename plus a file
- /// pattern.
+ /// Builds a list of filenames for all files matching the base filename plus a file pattern.
/// </summary>
- /// <param name="baseFilePath"></param>
- /// <returns></returns>
- private ArrayList GetExistingFiles(string baseFilePath)
+ protected List<string> GetExistingFiles(string baseFilePath)
{
- var alFiles = new ArrayList();
+ var alFiles = new List<string>();
- string directory = null;
-
- using (SecurityContext.Impersonate(this))
+ string? directory;
+ using (SecurityContext?.Impersonate(this))
{
var fullPath = Path.GetFullPath(baseFilePath);
@@ -807,16 +708,12 @@
var baseFileName = Path.GetFileName(fullPath);
var files = Directory.GetFiles(directory, GetWildcardPatternForFile(baseFileName));
-
- if (files != null)
+ for (var i = 0; i < files.Length; i++)
{
- for (var i = 0; i < files.Length; i++)
+ var curFileName = Path.GetFileName(files[i]);
+ if (curFileName.StartsWith(Path.GetFileNameWithoutExtension(baseFileName)))
{
- var curFileName = Path.GetFileName(files[i]);
- if (curFileName.StartsWith(Path.GetFileNameWithoutExtension(baseFileName)))
- {
- alFiles.Add(curFileName);
- }
+ alFiles.Add(curFileName);
}
}
}
@@ -830,34 +727,23 @@
/// </summary>
private void RollOverIfDateBoundaryCrossing()
{
- if (m_staticLogFileName && m_rollDate)
+ if (StaticLogFileName && m_rollDate)
{
- if (FileExists(m_baseFileName))
+ if (m_baseFileName is not null && FileExists(m_baseFileName))
{
DateTime last;
- using (SecurityContext.Impersonate(this))
- {
-#if !NET_1_0 && !CLI_1_0 && !NETCF
- if (DateTimeStrategy is UniversalDateTime)
- {
- last = System.IO.File.GetLastWriteTimeUtc(m_baseFileName);
- }
- else
- {
-#endif
- last = System.IO.File.GetLastWriteTime(m_baseFileName);
-#if !NET_1_0 && !CLI_1_0 && !NETCF
- }
-#endif
- }
- LogLog.Debug(declaringType, "[" + last.ToString(m_datePattern, DateTimeFormatInfo.InvariantInfo) + "] vs. [" + m_now.ToString(m_datePattern, DateTimeFormatInfo.InvariantInfo) + "]");
+ using (SecurityContext?.Impersonate(this))
+ last = DateTimeStrategy is UniversalDateTime
+ ? System.IO.File.GetLastWriteTimeUtc(m_baseFileName)
+ : System.IO.File.GetLastWriteTime(m_baseFileName);
+ LogLog.Debug(declaringType, $"[{last.ToString(DatePattern, DateTimeFormatInfo.InvariantInfo)}] vs. [{m_now.ToString(DatePattern, DateTimeFormatInfo.InvariantInfo)}]");
- if (!(last.ToString(m_datePattern, DateTimeFormatInfo.InvariantInfo).Equals(m_now.ToString(m_datePattern, DateTimeFormatInfo.InvariantInfo))))
+ if (!last.ToString(DatePattern, DateTimeFormatInfo.InvariantInfo).Equals(m_now.ToString(DatePattern, DateTimeFormatInfo.InvariantInfo)))
{
- m_scheduledFilename = CombinePath(m_baseFileName, last.ToString(m_datePattern, DateTimeFormatInfo.InvariantInfo));
- LogLog.Debug(declaringType, "Initial roll over to [" + m_scheduledFilename + "]");
+ m_scheduledFilename = CombinePath(m_baseFileName, last.ToString(DatePattern, DateTimeFormatInfo.InvariantInfo));
+ LogLog.Debug(declaringType, $"Initial roll over to [{m_scheduledFilename}]");
RollOverTime(false);
- LogLog.Debug(declaringType, "curSizeRollBackups after rollOver at [" + m_curSizeRollBackups + "]");
+ LogLog.Debug(declaringType, $"curSizeRollBackups after rollOver at [{CurrentSizeRollBackups}]");
}
}
}
@@ -882,32 +768,23 @@
RollOverIfDateBoundaryCrossing();
// If file exists and we are not appending then roll it out of the way
- if (AppendToFile != false)
- {
+ if (AppendToFile)
return;
- }
bool fileExists;
- var fileName = GetNextOutputFileName(m_baseFileName);
+ string fileName = GetNextOutputFileName(m_baseFileName!);
- using (SecurityContext.Impersonate(this))
- {
+ using (SecurityContext?.Impersonate(this))
fileExists = System.IO.File.Exists(fileName);
- }
if (!fileExists)
- {
return;
- }
- if (m_maxSizeRollBackups == 0)
- {
- LogLog.Debug(declaringType, "Output file [" + fileName + "] already exists. MaxSizeRollBackups is 0; cannot roll. Overwriting existing file.");
- }
+ if (MaxSizeRollBackups == 0)
+ LogLog.Debug(declaringType, $"Output file [{fileName}] already exists. MaxSizeRollBackups is 0; cannot roll. Overwriting existing file.");
else
{
- LogLog.Debug(declaringType, "Output file [" + fileName + "] already exists. Not appending to file. Rolling existing file out of the way.");
-
+ LogLog.Debug(declaringType, $"Output file [{fileName}] already exists. Not appending to file. Rolling existing file out of the way.");
RollOverRenameFiles(fileName);
}
}
@@ -926,29 +803,23 @@
curFileName = curFileName.ToLower();
baseFile = baseFile.ToLower();
if (curFileName.StartsWith(Path.GetFileNameWithoutExtension(baseFile)) == false)
- {
- // This is not a log file, so ignore
- return;
- }
+ return; // This is not a log file, so ignore
if (curFileName.Equals(baseFile))
- {
- // Base log file is not an incremented logfile (.1 or .2, etc)
- return;
- }
+ return; // Base log file is not an incremented logfile (.1 or .2, etc.)
// Only look for files in the current roll point
- if (m_rollDate && !m_staticLogFileName)
+ if (m_rollDate && !StaticLogFileName)
{
- var date = m_dateTime.Now.ToString(m_datePattern, DateTimeFormatInfo.InvariantInfo).ToLower();
- var prefix = (m_preserveLogFileNameExtension
+ var date = DateTimeStrategy.Now.ToString(DatePattern, DateTimeFormatInfo.InvariantInfo).ToLower();
+ var prefix = (PreserveLogFileNameExtension
? Path.GetFileNameWithoutExtension(baseFile) + date
: baseFile + date).ToLower();
- var suffix = m_preserveLogFileNameExtension
+ var suffix = PreserveLogFileNameExtension
? Path.GetExtension(baseFile).ToLower()
: "";
if (!curFileName.StartsWith(prefix) || !curFileName.EndsWith(suffix))
{
- LogLog.Debug(declaringType, "Ignoring file [" + curFileName + "] because it is from a different date period");
+ LogLog.Debug(declaringType, $"Ignoring file [{curFileName}] because it is from a different date period");
return;
}
}
@@ -962,42 +833,42 @@
// date patterns such as yyyyMMdd are used...those are
// valid number but aren't the kind of back up index
// we're looking for
- if (backup > m_curSizeRollBackups)
+ if (backup > CurrentSizeRollBackups)
{
- if (0 == m_maxSizeRollBackups)
+ if (0 == MaxSizeRollBackups)
{
// Stay at zero when zero backups are desired
}
- else if (-1 == m_maxSizeRollBackups)
+ else if (-1 == MaxSizeRollBackups)
{
// Infinite backups, so go as high as the highest value
- m_curSizeRollBackups = backup;
+ CurrentSizeRollBackups = backup;
}
else
{
// Backups limited to a finite number
- if (m_countDirection >= 0)
+ if (CountDirection >= 0)
{
// Go with the highest file when counting up
- m_curSizeRollBackups = backup;
+ CurrentSizeRollBackups = backup;
}
else
{
// Clip to the limit when counting down
- if (backup <= m_maxSizeRollBackups)
+ if (backup <= MaxSizeRollBackups)
{
- m_curSizeRollBackups = backup;
+ CurrentSizeRollBackups = backup;
}
}
}
- LogLog.Debug(declaringType, "File name [" + curFileName + "] moves current count to [" + m_curSizeRollBackups + "]");
+ LogLog.Debug(declaringType, $"File name [{curFileName}] moves current count to [{CurrentSizeRollBackups}]");
}
}
catch (FormatException)
{
//this happens when file.log -> file.log.yyyy-MM-dd which is normal
//when staticLogFileName == false
- LogLog.Debug(declaringType, "Encountered a backup file not ending in .x [" + curFileName + "]");
+ LogLog.Debug(declaringType, $"Encountered a backup file not ending in .x [{curFileName}]");
}
}
@@ -1008,19 +879,17 @@
/// <remarks>
/// Certain date pattern extensions like yyyyMMdd will be parsed as valid backup indexes.
/// </remarks>
- /// <param name="curFileName"></param>
- /// <returns></returns>
private int GetBackUpIndex(string curFileName)
{
var backUpIndex = -1;
var fileName = curFileName;
- if (m_preserveLogFileNameExtension)
+ if (PreserveLogFileNameExtension)
{
fileName = Path.GetFileNameWithoutExtension(fileName);
}
- var index = fileName.LastIndexOf(".");
+ var index = fileName.LastIndexOf(".", StringComparison.Ordinal);
if (index > 0)
{
// if the "yyyy-MM-dd" component of file.log.yyyy-MM-dd is passed to TryParse
@@ -1036,19 +905,13 @@
/// 'incremented' versions of the base file. Bumps the max
/// count up to the highest count seen.
/// </summary>
- /// <param name="baseFile"></param>
- /// <param name="arrayFiles"></param>
- private void InitializeRollBackups(string baseFile, ArrayList arrayFiles)
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void InitializeRollBackups(string baseFile, List<string> arrayFiles)
{
- if (null != arrayFiles)
- {
- var baseFileLower = baseFile.ToLowerInvariant();
+ var baseFileLower = baseFile.ToLowerInvariant();
- foreach (string curFileName in arrayFiles)
- {
- InitializeFromOneFile(baseFileLower, curFileName.ToLowerInvariant());
- }
- }
+ foreach (string curFileName in arrayFiles)
+ InitializeFromOneFile(baseFileLower, curFileName.ToLowerInvariant());
}
/// <summary>
@@ -1064,25 +927,26 @@
/// and hour then the smallest roll point that can be detected would be
/// and hourly roll point as minutes could not be detected.
/// </remarks>
- private RollPoint ComputeCheckPeriod(string datePattern)
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public RollPoint ComputeCheckPeriod(string datePattern)
{
// s_date1970 is 1970-01-01 00:00:00 this is UniversalSortableDateTimePattern
// (based on ISO 8601) using universal time. This date is used for reference
// purposes to calculate the resolution of the date pattern.
// Get string representation of base line date
- var r0 = s_date1970.ToString(datePattern, DateTimeFormatInfo.InvariantInfo);
+ string r0 = s_date1970.ToString(datePattern, DateTimeFormatInfo.InvariantInfo);
// Check each type of rolling mode starting with the smallest increment.
for (var i = (int)RollPoint.TopOfMinute; i <= (int)RollPoint.TopOfMonth; i++)
{
// Get string representation of next pattern
- var r1 = NextCheckDate(s_date1970, (RollPoint)i).ToString(datePattern, DateTimeFormatInfo.InvariantInfo);
+ string r1 = NextCheckDate(s_date1970, (RollPoint)i).ToString(datePattern, DateTimeFormatInfo.InvariantInfo);
- LogLog.Debug(declaringType, "Type = [" + i + "], r0 = [" + r0 + "], r1 = [" + r1 + "]");
+ LogLog.Debug(declaringType, $"Type = [{i}], r0 = [{r0}], r1 = [{r1}]");
// Check if the string representations are different
- if (r0 != null && r1 != null && !r0.Equals(r1))
+ if (!r0.Equals(r1))
{
// Found highest precision roll point
return (RollPoint)i;
@@ -1115,19 +979,14 @@
/// </remarks>
public override void ActivateOptions()
{
- if (m_dateTime == null)
+ if (m_rollDate && DatePattern != null)
{
- m_dateTime = new LocalDateTime();
- }
-
- if (m_rollDate && m_datePattern != null)
- {
- m_now = m_dateTime.Now;
- m_rollPoint = ComputeCheckPeriod(m_datePattern);
+ m_now = DateTimeStrategy.Now;
+ m_rollPoint = ComputeCheckPeriod(DatePattern);
if (m_rollPoint == RollPoint.InvalidRollPoint)
{
- throw new ArgumentException("Invalid RollPoint, unable to parse [" + m_datePattern + "]");
+ throw new ArgumentException($"Invalid RollPoint, unable to parse [{DatePattern}]");
}
// next line added as this removes the name check in rollOver
@@ -1137,38 +996,33 @@
{
if (m_rollDate)
{
- ErrorHandler.Error("Either DatePattern or rollingStyle options are not set for [" + Name + "].");
+ ErrorHandler.Error($"Either DatePattern or rollingStyle options are not set for [{Name}].");
}
}
- if (SecurityContext == null)
- {
- SecurityContext = SecurityContextProvider.DefaultProvider.CreateSecurityContext(this);
- }
+ SecurityContext ??= SecurityContextProvider.DefaultProvider.CreateSecurityContext(this);
using (SecurityContext.Impersonate(this))
{
// Must convert the FileAppender's m_filePath to an absolute path before we
// call ExistingInit(). This will be done by the base.ActivateOptions() but
// we need to duplicate that functionality here first.
- base.File = ConvertToFullPath(base.File.Trim());
+ base.File = ConvertToFullPath(base.File!.Trim());
// Store fully qualified base file name
m_baseFileName = base.File;
}
-#if !NETCF
// initialize the mutex that is used to lock rolling
m_mutexForRolling = new Mutex(false, m_baseFileName
.Replace("\\", "_")
.Replace(":", "_")
.Replace("/", "_") + "_rolling"
);
-#endif
if (m_rollDate && File != null && m_scheduledFilename == null)
{
- m_scheduledFilename = CombinePath(File, m_now.ToString(m_datePattern, DateTimeFormatInfo.InvariantInfo));
+ m_scheduledFilename = CombinePath(File, m_now.ToString(DatePattern, DateTimeFormatInfo.InvariantInfo));
}
ExistingInit();
@@ -1176,12 +1030,8 @@
base.ActivateOptions();
}
- #endregion
-
- #region Roll File
-
/// <summary>
- ///
+ /// CombinePath
/// </summary>
/// <param name="path1"></param>
/// <param name="path2">.1, .2, .3, etc.</param>
@@ -1189,14 +1039,9 @@
private string CombinePath(string path1, string path2)
{
var extension = Path.GetExtension(path1);
- if (m_preserveLogFileNameExtension && extension.Length > 0)
- {
- return Path.Combine(Path.GetDirectoryName(path1), Path.GetFileNameWithoutExtension(path1) + path2 + extension);
- }
- else
- {
- return path1 + path2;
- }
+ if (PreserveLogFileNameExtension && extension.Length > 0)
+ return Path.Combine(Path.GetDirectoryName(path1) ?? string.Empty, Path.GetFileNameWithoutExtension(path1) + path2 + extension);
+ return path1 + path2;
}
/// <summary>
@@ -1212,10 +1057,10 @@
/// </remarks>
protected void RollOverTime(bool fileIsOpen)
{
- if (m_staticLogFileName)
+ if (StaticLogFileName)
{
// Compute filename, but only if datePattern is specified
- if (m_datePattern == null)
+ if (DatePattern == null)
{
ErrorHandler.Error("Missing DatePattern option in rollOver().");
return;
@@ -1224,10 +1069,10 @@
//is the new file name equivalent to the 'current' one
//something has gone wrong if we hit this -- we should only
//roll over if the new file will be different from the old
- var dateFormat = m_now.ToString(m_datePattern, DateTimeFormatInfo.InvariantInfo);
- if (m_scheduledFilename.Equals(CombinePath(File, dateFormat)))
+ var dateFormat = m_now.ToString(DatePattern, DateTimeFormatInfo.InvariantInfo);
+ if (string.Equals(m_scheduledFilename, CombinePath(File!, dateFormat)))
{
- ErrorHandler.Error("Compare " + m_scheduledFilename + " : " + CombinePath(File, dateFormat));
+ ErrorHandler.Error($"Compare {m_scheduledFilename} : {CombinePath(File!, dateFormat)}");
return;
}
@@ -1238,26 +1083,26 @@
}
//we may have to roll over a large number of backups here
- for (var i = 1; i <= m_curSizeRollBackups; i++)
+ for (var i = 1; i <= CurrentSizeRollBackups; i++)
{
- var from = CombinePath(File, "." + i);
- var to = CombinePath(m_scheduledFilename, "." + i);
+ var from = CombinePath(File!, "." + i);
+ var to = CombinePath(m_scheduledFilename!, "." + i);
RollFile(from, to);
}
- RollFile(File, m_scheduledFilename);
+ RollFile(File!, m_scheduledFilename!);
}
//We've cleared out the old date and are ready for the new
- m_curSizeRollBackups = 0;
+ CurrentSizeRollBackups = 0;
//new scheduled name
- m_scheduledFilename = CombinePath(File, m_now.ToString(m_datePattern, DateTimeFormatInfo.InvariantInfo));
+ m_scheduledFilename = CombinePath(File!, m_now.ToString(DatePattern, DateTimeFormatInfo.InvariantInfo));
if (fileIsOpen)
{
// This will also close the file. This is OK since multiple close operations are safe.
- SafeOpenFile(m_baseFileName, false);
+ SafeOpenFile(m_baseFileName!, false);
}
}
@@ -1282,20 +1127,20 @@
// We may not have permission to move the file, or the file may be locked
try
{
- LogLog.Debug(declaringType, "Moving [" + fromFile + "] -> [" + toFile + "]");
- using (SecurityContext.Impersonate(this))
+ LogLog.Debug(declaringType, $"Moving [{fromFile}] -> [{toFile}]");
+ using (SecurityContext?.Impersonate(this))
{
System.IO.File.Move(fromFile, toFile);
}
}
catch (Exception moveEx)
{
- ErrorHandler.Error("Exception while rolling file [" + fromFile + "] -> [" + toFile + "]", moveEx, ErrorCode.GenericFailure);
+ ErrorHandler.Error($"Exception while rolling file [{fromFile}] -> [{toFile}]", moveEx, ErrorCode.GenericFailure);
}
}
else
{
- LogLog.Warn(declaringType, "Cannot RollFile [" + fromFile + "] -> [" + toFile + "]. Source does not exist");
+ LogLog.Warn(declaringType, $"Cannot RollFile [{fromFile}] -> [{toFile}]. Source does not exist");
}
}
@@ -1311,7 +1156,7 @@
/// </remarks>
protected bool FileExists(string path)
{
- using (SecurityContext.Impersonate(this))
+ using (SecurityContext?.Impersonate(this))
{
return System.IO.File.Exists(path);
}
@@ -1323,7 +1168,7 @@
/// <param name="fileName">The file to delete.</param>
/// <remarks>
/// <para>
- /// Delete a file if is exists.
+ /// Delete a file if it exists.
/// The file is first moved to a new filename then deleted.
/// This allows the file to be removed even when it cannot
/// be deleted, but it still can be moved.
@@ -1342,7 +1187,7 @@
var tempFileName = fileName + "." + Environment.TickCount + ".DeletePending";
try
{
- using (SecurityContext.Impersonate(this))
+ using (SecurityContext?.Impersonate(this))
{
System.IO.File.Move(fileName, tempFileName);
}
@@ -1350,30 +1195,30 @@
}
catch (Exception moveEx)
{
- LogLog.Debug(declaringType, "Exception while moving file to be deleted [" + fileName + "] -> [" + tempFileName + "]", moveEx);
+ LogLog.Debug(declaringType, $"Exception while moving file to be deleted [{fileName}] -> [{tempFileName}]", moveEx);
}
// Try to delete the file (either the original or the moved file)
try
{
- using (SecurityContext.Impersonate(this))
+ using (SecurityContext?.Impersonate(this))
{
System.IO.File.Delete(fileToDelete);
}
- LogLog.Debug(declaringType, "Deleted file [" + fileName + "]");
+ LogLog.Debug(declaringType, $"Deleted file [{fileName}]");
}
catch (Exception deleteEx)
{
if (fileToDelete == fileName)
{
// Unable to move or delete the file
- ErrorHandler.Error("Exception while deleting file [" + fileToDelete + "]", deleteEx, ErrorCode.GenericFailure);
+ ErrorHandler.Error($"Exception while deleting file [{fileToDelete}]", deleteEx, ErrorCode.GenericFailure);
}
else
{
// Moved the file, but the delete failed. File is probably locked.
// The file should automatically be deleted when the lock is released.
- LogLog.Debug(declaringType, "Exception while deleting temp file [" + fileToDelete + "]", deleteEx);
+ LogLog.Debug(declaringType, $"Exception while deleting temp file [{fileToDelete}]", deleteEx);
}
}
}
@@ -1409,20 +1254,23 @@
{
CloseFile(); // keep windows happy.
- LogLog.Debug(declaringType, "rolling over count [" + ((CountingQuietTextWriter)QuietWriter).Count + "]");
- LogLog.Debug(declaringType, "maxSizeRollBackups [" + m_maxSizeRollBackups + "]");
- LogLog.Debug(declaringType, "curSizeRollBackups [" + m_curSizeRollBackups + "]");
- LogLog.Debug(declaringType, "countDirection [" + m_countDirection + "]");
+ LogLog.Debug(declaringType, $"rolling over count [{((CountingQuietTextWriter)QuietWriter!).Count}]");
+ LogLog.Debug(declaringType, $"maxSizeRollBackups [{MaxSizeRollBackups}]");
+ LogLog.Debug(declaringType, $"curSizeRollBackups [{CurrentSizeRollBackups}]");
+ LogLog.Debug(declaringType, $"countDirection [{CountDirection}]");
- RollOverRenameFiles(File);
-
- if (!m_staticLogFileName && m_countDirection >= 0)
+ if (File is not null)
{
- m_curSizeRollBackups++;
+ RollOverRenameFiles(File);
+ }
+
+ if (!StaticLogFileName && CountDirection >= 0)
+ {
+ CurrentSizeRollBackups++;
}
// This will also close the file. This is OK since multiple close operations are safe.
- SafeOpenFile(m_baseFileName, false);
+ SafeOpenFile(m_baseFileName!, false);
}
/// <summary>
@@ -1454,24 +1302,24 @@
protected void RollOverRenameFiles(string baseFileName)
{
// If maxBackups <= 0, then there is no file renaming to be done.
- if (m_maxSizeRollBackups != 0)
+ if (MaxSizeRollBackups != 0)
{
- if (m_countDirection < 0)
+ if (CountDirection < 0)
{
// Delete the oldest file, to keep Windows happy.
- if (m_curSizeRollBackups == m_maxSizeRollBackups)
+ if (CurrentSizeRollBackups == MaxSizeRollBackups)
{
- DeleteFile(CombinePath(baseFileName, "." + m_maxSizeRollBackups));
- m_curSizeRollBackups--;
+ DeleteFile(CombinePath(baseFileName, "." + MaxSizeRollBackups));
+ CurrentSizeRollBackups--;
}
// Map {(maxBackupIndex - 1), ..., 2, 1} to {maxBackupIndex, ..., 3, 2}
- for (var i = m_curSizeRollBackups; i >= 1; i--)
+ for (var i = CurrentSizeRollBackups; i >= 1; i--)
{
RollFile((CombinePath(baseFileName, "." + i)), (CombinePath(baseFileName, "." + (i + 1))));
}
- m_curSizeRollBackups++;
+ CurrentSizeRollBackups++;
// Rename fileName to fileName.1
RollFile(baseFileName, CombinePath(baseFileName, ".1"));
@@ -1479,13 +1327,13 @@
else
{
//countDirection >= 0
- if (m_curSizeRollBackups >= m_maxSizeRollBackups && m_maxSizeRollBackups > 0)
+ if (CurrentSizeRollBackups >= MaxSizeRollBackups && MaxSizeRollBackups > 0)
{
//delete the first and keep counting up.
- var oldestFileIndex = m_curSizeRollBackups - m_maxSizeRollBackups;
+ var oldestFileIndex = CurrentSizeRollBackups - MaxSizeRollBackups;
// If static then there is 1 file without a number, therefore 1 less archive
- if (m_staticLogFileName)
+ if (StaticLogFileName)
{
oldestFileIndex++;
}
@@ -1494,13 +1342,13 @@
// If not using a static log file then the baseFileName will already have a numbered postfix which
// we must remove, however it may have a date postfix which we must keep!
var archiveFileBaseName = baseFileName;
- if (!m_staticLogFileName)
+ if (!StaticLogFileName)
{
- if (m_preserveLogFileNameExtension)
+ if (PreserveLogFileNameExtension)
{
var extension = Path.GetExtension(archiveFileBaseName);
var baseName = Path.GetFileNameWithoutExtension(archiveFileBaseName);
- var lastDotIndex = baseName.LastIndexOf(".");
+ var lastDotIndex = baseName.LastIndexOf(".", StringComparison.Ordinal);
if (lastDotIndex >= 0)
{
archiveFileBaseName = baseName.Substring(0, lastDotIndex) + extension;
@@ -1508,7 +1356,7 @@
}
else
{
- var lastDotIndex = archiveFileBaseName.LastIndexOf(".");
+ var lastDotIndex = archiveFileBaseName.LastIndexOf(".", StringComparison.Ordinal);
if (lastDotIndex >= 0)
{
archiveFileBaseName = archiveFileBaseName.Substring(0, lastDotIndex);
@@ -1520,19 +1368,15 @@
DeleteFile(CombinePath(archiveFileBaseName, "." + oldestFileIndex));
}
- if (m_staticLogFileName)
+ if (StaticLogFileName)
{
- m_curSizeRollBackups++;
- RollFile(baseFileName, CombinePath(baseFileName, "." + m_curSizeRollBackups));
+ CurrentSizeRollBackups++;
+ RollFile(baseFileName, CombinePath(baseFileName, "." + CurrentSizeRollBackups));
}
}
}
}
- #endregion
-
- #region NextCheckDate
-
/// <summary>
/// Get the start time of the next window for the current rollpoint
/// </summary>
@@ -1615,29 +1459,12 @@
return current;
}
- #endregion
-
- #region Private Instance Fields
-
- /// <summary>
- /// This object supplies the current date/time. Allows test code to plug in
- /// a method to control this class when testing date/time based rolling. The default
- /// implementation uses the underlying value of DateTime.Now.
- /// </summary>
- private IDateTime m_dateTime = null;
-
- /// <summary>
- /// The date pattern. By default, the pattern is set to <c>".yyyy-MM-dd"</c>
- /// meaning daily rollover.
- /// </summary>
- private string m_datePattern = ".yyyy-MM-dd";
-
/// <summary>
/// The actual formatted filename that is currently being written to
/// or will be the file transferred to on roll over
/// (based on staticLogFileName).
/// </summary>
- private string m_scheduledFilename = null;
+ private string? m_scheduledFilename;
/// <summary>
/// The timestamp when we shall next recompute the filename.
@@ -1655,24 +1482,9 @@
private RollPoint m_rollPoint;
/// <summary>
- /// The default maximum file size is 10MB
- /// </summary>
- private long m_maxFileSize = 10 * 1024 * 1024;
-
- /// <summary>
- /// There is zero backup files by default
- /// </summary>
- private int m_maxSizeRollBackups = 0;
-
- /// <summary>
/// How many sized based backups have been made so far
/// </summary>
- private int m_curSizeRollBackups = 0;
-
- /// <summary>
- /// The rolling file count direction.
- /// </summary>
- private int m_countDirection = -1;
+ public int CurrentSizeRollBackups { get; set; }
/// <summary>
/// The rolling mode used in this appender.
@@ -1690,105 +1502,18 @@
private bool m_rollSize = true;
/// <summary>
- /// Value indicating whether to always log to the same file.
- /// </summary>
- private bool m_staticLogFileName = true;
-
- /// <summary>
- /// Value indicating whether to preserve the file name extension when rolling.
- /// </summary>
- private bool m_preserveLogFileNameExtension = false;
-
-
- /// <summary>
/// FileName provided in configuration. Used for rolling properly
/// </summary>
- private string m_baseFileName;
+ private string? m_baseFileName;
-#if !NETCF
/// <summary>
/// A mutex that is used to lock rolling of files.
/// </summary>
- private Mutex m_mutexForRolling;
-#endif
-
- #endregion Private Instance Fields
-
- #region Static Members
+ private Mutex? m_mutexForRolling;
/// <summary>
/// The 1st of January 1970 in UTC
/// </summary>
private static readonly DateTime s_date1970 = new DateTime(1970, 1, 1);
-
- #endregion
-
- #region DateTime
-
- /// <summary>
- /// This interface is used to supply Date/Time information to the <see cref="RollingFileAppender"/>.
- /// </summary>
- /// <remarks>
- /// This interface is used to supply Date/Time information to the <see cref="RollingFileAppender"/>.
- /// Used primarily to allow test classes to plug themselves in so they can
- /// supply test date/times.
- /// </remarks>
- public interface IDateTime
- {
- /// <summary>
- /// Gets the <i>current</i> time.
- /// </summary>
- /// <value>The <i>current</i> time.</value>
- /// <remarks>
- /// <para>
- /// Gets the <i>current</i> time.
- /// </para>
- /// </remarks>
- DateTime Now { get; }
- }
-
- /// <summary>
- /// Default implementation of <see cref="IDateTime"/> that returns the current time.
- /// </summary>
- private class LocalDateTime : IDateTime
- {
- /// <summary>
- /// Gets the <b>current</b> time.
- /// </summary>
- /// <value>The <b>current</b> time.</value>
- /// <remarks>
- /// <para>
- /// Gets the <b>current</b> time.
- /// </para>
- /// </remarks>
- public DateTime Now
- {
- get { return DateTime.Now; }
- }
- }
-
-#if !NET_1_0 && !CLI_1_0 && !NETCF
- /// <summary>
- /// Implementation of <see cref="IDateTime"/> that returns the current time as the coordinated universal time (UTC).
- /// </summary>
- private class UniversalDateTime : IDateTime
- {
- /// <summary>
- /// Gets the <b>current</b> time.
- /// </summary>
- /// <value>The <b>current</b> time.</value>
- /// <remarks>
- /// <para>
- /// Gets the <b>current</b> time.
- /// </para>
- /// </remarks>
- public DateTime Now
- {
- get { return DateTime.UtcNow; }
- }
- }
-#endif
-
- #endregion DateTime
}
-}
+}
\ No newline at end of file
diff --git a/src/log4net/Appender/SmtpAppender.cs b/src/log4net/Appender/SmtpAppender.cs
index 58f822b..bc00111 100644
--- a/src/log4net/Appender/SmtpAppender.cs
+++ b/src/log4net/Appender/SmtpAppender.cs
@@ -1,4 +1,3 @@
-#if NET_2_0 || NETSTANDARD2_0
#region Apache License
//
// Licensed to the Apache Software Foundation (ASF) under one or more
@@ -18,20 +17,11 @@
//
#endregion
-// .NET Compact Framework 1.0 has no support for System.Web.Mail
-// SSCLI 1.0 has no support for System.Web.Mail
-#if !NETCF && !SSCLI
-
using System;
using System.IO;
using System.Text;
-#if NET_2_0 || MONO_2_0 || NETSTANDARD2_0
using System.Net.Mail;
-#else
-using System.Web.Mail;
-#endif
-
using log4net.Core;
namespace log4net.Appender
@@ -49,13 +39,6 @@
/// cyclic buffer. This keeps memory requirements at a reasonable level while
/// still delivering useful application context.
/// </para>
- /// <note type="caution">
- /// Authentication and setting the server Port are only available on the MS .NET 1.1 runtime.
- /// For these features to be enabled you need to ensure that you are using a version of
- /// the log4net assembly that is built against the MS .NET 1.1 framework and that you are
- /// running the your application on the MS .NET 1.1 runtime. On all other platforms only sending
- /// unauthenticated messages to a server listening on port 25 (the default) is supported.
- /// </note>
/// <para>
/// Authentication is supported by setting the <see cref="Authentication"/> property to
/// either <see cref="SmtpAuthentication.Basic"/> or <see cref="SmtpAuthentication.Ntlm"/>.
@@ -70,8 +53,6 @@
/// <author>Gert Driesen</author>
public class SmtpAppender : BufferingAppenderSkeleton
{
- #region Public Instance Constructors
-
/// <summary>
/// Default constructor
/// </summary>
@@ -84,59 +65,23 @@
{
}
- #endregion // Public Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
- /// Gets or sets a comma- or semicolon-delimited list of recipient e-mail addresses (use semicolon on .NET 1.1 and comma for later versions).
+ /// Gets or sets a comma-delimited list of recipient e-mail addresses.
/// </summary>
- /// <value>
- /// <para>
- /// For .NET 1.1 (System.Web.Mail): A semicolon-delimited list of e-mail addresses.
- /// </para>
- /// <para>
- /// For .NET 2.0 (System.Net.Mail): A comma-delimited list of e-mail addresses.
- /// </para>
- /// </value>
- /// <remarks>
- /// <para>
- /// For .NET 1.1 (System.Web.Mail): A semicolon-delimited list of e-mail addresses.
- /// </para>
- /// <para>
- /// For .NET 2.0 (System.Net.Mail): A comma-delimited list of e-mail addresses.
- /// </para>
- /// </remarks>
- public string To
+ public string? To
{
get { return m_to; }
set { m_to = MaybeTrimSeparators(value); }
}
/// <summary>
- /// Gets or sets a comma- or semicolon-delimited list of recipient e-mail addresses
- /// that will be carbon copied (use semicolon on .NET 1.1 and comma for later versions).
+ /// Gets or sets a comma-delimited list of recipient e-mail addresses
+ /// that will be carbon copied.
/// </summary>
- /// <value>
- /// <para>
- /// For .NET 1.1 (System.Web.Mail): A semicolon-delimited list of e-mail addresses.
- /// </para>
- /// <para>
- /// For .NET 2.0 (System.Net.Mail): A comma-delimited list of e-mail addresses.
- /// </para>
- /// </value>
- /// <remarks>
- /// <para>
- /// For .NET 1.1 (System.Web.Mail): A semicolon-delimited list of e-mail addresses.
- /// </para>
- /// <para>
- /// For .NET 2.0 (System.Net.Mail): A comma-delimited list of e-mail addresses.
- /// </para>
- /// </remarks>
- public string Cc
+ public string? Cc
{
- get { return m_cc; }
- set { m_cc = MaybeTrimSeparators(value); }
+ get => m_cc;
+ set => m_cc = MaybeTrimSeparators(value);
}
/// <summary>
@@ -151,10 +96,10 @@
/// A semicolon-delimited list of recipient e-mail addresses.
/// </para>
/// </remarks>
- public string Bcc
+ public string? Bcc
{
- get { return m_bcc; }
- set { m_bcc = MaybeTrimSeparators(value); }
+ get => m_bcc;
+ set => m_bcc = MaybeTrimSeparators(value);
}
/// <summary>
@@ -168,11 +113,7 @@
/// The e-mail address of the sender.
/// </para>
/// </remarks>
- public string From
- {
- get { return m_from; }
- set { m_from = value; }
- }
+ public string? From { get; set; }
/// <summary>
/// Gets or sets the subject line of the e-mail message.
@@ -185,11 +126,7 @@
/// The subject line of the e-mail message.
/// </para>
/// </remarks>
- public string Subject
- {
- get { return m_subject; }
- set { m_subject = value; }
- }
+ public string? Subject { get; set; }
/// <summary>
/// Gets or sets the name of the SMTP relay mail server to use to send
@@ -205,11 +142,7 @@
/// name of the local SMTP server is used.
/// </para>
/// </remarks>
- public string SmtpHost
- {
- get { return m_smtpHost; }
- set { m_smtpHost = value; }
- }
+ public string? SmtpHost { get; set; }
/// <summary>
/// Obsolete
@@ -233,7 +166,6 @@
/// The mode to use to authentication with the SMTP server
/// </summary>
/// <remarks>
- /// <note type="caution">Authentication is only available on the MS .NET 1.1 runtime.</note>
/// <para>
/// Valid Authentication mode values are: <see cref="SmtpAuthentication.None"/>,
/// <see cref="SmtpAuthentication.Basic"/>, and <see cref="SmtpAuthentication.Ntlm"/>.
@@ -244,62 +176,42 @@
/// thread, if impersonating, or the process will be used to authenticate.
/// </para>
/// </remarks>
- public SmtpAuthentication Authentication
- {
- get { return m_authentication; }
- set { m_authentication = value; }
- }
+ public SmtpAuthentication Authentication { get; set; } = SmtpAuthentication.None;
/// <summary>
/// The username to use to authenticate with the SMTP server
/// </summary>
/// <remarks>
- /// <note type="caution">Authentication is only available on the MS .NET 1.1 runtime.</note>
/// <para>
/// A <see cref="Username"/> and <see cref="Password"/> must be specified when
/// <see cref="Authentication"/> is set to <see cref="SmtpAuthentication.Basic"/>,
/// otherwise the username will be ignored.
/// </para>
/// </remarks>
- public string Username
- {
- get { return m_username; }
- set { m_username = value; }
- }
+ public string? Username { get; set; }
/// <summary>
/// The password to use to authenticate with the SMTP server
/// </summary>
/// <remarks>
- /// <note type="caution">Authentication is only available on the MS .NET 1.1 runtime.</note>
/// <para>
/// A <see cref="Username"/> and <see cref="Password"/> must be specified when
/// <see cref="Authentication"/> is set to <see cref="SmtpAuthentication.Basic"/>,
/// otherwise the password will be ignored.
/// </para>
/// </remarks>
- public string Password
- {
- get { return m_password; }
- set { m_password = value; }
- }
+ public string? Password { get; set; }
/// <summary>
/// The port on which the SMTP server is listening
/// </summary>
/// <remarks>
- /// <note type="caution">Server Port is only available on the MS .NET 1.1 runtime.</note>
/// <para>
/// The port on which the SMTP server is listening. The default
- /// port is <c>25</c>. The Port can only be changed when running on
- /// the MS .NET 1.1 runtime.
+ /// port is <c>25</c>.
/// </para>
/// </remarks>
- public int Port
- {
- get { return m_port; }
- set { m_port = value; }
- }
+ public int Port { get; set; } = 25;
/// <summary>
/// Gets or sets the priority of the e-mail message
@@ -317,37 +229,20 @@
/// you may want to set the priority to <see cref="MailPriority.High"/>.
/// </para>
/// </remarks>
- public MailPriority Priority
- {
- get { return m_mailPriority; }
- set { m_mailPriority = value; }
- }
+ public MailPriority Priority { get; set; } = MailPriority.Normal;
-#if NET_2_0 || MONO_2_0 || NETSTANDARD2_0
/// <summary>
/// Enable or disable use of SSL when sending e-mail message
/// </summary>
/// <remarks>
/// This is available on MS .NET 2.0 runtime and higher
/// </remarks>
- public bool EnableSsl
- {
- get { return m_enableSsl; }
- set { m_enableSsl = value; }
- }
+ public bool EnableSsl { get; set; }
/// <summary>
/// Gets or sets the reply-to e-mail address.
/// </summary>
- /// <remarks>
- /// This is available on MS .NET 2.0 runtime and higher
- /// </remarks>
- public string ReplyTo
- {
- get { return m_replyTo; }
- set { m_replyTo = value; }
- }
-#endif
+ public string? ReplyTo { get; set; }
/// <summary>
/// Gets or sets the subject encoding to be used.
@@ -355,11 +250,7 @@
/// <remarks>
/// The default encoding is the operating system's current ANSI codepage.
/// </remarks>
- public Encoding SubjectEncoding
- {
- get { return m_subjectEncoding; }
- set { m_subjectEncoding = value; }
- }
+ public Encoding SubjectEncoding { get; set; } = Encoding.UTF8;
/// <summary>
/// Gets or sets the body encoding to be used.
@@ -367,15 +258,7 @@
/// <remarks>
/// The default encoding is the operating system's current ANSI codepage.
/// </remarks>
- public Encoding BodyEncoding
- {
- get { return m_bodyEncoding; }
- set { m_bodyEncoding = value; }
- }
-
- #endregion // Public Instance Properties
-
- #region Override implementation of BufferingAppenderSkeleton
+ public Encoding BodyEncoding { get; set; } = Encoding.UTF8;
/// <summary>
/// Sends the contents of the cyclic buffer as an e-mail message.
@@ -387,12 +270,11 @@
// appender. This frees us from needing to synchronize again.
try
{
- using StringWriter writer = new StringWriter(System.Globalization.CultureInfo.InvariantCulture);
+ using var writer = new StringWriter(System.Globalization.CultureInfo.InvariantCulture);
- string t = Layout.Header;
- if (t != null)
+ if (Layout?.Header is string header)
{
- writer.Write(t);
+ writer.Write(header);
}
for (int i = 0; i < events.Length; i++)
@@ -401,10 +283,9 @@
RenderLoggingEvent(writer, events[i]);
}
- t = Layout.Footer;
- if (t != null)
+ if (Layout?.Footer is string footer)
{
- writer.Write(t);
+ writer.Write(footer);
}
SendEmail(writer.ToString());
@@ -415,27 +296,10 @@
}
}
- #endregion // Override implementation of BufferingAppenderSkeleton
-
- #region Override implementation of AppenderSkeleton
-
/// <summary>
/// This appender requires a <see cref="Layout"/> to be set.
/// </summary>
- /// <value><c>true</c></value>
- /// <remarks>
- /// <para>
- /// This appender requires a <see cref="Layout"/> to be set.
- /// </para>
- /// </remarks>
- protected override bool RequiresLayout
- {
- get { return true; }
- }
-
- #endregion // Override implementation of AppenderSkeleton
-
- #region Protected Methods
+ protected override bool RequiresLayout => true;
/// <summary>
/// Send the email message
@@ -443,178 +307,63 @@
/// <param name="messageBody">the body text to include in the mail</param>
protected virtual void SendEmail(string messageBody)
{
-#if NET_2_0 || MONO_2_0 || NETSTANDARD2_0
- // .NET 2.0 has a new API for SMTP email System.Net.Mail
- // This API supports credentials and multiple hosts correctly.
- // The old API is deprecated.
-
// Create and configure the smtp client
-#if NET_4_0 || MONO_4_0 || NETSTANDARD2_0
- using SmtpClient smtpClient = new SmtpClient();
-#else
- SmtpClient smtpClient = new SmtpClient();
-#endif
- if (!String.IsNullOrEmpty(m_smtpHost))
+#pragma warning disable CS0618 // Type or member is obsolete
+ using var smtpClient = new SmtpClient();
+#pragma warning restore CS0618 // Type or member is obsolete
+ if (!string.IsNullOrEmpty(SmtpHost))
{
- smtpClient.Host = m_smtpHost;
+ smtpClient.Host = SmtpHost;
}
- smtpClient.Port = m_port;
+ smtpClient.Port = Port;
smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
- smtpClient.EnableSsl = m_enableSsl;
+ smtpClient.EnableSsl = EnableSsl;
- if (m_authentication == SmtpAuthentication.Basic)
+ if (Authentication == SmtpAuthentication.Basic)
{
// Perform basic authentication
- smtpClient.Credentials = new System.Net.NetworkCredential(m_username, m_password);
+ smtpClient.Credentials = new System.Net.NetworkCredential(Username, Password);
}
- else if (m_authentication == SmtpAuthentication.Ntlm)
+ else if (Authentication == SmtpAuthentication.Ntlm)
{
// Perform integrated authentication (NTLM)
smtpClient.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
}
- using (MailMessage mailMessage = new MailMessage())
+ using (var mailMessage = new MailMessage())
{
mailMessage.Body = messageBody;
- mailMessage.BodyEncoding = m_bodyEncoding;
- mailMessage.From = new MailAddress(m_from);
+ mailMessage.BodyEncoding = BodyEncoding;
+ mailMessage.From = new MailAddress(From);
mailMessage.To.Add(m_to);
- if (!String.IsNullOrEmpty(m_cc))
+ if (!string.IsNullOrEmpty(m_cc))
{
mailMessage.CC.Add(m_cc);
}
- if (!String.IsNullOrEmpty(m_bcc))
+ if (!string.IsNullOrEmpty(m_bcc))
{
mailMessage.Bcc.Add(m_bcc);
}
- if (!String.IsNullOrEmpty(m_replyTo))
+ if (!string.IsNullOrEmpty(ReplyTo))
{
- // .NET 4.0 warning CS0618: 'System.Net.Mail.MailMessage.ReplyTo' is obsolete:
- // 'ReplyTo is obsoleted for this type. Please use ReplyToList instead which can accept multiple addresses. http://go.microsoft.com/fwlink/?linkid=14202'
-#if !NET_4_0 && !MONO_4_0 && !NETSTANDARD2_0
- mailMessage.ReplyTo = new MailAddress(m_replyTo);
-#else
- mailMessage.ReplyToList.Add(new MailAddress(m_replyTo));
-#endif
+ mailMessage.ReplyToList.Add(new MailAddress(ReplyTo));
}
- mailMessage.Subject = m_subject;
- mailMessage.SubjectEncoding = m_subjectEncoding;
- mailMessage.Priority = m_mailPriority;
+ mailMessage.Subject = Subject;
+ mailMessage.SubjectEncoding = SubjectEncoding;
+ mailMessage.Priority = Priority;
- // TODO: Consider using SendAsync to send the message without blocking. This would be a change in
- // behaviour compared to .NET 1.x. We would need a SendCompletedCallback to log errors.
+ // TODO: Consider using SendAsync to send the message without blocking. We would need a SendCompletedCallback to log errors.
smtpClient.Send(mailMessage);
}
-#else
- // .NET 1.x uses the System.Web.Mail API for sending Mail
-
- MailMessage mailMessage = new MailMessage();
- mailMessage.Body = messageBody;
- mailMessage.BodyEncoding = m_bodyEncoding;
- mailMessage.From = m_from;
- mailMessage.To = m_to;
- if (m_cc != null && m_cc.Length > 0)
- {
- mailMessage.Cc = m_cc;
- }
- if (m_bcc != null && m_bcc.Length > 0)
- {
- mailMessage.Bcc = m_bcc;
- }
- mailMessage.Subject = m_subject;
-#if !MONO && !NET_1_0 && !NET_1_1 && !CLI_1_0
- mailMessage.SubjectEncoding = m_subjectEncoding;
-#endif
- mailMessage.Priority = m_mailPriority;
-
-#if NET_1_1
- // The Fields property on the MailMessage allows the CDO properties to be set directly.
- // This property is only available on .NET Framework 1.1 and the implementation must understand
- // the CDO properties. For details of the fields available in CDO see:
- //
- // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_configuration_coclass.asp
- //
-
- try
- {
- if (m_authentication == SmtpAuthentication.Basic)
- {
- // Perform basic authentication
- mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", 1);
- mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", m_username);
- mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", m_password);
- }
- else if (m_authentication == SmtpAuthentication.Ntlm)
- {
- // Perform integrated authentication (NTLM)
- mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", 2);
- }
-
- // Set the port if not the default value
- if (m_port != 25)
- {
- mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", m_port);
- }
- }
- catch(MissingMethodException missingMethodException)
- {
- // If we were compiled against .NET 1.1 but are running against .NET 1.0 then
- // we will get a MissingMethodException when accessing the MailMessage.Fields property.
-
- ErrorHandler.Error("SmtpAppender: Authentication and server Port are only supported when running on the MS .NET 1.1 framework", missingMethodException);
- }
-#else
- if (m_authentication != SmtpAuthentication.None)
- {
- ErrorHandler.Error("SmtpAppender: Authentication is only supported on the MS .NET 1.1 or MS .NET 2.0 builds of log4net");
- }
-
- if (m_port != 25)
- {
- ErrorHandler.Error("SmtpAppender: Server Port is only supported on the MS .NET 1.1 or MS .NET 2.0 builds of log4net");
- }
-#endif // if NET_1_1
-
- if (m_smtpHost != null && m_smtpHost.Length > 0)
- {
- SmtpMail.SmtpServer = m_smtpHost;
- }
-
- SmtpMail.Send(mailMessage);
-#endif // if NET_2_0
}
- #endregion // Protected Methods
-
- #region Private Instance Fields
-
- private string m_to;
- private string m_cc;
- private string m_bcc;
- private string m_from;
- private string m_subject;
- private string m_smtpHost;
- private Encoding m_subjectEncoding = Encoding.UTF8;
- private Encoding m_bodyEncoding = Encoding.UTF8;
+ private string? m_to;
+ private string? m_cc;
+ private string? m_bcc;
// authentication fields
- private SmtpAuthentication m_authentication = SmtpAuthentication.None;
- private string m_username;
- private string m_password;
// server port, default port 25
- private int m_port = 25;
-
- private MailPriority m_mailPriority = MailPriority.Normal;
-
-#if NET_2_0 || MONO_2_0 || NETSTANDARD2_0
- private bool m_enableSsl = false;
- private string m_replyTo;
-#endif
-
- #endregion // Private Instance Fields
-
- #region SmtpAuthentication Enum
/// <summary>
/// Values for the <see cref="SmtpAppender.Authentication"/> property.
@@ -647,24 +396,16 @@
/// </remarks>
Ntlm
}
-
- #endregion // SmtpAuthentication Enum
-
- private static readonly char[] ADDRESS_DELIMITERS = new char[] { ',', ';' };
+
+ // Allow semicolon delimiters for backward compatibility.
+ private static readonly char[] ADDRESS_DELIMITERS = { ',', ';' };
/// <summary>
/// trims leading and trailing commas or semicolons
/// </summary>
- private static string MaybeTrimSeparators(string s)
+ private static string? MaybeTrimSeparators(string? s)
{
-#if NET_2_0 || MONO_2_0 || NETSTANDARD2_0
- return string.IsNullOrEmpty(s) ? s : s.Trim(ADDRESS_DELIMITERS);
-#else
- return s != null && s.Length > 0 ? s : s.Trim(ADDRESS_DELIMITERS);
-#endif
+ return s?.Trim(ADDRESS_DELIMITERS);
}
}
-}
-
-#endif // !NETCF && !SSCLI
-#endif // NET_2_0
+}
\ No newline at end of file
diff --git a/src/log4net/Appender/SmtpPickupDirAppender.cs b/src/log4net/Appender/SmtpPickupDirAppender.cs
index 8a0fab0..211b7f8 100644
--- a/src/log4net/Appender/SmtpPickupDirAppender.cs
+++ b/src/log4net/Appender/SmtpPickupDirAppender.cs
@@ -50,75 +50,20 @@
/// <author>Nicko Cadell</author>
public class SmtpPickupDirAppender : BufferingAppenderSkeleton
{
- #region Public Instance Constructors
-
- /// <summary>
- /// Default constructor
- /// </summary>
- /// <remarks>
- /// <para>
- /// Default constructor
- /// </para>
- /// </remarks>
- public SmtpPickupDirAppender()
- {
- m_fileExtension = string.Empty; // Default to empty string, not null
- }
-
- #endregion Public Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
/// Gets or sets a semicolon-delimited list of recipient e-mail addresses.
/// </summary>
- /// <value>
- /// A semicolon-delimited list of e-mail addresses.
- /// </value>
- /// <remarks>
- /// <para>
- /// A semicolon-delimited list of e-mail addresses.
- /// </para>
- /// </remarks>
- public string To
- {
- get { return m_to; }
- set { m_to = value; }
- }
+ public string? To { get; set; }
/// <summary>
/// Gets or sets the e-mail address of the sender.
/// </summary>
- /// <value>
- /// The e-mail address of the sender.
- /// </value>
- /// <remarks>
- /// <para>
- /// The e-mail address of the sender.
- /// </para>
- /// </remarks>
- public string From
- {
- get { return m_from; }
- set { m_from = value; }
- }
+ public string? From { get; set; }
/// <summary>
/// Gets or sets the subject line of the e-mail message.
/// </summary>
- /// <value>
- /// The subject line of the e-mail message.
- /// </value>
- /// <remarks>
- /// <para>
- /// The subject line of the e-mail message.
- /// </para>
- /// </remarks>
- public string Subject
- {
- get { return m_subject; }
- set { m_subject = value; }
- }
+ public string? Subject { get; set; }
/// <summary>
/// Gets or sets the path to write the messages to.
@@ -129,39 +74,19 @@
/// as that used by the agent sending the messages.
/// </para>
/// </remarks>
- public string PickupDir
- {
- get { return m_pickupDir; }
- set { m_pickupDir = value; }
- }
+ public string? PickupDir { get; set; }
/// <summary>
/// Gets or sets the file extension for the generated files
/// </summary>
- /// <value>
- /// The file extension for the generated files
- /// </value>
- /// <remarks>
- /// <para>
- /// The file extension for the generated files
- /// </para>
- /// </remarks>
- public string FileExtension
+ public string? FileExtension
{
- get { return m_fileExtension; }
+ get => m_fileExtension;
set
{
- m_fileExtension = value;
- if (m_fileExtension == null)
- {
- m_fileExtension = string.Empty;
- }
- // Make sure any non empty extension starts with a dot
-#if NET_2_0 || MONO_2_0 || NETSTANDARD
+ m_fileExtension = value ?? string.Empty;
+ // Make sure any non-empty extension starts with a dot
if (!string.IsNullOrEmpty(m_fileExtension) && !m_fileExtension.StartsWith("."))
-#else
- if (m_fileExtension != null && m_fileExtension.Length > 0 && !m_fileExtension.StartsWith("."))
-#endif
{
m_fileExtension = "." + m_fileExtension;
}
@@ -182,15 +107,7 @@
/// of the current thread.
/// </para>
/// </remarks>
- public SecurityContext SecurityContext
- {
- get { return m_securityContext; }
- set { m_securityContext = value; }
- }
-
- #endregion Public Instance Properties
-
- #region Override implementation of BufferingAppenderSkeleton
+ public SecurityContext? SecurityContext { get; set; }
/// <summary>
/// Sends the contents of the cyclic buffer as an e-mail message.
@@ -207,51 +124,43 @@
// appender. This frees us from needing to synchronize again.
try
{
- string filePath = null;
- StreamWriter writer = null;
+ StreamWriter writer;
// Impersonate to open the file
- using (SecurityContext.Impersonate(this))
+ string filePath = Path.Combine(PickupDir, Guid.NewGuid().ToString("N") + m_fileExtension);
+ using (SecurityContext?.Impersonate(this))
{
- filePath = Path.Combine(m_pickupDir, SystemInfo.NewGuid().ToString("N") + m_fileExtension);
writer = File.CreateText(filePath);
}
- if (writer == null)
+ using (writer)
{
- ErrorHandler.Error("Failed to create output file for writing [" + filePath + "]", null, ErrorCode.FileOpenFailure);
- }
- else
- {
- using (writer)
+ writer.WriteLine("To: " + To);
+ writer.WriteLine("From: " + From);
+ writer.WriteLine("Subject: " + Subject);
+ writer.WriteLine("Date: " + DateTime.UtcNow.ToString("r"));
+ writer.WriteLine();
+
+ string? t = Layout?.Header;
+ if (t is not null)
{
- writer.WriteLine("To: " + m_to);
- writer.WriteLine("From: " + m_from);
- writer.WriteLine("Subject: " + m_subject);
- writer.WriteLine("Date: " + DateTime.UtcNow.ToString("r"));
- writer.WriteLine("");
-
- string t = Layout.Header;
- if (t != null)
- {
- writer.Write(t);
- }
-
- for (int i = 0; i < events.Length; i++)
- {
- // Render the event and append the text to the buffer
- RenderLoggingEvent(writer, events[i]);
- }
-
- t = Layout.Footer;
- if (t != null)
- {
- writer.Write(t);
- }
-
- writer.WriteLine("");
- writer.WriteLine(".");
+ writer.Write(t);
}
+
+ for (int i = 0; i < events.Length; i++)
+ {
+ // Render the event and append the text to the buffer
+ RenderLoggingEvent(writer, events[i]);
+ }
+
+ t = Layout?.Footer;
+ if (t is not null)
+ {
+ writer.Write(t);
+ }
+
+ writer.WriteLine();
+ writer.WriteLine(".");
}
}
catch (Exception e)
@@ -260,10 +169,6 @@
}
}
- #endregion Override implementation of BufferingAppenderSkeleton
-
- #region Override implementation of AppenderSkeleton
-
/// <summary>
/// Activate the options on this appender.
/// </summary>
@@ -284,34 +189,18 @@
{
base.ActivateOptions();
- if (m_securityContext == null)
- {
- m_securityContext = SecurityContextProvider.DefaultProvider.CreateSecurityContext(this);
- }
+ SecurityContext ??= SecurityContextProvider.DefaultProvider.CreateSecurityContext(this);
using (SecurityContext.Impersonate(this))
{
- m_pickupDir = ConvertToFullPath(m_pickupDir.Trim());
+ PickupDir = ConvertToFullPath(PickupDir.Trim());
}
}
/// <summary>
/// This appender requires a <see cref="Layout"/> to be set.
/// </summary>
- /// <value><c>true</c></value>
- /// <remarks>
- /// <para>
- /// This appender requires a <see cref="Layout"/> to be set.
- /// </para>
- /// </remarks>
- protected override bool RequiresLayout
- {
- get { return true; }
- }
-
- #endregion Override implementation of AppenderSkeleton
-
- #region Protected Static Methods
+ protected override bool RequiresLayout => true;
/// <summary>
/// Convert a path into a fully qualified path.
@@ -331,21 +220,6 @@
return SystemInfo.ConvertToFullPath(path);
}
- #endregion Protected Static Methods
-
- #region Private Instance Fields
-
- private string m_to;
- private string m_from;
- private string m_subject;
- private string m_pickupDir;
- private string m_fileExtension;
-
- /// <summary>
- /// The security context to use for privileged calls
- /// </summary>
- private SecurityContext m_securityContext;
-
- #endregion Private Instance Fields
+ private string m_fileExtension = string.Empty;
}
}
diff --git a/src/log4net/Appender/TelnetAppender.cs b/src/log4net/Appender/TelnetAppender.cs
index b0e2130..0e53edb 100644
--- a/src/log4net/Appender/TelnetAppender.cs
+++ b/src/log4net/Appender/TelnetAppender.cs
@@ -18,15 +18,11 @@
#endregion
using System;
-using System.Collections;
-using System.Globalization;
+using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
using System.IO;
-#if NETSTANDARD
-using System.Threading.Tasks;
-#endif
-
+using System.Linq;
using log4net.Core;
using log4net.Util;
@@ -51,27 +47,9 @@
/// <author>Nicko Cadell</author>
public class TelnetAppender : AppenderSkeleton
{
- private SocketHandler m_handler;
+ private SocketHandler? m_handler;
private int m_listeningPort = 23;
- #region Constructor
-
- /// <summary>
- /// Default constructor
- /// </summary>
- /// <remarks>
- /// <para>
- /// Default constructor
- /// </para>
- /// </remarks>
- public TelnetAppender()
- {
- }
-
- #endregion
-
- #region Private Static Fields
-
/// <summary>
/// The fully qualified type of the TelnetAppender class.
/// </summary>
@@ -81,8 +59,6 @@
/// </remarks>
private static readonly Type declaringType = typeof(TelnetAppender);
- #endregion Private Static Fields
-
/// <summary>
/// Gets or sets the TCP port number on which this <see cref="TelnetAppender"/> will listen for connections.
/// </summary>
@@ -99,19 +75,13 @@
/// or greater than <see cref="IPEndPoint.MaxPort" />.</exception>
public int Port
{
- get
- {
- return m_listeningPort;
- }
+ get => m_listeningPort;
set
{
if (value < IPEndPoint.MinPort || value > IPEndPoint.MaxPort)
{
- throw log4net.Util.SystemInfo.CreateArgumentOutOfRangeException("value", (object)value,
- "The value specified for Port is less than " +
- IPEndPoint.MinPort.ToString(NumberFormatInfo.InvariantInfo) +
- " or greater than " +
- IPEndPoint.MaxPort.ToString(NumberFormatInfo.InvariantInfo) + ".");
+ throw SystemInfo.CreateArgumentOutOfRangeException(nameof(value), value,
+ $"The value specified for Port is less than {IPEndPoint.MinPort} or greater than {IPEndPoint.MaxPort}.");
}
else
{
@@ -120,8 +90,6 @@
}
}
- #region Override implementation of AppenderSkeleton
-
/// <summary>
/// Overrides the parent method to close the socket handler
/// </summary>
@@ -134,7 +102,7 @@
{
base.OnClose();
- if (m_handler != null)
+ if (m_handler is not null)
{
m_handler.Dispose();
m_handler = null;
@@ -144,19 +112,10 @@
/// <summary>
/// This appender requires a <see cref="Layout"/> to be set.
/// </summary>
- /// <value><c>true</c></value>
- /// <remarks>
- /// <para>
- /// This appender requires a <see cref="Layout"/> to be set.
- /// </para>
- /// </remarks>
- protected override bool RequiresLayout
- {
- get { return true; }
- }
+ protected override bool RequiresLayout => true;
/// <summary>
- /// Initialize the appender based on the options set.
+ /// Initializes the appender based on the options set.
/// </summary>
/// <remarks>
/// <para>
@@ -179,7 +138,7 @@
base.ActivateOptions();
try
{
- LogLog.Debug(declaringType, "Creating SocketHandler to listen on port [" + m_listeningPort + "]");
+ LogLog.Debug(declaringType, $"Creating SocketHandler to listen on port [{m_listeningPort}]");
m_handler = new SocketHandler(m_listeningPort);
}
catch (Exception ex)
@@ -193,23 +152,14 @@
/// Writes the logging event to each connected client.
/// </summary>
/// <param name="loggingEvent">The event to log.</param>
- /// <remarks>
- /// <para>
- /// Writes the logging event to each connected client.
- /// </para>
- /// </remarks>
protected override void Append(LoggingEvent loggingEvent)
{
- if (m_handler != null && m_handler.HasConnections)
+ if (m_handler is not null && m_handler.HasConnections)
{
m_handler.Send(RenderLoggingEvent(loggingEvent));
}
}
- #endregion
-
- #region SocketHandler helper class
-
/// <summary>
/// Helper class to manage connected clients
/// </summary>
@@ -224,21 +174,18 @@
{
private const int MAX_CONNECTIONS = 20;
- private Socket m_serverSocket;
- private ArrayList m_clients = new ArrayList();
+ private readonly Socket m_serverSocket;
+ private readonly List<SocketClient> m_clients = new();
+ private readonly object m_lockObj = new();
+ private bool m_disposed;
/// <summary>
/// Class that represents a client connected to this handler
/// </summary>
- /// <remarks>
- /// <para>
- /// Class that represents a client connected to this handler
- /// </para>
- /// </remarks>
protected class SocketClient : IDisposable
{
- private Socket m_socket;
- private StreamWriter m_writer;
+ private readonly Socket m_socket;
+ private readonly StreamWriter m_writer;
/// <summary>
/// Create this <see cref="SocketClient"/> for the specified <see cref="Socket"/>
@@ -265,65 +212,47 @@
}
/// <summary>
- /// Write a string to the client
+ /// Writes a string to the client.
/// </summary>
/// <param name="message">string to send</param>
- /// <remarks>
- /// <para>
- /// Write a string to the client
- /// </para>
- /// </remarks>
- public void Send(String message)
+ public void Send(string message)
{
m_writer.Write(message);
m_writer.Flush();
}
- #region IDisposable Members
-
/// <summary>
- /// Cleanup the clients connection
+ /// Cleans up the client connection.
/// </summary>
- /// <remarks>
- /// <para>
- /// Close the socket connection.
- /// </para>
- /// </remarks>
public void Dispose()
{
try
{
- if (m_writer != null)
- {
- m_writer.Dispose();
- m_writer = null;
- }
+ m_writer.Dispose();
}
- catch { }
-
- if (m_socket != null)
+ catch
{
- try
- {
- m_socket.Shutdown(SocketShutdown.Both);
- }
- catch { }
+ // Ignore
+ }
- try
- {
-#if NET_4_0 || NETSTANDARD
- m_socket.Dispose();
-#else
- m_socket.Close();
-#endif
- }
- catch { }
+ try
+ {
+ m_socket.Shutdown(SocketShutdown.Both);
+ }
+ catch
+ {
+ // Ignore
+ }
- m_socket = null;
+ try
+ {
+ m_socket.Dispose();
+ }
+ catch
+ {
+ // Ignore
}
}
-
- #endregion
}
/// <summary>
@@ -338,7 +267,6 @@
public SocketHandler(int port)
{
m_serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
-
m_serverSocket.Bind(new IPEndPoint(IPAddress.Any, port));
m_serverSocket.Listen(5);
AcceptConnection();
@@ -346,26 +274,23 @@
private void AcceptConnection()
{
-#if NETSTANDARD
- m_serverSocket.AcceptAsync().ContinueWith(OnConnect, TaskScheduler.Default);
-#else
- m_serverSocket.BeginAccept(new AsyncCallback(OnConnect), null);
-#endif
+ m_serverSocket.BeginAccept(OnConnect, null);
}
/// <summary>
- /// Sends a string message to each of the connected clients
+ /// Sends a string message to each of the connected clients.
/// </summary>
/// <param name="message">the text to send</param>
- /// <remarks>
- /// <para>
- /// Sends a string message to each of the connected clients
- /// </para>
- /// </remarks>
- public void Send(String message)
+ public void Send(string message)
{
- ArrayList localClients = m_clients;
+ List<SocketClient> localClients;
+ lock (m_lockObj)
+ {
+ localClients = m_clients.ToList();
+ }
+
+ // Send outside lock.
foreach (SocketClient client in localClients)
{
try
@@ -387,11 +312,9 @@
/// <param name="client">client to add</param>
private void AddClient(SocketClient client)
{
- lock (this)
+ lock (m_lockObj)
{
- ArrayList clientsCopy = (ArrayList)m_clients.Clone();
- clientsCopy.Add(client);
- m_clients = clientsCopy;
+ m_clients.Add(client);
}
}
@@ -401,11 +324,9 @@
/// <param name="client">client to remove</param>
private void RemoveClient(SocketClient client)
{
- lock (this)
+ lock (m_lockObj)
{
- ArrayList clientsCopy = (ArrayList)m_clients.Clone();
- clientsCopy.Remove(client);
- m_clients = clientsCopy;
+ m_clients.Remove(client);
}
}
@@ -426,16 +347,11 @@
{
get
{
- ArrayList localClients = m_clients;
-
- return (localClients != null && localClients.Count > 0);
+ // m_clients.Count is an atomic read that can be done outside the lock.
+ return m_clients.Count > 0;
}
}
-
-#if NETSTANDARD
- private void OnConnect(Task<Socket> acceptTask)
-#else
/// <summary>
/// Callback used to accept a connection on the server socket
/// </summary>
@@ -443,29 +359,25 @@
/// <remarks>
/// <para>
/// On connection adds to the list of connections
- /// if there are two many open connections you will be disconnected
+ /// if there are too many open connections you will be disconnected
/// </para>
/// </remarks>
private void OnConnect(IAsyncResult asyncResult)
-#endif
{
try
{
-#if NETSTANDARD
- Socket socket = acceptTask.GetAwaiter().GetResult();
-#else
// Block until a client connects
Socket socket = m_serverSocket.EndAccept(asyncResult);
-#endif
- LogLog.Debug(declaringType, "Accepting connection from [" + socket.RemoteEndPoint.ToString() + "]");
- SocketClient client = new SocketClient(socket);
+ LogLog.Debug(declaringType, $"Accepting connection from [{socket.RemoteEndPoint}]");
+ var client = new SocketClient(socket);
+ // m_clients.Count is an atomic read that can be done outside the lock.
int currentActiveConnectionsCount = m_clients.Count;
if (currentActiveConnectionsCount < MAX_CONNECTIONS)
{
try
{
- client.Send("TelnetAppender v1.0 (" + (currentActiveConnectionsCount + 1) + " active connections)\r\n\r\n");
+ client.Send($"TelnetAppender v1.0 ({(currentActiveConnectionsCount + 1)} active connections)\r\n\r\n");
AddClient(client);
}
catch
@@ -481,62 +393,53 @@
}
catch
{
+ // Ignore
}
finally
{
- if (m_serverSocket != null)
+ AcceptConnection();
+ }
+ }
+
+ /// <summary>
+ /// Closes all network connections
+ /// </summary>
+ public void Dispose()
+ {
+ if (m_disposed)
+ {
+ return;
+ }
+
+ m_disposed = true;
+
+ lock (m_lockObj)
+ {
+ foreach (SocketClient client in m_clients)
{
- AcceptConnection();
+ client.Dispose();
+ }
+ m_clients.Clear();
+
+ try
+ {
+ m_serverSocket.Shutdown(SocketShutdown.Both);
+ }
+ catch
+ {
+ // Ignore
+ }
+
+ try
+ {
+ m_serverSocket.Dispose();
+ }
+ catch
+ {
+ // Ignore
}
}
}
-
- #region IDisposable Members
-
- /// <summary>
- /// Close all network connections
- /// </summary>
- /// <remarks>
- /// <para>
- /// Make sure we close all network connections
- /// </para>
- /// </remarks>
- public void Dispose()
- {
- ArrayList localClients = m_clients;
-
- foreach (SocketClient client in localClients)
- {
- client.Dispose();
- }
- m_clients.Clear();
-
- Socket localSocket = m_serverSocket;
- m_serverSocket = null;
- try
- {
- localSocket.Shutdown(SocketShutdown.Both);
- }
- catch
- {
- }
-
- try
- {
-#if NET_2_0
- localSocket.Close();
-#else
- localSocket.Dispose();
-#endif
- }
- catch
- {
- }
- }
-
- #endregion
}
-
- #endregion
}
}
diff --git a/src/log4net/Appender/TextWriterAppender.cs b/src/log4net/Appender/TextWriterAppender.cs
index 41b9dc5..7ebe7d9 100644
--- a/src/log4net/Appender/TextWriterAppender.cs
+++ b/src/log4net/Appender/TextWriterAppender.cs
@@ -44,8 +44,6 @@
/// <author>Douglas de la Torre</author>
public class TextWriterAppender : AppenderSkeleton
{
- #region Public Instance Constructors
-
/// <summary>
/// Initializes a new instance of the <see cref="TextWriterAppender" /> class.
/// </summary>
@@ -96,10 +94,6 @@
Writer = writer;
}
- #endregion
-
- #region Public Instance Properties
-
/// <summary>
/// Gets or set whether the appender will flush at the end
/// of each append operation.
@@ -117,17 +111,13 @@
/// </value>
/// <remarks>
/// Avoiding the flush operation at the end of each append results in
- /// a performance gain of 10 to 20 percent. However, there is safety
+ /// a performance gain of 10 to 20 percent. However, there is a safety
/// trade-off involved in skipping flushing. Indeed, when flushing is
/// skipped, then it is likely that the last few log events will not
/// be recorded on disk when the application exits. This is a high
/// price to pay even for a 20% performance gain.
/// </remarks>
- public bool ImmediateFlush
- {
- get { return m_immediateFlush; }
- set { m_immediateFlush = value; }
- }
+ public bool ImmediateFlush { get; set; } = true;
/// <summary>
/// Sets the <see cref="TextWriter"/> where the log output will go.
@@ -144,27 +134,23 @@
/// <b>Note:</b> Logging to an unopened <see cref="TextWriter"/> will fail.
/// </para>
/// </remarks>
- public virtual TextWriter Writer
+ public virtual TextWriter? Writer
{
- get { return m_qtw; }
+ get => QuietWriter;
set
{
- lock (this)
+ lock (m_lockObj)
{
Reset();
- if (value != null)
+ if (value is not null)
{
- m_qtw = new QuietTextWriter(value, ErrorHandler);
+ QuietWriter = new QuietTextWriter(value, ErrorHandler);
WriteHeader();
}
}
}
}
- #endregion Public Instance Properties
-
- #region Override implementation of AppenderSkeleton
-
/// <summary>
/// This method determines if there is a sense in attempting to append.
/// </summary>
@@ -182,18 +168,18 @@
return false;
}
- if (m_qtw == null)
+ if (QuietWriter == null)
{
// Allow subclass to lazily create the writer
PrepareWriter();
- if (m_qtw == null)
+ if (QuietWriter == null)
{
ErrorHandler.Error("No output stream or file set for the appender named [" + Name + "].");
return false;
}
}
- if (m_qtw.Closed)
+ if (QuietWriter.Closed)
{
ErrorHandler.Error("Output stream for appender named [" + Name + "] has been closed.");
return false;
@@ -218,11 +204,16 @@
/// </remarks>
protected override void Append(LoggingEvent loggingEvent)
{
- RenderLoggingEvent(m_qtw, loggingEvent);
-
- if (m_immediateFlush)
+ if (QuietWriter is null)
{
- m_qtw.Flush();
+ return;
+ }
+
+ RenderLoggingEvent(QuietWriter, loggingEvent);
+
+ if (ImmediateFlush)
+ {
+ QuietWriter.Flush();
}
}
@@ -239,14 +230,19 @@
/// </remarks>
protected override void Append(LoggingEvent[] loggingEvents)
{
- foreach (LoggingEvent loggingEvent in loggingEvents)
+ if (QuietWriter is null)
{
- RenderLoggingEvent(m_qtw, loggingEvent);
+ return;
}
- if (m_immediateFlush)
+ foreach (LoggingEvent loggingEvent in loggingEvents)
{
- m_qtw.Flush();
+ RenderLoggingEvent(QuietWriter, loggingEvent);
+ }
+
+ if (ImmediateFlush)
+ {
+ QuietWriter.Flush();
}
}
@@ -258,7 +254,7 @@
/// </remarks>
protected override void OnClose()
{
- lock (this)
+ lock (m_lockObj)
{
Reset();
}
@@ -273,21 +269,21 @@
/// </value>
public override IErrorHandler ErrorHandler
{
- get { return base.ErrorHandler; }
+ get => base.ErrorHandler;
set
{
- lock (this)
+ lock (m_lockObj)
{
- if (value == null)
+ if (value is null)
{
LogLog.Warn(declaringType, "TextWriterAppender: You have tried to set a null error-handler.");
}
else
{
base.ErrorHandler = value;
- if (m_qtw != null)
+ if (QuietWriter is not null)
{
- m_qtw.ErrorHandler = value;
+ QuietWriter.ErrorHandler = value;
}
}
}
@@ -297,29 +293,11 @@
/// <summary>
/// This appender requires a <see cref="Layout"/> to be set.
/// </summary>
- /// <value><c>true</c></value>
- /// <remarks>
- /// <para>
- /// This appender requires a <see cref="Layout"/> to be set.
- /// </para>
- /// </remarks>
- protected override bool RequiresLayout
- {
- get { return true; }
- }
-
- #endregion Override implementation of AppenderSkeleton
-
- #region Protected Instance Methods
+ protected override bool RequiresLayout => true;
/// <summary>
/// Writes the footer and closes the underlying <see cref="TextWriter"/>.
/// </summary>
- /// <remarks>
- /// <para>
- /// Writes the footer and closes the underlying <see cref="TextWriter"/>.
- /// </para>
- /// </remarks>
protected virtual void WriteFooterAndCloseWriter()
{
WriteFooter();
@@ -329,22 +307,17 @@
/// <summary>
/// Closes the underlying <see cref="TextWriter"/>.
/// </summary>
- /// <remarks>
- /// <para>
- /// Closes the underlying <see cref="TextWriter"/>.
- /// </para>
- /// </remarks>
protected virtual void CloseWriter()
{
- if (m_qtw != null)
+ if (QuietWriter is not null)
{
try
{
- m_qtw.Close();
+ QuietWriter.Close();
}
catch (Exception e)
{
- ErrorHandler.Error("Could not close writer [" + m_qtw + "]", e);
+ ErrorHandler.Error($"Could not close writer [{QuietWriter}]", e);
// do need to invoke an error handler
// at this late stage
}
@@ -363,7 +336,7 @@
protected virtual void Reset()
{
WriteFooterAndCloseWriter();
- m_qtw = null;
+ QuietWriter = null;
}
/// <summary>
@@ -376,12 +349,12 @@
/// </remarks>
protected virtual void WriteFooter()
{
- if (Layout != null && m_qtw != null && !m_qtw.Closed)
+ if (Layout is not null && QuietWriter is not null && !QuietWriter.Closed)
{
- string f = Layout.Footer;
- if (f != null)
+ string? f = Layout.Footer;
+ if (f is not null)
{
- m_qtw.Write(f);
+ QuietWriter.Write(f);
}
}
}
@@ -396,12 +369,12 @@
/// </remarks>
protected virtual void WriteHeader()
{
- if (Layout != null && m_qtw != null && !m_qtw.Closed)
+ if (Layout is not null && QuietWriter is not null && !QuietWriter.Closed)
{
string h = Layout.Header;
- if (h != null)
+ if (h is not null)
{
- m_qtw.Write(h);
+ QuietWriter.Write(h);
}
}
}
@@ -433,43 +406,9 @@
/// will be written to.
/// </para>
/// </remarks>
- protected QuietTextWriter QuietWriter
- {
- get { return m_qtw; }
- set { m_qtw = value; }
- }
+ protected QuietTextWriter? QuietWriter { get; set; }
- #endregion Protected Instance Methods
-
- #region Private Instance Fields
-
- /// <summary>
- /// This is the <see cref="log4net.Util.QuietTextWriter"/> where logging events
- /// will be written to.
- /// </summary>
- private QuietTextWriter m_qtw;
-
- /// <summary>
- /// Immediate flush means that the underlying <see cref="TextWriter" />
- /// or output stream will be flushed at the end of each append operation.
- /// </summary>
- /// <remarks>
- /// <para>
- /// Immediate flush is slower but ensures that each append request is
- /// actually written. If <see cref="ImmediateFlush"/> is set to
- /// <c>false</c>, then there is a good chance that the last few
- /// logging events are not actually persisted if and when the application
- /// crashes.
- /// </para>
- /// <para>
- /// The default value is <c>true</c>.
- /// </para>
- /// </remarks>
- private bool m_immediateFlush = true;
-
- #endregion Private Instance Fields
-
- #region Private Static Fields
+ private readonly object m_lockObj = new();
/// <summary>
/// The fully qualified type of the TextWriterAppender class.
@@ -480,8 +419,6 @@
/// </remarks>
private static readonly Type declaringType = typeof(TextWriterAppender);
- #endregion Private Static Fields
-
/// <summary>
/// Flushes any buffered log data.
/// </summary>
@@ -490,12 +427,15 @@
public override bool Flush(int millisecondsTimeout)
{
// Nothing to do if ImmediateFlush is true
- if (m_immediateFlush) return true;
+ if (ImmediateFlush)
+ {
+ return true;
+ }
// lock(this) will block any Appends while the buffer is flushed.
- lock (this)
+ lock (m_lockObj)
{
- m_qtw.Flush();
+ QuietWriter?.Flush();
}
return true;
diff --git a/src/log4net/Appender/TraceAppender.cs b/src/log4net/Appender/TraceAppender.cs
index e495336..772938a 100644
--- a/src/log4net/Appender/TraceAppender.cs
+++ b/src/log4net/Appender/TraceAppender.cs
@@ -53,8 +53,6 @@
/// <author>Ron Grabowski</author>
public class TraceAppender : AppenderSkeleton
{
- #region Public Instance Constructors
-
/// <summary>
/// Initializes a new instance of the <see cref="TraceAppender" />.
/// </summary>
@@ -83,10 +81,6 @@
Layout = layout;
}
- #endregion Public Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
/// Gets or sets a value that indicates whether the appender will
/// flush at the end of each write.
@@ -105,11 +99,7 @@
/// price to pay even for a 20% performance gain.
/// </para>
/// </remarks>
- public bool ImmediateFlush
- {
- get { return m_immediateFlush; }
- set { m_immediateFlush = value; }
- }
+ public bool ImmediateFlush { get; set; } = true;
/// <summary>
/// The category parameter sent to the Trace method.
@@ -119,93 +109,27 @@
/// Defaults to %logger which will use the logger name of the current
/// <see cref="LoggingEvent"/> as the category parameter.
/// </para>
- /// <para>
- /// </para>
/// </remarks>
- public PatternLayout Category
- {
- get { return m_category; }
- set { m_category = value; }
- }
-
- #endregion Public Instance Properties
-
- #region Override implementation of AppenderSkeleton
+ public PatternLayout Category { get; set; } = new("%logger");
/// <summary>
/// Writes the logging event to the <see cref="System.Diagnostics.Trace"/> system.
/// </summary>
/// <param name="loggingEvent">The event to log.</param>
- /// <remarks>
- /// <para>
- /// Writes the logging event to the <see cref="System.Diagnostics.Trace"/> system.
- /// </para>
- /// </remarks>
protected override void Append(LoggingEvent loggingEvent)
{
- //
- // Write the string to the Trace system
- //
-#if NETCF
- System.Diagnostics.Debug.Write(RenderLoggingEvent(loggingEvent), m_category.Format(loggingEvent));
-#else
- System.Diagnostics.Trace.Write(RenderLoggingEvent(loggingEvent), m_category.Format(loggingEvent));
-#endif
+ System.Diagnostics.Trace.Write(RenderLoggingEvent(loggingEvent), Category.Format(loggingEvent));
- //
- // Flush the Trace system if needed
- //
- if (m_immediateFlush)
+ if (ImmediateFlush)
{
-#if NETCF
- System.Diagnostics.Debug.Flush();
-#else
System.Diagnostics.Trace.Flush();
-#endif
}
}
/// <summary>
/// This appender requires a <see cref="Layout"/> to be set.
/// </summary>
- /// <value><c>true</c></value>
- /// <remarks>
- /// <para>
- /// This appender requires a <see cref="Layout"/> to be set.
- /// </para>
- /// </remarks>
- protected override bool RequiresLayout
- {
- get { return true; }
- }
-
- #endregion Override implementation of AppenderSkeleton
-
- #region Private Instance Fields
-
- /// <summary>
- /// Immediate flush means that the underlying writer or output stream
- /// will be flushed at the end of each append operation.
- /// </summary>
- /// <remarks>
- /// <para>
- /// Immediate flush is slower but ensures that each append request is
- /// actually written. If <see cref="ImmediateFlush"/> is set to
- /// <c>false</c>, then there is a good chance that the last few
- /// logs events are not actually written to persistent media if and
- /// when the application crashes.
- /// </para>
- /// <para>
- /// The default value is <c>true</c>.</para>
- /// </remarks>
- private bool m_immediateFlush = true;
-
- /// <summary>
- /// Defaults to %logger
- /// </summary>
- private PatternLayout m_category = new PatternLayout("%logger");
-
- #endregion Private Instance Fields
+ protected override bool RequiresLayout => true;
/// <summary>
/// Flushes any buffered log data.
@@ -215,14 +139,13 @@
public override bool Flush(int millisecondsTimeout)
{
// Nothing to do if ImmediateFlush is true
- if (m_immediateFlush) return true;
+ if (ImmediateFlush)
+ {
+ return true;
+ }
- // System.Diagnostics.Trace and System.Diagnostics.Debug are thread-safe, so no need for lock(this).
-#if NETCF
- System.Diagnostics.Debug.Flush();
-#else
+ // System.Diagnostics.Trace and System.Diagnostics.Debug are thread-safe, so no need for lock.
System.Diagnostics.Trace.Flush();
-#endif
return true;
}
}
diff --git a/src/log4net/Appender/UdpAppender.cs b/src/log4net/Appender/UdpAppender.cs
index b0d4f68..f5bc30b 100644
--- a/src/log4net/Appender/UdpAppender.cs
+++ b/src/log4net/Appender/UdpAppender.cs
@@ -18,7 +18,6 @@
#endregion
using System;
-using System.Globalization;
using System.Net;
using System.Net.Sockets;
using System.Text;
@@ -106,8 +105,6 @@
/// <author>Nicko Cadell</author>
public class UdpAppender : AppenderSkeleton
{
- #region Public Instance Constructors
-
/// <summary>
/// Initializes a new instance of the <see cref="UdpAppender" /> class.
/// </summary>
@@ -118,10 +115,6 @@
{
}
- #endregion Public Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
/// Gets or sets the IP address of the remote host or multicast group to which
/// the underlying <see cref="UdpClient" /> should sent the logging event.
@@ -189,11 +182,7 @@
/// of the local network.
/// </para>
/// </remarks>
- public IPAddress RemoteAddress
- {
- get { return m_remoteAddress; }
- set { m_remoteAddress = value; }
- }
+ public IPAddress? RemoteAddress { get; set; }
/// <summary>
/// Gets or sets the TCP port number of the remote host or multicast group to which
@@ -211,16 +200,13 @@
/// <exception cref="ArgumentOutOfRangeException">The value specified is less than <see cref="IPEndPoint.MinPort" /> or greater than <see cref="IPEndPoint.MaxPort" />.</exception>
public int RemotePort
{
- get { return m_remotePort; }
+ get => m_remotePort;
set
{
if (value < IPEndPoint.MinPort || value > IPEndPoint.MaxPort)
{
- throw log4net.Util.SystemInfo.CreateArgumentOutOfRangeException("value", (object)value,
- "The value specified is less than " +
- IPEndPoint.MinPort.ToString(NumberFormatInfo.InvariantInfo) +
- " or greater than " +
- IPEndPoint.MaxPort.ToString(NumberFormatInfo.InvariantInfo) + ".");
+ throw Util.SystemInfo.CreateArgumentOutOfRangeException(nameof(value), value,
+ $"The value specified is less than {IPEndPoint.MinPort} or greater than {IPEndPoint.MaxPort}.");
}
else
{
@@ -248,16 +234,13 @@
/// <exception cref="ArgumentOutOfRangeException">The value specified is less than <see cref="IPEndPoint.MinPort" /> or greater than <see cref="IPEndPoint.MaxPort" />.</exception>
public int LocalPort
{
- get { return m_localPort; }
+ get => m_localPort;
set
{
if (value != 0 && (value < IPEndPoint.MinPort || value > IPEndPoint.MaxPort))
{
- throw log4net.Util.SystemInfo.CreateArgumentOutOfRangeException("value", (object)value,
- "The value specified is less than " +
- IPEndPoint.MinPort.ToString(NumberFormatInfo.InvariantInfo) +
- " or greater than " +
- IPEndPoint.MaxPort.ToString(NumberFormatInfo.InvariantInfo) + ".");
+ throw Util.SystemInfo.CreateArgumentOutOfRangeException(nameof(value), value,
+ $"The value specified is less than {IPEndPoint.MinPort} or greater than {IPEndPoint.MaxPort}.");
}
else
{
@@ -277,15 +260,7 @@
/// The <see cref="Encoding"/> used to write the packets.
/// </para>
/// </remarks>
- public Encoding Encoding
- {
- get { return m_encoding; }
- set { m_encoding = value; }
- }
-
- #endregion Public Instance Properties
-
- #region Protected Instance Properties
+ public Encoding Encoding { get; set; } = Encoding.Default;
/// <summary>
/// Gets or sets the underlying <see cref="UdpClient" />.
@@ -300,32 +275,17 @@
/// returned from <see cref="Client" /> if you require access beyond that which
/// <see cref="UdpAppender" /> provides.
/// </remarks>
- protected UdpClient Client
- {
- get { return this.m_client; }
- set { this.m_client = value; }
- }
+ protected UdpClient? Client { get; set; }
/// <summary>
/// Gets or sets the cached remote endpoint to which the logging events should be sent.
/// </summary>
- /// <value>
- /// The cached remote endpoint to which the logging events will be sent.
- /// </value>
/// <remarks>
/// The <see cref="ActivateOptions" /> method will initialize the remote endpoint
/// with the values of the <see cref="RemoteAddress" /> and <see cref="RemotePort"/>
/// properties.
/// </remarks>
- protected IPEndPoint RemoteEndPoint
- {
- get { return this.m_remoteEndPoint; }
- set { this.m_remoteEndPoint = value; }
- }
-
- #endregion Protected Instance Properties
-
- #region Implementation of IOptionHandler
+ protected IPEndPoint? RemoteEndPoint { get; set; }
/// <summary>
/// Initialize the appender based on the options set.
@@ -353,37 +313,27 @@
{
base.ActivateOptions();
- if (this.RemoteAddress == null)
+ if (RemoteAddress is null)
{
throw new ArgumentNullException("The required property 'Address' was not specified.");
}
- else if (this.RemotePort < IPEndPoint.MinPort || this.RemotePort > IPEndPoint.MaxPort)
+ else if (RemotePort < IPEndPoint.MinPort || RemotePort > IPEndPoint.MaxPort)
{
- throw log4net.Util.SystemInfo.CreateArgumentOutOfRangeException("this.RemotePort", (object)this.RemotePort,
- "The RemotePort is less than " +
- IPEndPoint.MinPort.ToString(NumberFormatInfo.InvariantInfo) +
- " or greater than " +
- IPEndPoint.MaxPort.ToString(NumberFormatInfo.InvariantInfo) + ".");
+ throw Util.SystemInfo.CreateArgumentOutOfRangeException(nameof(RemotePort), RemotePort,
+ $"The RemotePort is less than {IPEndPoint.MinPort} or greater than {IPEndPoint.MaxPort}.");
}
- else if (this.LocalPort != 0 && (this.LocalPort < IPEndPoint.MinPort || this.LocalPort > IPEndPoint.MaxPort))
+ else if (LocalPort != 0 && (LocalPort < IPEndPoint.MinPort || this.LocalPort > IPEndPoint.MaxPort))
{
- throw log4net.Util.SystemInfo.CreateArgumentOutOfRangeException("this.LocalPort", (object)this.LocalPort,
- "The LocalPort is less than " +
- IPEndPoint.MinPort.ToString(NumberFormatInfo.InvariantInfo) +
- " or greater than " +
- IPEndPoint.MaxPort.ToString(NumberFormatInfo.InvariantInfo) + ".");
+ throw Util.SystemInfo.CreateArgumentOutOfRangeException(nameof(LocalPort), LocalPort,
+ $"The LocalPort is less than {IPEndPoint.MinPort} or greater than {IPEndPoint.MaxPort}.");
}
else
{
- this.RemoteEndPoint = new IPEndPoint(this.RemoteAddress, this.RemotePort);
- this.InitializeClientConnection();
+ RemoteEndPoint = new IPEndPoint(RemoteAddress, RemotePort);
+ InitializeClientConnection();
}
}
- #endregion
-
- #region Override implementation of AppenderSkeleton
-
/// <summary>
/// This method is called by the <see cref="M:AppenderSkeleton.DoAppend(LoggingEvent)"/> method.
/// </summary>
@@ -398,22 +348,22 @@
/// </remarks>
protected override void Append(LoggingEvent loggingEvent)
{
+ if (Client is null)
+ {
+ ErrorHandler.Error(
+ $"Unable to send logging event to remote host {RemoteAddress} on port {RemotePort}, no client created",
+ e: null,
+ ErrorCode.WriteFailure);
+ }
try
{
- Byte[] buffer = m_encoding.GetBytes(RenderLoggingEvent(loggingEvent).ToCharArray());
-#if NETSTANDARD
- Client.SendAsync(buffer, buffer.Length, RemoteEndPoint).Wait();
-#else
- this.Client.Send(buffer, buffer.Length, this.RemoteEndPoint);
-#endif
+ Byte[] buffer = Encoding.GetBytes(RenderLoggingEvent(loggingEvent).ToCharArray());
+ Client.Send(buffer, buffer.Length, RemoteEndPoint);
}
catch (Exception ex)
{
ErrorHandler.Error(
- "Unable to send logging event to remote host " +
- this.RemoteAddress.ToString() +
- " on port " +
- this.RemotePort + ".",
+ $"Unable to send logging event to remote host {RemoteAddress} on port {RemotePort}.",
ex,
ErrorCode.WriteFailure);
}
@@ -422,16 +372,7 @@
/// <summary>
/// This appender requires a <see cref="Layout"/> to be set.
/// </summary>
- /// <value><c>true</c></value>
- /// <remarks>
- /// <para>
- /// This appender requires a <see cref="Layout"/> to be set.
- /// </para>
- /// </remarks>
- protected override bool RequiresLayout
- {
- get { return true; }
- }
+ protected override bool RequiresLayout => true;
/// <summary>
/// Closes the UDP connection and releases all resources associated with
@@ -447,16 +388,9 @@
{
base.OnClose();
- if (this.Client != null)
- {
- this.Client.Close();
- }
+ Client?.Close();
}
- #endregion Override implementation of AppenderSkeleton
-
- #region Protected Instance Methods
-
/// <summary>
/// Initializes the underlying <see cref="UdpClient" /> connection.
/// </summary>
@@ -473,45 +407,26 @@
{
try
{
- if (this.LocalPort == 0)
+ if (LocalPort == 0)
{
-#if NETCF || NET_1_0 || SSCLI_1_0 || CLI_1_0
- this.Client = new UdpClient();
-#else
- this.Client = new UdpClient(RemoteAddress.AddressFamily);
-#endif
+ Client = new UdpClient(RemoteAddress.AddressFamily);
}
else
{
-#if NETCF || NET_1_0 || SSCLI_1_0 || CLI_1_0
- this.Client = new UdpClient(this.LocalPort);
-#else
- this.Client = new UdpClient(this.LocalPort, RemoteAddress.AddressFamily);
-#endif
+ Client = new UdpClient(this.LocalPort, RemoteAddress.AddressFamily);
}
}
catch (Exception ex)
{
ErrorHandler.Error(
- "Could not initialize the UdpClient connection on port " +
- this.LocalPort.ToString(NumberFormatInfo.InvariantInfo) + ".",
+ $"Could not initialize the UdpClient connection on port {LocalPort}.",
ex,
ErrorCode.GenericFailure);
- this.Client = null;
+ Client = null;
}
}
- #endregion Protected Instance Methods
-
- #region Private Instance Fields
-
- /// <summary>
- /// The IP address of the remote host or multicast group to which
- /// the logging event will be sent.
- /// </summary>
- private IPAddress m_remoteAddress;
-
/// <summary>
/// The TCP port number of the remote host or multicast group to
/// which the logging event will be sent.
@@ -519,30 +434,8 @@
private int m_remotePort;
/// <summary>
- /// The cached remote endpoint to which the logging events will be sent.
- /// </summary>
- private IPEndPoint m_remoteEndPoint;
-
- /// <summary>
/// The TCP port number from which the <see cref="UdpClient" /> will communicate.
/// </summary>
private int m_localPort;
-
- /// <summary>
- /// The <see cref="UdpClient" /> instance that will be used for sending the
- /// logging events.
- /// </summary>
- private UdpClient m_client;
-
- /// <summary>
- /// The encoding to use for the packet.
- /// </summary>
-#if NETSTANDARD
- private Encoding m_encoding = Encoding.Unicode;
-#else
- private Encoding m_encoding = Encoding.Default;
-#endif
-
- #endregion Private Instance Fields
}
}
diff --git a/src/log4net/AssemblyInfo.cs b/src/log4net/AssemblyInfo.cs
index 06ff5fc..f22bdb9 100644
--- a/src/log4net/AssemblyInfo.cs
+++ b/src/log4net/AssemblyInfo.cs
@@ -20,113 +20,39 @@
using System.Reflection;
using System.Runtime.CompilerServices;
-// [assembly:AssemblyKeyFile("log4net.snk")]
-
-#if (!SSCLI)
//
// log4net makes use of static methods which cannot be made com visible
//
[assembly: System.Runtime.InteropServices.ComVisible(false)]
-#endif
//
// log4net is CLS compliant
//
[assembly: System.CLSCompliant(true)]
-#if (!NETCF)
//
// If log4net is strongly named it still allows partially trusted callers
//
[assembly: System.Security.AllowPartiallyTrustedCallers]
-#endif
-#if (NET_4_0 || NETSTANDARD2_0)
//
// Allows partial trust applications (e.g. ASP.NET shared hosting) on .NET 4.0 to work
// given our implementation of ISerializable.
//
[assembly: System.Security.SecurityRules(System.Security.SecurityRuleSet.Level1)]
-#endif
//
// 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.
//
-#if (CLI_1_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.17.0-.CLI 1.0")]
-[assembly: AssemblyTitle("Apache log4net for CLI 1.0 Compatible Frameworks")]
-#elif (NET_1_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.17.0-.NET 1.0")]
-[assembly: AssemblyTitle("Apache log4net for .NET Framework 1.0")]
-#elif (NET_1_1)
-[assembly: AssemblyInformationalVersionAttribute("2.0.17.0-.NET 1.1")]
-[assembly: AssemblyTitle("Apache log4net for .NET Framework 1.1")]
-#elif (NET_4_5)
-[assembly: AssemblyInformationalVersionAttribute("2.0.17.0-.NET 4.5")]
-[assembly: AssemblyTitle("Apache log4net for .NET Framework 4.5")]
-#elif (NET_4_0)
-#if CLIENT_PROFILE
-[assembly: AssemblyInformationalVersionAttribute("2.0.17.0-.NET 4.0 CP")]
-[assembly: AssemblyTitle("Apache log4net for .NET Framework 4.0 Client Profile")]
-#else
-[assembly: AssemblyInformationalVersionAttribute("2.0.17.0-.NET 4.0")]
-[assembly: AssemblyTitle("Apache log4net for .NET Framework 4.0")]
-#endif // Client Profile
-#elif (NET_3_5)
-#if CLIENT_PROFILE
-[assembly: AssemblyInformationalVersionAttribute("2.0.17.0-.NET 3.5 CP")]
-[assembly: AssemblyTitle("Apache log4net for .NET Framework 3.5 Client Profile")]
-#else
-[assembly: AssemblyInformationalVersionAttribute("2.0.17.0-.NET 3.5")]
-[assembly: AssemblyTitle("Apache log4net for .NET Framework 3.5")]
-#endif // Client Profile
-#elif (NET_2_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.17.0-.NET 2.0")]
-[assembly: AssemblyTitle("Apache log4net for .NET Framework 2.0")]
-#elif (NETCF_1_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.17.0-.NETCF 1.0")]
-[assembly: AssemblyTitle("Apache log4net for .NET Compact Framework 1.0")]
-#elif (NETCF_2_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.17.0-.NETCF 2.0")]
-[assembly: AssemblyTitle("Apache log4net for .NET Compact Framework 2.0")]
-#elif (MONO_1_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.17.0-Mono 1.0")]
-[assembly: AssemblyTitle("Apache log4net for Mono 1.0")]
-#elif (MONO_2_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.17.0-Mono 2.0")]
-[assembly: AssemblyTitle("Apache log4net for Mono 2.0")]
-#elif (MONO_3_5)
-[assembly: AssemblyInformationalVersionAttribute("2.0.17.0-Mono 3.5")]
-[assembly: AssemblyTitle("Apache log4net for Mono 3.5")]
-#elif (MONO_4_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.17.0-Mono 4.0")]
-[assembly: AssemblyTitle("Apache log4net for Mono 4.0")]
-#elif (SSCLI_1_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.17.0-SSCLI 1.0")]
-[assembly: AssemblyTitle("Apache log4net for Shared Source CLI 1.0")]
-#elif (NET)
-[assembly: AssemblyInformationalVersionAttribute("2.0.17.0-.NET")]
-[assembly: AssemblyTitle("Apache log4net for .NET Framework")]
-#elif (NETSTANDARD1_3)
-[assembly: AssemblyInformationalVersionAttribute("2.0.17.0-.NET Standard 1.3")]
-[assembly: AssemblyTitle("Apache log4net for .NET Standard 1.3")]
-#elif (NETSTANDARD2_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.17.0-.NET Standard 2.0")]
+#if NET462_OR_GREATER
+[assembly: AssemblyInformationalVersion("3.0.0.0-.NET 4.6.2")]
+[assembly: AssemblyTitle("Apache log4net for .NET Framework 4.6.2")]
+#endif
+#if NETSTANDARD2_0_OR_GREATER
+[assembly: AssemblyInformationalVersion("3.0.0.0-.NET Standard 2.0")]
[assembly: AssemblyTitle("Apache log4net for .NET Standard 2.0")]
-#elif (NETCF)
-[assembly: AssemblyInformationalVersionAttribute("2.0.17.0-.NETCF")]
-[assembly: AssemblyTitle("Apache log4net for .NET Compact Framework")]
-#elif (MONO)
-[assembly: AssemblyInformationalVersionAttribute("2.0.17.0-Mono")]
-[assembly: AssemblyTitle("Apache log4net for Mono")]
-#elif (SSCLI)
-[assembly: AssemblyInformationalVersionAttribute("2.0.17.0-SSCLI")]
-[assembly: AssemblyTitle("Apache log4net for Shared Source CLI")]
-#else
-[assembly: AssemblyInformationalVersionAttribute("2.0.17.0")]
-[assembly: AssemblyTitle("Apache log4net")]
#endif
#if DEBUG
@@ -137,43 +63,4 @@
[assembly: AssemblyProduct("log4net")]
[assembly: AssemblyDefaultAlias("log4net")]
-[assembly: AssemblyCulture("")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-#if STRONG && (CLI_1_0 || NET_1_0 || NET_1_1 || NETCF_1_0 || SSCLI)
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile(@"..\..\..\log4net.snk")]
-#endif
-// We do not use a CSP key for strong naming
-// [assembly: AssemblyKeyName("")]
-
-[assembly: InternalsVisibleTo("log4net.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100297dcac908e286"
- + "89360399027b0ea4cd852fbb74e1ed95e695a5ba55cbd1d075ec20cdb5fa6fc593d3d571527b20"
- + "558d6f39e1f4d5cfe0798428c589c311965244b209c38a02aaa8c9da3b72405b6fedeeb4292c34"
- + "57e9769b74e645c19cb06c2be75fb2d12281a585fbeabf7bd195d6961ba113286fc3e286d7bbd6"
- + "9024ceda")]
-
+[assembly: AssemblyCulture("")]
\ No newline at end of file
diff --git a/src/log4net/AssemblyVersionInfo.cs b/src/log4net/AssemblyVersionInfo.cs
index 45e01a6..e22225f 100644
--- a/src/log4net/AssemblyVersionInfo.cs
+++ b/src/log4net/AssemblyVersionInfo.cs
@@ -28,18 +28,13 @@
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
-[assembly: System.Reflection.AssemblyVersion("2.0.17.0")]
-
-#if !NETCF
-#if !SSCLI
-[assembly: System.Reflection.AssemblyFileVersion("2.0.17.0")]
-#endif
-#endif
+[assembly: System.Reflection.AssemblyVersion("3.0.0.0")]
+[assembly: System.Reflection.AssemblyFileVersion("3.0.0.0")]
//
// Shared assembly settings
//
[assembly: System.Reflection.AssemblyCompany("The Apache Software Foundation")]
-[assembly: System.Reflection.AssemblyCopyright("Copyright 2004-2017 The Apache Software Foundation.")]
-[assembly: System.Reflection.AssemblyTrademark("Apache and Apache log4net are trademarks of The Apache Software Foundation")]
+[assembly: System.Reflection.AssemblyCopyright("Copyright 2004-2024 The Apache Software Foundation.")]
+[assembly: System.Reflection.AssemblyTrademark("Apache and Apache log4net are trademarks of The Apache Software Foundation")]
\ No newline at end of file
diff --git a/src/log4net/Config/AliasDomainAttribute.cs b/src/log4net/Config/AliasDomainAttribute.cs
index c1da999..df283f1 100644
--- a/src/log4net/Config/AliasDomainAttribute.cs
+++ b/src/log4net/Config/AliasDomainAttribute.cs
@@ -17,9 +17,6 @@
//
#endregion
-// .NET Compact Framework 1.0 has no support for reading assembly attributes
-#if !NETCF
-
using System;
namespace log4net.Config
@@ -51,8 +48,6 @@
[Obsolete("Use AliasRepositoryAttribute instead of AliasDomainAttribute")]
public sealed class AliasDomainAttribute : AliasRepositoryAttribute
{
- #region Public Instance Constructors
-
/// <summary>
/// Initializes a new instance of the <see cref="AliasDomainAttribute" /> class with
/// the specified domain to alias to this assembly's repository.
@@ -66,9 +61,5 @@
public AliasDomainAttribute(string name) : base(name)
{
}
-
- #endregion Public Instance Constructors
}
}
-
-#endif // !NETCF
\ No newline at end of file
diff --git a/src/log4net/Config/AliasRepositoryAttribute.cs b/src/log4net/Config/AliasRepositoryAttribute.cs
index 29b4a8f..01dc008 100644
--- a/src/log4net/Config/AliasRepositoryAttribute.cs
+++ b/src/log4net/Config/AliasRepositoryAttribute.cs
@@ -17,9 +17,6 @@
//
#endregion
-// .NET Compact Framework 1.0 has no support for reading assembly attributes
-#if !NETCF
-
using System;
namespace log4net.Config
@@ -51,53 +48,19 @@
// Class is not sealed because AliasDomainAttribute extends it while it is obsoleted
//
- #region Public Instance Constructors
-
/// <summary>
/// Initializes a new instance of the <see cref="AliasRepositoryAttribute" /> class with
/// the specified repository to alias to this assembly's repository.
/// </summary>
/// <param name="name">The repository to alias to this assemby's repository.</param>
- /// <remarks>
- /// <para>
- /// Initializes a new instance of the <see cref="AliasRepositoryAttribute" /> class with
- /// the specified repository to alias to this assembly's repository.
- /// </para>
- /// </remarks>
public AliasRepositoryAttribute(string name)
{
Name = name;
}
- #endregion Public Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
/// Gets or sets the repository to alias to this assemby's repository.
/// </summary>
- /// <value>
- /// The repository to alias to this assemby's repository.
- /// </value>
- /// <remarks>
- /// <para>
- /// The name of the repository to alias to this assemby's repository.
- /// </para>
- /// </remarks>
- public string Name
- {
- get { return m_name; }
- set { m_name = value; }
- }
-
- #endregion Public Instance Properties
-
- #region Private Instance Fields
-
- private string m_name = null;
-
- #endregion Private Instance Fields
+ public string Name { get; }
}
-}
-
-#endif // !NETCF
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/src/log4net/Config/BasicConfigurator.cs b/src/log4net/Config/BasicConfigurator.cs
index 53afeae..7af9f90 100644
--- a/src/log4net/Config/BasicConfigurator.cs
+++ b/src/log4net/Config/BasicConfigurator.cs
@@ -19,9 +19,8 @@
using System;
using System.Collections;
-#if !NETSTANDARD1_3
+using System.Collections.Generic;
using System.Reflection;
-#endif
using log4net.Appender;
using log4net.Layout;
@@ -51,10 +50,8 @@
/// </remarks>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
- public sealed class BasicConfigurator
+ public static class BasicConfigurator
{
- #region Private Static Fields
-
/// <summary>
/// The fully qualified type of the BasicConfigurator class.
/// </summary>
@@ -64,27 +61,6 @@
/// </remarks>
private static readonly Type declaringType = typeof(BasicConfigurator);
- #endregion Private Static Fields
-
- #region Private Instance Constructors
-
- /// <summary>
- /// Initializes a new instance of the <see cref="BasicConfigurator" /> class.
- /// </summary>
- /// <remarks>
- /// <para>
- /// Uses a private access modifier to prevent instantiation of this class.
- /// </para>
- /// </remarks>
- private BasicConfigurator()
- {
- }
-
- #endregion Private Instance Constructors
-
- #region Public Static Methods
-
-#if !NETSTANDARD1_3
/// <summary>
/// Initializes the log4net system with a default configuration.
/// </summary>
@@ -99,7 +75,7 @@
/// </remarks>
public static ICollection Configure()
{
- return BasicConfigurator.Configure(LogManager.GetRepository(Assembly.GetCallingAssembly()));
+ return Configure(LogManager.GetRepository(Assembly.GetCallingAssembly()));
}
/// <summary>
@@ -113,7 +89,7 @@
/// </remarks>
public static ICollection Configure(params IAppender[] appenders)
{
- ArrayList configurationMessages = new ArrayList();
+ var configurationMessages = new List<LogLog>();
ILoggerRepository repository = LogManager.GetRepository(Assembly.GetCallingAssembly());
@@ -128,21 +104,6 @@
}
/// <summary>
- /// Initializes the log4net system using the specified appender.
- /// </summary>
- /// <param name="appender">The appender to use to log all logging events.</param>
- /// <remarks>
- /// <para>
- /// Initializes the log4net system using the specified appender.
- /// </para>
- /// </remarks>
- public static ICollection Configure(IAppender appender)
- {
- return Configure(new IAppender[] { appender });
- }
-#endif // !NETSTANDARD1_3
-
- /// <summary>
/// Initializes the <see cref="ILoggerRepository"/> with a default configuration.
/// </summary>
/// <param name="repository">The repository to configure.</param>
@@ -157,18 +118,16 @@
/// </remarks>
public static ICollection Configure(ILoggerRepository repository)
{
- ArrayList configurationMessages = new ArrayList();
+ var configurationMessages = new List<LogLog>();
using (new LogLog.LogReceivedAdapter(configurationMessages))
{
// Create the layout
- PatternLayout layout = new PatternLayout();
- layout.ConversionPattern = PatternLayout.DetailConversionPattern;
+ var layout = new PatternLayout { ConversionPattern = PatternLayout.DetailConversionPattern };
layout.ActivateOptions();
// Create the appender
- ConsoleAppender appender = new ConsoleAppender();
- appender.Layout = layout;
+ var appender = new ConsoleAppender { Layout = layout };
appender.ActivateOptions();
InternalConfigure(repository, appender);
@@ -180,21 +139,6 @@
}
/// <summary>
- /// Initializes the <see cref="ILoggerRepository"/> using the specified appender.
- /// </summary>
- /// <param name="repository">The repository to configure.</param>
- /// <param name="appender">The appender to use to log all logging events.</param>
- /// <remarks>
- /// <para>
- /// Initializes the <see cref="ILoggerRepository"/> using the specified appender.
- /// </para>
- /// </remarks>
- public static ICollection Configure(ILoggerRepository repository, IAppender appender)
- {
- return Configure(repository, new IAppender[] { appender });
- }
-
- /// <summary>
/// Initializes the <see cref="ILoggerRepository"/> using the specified appenders.
/// </summary>
/// <param name="repository">The repository to configure.</param>
@@ -206,7 +150,7 @@
/// </remarks>
public static ICollection Configure(ILoggerRepository repository, params IAppender[] appenders)
{
- ArrayList configurationMessages = new ArrayList();
+ var configurationMessages = new List<LogLog>();
using (new LogLog.LogReceivedAdapter(configurationMessages))
{
@@ -220,17 +164,14 @@
private static void InternalConfigure(ILoggerRepository repository, params IAppender[] appenders)
{
- IBasicRepositoryConfigurator configurableRepository = repository as IBasicRepositoryConfigurator;
- if (configurableRepository != null)
+ if (repository is IBasicRepositoryConfigurator configurableRepository)
{
configurableRepository.Configure(appenders);
}
else
{
- LogLog.Warn(declaringType, "BasicConfigurator: Repository [" + repository + "] does not support the BasicConfigurator");
+ LogLog.Warn(declaringType, $"BasicConfigurator: Repository [{repository}] does not support the BasicConfigurator");
}
}
-
- #endregion Public Static Methods
}
}
diff --git a/src/log4net/Config/ConfiguratorAttribute.cs b/src/log4net/Config/ConfiguratorAttribute.cs
index c884736..83d7a39 100644
--- a/src/log4net/Config/ConfiguratorAttribute.cs
+++ b/src/log4net/Config/ConfiguratorAttribute.cs
@@ -17,9 +17,6 @@
//
#endregion
-// .NET Compact Framework 1.0 has no support for reading assembly attributes
-#if !NETCF
-
using System;
using System.Reflection;
@@ -108,6 +105,4 @@
return result;
}
}
-}
-
-#endif //!NETCF
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/src/log4net/Config/DOMConfigurator.cs b/src/log4net/Config/DOMConfigurator.cs
index b7c1563..511e7a4 100644
--- a/src/log4net/Config/DOMConfigurator.cs
+++ b/src/log4net/Config/DOMConfigurator.cs
@@ -17,16 +17,11 @@
//
#endregion
-#if NET_2_0 // really only because netstandard doesn't understand Assembly.GetCallingAssembly()
using System;
-using System.Xml;
-using System.Collections;
using System.IO;
using System.Reflection;
-using System.Threading;
+using System.Xml;
-using log4net.Appender;
-using log4net.Util;
using log4net.Repository;
namespace log4net.Config
@@ -47,8 +42,6 @@
[Obsolete("Use XmlConfigurator instead of DOMConfigurator")]
public sealed class DOMConfigurator
{
- #region Private Instance Constructors
-
/// <summary>
/// Private constructor
/// </summary>
@@ -56,10 +49,6 @@
{
}
- #endregion Protected Instance Constructors
-
- #region Configure static methods
-
/// <summary>
/// Automatically configures the log4net system based on the
/// application's configuration settings.
@@ -284,12 +273,6 @@
XmlConfigurator.Configure(repository, configStream);
}
- #endregion Configure static methods
-
- #region ConfigureAndWatch static methods
-
-#if (!NETCF && !SSCLI)
-
/// <summary>
/// Configures log4net using the file specified, monitors the file for changes
/// and reloads the configuration if a change is detected.
@@ -351,9 +334,5 @@
{
XmlConfigurator.ConfigureAndWatch(repository, configFile);
}
-#endif
-
- #endregion ConfigureAndWatch static methods
}
-}
-#endif // NET_2_0
+}
\ No newline at end of file
diff --git a/src/log4net/Config/DOMConfiguratorAttribute.cs b/src/log4net/Config/DOMConfiguratorAttribute.cs
index 4a2c2b5..4243bed 100644
--- a/src/log4net/Config/DOMConfiguratorAttribute.cs
+++ b/src/log4net/Config/DOMConfiguratorAttribute.cs
@@ -17,16 +17,7 @@
//
#endregion
-// .NET Compact Framework 1.0 has no support for reading assembly attributes
-#if !NETCF
-
using System;
-using System.Reflection;
-using System.IO;
-
-using log4net.Util;
-using log4net.Repository;
-using log4net.Repository.Hierarchy;
namespace log4net.Config
{
@@ -55,6 +46,4 @@
public sealed class DOMConfiguratorAttribute : XmlConfiguratorAttribute
{
}
-}
-
-#endif // !NETCF
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/src/log4net/Config/DomainAttribute.cs b/src/log4net/Config/DomainAttribute.cs
index 1aeab43..b6faa1b 100644
--- a/src/log4net/Config/DomainAttribute.cs
+++ b/src/log4net/Config/DomainAttribute.cs
@@ -17,9 +17,6 @@
//
#endregion
-// .NET Compact Framework 1.0 has no support for reading assembly attributes
-#if !NETCF
-
using System;
namespace log4net.Config
@@ -52,8 +49,6 @@
[Obsolete("Use RepositoryAttribute instead of DomainAttribute")]
public sealed class DomainAttribute : RepositoryAttribute
{
- #region Public Instance Constructors
-
/// <summary>
/// Initializes a new instance of the <see cref="DomainAttribute" /> class.
/// </summary>
@@ -79,9 +74,5 @@
public DomainAttribute(string name) : base(name)
{
}
-
- #endregion Public Instance Constructors
}
-}
-
-#endif // !NETCF
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/src/log4net/Config/Log4NetConfigurationSectionHandler.cs b/src/log4net/Config/Log4NetConfigurationSectionHandler.cs
index be34c8c..2638ac4 100644
--- a/src/log4net/Config/Log4NetConfigurationSectionHandler.cs
+++ b/src/log4net/Config/Log4NetConfigurationSectionHandler.cs
@@ -1,4 +1,3 @@
-#if NET_2_0 || NETSTANDARD2_0
#region Apache License
//
// Licensed to the Apache Software Foundation (ASF) under one or more
@@ -18,9 +17,6 @@
//
#endregion
-// .NET Compact Framework 1.0 has no support for application .config files
-#if !NETCF
-
using System.Configuration;
using System.Xml;
@@ -51,8 +47,6 @@
/// <author>Gert Driesen</author>
public class Log4NetConfigurationSectionHandler : IConfigurationSectionHandler
{
- #region Public Instance Constructors
-
/// <summary>
/// Initializes a new instance of the <see cref="Log4NetConfigurationSectionHandler"/> class.
/// </summary>
@@ -65,10 +59,6 @@
{
}
- #endregion Public Instance Constructors
-
- #region Implementation of IConfigurationSectionHandler
-
/// <summary>
/// Parses the configuration section.
/// </summary>
@@ -85,10 +75,5 @@
{
return section;
}
-
- #endregion Implementation of IConfigurationSectionHandler
}
-}
-
-#endif // !NETCF
-#endif // NET_2_0 || NETSTANDARD2_0
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/src/log4net/Config/PluginAttribute.cs b/src/log4net/Config/PluginAttribute.cs
index 21bbad7..35ee8e7 100644
--- a/src/log4net/Config/PluginAttribute.cs
+++ b/src/log4net/Config/PluginAttribute.cs
@@ -17,15 +17,10 @@
//
#endregion
-// .NET Compact Framework 1.0 has no support for reading assembly attributes
-#if !NETCF
-
using System;
using log4net.Core;
-#if !NETSTANDARD1_3
using log4net.Util;
-#endif
using log4net.Plugin;
namespace log4net.Config
@@ -47,9 +42,6 @@
[Serializable]
public sealed class PluginAttribute : Attribute, IPluginFactory
{
- #region Public Instance Constructors
-
-#if !NETSTANDARD1_3 // Excluded because GetCallingAssembly() is not available in CoreFX (https://github.com/dotnet/corefx/issues/2221).
/// <summary>
/// Initializes a new instance of the <see cref="PluginAttribute" /> class
/// with the specified type.
@@ -65,9 +57,8 @@
/// </remarks>
public PluginAttribute(string typeName)
{
- m_typeName = typeName;
+ TypeName = typeName;
}
-#endif
/// <summary>
/// Initializes a new instance of the <see cref="PluginAttribute" /> class
@@ -81,53 +72,23 @@
/// </remarks>
public PluginAttribute(Type type)
{
- m_type = type;
+ Type = type;
}
- #endregion Public Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
/// Gets or sets the type for the plugin.
/// </summary>
- /// <value>
- /// The type for the plugin.
- /// </value>
- /// <remarks>
- /// <para>
- /// The type for the plugin.
- /// </para>
- /// </remarks>
- public Type Type
- {
- get { return m_type; }
- set { m_type = value; }
- }
+ public Type? Type { get; set; }
/// <summary>
/// Gets or sets the type name for the plugin.
/// </summary>
- /// <value>
- /// The type name for the plugin.
- /// </value>
/// <remarks>
/// <para>
- /// The type name for the plugin.
- /// </para>
- /// <para>
/// Where possible use the <see cref="Type"/> property instead.
/// </para>
/// </remarks>
- public string TypeName
- {
- get { return m_typeName; }
- set { m_typeName = value; }
- }
-
- #endregion Public Instance Properties
-
- #region Implementation of IPluginFactory
+ public string? TypeName { get; set; }
/// <summary>
/// Creates the plugin object defined by this attribute.
@@ -141,18 +102,13 @@
/// <returns>The plugin object.</returns>
public IPlugin CreatePlugin()
{
- Type pluginType = m_type;
-#if !NETSTANDARD1_3
- if (m_type == null)
- {
- // Get the plugin object type from the string type name
- pluginType = SystemInfo.GetTypeFromString(m_typeName, true, true);
- }
-#endif
+ // Get the plugin object type from the type first before trying the string type name.
+ Type? pluginType = Type ?? SystemInfo.GetTypeFromString(TypeName, true, true);
+
// Check that the type is a plugin
if (!(typeof(IPlugin).IsAssignableFrom(pluginType)))
{
- throw new LogException("Plugin type [" + pluginType.FullName + "] does not implement the log4net.IPlugin interface");
+ throw new LogException($"Plugin type [{pluginType.FullName}] does not implement the log4net.IPlugin interface");
}
// Create an instance of the plugin using the default constructor
@@ -161,10 +117,6 @@
return plugin;
}
- #endregion Implementation of IPluginFactory
-
- #region Override implementation of Object
-
/// <summary>
/// Returns a representation of the properties of this object.
/// </summary>
@@ -177,22 +129,7 @@
/// <returns>A representation of the properties of this object</returns>
public override string ToString()
{
- if (m_type != null)
- {
- return "PluginAttribute[Type=" + m_type.FullName + "]";
- }
- return "PluginAttribute[Type=" + m_typeName + "]";
+ return $"PluginAttribute[Type={Type?.FullName ?? TypeName}]";
}
-
- #endregion Override implementation of Object
-
- #region Private Instance Fields
-
- private string m_typeName = null;
- private Type m_type = null;
-
- #endregion Private Instance Fields
}
-}
-
-#endif // !NETCF
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/src/log4net/Config/RepositoryAttribute.cs b/src/log4net/Config/RepositoryAttribute.cs
index 9f3b723..443e4af 100644
--- a/src/log4net/Config/RepositoryAttribute.cs
+++ b/src/log4net/Config/RepositoryAttribute.cs
@@ -17,11 +17,10 @@
//
#endregion
-// .NET Compact Framework 1.0 has no support for reading assembly attributes
-#if !NETCF
-
using System;
+#nullable enable
+
namespace log4net.Config
{
/// <summary>
@@ -52,8 +51,6 @@
// Class is not sealed because DomainAttribute extends it while it is obsoleted
//
- #region Public Instance Constructors
-
/// <summary>
/// Initializes a new instance of the <see cref="RepositoryAttribute" /> class.
/// </summary>
@@ -78,13 +75,9 @@
/// </remarks>
public RepositoryAttribute(string name)
{
- m_name = name;
+ Name = name;
}
- #endregion Public Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
/// Gets or sets the name of the logging repository.
/// </summary>
@@ -98,11 +91,7 @@
/// same repository. They will share the logging configuration of the repository.
/// </para>
/// </remarks>
- public string Name
- {
- get { return m_name; }
- set { m_name = value; }
- }
+ public string? Name { get; set; }
/// <summary>
/// Gets or sets the type of repository to create for this assembly.
@@ -124,21 +113,6 @@
/// repository.
/// </para>
/// </remarks>
- public Type RepositoryType
- {
- get { return m_repositoryType; }
- set { m_repositoryType = value; }
- }
-
- #endregion Public Instance Properties
-
- #region Private Instance Fields
-
- private string m_name = null;
- private Type m_repositoryType = null;
-
- #endregion Private Instance Fields
+ public Type? RepositoryType { get; set; }
}
-}
-
-#endif // !NETCF
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/src/log4net/Config/SecurityContextProviderAttribute.cs b/src/log4net/Config/SecurityContextProviderAttribute.cs
index 5e76c1f..e82e858 100644
--- a/src/log4net/Config/SecurityContextProviderAttribute.cs
+++ b/src/log4net/Config/SecurityContextProviderAttribute.cs
@@ -17,9 +17,6 @@
//
#endregion
-// .NET Compact Framework 1.0 has no support for reading assembly attributes
-#if !NETCF
-
using System;
using System.Reflection;
@@ -48,8 +45,6 @@
[Serializable]
public sealed class SecurityContextProviderAttribute : ConfiguratorAttribute
{
- #region Constructor
-
/// <summary>
/// Construct provider attribute with type specified
/// </summary>
@@ -62,34 +57,19 @@
/// </remarks>
public SecurityContextProviderAttribute(Type providerType) : base(100) /* configurator priority 100 to execute before the XmlConfigurator */
{
- m_providerType = providerType;
+ ProviderType = providerType;
}
- #endregion
-
- #region Public Instance Properties
-
/// <summary>
/// Gets or sets the type of the provider to use.
/// </summary>
- /// <value>
- /// the type of the provider to use.
- /// </value>
/// <remarks>
/// <para>
/// The provider specified must subclass the <see cref="SecurityContextProvider"/>
/// class.
/// </para>
/// </remarks>
- public Type ProviderType
- {
- get { return m_providerType; }
- set { m_providerType = value; }
- }
-
- #endregion Public Instance Properties
-
- #region Override ConfiguratorAttribute
+ public Type ProviderType { get; set; }
/// <summary>
/// Configures the SecurityContextProvider
@@ -104,19 +84,17 @@
/// </remarks>
public override void Configure(Assembly sourceAssembly, ILoggerRepository targetRepository)
{
- if (m_providerType == null)
+ if (ProviderType is null)
{
- LogLog.Error(declaringType, "Attribute specified on assembly [" + sourceAssembly.FullName + "] with null ProviderType.");
+ LogLog.Error(declaringType, $"Attribute specified on assembly [{sourceAssembly.FullName}] with null ProviderType.");
}
else
{
- LogLog.Debug(declaringType, "Creating provider of type [" + m_providerType.FullName + "]");
+ LogLog.Debug(declaringType, $"Creating provider of type [{ProviderType.FullName}]");
- SecurityContextProvider provider = Activator.CreateInstance(m_providerType) as SecurityContextProvider;
-
- if (provider == null)
+ if (Activator.CreateInstance(ProviderType) is not SecurityContextProvider provider)
{
- LogLog.Error(declaringType, "Failed to create SecurityContextProvider instance of type [" + m_providerType.Name + "].");
+ LogLog.Error(declaringType, $"Failed to create SecurityContextProvider instance of type [{ProviderType.Name}].");
}
else
{
@@ -125,16 +103,6 @@
}
}
- #endregion
-
- #region Private Instance Fields
-
- private Type m_providerType = null;
-
- #endregion Private Instance Fields
-
- #region Private Static Fields
-
/// <summary>
/// The fully qualified type of the SecurityContextProviderAttribute class.
/// </summary>
@@ -143,9 +111,5 @@
/// log message.
/// </remarks>
private static readonly Type declaringType = typeof(SecurityContextProviderAttribute);
-
- #endregion Private Static Fields
}
}
-
-#endif // !NETCF
\ No newline at end of file
diff --git a/src/log4net/Config/XmlConfigurator.cs b/src/log4net/Config/XmlConfigurator.cs
index b11cda0..29ecbab 100644
--- a/src/log4net/Config/XmlConfigurator.cs
+++ b/src/log4net/Config/XmlConfigurator.cs
@@ -20,44 +20,25 @@
using System;
using System.Xml;
using System.Collections;
+using System.Collections.Concurrent;
using System.IO;
-#if !NETCF && !NETSTANDARD1_3
using System.Reflection;
-#endif
using System.Threading;
using System.Net;
using log4net.Util;
using log4net.Repository;
+using System.Collections.Generic;
namespace log4net.Config
{
/// <summary>
- /// Use this class to initialize the log4net environment using an Xml tree.
+ /// Configures a <see cref="ILoggerRepository"/> using an XML tree.
/// </summary>
- /// <remarks>
- /// <para>
- /// Configures a <see cref="ILoggerRepository"/> using an Xml tree.
- /// </para>
- /// </remarks>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
- public sealed class XmlConfigurator
+ public static class XmlConfigurator
{
- #region Private Instance Constructors
-
- /// <summary>
- /// Private constructor
- /// </summary>
- private XmlConfigurator()
- {
- }
-
- #endregion Protected Instance Constructors
-
- #region Configure static methods
-
-#if !NETCF
/// <summary>
/// Automatically configures the <see cref="ILoggerRepository"/> using settings
/// stored in the application's configuration file.
@@ -78,25 +59,9 @@
/// </para>
/// </remarks>
/// <param name="repository">The repository to configure.</param>
-#else
- /// <summary>
- /// Automatically configures the <see cref="ILoggerRepository"/> using settings
- /// stored in the application's configuration file.
- /// </summary>
- /// <remarks>
- /// <para>
- /// Each application has a configuration file. This has the
- /// same name as the application with '.config' appended.
- /// This file is XML and calling this function prompts the
- /// configurator to look in that file for a section called
- /// <c>log4net</c> that contains the configuration data.
- /// </para>
- /// </remarks>
- /// <param name="repository">The repository to configure.</param>
-#endif
public static ICollection Configure(ILoggerRepository repository)
{
- ArrayList configurationMessages = new ArrayList();
+ var configurationMessages = new List<LogLog>();
using (new LogLog.LogReceivedAdapter(configurationMessages))
{
@@ -110,11 +75,11 @@
private static void InternalConfigure(ILoggerRepository repository)
{
- LogLog.Debug(declaringType, "configuring repository [" + repository.Name + "] using .config file section");
+ LogLog.Debug(declaringType, $"configuring repository [{repository.Name}] using .config file section");
try
{
- LogLog.Debug(declaringType, "Application config file is [" + SystemInfo.ConfigurationFileLocation + "]");
+ LogLog.Debug(declaringType, $"Application config file is [{SystemInfo.ConfigurationFileLocation}]");
}
catch
{
@@ -122,14 +87,9 @@
LogLog.Debug(declaringType, "Application config file location unknown");
}
-#if NETCF || NETSTANDARD1_3
- // No config file reading stuff. Just go straight for the file
- Configure(repository, new FileInfo(SystemInfo.ConfigurationFileLocation));
-#else
try
{
- XmlElement configElement = System.Configuration.ConfigurationManager.GetSection("log4net") as XmlElement;
- if (configElement == null)
+ if (System.Configuration.ConfigurationManager.GetSection("log4net") is not XmlElement configElement)
{
// Failed to load the xml config using configuration settings handler
LogLog.Error(declaringType, "Failed to find configuration section 'log4net' in the application's .config file. Check your .config file for the <log4net> and <configSections> elements. The configuration section should look like: <section name=\"log4net\" type=\"log4net.Config.Log4NetConfigurationSectionHandler,log4net\" />");
@@ -142,7 +102,7 @@
}
catch (System.Configuration.ConfigurationException confEx)
{
- if (confEx.BareMessage.IndexOf("Unrecognized element") >= 0)
+ if (confEx.BareMessage.IndexOf("Unrecognized element", StringComparison.Ordinal) >= 0)
{
// Looks like the XML file is not valid
LogLog.Error(declaringType, "Failed to parse config file. Check your .config file is well formed XML.", confEx);
@@ -154,11 +114,8 @@
LogLog.Error(declaringType, "Failed to parse config file. Is the <configSections> specified as: " + configSectionStr, confEx);
}
}
-#endif
}
-#if !NETSTANDARD1_3 // Excluded because GetCallingAssembly() is not available in CoreFX (https://github.com/dotnet/corefx/issues/2221).
-#if !NETCF
/// <summary>
/// Automatically configures the log4net system based on the
/// application's configuration settings.
@@ -179,21 +136,6 @@
/// </para>
/// </remarks>
/// <seealso cref="Log4NetConfigurationSectionHandler"/>
-#else
- /// <summary>
- /// Automatically configures the log4net system based on the
- /// application's configuration settings.
- /// </summary>
- /// <remarks>
- /// <para>
- /// Each application has a configuration file. This has the
- /// same name as the application with '.config' appended.
- /// This file is XML and calling this function prompts the
- /// configurator to look in that file for a section called
- /// <c>log4net</c> that contains the configuration data.
- /// </para>
- /// </remarks>
-#endif
public static ICollection Configure()
{
return Configure(LogManager.GetRepository(Assembly.GetCallingAssembly()));
@@ -211,7 +153,7 @@
/// <param name="element">The element to parse.</param>
public static ICollection Configure(XmlElement element)
{
- ArrayList configurationMessages = new ArrayList();
+ var configurationMessages = new List<LogLog>();
ILoggerRepository repository = LogManager.GetRepository(Assembly.GetCallingAssembly());
@@ -225,7 +167,6 @@
return configurationMessages;
}
-#if !NETCF
/// <summary>
/// Configures log4net using the specified configuration file.
/// </summary>
@@ -237,7 +178,7 @@
/// the log4net configuration data.
/// </para>
/// <para>
- /// The log4net configuration file can possible be specified in the application's
+ /// The log4net configuration file can possibly be specified in the application's
/// configuration file (either <c>MyAppName.exe.config</c> for a
/// normal application on <c>Web.config</c> for an ASP.NET application).
/// </para>
@@ -276,45 +217,9 @@
/// </configuration>
/// </code>
/// </remarks>
-#else
- /// <summary>
- /// Configures log4net using the specified configuration file.
- /// </summary>
- /// <param name="configFile">The XML file to load the configuration from.</param>
- /// <remarks>
- /// <para>
- /// The configuration file must be valid XML. It must contain
- /// at least one element called <c>log4net</c> that holds
- /// the log4net configuration data.
- /// </para>
- /// <example>
- /// The following example configures log4net using a configuration file, of which the
- /// location is stored in the application's configuration file :
- /// </example>
- /// <code lang="C#">
- /// using log4net.Config;
- /// using System.IO;
- /// using System.Configuration;
- ///
- /// ...
- ///
- /// XmlConfigurator.Configure(new FileInfo(ConfigurationSettings.AppSettings["log4net-config-file"]));
- /// </code>
- /// <para>
- /// In the <c>.config</c> file, the path to the log4net can be specified like this :
- /// </para>
- /// <code lang="XML" escaped="true">
- /// <configuration>
- /// <appSettings>
- /// <add key="log4net-config-file" value="log.config"/>
- /// </appSettings>
- /// </configuration>
- /// </code>
- /// </remarks>
-#endif
public static ICollection Configure(FileInfo configFile)
{
- ArrayList configurationMessages = new ArrayList();
+ var configurationMessages = new List<LogLog>();
using (new LogLog.LogReceivedAdapter(configurationMessages))
{
@@ -340,7 +245,7 @@
/// </remarks>
public static ICollection Configure(Uri configUri)
{
- ArrayList configurationMessages = new ArrayList();
+ var configurationMessages = new List<LogLog>();
ILoggerRepository repository = LogManager.GetRepository(Assembly.GetCallingAssembly());
using (new LogLog.LogReceivedAdapter(configurationMessages))
@@ -369,7 +274,7 @@
/// </remarks>
public static ICollection Configure(Stream configStream)
{
- ArrayList configurationMessages = new ArrayList();
+ var configurationMessages = new List<LogLog>();
ILoggerRepository repository = LogManager.GetRepository(Assembly.GetCallingAssembly());
using (new LogLog.LogReceivedAdapter(configurationMessages))
@@ -381,7 +286,6 @@
return configurationMessages;
}
-#endif // !NETSTANDARD1_3
/// <summary>
/// Configures the <see cref="ILoggerRepository"/> using the specified XML
@@ -395,7 +299,7 @@
/// <param name="element">The element to parse.</param>
public static ICollection Configure(ILoggerRepository repository, XmlElement element)
{
- ArrayList configurationMessages = new ArrayList();
+ var configurationMessages = new List<LogLog>();
using (new LogLog.LogReceivedAdapter(configurationMessages))
{
@@ -409,7 +313,6 @@
return configurationMessages;
}
-#if !NETCF
/// <summary>
/// Configures the <see cref="ILoggerRepository"/> using the specified configuration
/// file.
@@ -423,7 +326,7 @@
/// the configuration data.
/// </para>
/// <para>
- /// The log4net configuration file can possible be specified in the application's
+ /// The log4net configuration file can possibly be specified in the application's
/// configuration file (either <c>MyAppName.exe.config</c> for a
/// normal application on <c>Web.config</c> for an ASP.NET application).
/// </para>
@@ -462,47 +365,9 @@
/// </configuration>
/// </code>
/// </remarks>
-#else
- /// <summary>
- /// Configures the <see cref="ILoggerRepository"/> using the specified configuration
- /// file.
- /// </summary>
- /// <param name="repository">The repository to configure.</param>
- /// <param name="configFile">The XML file to load the configuration from.</param>
- /// <remarks>
- /// <para>
- /// The configuration file must be valid XML. It must contain
- /// at least one element called <c>log4net</c> that holds
- /// the configuration data.
- /// </para>
- /// <example>
- /// The following example configures log4net using a configuration file, of which the
- /// location is stored in the application's configuration file :
- /// </example>
- /// <code lang="C#">
- /// using log4net.Config;
- /// using System.IO;
- /// using System.Configuration;
- ///
- /// ...
- ///
- /// XmlConfigurator.Configure(new FileInfo(ConfigurationSettings.AppSettings["log4net-config-file"]));
- /// </code>
- /// <para>
- /// In the <c>.config</c> file, the path to the log4net can be specified like this :
- /// </para>
- /// <code lang="XML" escaped="true">
- /// <configuration>
- /// <appSettings>
- /// <add key="log4net-config-file" value="log.config"/>
- /// </appSettings>
- /// </configuration>
- /// </code>
- /// </remarks>
-#endif
public static ICollection Configure(ILoggerRepository repository, FileInfo configFile)
{
- ArrayList configurationMessages = new ArrayList();
+ var configurationMessages = new List<LogLog>();
using (new LogLog.LogReceivedAdapter(configurationMessages))
{
@@ -514,11 +379,11 @@
return configurationMessages;
}
- private static void InternalConfigure(ILoggerRepository repository, FileInfo configFile)
+ private static void InternalConfigure(ILoggerRepository repository, FileInfo? configFile)
{
- LogLog.Debug(declaringType, "configuring repository [" + repository.Name + "] using file [" + configFile + "]");
+ LogLog.Debug(declaringType, $"configuring repository [{repository.Name}] using file [{configFile}]");
- if (configFile == null)
+ if (configFile is null)
{
LogLog.Error(declaringType, "Configure called with null 'configFile' parameter");
}
@@ -529,7 +394,7 @@
if (File.Exists(configFile.FullName))
{
// Open the file for reading
- FileStream fs = null;
+ FileStream? fs = null;
// Try hard to open the file
for (int retry = 5; --retry >= 0;)
@@ -543,16 +408,16 @@
{
if (retry == 0)
{
- LogLog.Error(declaringType, "Failed to open XML config file [" + configFile.Name + "]", ex);
+ LogLog.Error(declaringType, $"Failed to open XML config file [{configFile.Name}]", ex);
// The stream cannot be valid
fs = null;
}
- System.Threading.Thread.Sleep(250);
+ Thread.Sleep(250);
}
}
- if (fs != null)
+ if (fs is not null)
{
try
{
@@ -591,7 +456,7 @@
/// </remarks>
public static ICollection Configure(ILoggerRepository repository, Uri configUri)
{
- ArrayList configurationMessages = new ArrayList();
+ var configurationMessages = new List<LogLog>();
using (new LogLog.LogReceivedAdapter(configurationMessages))
{
@@ -603,11 +468,11 @@
return configurationMessages;
}
- private static void InternalConfigure(ILoggerRepository repository, Uri configUri)
+ private static void InternalConfigure(ILoggerRepository repository, Uri? configUri)
{
- LogLog.Debug(declaringType, "configuring repository [" + repository.Name + "] using URI [" + configUri + "]");
+ LogLog.Debug(declaringType, $"configuring repository [{repository.Name}] using URI [{configUri}]");
- if (configUri == null)
+ if (configUri is null)
{
LogLog.Error(declaringType, "Configure called with null 'configUri' parameter");
}
@@ -621,7 +486,7 @@
else
{
// NETCF dose not support WebClient
- WebRequest configRequest = null;
+ WebRequest? configRequest = null;
try
{
@@ -629,12 +494,11 @@
}
catch (Exception ex)
{
- LogLog.Error(declaringType, "Failed to create WebRequest for URI [" + configUri + "]", ex);
+ LogLog.Error(declaringType, $"Failed to create WebRequest for URI [{configUri}]", ex);
}
- if (configRequest != null)
+ if (configRequest is not null)
{
-#if !NETCF_1_0
// authentication may be required, set client to use default credentials
try
{
@@ -644,15 +508,10 @@
{
// ignore security exception
}
-#endif
try
{
-#if NETSTANDARD
- using WebResponse response = configRequest.GetResponseAsync().GetAwaiter().GetResult();
-#else
- using WebResponse response = configRequest.GetResponse();
-#endif
- if (response != null)
+ using WebResponse? response = configRequest.GetResponse();
+ if (response is not null)
{
using var configStream = response.GetResponseStream();
InternalConfigure(repository, configStream);
@@ -660,7 +519,7 @@
}
catch (Exception ex)
{
- LogLog.Error(declaringType, "Failed to request config from URI [" + configUri + "]", ex);
+ LogLog.Error(declaringType, $"Failed to request config from URI [{configUri}]", ex);
}
}
}
@@ -685,7 +544,7 @@
/// </remarks>
public static ICollection Configure(ILoggerRepository repository, Stream configStream)
{
- ArrayList configurationMessages = new ArrayList();
+ var configurationMessages = new List<LogLog>();
using (new LogLog.LogReceivedAdapter(configurationMessages))
{
@@ -697,51 +556,28 @@
return configurationMessages;
}
- private static void InternalConfigure(ILoggerRepository repository, Stream configStream)
+ private static void InternalConfigure(ILoggerRepository repository, Stream? configStream)
{
- LogLog.Debug(declaringType, "configuring repository [" + repository.Name + "] using stream");
+ LogLog.Debug(declaringType, $"configuring repository [{repository.Name}] using stream");
- if (configStream == null)
+ if (configStream is null)
{
LogLog.Error(declaringType, "Configure called with null 'configStream' parameter");
}
else
{
// Load the config file into a document
-#if NETSTANDARD1_3
- XmlDocument doc = new XmlDocument();
-#else
- XmlDocument doc = new XmlDocument { XmlResolver = null };
-#endif
+ XmlDocument? doc = new XmlDocument { XmlResolver = null };
try
{
-#if (NETCF)
- // Create a text reader for the file stream
- XmlTextReader xmlReader = new XmlTextReader(configStream);
-#elif NET_2_0 || NETSTANDARD
// Allow the DTD to specify entity includes
- XmlReaderSettings settings = new XmlReaderSettings();
+ var settings = new XmlReaderSettings();
// .NET 4.0 warning CS0618: 'System.Xml.XmlReaderSettings.ProhibitDtd'
// is obsolete: 'Use XmlReaderSettings.DtdProcessing property instead.'
-#if NETSTANDARD1_3 // TODO DtdProcessing.Parse not yet available (https://github.com/dotnet/corefx/issues/4376)
settings.DtdProcessing = DtdProcessing.Ignore;
-#elif !NET_4_0 && !MONO_4_0 && !NETSTANDARD2_0
- settings.ProhibitDtd = true;
-#else
- settings.DtdProcessing = DtdProcessing.Ignore;
-#endif
// Create a reader over the input stream
using XmlReader xmlReader = XmlReader.Create(configStream, settings);
-#else
- // Create a validating reader around a text reader for the file stream
- using XmlValidatingReader xmlReader = new XmlValidatingReader(new XmlTextReader(configStream));
-
- // Specify that the reader should not perform validation, but that it should
- // expand entity refs.
- xmlReader.ValidationType = ValidationType.None;
- xmlReader.EntityHandling = EntityHandling.ExpandEntities;
-#endif
// load the data into the document
doc.Load(xmlReader);
@@ -754,7 +590,7 @@
doc = null;
}
- if (doc != null)
+ if (doc is not null)
{
LogLog.Debug(declaringType, "loading XML configuration");
@@ -766,7 +602,7 @@
}
else if (configNodeList.Count > 1)
{
- LogLog.Error(declaringType, "XML configuration contains [" + configNodeList.Count + "] <log4net> elements. Only one is allowed. Configuration Aborted.");
+ LogLog.Error(declaringType, $"XML configuration contains [{configNodeList.Count}] <log4net> elements. Only one is allowed. Configuration Aborted.");
}
else
{
@@ -776,12 +612,6 @@
}
}
- #endregion Configure static methods
-
- #region ConfigureAndWatch static methods
-
-#if (!NETCF && !SSCLI)
-#if !NETSTANDARD1_3 // Excluded because GetCallingAssembly() is not available in CoreFX (https://github.com/dotnet/corefx/issues/2221).
/// <summary>
/// Configures log4net using the file specified, monitors the file for changes
/// and reloads the configuration if a change is detected.
@@ -805,7 +635,7 @@
/// <seealso cref="M:Configure(FileInfo)"/>
public static ICollection ConfigureAndWatch(FileInfo configFile)
{
- ArrayList configurationMessages = new ArrayList();
+ var configurationMessages = new List<LogLog>();
ILoggerRepository repository = LogManager.GetRepository(Assembly.GetCallingAssembly());
@@ -818,7 +648,6 @@
return configurationMessages;
}
-#endif // !NETSTANDARD1_3
/// <summary>
/// Configures the <see cref="ILoggerRepository"/> using the file specified,
@@ -845,7 +674,7 @@
/// <seealso cref="M:Configure(FileInfo)"/>
public static ICollection ConfigureAndWatch(ILoggerRepository repository, FileInfo configFile)
{
- ArrayList configurationMessages = new ArrayList();
+ var configurationMessages = new List<LogLog>();
using (new LogLog.LogReceivedAdapter(configurationMessages))
{
@@ -857,9 +686,9 @@
return configurationMessages;
}
- private static void InternalConfigureAndWatch(ILoggerRepository repository, FileInfo configFile)
+ private static void InternalConfigureAndWatch(ILoggerRepository repository, FileInfo? configFile)
{
- LogLog.Debug(declaringType, "configuring repository [" + repository.Name + "] using file [" + configFile + "] watching for file updates");
+ LogLog.Debug(declaringType, $"configuring repository [{repository.Name}] using file [{configFile}] watching for file updates");
if (configFile == null)
{
@@ -872,37 +701,26 @@
try
{
- lock (m_repositoryName2ConfigAndWatchHandler)
- {
- // support multiple repositories each having their own watcher
- ConfigureAndWatchHandler handler =
- (ConfigureAndWatchHandler)m_repositoryName2ConfigAndWatchHandler[configFile.FullName];
-
- if (handler != null)
+ // Support multiple repositories each having their own watcher.
+ // Create and start a watch handler that will reload the
+ // configuration whenever the config file is modified.
+ m_repositoryName2ConfigAndWatchHandler.AddOrUpdate(
+ configFile.FullName,
+ _ => new ConfigureAndWatchHandler(repository, configFile),
+ (_, handler) =>
{
- m_repositoryName2ConfigAndWatchHandler.Remove(configFile.FullName);
+ // Replace the old handler.
handler.Dispose();
- }
-
- // Create and start a watch handler that will reload the
- // configuration whenever the config file is modified.
- handler = new ConfigureAndWatchHandler(repository, configFile);
- m_repositoryName2ConfigAndWatchHandler[configFile.FullName] = handler;
- }
+ return new ConfigureAndWatchHandler(repository, configFile);
+ });
}
catch (Exception ex)
{
- LogLog.Error(declaringType, "Failed to initialize configuration file watcher for file [" + configFile.FullName + "]", ex);
+ LogLog.Error(declaringType, $"Failed to initialize configuration file watcher for file [{configFile.FullName}]", ex);
}
}
}
-#endif
- #endregion ConfigureAndWatch static methods
-
- #region ConfigureAndWatchHandler
-
-#if (!NETCF && !SSCLI)
/// <summary>
/// Class used to watch config files.
/// </summary>
@@ -924,17 +742,17 @@
/// <summary>
/// Holds the FileInfo used to configure the XmlConfigurator
/// </summary>
- private FileInfo m_configFile;
+ private readonly FileInfo m_configFile;
/// <summary>
/// Holds the repository being configured.
/// </summary>
- private ILoggerRepository m_repository;
+ private readonly ILoggerRepository m_repository;
/// <summary>
/// The timer used to compress the notification events.
/// </summary>
- private Timer m_timer;
+ private readonly Timer m_timer;
/// <summary>
/// The default amount of time to wait after receiving notification
@@ -946,7 +764,7 @@
/// Watches file for changes. This object should be disposed when no longer
/// needed to free system handles on the watched resources.
/// </summary>
- private FileSystemWatcher m_watcher;
+ private readonly FileSystemWatcher m_watcher;
/// <summary>
/// Initializes a new instance of the <see cref="ConfigureAndWatchHandler" /> class to
@@ -959,34 +777,31 @@
/// Initializes a new instance of the <see cref="ConfigureAndWatchHandler" /> class.
/// </para>
/// </remarks>
-#if NET_4_0 || MONO_4_0 || NETSTANDARD
[System.Security.SecuritySafeCritical]
-#endif
public ConfigureAndWatchHandler(ILoggerRepository repository, FileInfo configFile)
{
m_repository = repository;
m_configFile = configFile;
// Create a new FileSystemWatcher and set its properties.
- m_watcher = new FileSystemWatcher();
-
- m_watcher.Path = m_configFile.DirectoryName;
- m_watcher.Filter = m_configFile.Name;
-
- // Set the notification filters
- m_watcher.NotifyFilter = NotifyFilters.CreationTime | NotifyFilters.LastWrite | NotifyFilters.FileName;
+ m_watcher = new FileSystemWatcher()
+ {
+ Path = m_configFile.DirectoryName,
+ Filter = m_configFile.Name,
+ NotifyFilter = NotifyFilters.CreationTime | NotifyFilters.LastWrite | NotifyFilters.FileName,
+ };
// Add event handlers. OnChanged will do for all event handlers that fire a FileSystemEventArgs
- m_watcher.Changed += new FileSystemEventHandler(ConfigureAndWatchHandler_OnChanged);
- m_watcher.Created += new FileSystemEventHandler(ConfigureAndWatchHandler_OnChanged);
- m_watcher.Deleted += new FileSystemEventHandler(ConfigureAndWatchHandler_OnChanged);
- m_watcher.Renamed += new RenamedEventHandler(ConfigureAndWatchHandler_OnRenamed);
+ m_watcher.Changed += ConfigureAndWatchHandler_OnChanged;
+ m_watcher.Created += ConfigureAndWatchHandler_OnChanged;
+ m_watcher.Deleted += ConfigureAndWatchHandler_OnChanged;
+ m_watcher.Renamed += ConfigureAndWatchHandler_OnRenamed;
// Begin watching.
m_watcher.EnableRaisingEvents = true;
// Create the timer that will be used to deliver events. Set as disabled
- m_timer = new Timer(new TimerCallback(OnWatchedFileChange), null, Timeout.Infinite, Timeout.Infinite);
+ m_timer = new Timer(OnWatchedFileChange, state: null, Timeout.Infinite, Timeout.Infinite);
}
/// <summary>
@@ -1001,7 +816,7 @@
/// </remarks>
private void ConfigureAndWatchHandler_OnChanged(object source, FileSystemEventArgs e)
{
- LogLog.Debug(declaringType, "ConfigureAndWatchHandler: " + e.ChangeType + " [" + m_configFile.FullName + "]");
+ LogLog.Debug(declaringType, $"ConfigureAndWatchHandler: {e.ChangeType} [{m_configFile.FullName}]");
// Deliver the event in TimeoutMillis time
// timer will fire only once
@@ -1020,7 +835,7 @@
/// </remarks>
private void ConfigureAndWatchHandler_OnRenamed(object source, RenamedEventArgs e)
{
- LogLog.Debug(declaringType, "ConfigureAndWatchHandler: " + e.ChangeType + " [" + m_configFile.FullName + "]");
+ LogLog.Debug(declaringType, $"ConfigureAndWatchHandler: {e.ChangeType} [{m_configFile.FullName}]");
// Deliver the event in TimeoutMillis time
// timer will fire only once
@@ -1039,9 +854,7 @@
/// <summary>
/// Release the handles held by the watcher and timer.
/// </summary>
-#if NET_4_0 || MONO_4_0 || NETSTANDARD
[System.Security.SecuritySafeCritical]
-#endif
public void Dispose()
{
m_watcher.EnableRaisingEvents = false;
@@ -1049,11 +862,6 @@
m_timer.Dispose();
}
}
-#endif
-
- #endregion ConfigureAndWatchHandler
-
- #region Private Static Methods
/// <summary>
/// Configures the specified repository using a <c>log4net</c> element.
@@ -1070,13 +878,13 @@
/// to load the configuration from an <see cref="XmlElement"/>.
/// </para>
/// </remarks>
- private static void InternalConfigureFromXml(ILoggerRepository repository, XmlElement element)
+ private static void InternalConfigureFromXml(ILoggerRepository? repository, XmlElement? element)
{
- if (element == null)
+ if (element is null)
{
LogLog.Error(declaringType, "ConfigureFromXml called with null 'element' parameter");
}
- else if (repository == null)
+ else if (repository is null)
{
LogLog.Error(declaringType, "ConfigureFromXml called with null 'repository' parameter");
}
@@ -1084,8 +892,7 @@
{
LogLog.Debug(declaringType, "Configuring Repository [" + repository.Name + "]");
- IXmlRepositoryConfigurator configurableRepository = repository as IXmlRepositoryConfigurator;
- if (configurableRepository == null)
+ if (repository is not IXmlRepositoryConfigurator configurableRepository)
{
LogLog.Warn(declaringType, "Repository [" + repository + "] does not support the XmlConfigurator");
}
@@ -1094,11 +901,7 @@
// Copy the xml data into the root of a new document
// this isolates the xml config data from the rest of
// the document
-#if NETSTANDARD1_3
- XmlDocument newDoc = new XmlDocument();
-#else
XmlDocument newDoc = new XmlDocument { XmlResolver = null };
-#endif
XmlElement newElement = (XmlElement)newDoc.AppendChild(newDoc.ImportNode(element, true));
// Pass the configurator the config element
@@ -1107,16 +910,12 @@
}
}
- #endregion Private Static Methods
-
- #region Private Static Fields
-
/// <summary>
/// Maps repository names to ConfigAndWatchHandler instances to allow a particular
/// ConfigAndWatchHandler to dispose of its FileSystemWatcher when a repository is
/// reconfigured.
/// </summary>
- private static readonly Hashtable m_repositoryName2ConfigAndWatchHandler = new Hashtable();
+ private static readonly ConcurrentDictionary<string, ConfigureAndWatchHandler> m_repositoryName2ConfigAndWatchHandler = new(StringComparer.Ordinal);
/// <summary>
/// The fully qualified type of the XmlConfigurator class.
@@ -1126,8 +925,5 @@
/// log message.
/// </remarks>
private static readonly Type declaringType = typeof(XmlConfigurator);
-
- #endregion Private Static Fields
}
}
-
diff --git a/src/log4net/Config/XmlConfiguratorAttribute.cs b/src/log4net/Config/XmlConfiguratorAttribute.cs
index bdc79a1..3579cda 100644
--- a/src/log4net/Config/XmlConfiguratorAttribute.cs
+++ b/src/log4net/Config/XmlConfiguratorAttribute.cs
@@ -17,11 +17,8 @@
//
#endregion
-// .NET Compact Framework 1.0 has no support for reading assembly attributes
-#if !NETCF
-
using System;
-using System.Collections;
+using System.Collections.Generic;
using System.Reflection;
using System.IO;
@@ -29,6 +26,8 @@
using log4net.Repository;
using log4net.Repository.Hierarchy;
+#nullable enable
+
namespace log4net.Config
{
/// <summary>
@@ -98,8 +97,6 @@
{
}
- #region Public Instance Properties
-
/// <summary>
/// Gets or sets the filename of the configuration file.
/// </summary>
@@ -116,18 +113,11 @@
/// The <see cref="ConfigFile"/> takes priority over the <see cref="ConfigFileExtension"/>.
/// </para>
/// </remarks>
- public string ConfigFile
- {
- get { return m_configFile; }
- set { m_configFile = value; }
- }
+ public string? ConfigFile { get; set; }
/// <summary>
/// Gets or sets the extension of the configuration file.
/// </summary>
- /// <value>
- /// The extension of the configuration file.
- /// </value>
/// <remarks>
/// <para>
/// If specified this is the extension for the configuration file.
@@ -144,11 +134,7 @@
/// The <see cref="ConfigFile"/> takes priority over the <see cref="ConfigFileExtension"/>.
/// </para>
/// </remarks>
- public string ConfigFileExtension
- {
- get { return m_configFileExtension; }
- set { m_configFileExtension = value; }
- }
+ public string? ConfigFileExtension { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to watch the configuration file.
@@ -172,15 +158,7 @@
/// Watching configuration is not supported on the SSCLI.
/// </note>
/// </remarks>
- public bool Watch
- {
- get { return m_configureAndWatch; }
- set { m_configureAndWatch = value; }
- }
-
- #endregion Public Instance Properties
-
- #region Override ConfiguratorAttribute
+ public bool Watch { get; set; }
/// <summary>
/// Configures the <see cref="ILoggerRepository"/> for the specified assembly.
@@ -198,11 +176,11 @@
/// <exception cref="ArgumentOutOfRangeException">The <paramref name="targetRepository" /> does not extend <see cref="Hierarchy"/>.</exception>
public override void Configure(Assembly sourceAssembly, ILoggerRepository targetRepository)
{
- IList configurationMessages = new ArrayList();
+ var configurationMessages = new List<LogLog>();
using (new LogLog.LogReceivedAdapter(configurationMessages))
{
- string applicationBaseDirectory = null;
+ string? applicationBaseDirectory = null;
try
{
applicationBaseDirectory = SystemInfo.ApplicationBaseDirectory;
@@ -213,21 +191,19 @@
// and the application does not have PathDiscovery permission
}
- if (applicationBaseDirectory == null || (new Uri(applicationBaseDirectory)).IsFile)
+ if (applicationBaseDirectory is null || (new Uri(applicationBaseDirectory)).IsFile)
{
ConfigureFromFile(sourceAssembly, targetRepository);
}
else
{
- ConfigureFromUri(sourceAssembly, targetRepository);
+ ConfigureFromUri(targetRepository);
}
}
targetRepository.ConfigurationMessages = configurationMessages;
}
- #endregion
-
/// <summary>
/// Attempt to load configuration from the local file system
/// </summary>
@@ -236,12 +212,12 @@
private void ConfigureFromFile(Assembly sourceAssembly, ILoggerRepository targetRepository)
{
// Work out the full path to the config file
- string fullPath2ConfigFile = null;
+ string? fullPath2ConfigFile = null;
// Select the config file
- if (m_configFile == null || m_configFile.Length == 0)
+ if (string.IsNullOrEmpty(ConfigFile))
{
- if (m_configFileExtension == null || m_configFileExtension.Length == 0)
+ if (string.IsNullOrEmpty(ConfigFileExtension))
{
// Use the default .config file for the AppDomain
try
@@ -256,12 +232,12 @@
else
{
// Force the extension to start with a '.'
- if (m_configFileExtension[0] != '.')
+ if (ConfigFileExtension![0] != '.')
{
- m_configFileExtension = "." + m_configFileExtension;
+ ConfigFileExtension = '.' + ConfigFileExtension;
}
- string applicationBaseDirectory = null;
+ string? applicationBaseDirectory = null;
try
{
applicationBaseDirectory = SystemInfo.ApplicationBaseDirectory;
@@ -271,36 +247,36 @@
LogLog.Error(declaringType, "Exception getting ApplicationBaseDirectory. Must be able to resolve ApplicationBaseDirectory and AssemblyFileName when ConfigFileExtension property is set.", ex);
}
- if (applicationBaseDirectory != null)
+ if (applicationBaseDirectory is not null)
{
- fullPath2ConfigFile = Path.Combine(applicationBaseDirectory, SystemInfo.AssemblyFileName(sourceAssembly) + m_configFileExtension);
+ fullPath2ConfigFile = Path.Combine(applicationBaseDirectory, SystemInfo.AssemblyFileName(sourceAssembly) + ConfigFileExtension);
}
}
}
else
{
- string applicationBaseDirectory = null;
+ string? applicationBaseDirectory = null;
try
{
applicationBaseDirectory = SystemInfo.ApplicationBaseDirectory;
}
catch (Exception ex)
{
- LogLog.Warn(declaringType, "Exception getting ApplicationBaseDirectory. ConfigFile property path [" + m_configFile + "] will be treated as an absolute path.", ex);
+ LogLog.Warn(declaringType, $"Exception getting ApplicationBaseDirectory. ConfigFile property path [{ConfigFile}] will be treated as an absolute path.", ex);
}
- if (applicationBaseDirectory != null)
+ if (applicationBaseDirectory is not null)
{
// Just the base dir + the config file
- fullPath2ConfigFile = Path.Combine(applicationBaseDirectory, m_configFile);
+ fullPath2ConfigFile = Path.Combine(applicationBaseDirectory, ConfigFile!);
}
else
{
- fullPath2ConfigFile = m_configFile;
+ fullPath2ConfigFile = ConfigFile;
}
}
- if (fullPath2ConfigFile != null)
+ if (fullPath2ConfigFile is not null)
{
ConfigureFromFile(targetRepository, new FileInfo(fullPath2ConfigFile));
}
@@ -313,15 +289,8 @@
/// <param name="configFile">the FileInfo pointing to the config file</param>
private void ConfigureFromFile(ILoggerRepository targetRepository, FileInfo configFile)
{
-#if (SSCLI)
- if (m_configureAndWatch)
- {
- LogLog.Warn(declaringType, "XmlConfiguratorAttribute: Unable to watch config file not supported on SSCLI");
- }
- XmlConfigurator.Configure(targetRepository, configFile);
-#else
// Do we configure just once or do we configure and then watch?
- if (m_configureAndWatch)
+ if (Watch)
{
XmlConfigurator.ConfigureAndWatch(targetRepository, configFile);
}
@@ -329,25 +298,23 @@
{
XmlConfigurator.Configure(targetRepository, configFile);
}
-#endif
}
/// <summary>
/// Attempt to load configuration from a URI
/// </summary>
- /// <param name="sourceAssembly">The assembly that this attribute was defined on.</param>
/// <param name="targetRepository">The repository to configure.</param>
- private void ConfigureFromUri(Assembly sourceAssembly, ILoggerRepository targetRepository)
+ private void ConfigureFromUri(ILoggerRepository targetRepository)
{
// Work out the full path to the config file
- Uri fullPath2ConfigFile = null;
+ Uri? fullPath2ConfigFile = null;
// Select the config file
- if (m_configFile == null || m_configFile.Length == 0)
+ if (string.IsNullOrEmpty(ConfigFile))
{
- if (m_configFileExtension == null || m_configFileExtension.Length == 0)
+ if (string.IsNullOrEmpty(ConfigFileExtension))
{
- string systemConfigFilePath = null;
+ string? systemConfigFilePath = null;
try
{
systemConfigFilePath = SystemInfo.ConfigurationFileLocation;
@@ -357,23 +324,21 @@
LogLog.Error(declaringType, "XmlConfiguratorAttribute: Exception getting ConfigurationFileLocation. Must be able to resolve ConfigurationFileLocation when ConfigFile and ConfigFileExtension properties are not set.", ex);
}
- if (systemConfigFilePath != null)
+ if (systemConfigFilePath is not null)
{
- Uri systemConfigFileUri = new Uri(systemConfigFilePath);
-
// Use the default .config file for the AppDomain
- fullPath2ConfigFile = systemConfigFileUri;
+ fullPath2ConfigFile = new Uri(systemConfigFilePath);
}
}
else
{
// Force the extension to start with a '.'
- if (m_configFileExtension[0] != '.')
+ if (ConfigFileExtension![0] != '.')
{
- m_configFileExtension = "." + m_configFileExtension;
+ ConfigFileExtension = '.' + ConfigFileExtension;
}
- string systemConfigFilePath = null;
+ string? systemConfigFilePath = null;
try
{
systemConfigFilePath = SystemInfo.ConfigurationFileLocation;
@@ -383,18 +348,18 @@
LogLog.Error(declaringType, "XmlConfiguratorAttribute: Exception getting ConfigurationFileLocation. Must be able to resolve ConfigurationFileLocation when the ConfigFile property are not set.", ex);
}
- if (systemConfigFilePath != null)
+ if (systemConfigFilePath is not null)
{
- UriBuilder builder = new UriBuilder(new Uri(systemConfigFilePath));
+ var builder = new UriBuilder(new Uri(systemConfigFilePath));
// Remove the current extension from the systemConfigFileUri path
string path = builder.Path;
- int startOfExtension = path.LastIndexOf(".");
+ int startOfExtension = path.LastIndexOf('.');
if (startOfExtension >= 0)
{
path = path.Substring(0, startOfExtension);
}
- path += m_configFileExtension;
+ path += ConfigFileExtension;
builder.Path = path;
fullPath2ConfigFile = builder.Uri;
@@ -403,38 +368,38 @@
}
else
{
- string applicationBaseDirectory = null;
+ string? applicationBaseDirectory = null;
try
{
applicationBaseDirectory = SystemInfo.ApplicationBaseDirectory;
}
catch (Exception ex)
{
- LogLog.Warn(declaringType, "Exception getting ApplicationBaseDirectory. ConfigFile property path [" + m_configFile + "] will be treated as an absolute URI.", ex);
+ LogLog.Warn(declaringType, $"Exception getting ApplicationBaseDirectory. ConfigFile property path [{ConfigFile}] will be treated as an absolute URI.", ex);
}
- if (applicationBaseDirectory != null)
+ if (applicationBaseDirectory is not null)
{
// Just the base dir + the config file
- fullPath2ConfigFile = new Uri(new Uri(applicationBaseDirectory), m_configFile);
+ fullPath2ConfigFile = new Uri(new Uri(applicationBaseDirectory), ConfigFile!);
}
else
{
- fullPath2ConfigFile = new Uri(m_configFile);
+ fullPath2ConfigFile = new Uri(ConfigFile!);
}
}
- if (fullPath2ConfigFile != null)
+ if (fullPath2ConfigFile is not null)
{
if (fullPath2ConfigFile.IsFile)
{
- // The m_configFile could be an absolute local path, therefore we have to be
+ // The ConfigFile could be an absolute local path, therefore we have to be
// prepared to switch back to using FileInfos here
ConfigureFromFile(targetRepository, new FileInfo(fullPath2ConfigFile.LocalPath));
}
else
{
- if (m_configureAndWatch)
+ if (Watch)
{
LogLog.Warn(declaringType, "XmlConfiguratorAttribute: Unable to watch config file loaded from a URI");
}
@@ -443,16 +408,6 @@
}
}
- #region Private Instance Fields
-
- private string m_configFile = null;
- private string m_configFileExtension = null;
- private bool m_configureAndWatch = false;
-
- #endregion Private Instance Fields
-
- #region Private Static Fields
-
/// <summary>
/// The fully qualified type of the XmlConfiguratorAttribute class.
/// </summary>
@@ -461,9 +416,5 @@
/// log message.
/// </remarks>
private static readonly Type declaringType = typeof(XmlConfiguratorAttribute);
-
- #endregion Private Static Fields
}
}
-
-#endif // !NETCF
diff --git a/src/log4net/Core/CompactRepositorySelector.cs b/src/log4net/Core/CompactRepositorySelector.cs
deleted file mode 100644
index 6034315..0000000
--- a/src/log4net/Core/CompactRepositorySelector.cs
+++ /dev/null
@@ -1,357 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-using System;
-using System.Collections;
-using System.Reflection;
-
-using log4net.Appender;
-using log4net.Util;
-using log4net.Repository;
-
-
-namespace log4net.Core
-{
- /// <summary>
- /// The implementation of the <see cref="IRepositorySelector"/> interface suitable
- /// for use with the compact framework
- /// </summary>
- /// <remarks>
- /// <para>
- /// This <see cref="IRepositorySelector"/> implementation is a simple
- /// mapping between repository name and <see cref="ILoggerRepository"/>
- /// object.
- /// </para>
- /// <para>
- /// The .NET Compact Framework 1.0 does not support retrieving assembly
- /// level attributes therefore unlike the <c>DefaultRepositorySelector</c>
- /// this selector does not examine the calling assembly for attributes.
- /// </para>
- /// </remarks>
- /// <author>Nicko Cadell</author>
- public class CompactRepositorySelector : IRepositorySelector
- {
- #region Member Variables
-
- private const string DefaultRepositoryName = "log4net-default-repository";
-
- private readonly Hashtable m_name2repositoryMap = new Hashtable();
- private readonly Type m_defaultRepositoryType;
-
- private event LoggerRepositoryCreationEventHandler m_loggerRepositoryCreatedEvent;
-
- #endregion
-
- #region Constructors
-
- /// <summary>
- /// Create a new repository selector
- /// </summary>
- /// <param name="defaultRepositoryType">the type of the repositories to create, must implement <see cref="ILoggerRepository"/></param>
- /// <remarks>
- /// <para>
- /// Create an new compact repository selector.
- /// The default type for repositories must be specified,
- /// an appropriate value would be <see cref="log4net.Repository.Hierarchy.Hierarchy"/>.
- /// </para>
- /// </remarks>
- /// <exception cref="ArgumentNullException">throw if <paramref name="defaultRepositoryType"/> is null</exception>
- /// <exception cref="ArgumentOutOfRangeException">throw if <paramref name="defaultRepositoryType"/> does not implement <see cref="ILoggerRepository"/></exception>
- public CompactRepositorySelector(Type defaultRepositoryType)
- {
- if (defaultRepositoryType == null)
- {
- throw new ArgumentNullException("defaultRepositoryType");
- }
-
- // Check that the type is a repository
- if (!(typeof(ILoggerRepository).IsAssignableFrom(defaultRepositoryType)))
- {
- throw log4net.Util.SystemInfo.CreateArgumentOutOfRangeException("defaultRepositoryType", (object)defaultRepositoryType, "Parameter: defaultRepositoryType, Value: [" + defaultRepositoryType + "] out of range. Argument must implement the ILoggerRepository interface");
- }
-
- m_defaultRepositoryType = defaultRepositoryType;
-
- LogLog.Debug(declaringType, "defaultRepositoryType [" + m_defaultRepositoryType + "]");
- }
-
- #endregion
-
- #region Implementation of IRepositorySelector
-
- /// <summary>
- /// Get the <see cref="ILoggerRepository"/> for the specified assembly
- /// </summary>
- /// <param name="assembly">not used</param>
- /// <returns>The default <see cref="ILoggerRepository"/></returns>
- /// <remarks>
- /// <para>
- /// The <paramref name="assembly"/> argument is not used. This selector does not create a
- /// separate repository for each assembly.
- /// </para>
- /// <para>
- /// As a named repository is not specified the default repository is
- /// returned. The default repository is named <c>log4net-default-repository</c>.
- /// </para>
- /// </remarks>
- public ILoggerRepository GetRepository(Assembly assembly)
- {
- return CreateRepository(assembly, m_defaultRepositoryType);
- }
-
- /// <summary>
- /// Get the named <see cref="ILoggerRepository"/>
- /// </summary>
- /// <param name="repositoryName">the name of the repository to lookup</param>
- /// <returns>The named <see cref="ILoggerRepository"/></returns>
- /// <remarks>
- /// <para>
- /// Get the named <see cref="ILoggerRepository"/>. The default
- /// repository is <c>log4net-default-repository</c>. Other repositories
- /// must be created using the <see cref="M:CreateRepository(string, Type)"/>.
- /// If the named repository does not exist an exception is thrown.
- /// </para>
- /// </remarks>
- /// <exception cref="ArgumentNullException">throw if <paramref name="repositoryName"/> is null</exception>
- /// <exception cref="LogException">throw if the <paramref name="repositoryName"/> does not exist</exception>
- public ILoggerRepository GetRepository(string repositoryName)
- {
- if (repositoryName == null)
- {
- throw new ArgumentNullException("repositoryName");
- }
-
- lock (this)
- {
- // Lookup in map
- ILoggerRepository rep = m_name2repositoryMap[repositoryName] as ILoggerRepository;
- if (rep == null)
- {
- throw new LogException("Repository [" + repositoryName + "] is NOT defined.");
- }
- return rep;
- }
- }
-
- /// <summary>
- /// Create a new repository for the assembly specified
- /// </summary>
- /// <param name="assembly">not used</param>
- /// <param name="repositoryType">the type of repository to create, must implement <see cref="ILoggerRepository"/></param>
- /// <returns>the repository created</returns>
- /// <remarks>
- /// <para>
- /// The <paramref name="assembly"/> argument is not used. This selector does not create a
- /// separate repository for each assembly.
- /// </para>
- /// <para>
- /// If the <paramref name="repositoryType"/> is <c>null</c> then the
- /// default repository type specified to the constructor is used.
- /// </para>
- /// <para>
- /// As a named repository is not specified the default repository is
- /// returned. The default repository is named <c>log4net-default-repository</c>.
- /// </para>
- /// </remarks>
- public ILoggerRepository CreateRepository(Assembly assembly, Type repositoryType)
- {
- // If the type is not set then use the default type
- if (repositoryType == null)
- {
- repositoryType = m_defaultRepositoryType;
- }
-
- lock (this)
- {
- // This method should not throw if the default repository already exists.
-
- // First check that the repository does not exist
- ILoggerRepository rep = m_name2repositoryMap[DefaultRepositoryName] as ILoggerRepository;
- if (rep == null)
- {
- // Must create the repository
- rep = CreateRepository(DefaultRepositoryName, repositoryType);
- }
-
- return rep;
- }
- }
-
- /// <summary>
- /// Create a new repository for the repository specified
- /// </summary>
- /// <param name="repositoryName">the repository to associate with the <see cref="ILoggerRepository"/></param>
- /// <param name="repositoryType">the type of repository to create, must implement <see cref="ILoggerRepository"/>.
- /// If this param is null then the default repository type is used.</param>
- /// <returns>the repository created</returns>
- /// <remarks>
- /// <para>
- /// The <see cref="ILoggerRepository"/> created will be associated with the repository
- /// specified such that a call to <see cref="M:GetRepository(string)"/> with the
- /// same repository specified will return the same repository instance.
- /// </para>
- /// <para>
- /// If the named repository already exists an exception will be thrown.
- /// </para>
- /// <para>
- /// If <paramref name="repositoryType"/> is <c>null</c> then the default
- /// repository type specified to the constructor is used.
- /// </para>
- /// </remarks>
- /// <exception cref="ArgumentNullException">throw if <paramref name="repositoryName"/> is null</exception>
- /// <exception cref="LogException">throw if the <paramref name="repositoryName"/> already exists</exception>
- public ILoggerRepository CreateRepository(string repositoryName, Type repositoryType)
- {
- if (repositoryName == null)
- {
- throw new ArgumentNullException("repositoryName");
- }
-
- // If the type is not set then use the default type
- if (repositoryType == null)
- {
- repositoryType = m_defaultRepositoryType;
- }
-
- lock (this)
- {
- ILoggerRepository rep = null;
-
- // First check that the repository does not exist
- rep = m_name2repositoryMap[repositoryName] as ILoggerRepository;
- if (rep != null)
- {
- throw new LogException("Repository [" + repositoryName + "] is already defined. Repositories cannot be redefined.");
- }
- else
- {
- LogLog.Debug(declaringType, "Creating repository [" + repositoryName + "] using type [" + repositoryType + "]");
-
- // Call the no arg constructor for the repositoryType
- rep = (ILoggerRepository)Activator.CreateInstance(repositoryType);
-
- // Set the name of the repository
- rep.Name = repositoryName;
-
- // Store in map
- m_name2repositoryMap[repositoryName] = rep;
-
- // Notify listeners that the repository has been created
- OnLoggerRepositoryCreatedEvent(rep);
- }
-
- return rep;
- }
- }
-
- /// <summary>
- /// Test if a named repository exists
- /// </summary>
- /// <param name="repositoryName">the named repository to check</param>
- /// <returns><c>true</c> if the repository exists</returns>
- /// <remarks>
- /// <para>
- /// Test if a named repository exists. Use <see cref="M:CreateRepository(string, Type)"/>
- /// to create a new repository and <see cref="M:GetRepository(string)"/> to retrieve
- /// a repository.
- /// </para>
- /// </remarks>
- public bool ExistsRepository(string repositoryName)
- {
- lock (this)
- {
- return m_name2repositoryMap.ContainsKey(repositoryName);
- }
- }
-
- /// <summary>
- /// Gets a list of <see cref="ILoggerRepository"/> objects
- /// </summary>
- /// <returns>an array of all known <see cref="ILoggerRepository"/> objects</returns>
- /// <remarks>
- /// <para>
- /// Gets an array of all of the repositories created by this selector.
- /// </para>
- /// </remarks>
- public ILoggerRepository[] GetAllRepositories()
- {
- lock (this)
- {
- ICollection reps = m_name2repositoryMap.Values;
- ILoggerRepository[] all = new ILoggerRepository[reps.Count];
- reps.CopyTo(all, 0);
- return all;
- }
- }
-
- #endregion
-
- #region Private Static Fields
-
- /// <summary>
- /// The fully qualified type of the CompactRepositorySelector class.
- /// </summary>
- /// <remarks>
- /// Used by the internal logger to record the Type of the
- /// log message.
- /// </remarks>
- private static readonly Type declaringType = typeof(CompactRepositorySelector);
-
- #endregion Private Static Fields
-
- /// <summary>
- /// Event to notify that a logger repository has been created.
- /// </summary>
- /// <value>
- /// Event to notify that a logger repository has been created.
- /// </value>
- /// <remarks>
- /// <para>
- /// Event raised when a new repository is created.
- /// The event source will be this selector. The event args will
- /// be a <see cref="LoggerRepositoryCreationEventArgs"/> which
- /// holds the newly created <see cref="ILoggerRepository"/>.
- /// </para>
- /// </remarks>
- public event LoggerRepositoryCreationEventHandler LoggerRepositoryCreatedEvent
- {
- add { m_loggerRepositoryCreatedEvent += value; }
- remove { m_loggerRepositoryCreatedEvent -= value; }
- }
-
- /// <summary>
- /// Notify the registered listeners that the repository has been created
- /// </summary>
- /// <param name="repository">The repository that has been created</param>
- /// <remarks>
- /// <para>
- /// Raises the <event cref="LoggerRepositoryCreatedEvent">LoggerRepositoryCreatedEvent</event>
- /// event.
- /// </para>
- /// </remarks>
- protected virtual void OnLoggerRepositoryCreatedEvent(ILoggerRepository repository)
- {
- LoggerRepositoryCreationEventHandler handler = m_loggerRepositoryCreatedEvent;
- if (handler != null)
- {
- handler(this, new LoggerRepositoryCreationEventArgs(repository));
- }
- }
- }
-}
diff --git a/src/log4net/Core/DefaultRepositorySelector.cs b/src/log4net/Core/DefaultRepositorySelector.cs
index 913bfc8..b117049 100644
--- a/src/log4net/Core/DefaultRepositorySelector.cs
+++ b/src/log4net/Core/DefaultRepositorySelector.cs
@@ -17,17 +17,9 @@
//
#endregion
-// .NET Compact Framework 1.0 has no support for reading assembly attributes
-// and uses the CompactRepositorySelector instead
-#if !NETCF
-
using System;
-using System.Collections;
-#if !NETSTANDARD
-using System.Configuration;
-#else
+using System.Collections.Generic;
using System.Linq;
-#endif
using System.IO;
using System.Reflection;
@@ -35,6 +27,8 @@
using log4net.Util;
using log4net.Repository;
+#nullable enable
+
namespace log4net.Core
{
/// <summary>
@@ -50,8 +44,6 @@
/// <author>Gert Driesen</author>
public class DefaultRepositorySelector : IRepositorySelector
{
- #region Public Events
-
/// <summary>
/// Event to notify that a logger repository has been created.
/// </summary>
@@ -66,15 +58,7 @@
/// holds the newly created <see cref="ILoggerRepository"/>.
/// </para>
/// </remarks>
- public event LoggerRepositoryCreationEventHandler LoggerRepositoryCreatedEvent
- {
- add { m_loggerRepositoryCreatedEvent += value; }
- remove { m_loggerRepositoryCreatedEvent -= value; }
- }
-
- #endregion Public Events
-
- #region Public Instance Constructors
+ public event LoggerRepositoryCreationEventHandler? LoggerRepositoryCreatedEvent;
/// <summary>
/// Creates a new repository selector.
@@ -82,7 +66,7 @@
/// <param name="defaultRepositoryType">The type of the repositories to create, must implement <see cref="ILoggerRepository"/></param>
/// <remarks>
/// <para>
- /// Create an new repository selector.
+ /// Create a new repository selector.
/// The default type for repositories must be specified,
/// an appropriate value would be <see cref="log4net.Repository.Hierarchy.Hierarchy"/>.
/// </para>
@@ -91,30 +75,26 @@
/// <exception cref="ArgumentOutOfRangeException"><paramref name="defaultRepositoryType"/> does not implement <see cref="ILoggerRepository"/>.</exception>
public DefaultRepositorySelector(Type defaultRepositoryType)
{
- if (defaultRepositoryType == null)
+ if (defaultRepositoryType is null)
{
- throw new ArgumentNullException("defaultRepositoryType");
+ throw new ArgumentNullException(nameof(defaultRepositoryType));
}
// Check that the type is a repository
if (!(typeof(ILoggerRepository).IsAssignableFrom(defaultRepositoryType)))
{
- throw log4net.Util.SystemInfo.CreateArgumentOutOfRangeException("defaultRepositoryType", defaultRepositoryType, "Parameter: defaultRepositoryType, Value: [" + defaultRepositoryType + "] out of range. Argument must implement the ILoggerRepository interface");
+ throw SystemInfo.CreateArgumentOutOfRangeException("defaultRepositoryType", defaultRepositoryType, $"Parameter: defaultRepositoryType, Value: [{defaultRepositoryType}] out of range. Argument must implement the ILoggerRepository interface");
}
m_defaultRepositoryType = defaultRepositoryType;
- LogLog.Debug(declaringType, "defaultRepositoryType [" + m_defaultRepositoryType + "]");
+ LogLog.Debug(declaringType, $"defaultRepositoryType [{m_defaultRepositoryType}]");
}
- #endregion Public Instance Constructors
-
- #region Implementation of IRepositorySelector
-
/// <summary>
/// Gets the <see cref="ILoggerRepository"/> for the specified assembly.
/// </summary>
- /// <param name="repositoryAssembly">The assembly use to lookup the <see cref="ILoggerRepository"/>.</param>
+ /// <param name="repositoryAssembly">The assembly use to look up the <see cref="ILoggerRepository"/>.</param>
/// <remarks>
/// <para>
/// The type of the <see cref="ILoggerRepository"/> created and the repository
@@ -136,9 +116,9 @@
/// <exception cref="ArgumentNullException"><paramref name="repositoryAssembly"/> is <see langword="null" />.</exception>
public ILoggerRepository GetRepository(Assembly repositoryAssembly)
{
- if (repositoryAssembly == null)
+ if (repositoryAssembly is null)
{
- throw new ArgumentNullException("repositoryAssembly");
+ throw new ArgumentNullException(nameof(repositoryAssembly));
}
return CreateRepository(repositoryAssembly, m_defaultRepositoryType);
}
@@ -146,7 +126,7 @@
/// <summary>
/// Gets the <see cref="ILoggerRepository"/> for the specified repository.
/// </summary>
- /// <param name="repositoryName">The repository to use to lookup the <see cref="ILoggerRepository"/>.</param>
+ /// <param name="repositoryName">The repository to use to look up the <see cref="ILoggerRepository"/>.</param>
/// <returns>The <see cref="ILoggerRepository"/> for the specified repository.</returns>
/// <remarks>
/// <para>
@@ -162,25 +142,23 @@
/// <exception cref="LogException"><paramref name="repositoryName"/> does not exist.</exception>
public ILoggerRepository GetRepository(string repositoryName)
{
- if (repositoryName == null)
+ if (repositoryName is null)
{
- throw new ArgumentNullException("repositoryName");
+ throw new ArgumentNullException(nameof(repositoryName));
}
- lock (this)
+ lock (m_lockObj)
{
- // Lookup in map
- ILoggerRepository rep = m_name2repositoryMap[repositoryName] as ILoggerRepository;
- if (rep == null)
+ if (m_name2repositoryMap.TryGetValue(repositoryName, out ILoggerRepository rep))
{
- throw new LogException("Repository [" + repositoryName + "] is NOT defined.");
+ return rep;
}
- return rep;
+ throw new LogException($"Repository [{repositoryName}] is NOT defined.");
}
}
/// <summary>
- /// Create a new repository for the assembly specified
+ /// Creates a new repository for the assembly specified
/// </summary>
/// <param name="repositoryAssembly">the assembly to use to create the repository to associate with the <see cref="ILoggerRepository"/>.</param>
/// <param name="repositoryType">The type of repository to create, must implement <see cref="ILoggerRepository"/>.</param>
@@ -258,27 +236,21 @@
/// </para>
/// </remarks>
/// <exception cref="ArgumentNullException"><paramref name="repositoryAssembly"/> is <see langword="null" />.</exception>
- public ILoggerRepository CreateRepository(Assembly repositoryAssembly, Type repositoryType, string repositoryName, bool readAssemblyAttributes)
+ public ILoggerRepository CreateRepository(Assembly repositoryAssembly, Type? repositoryType, string repositoryName, bool readAssemblyAttributes)
{
- if (repositoryAssembly == null)
+ if (repositoryAssembly is null)
{
- throw new ArgumentNullException("repositoryAssembly");
+ throw new ArgumentNullException(nameof(repositoryAssembly));
}
- // If the type is not set then use the default type
- if (repositoryType == null)
- {
- repositoryType = m_defaultRepositoryType;
- }
+ repositoryType ??= m_defaultRepositoryType;
- lock (this)
+ lock (m_lockObj)
{
- // Lookup in map
- ILoggerRepository rep = m_assembly2repositoryMap[repositoryAssembly] as ILoggerRepository;
- if (rep == null)
+ if (!m_assembly2repositoryMap.TryGetValue(repositoryAssembly, out ILoggerRepository? rep))
{
// Not found, therefore create
- LogLog.Debug(declaringType, "Creating repository for assembly [" + repositoryAssembly + "]");
+ LogLog.Debug(declaringType, $"Creating repository for assembly [{repositoryAssembly}]");
// Must specify defaults
string actualRepositoryName = repositoryName;
@@ -290,11 +262,10 @@
GetInfoForAssembly(repositoryAssembly, ref actualRepositoryName, ref actualRepositoryType);
}
- LogLog.Debug(declaringType, "Assembly [" + repositoryAssembly + "] using repository [" + actualRepositoryName + "] and repository type [" + actualRepositoryType + "]");
+ LogLog.Debug(declaringType, $"Assembly [{repositoryAssembly}] using repository [{actualRepositoryName}] and repository type [{actualRepositoryType}]");
// Lookup the repository in the map (as this may already be defined)
- rep = m_name2repositoryMap[actualRepositoryName] as ILoggerRepository;
- if (rep == null)
+ if (!m_name2repositoryMap.TryGetValue(actualRepositoryName, out rep))
{
// Create the repository
rep = CreateRepository(actualRepositoryName, actualRepositoryType);
@@ -314,13 +285,13 @@
}
catch (Exception ex)
{
- LogLog.Error(declaringType, "Failed to configure repository [" + actualRepositoryName + "] from assembly attributes.", ex);
+ LogLog.Error(declaringType, $"Failed to configure repository [{actualRepositoryName}] from assembly attributes.", ex);
}
}
}
else
{
- LogLog.Debug(declaringType, "repository [" + actualRepositoryName + "] already exists, using repository type [" + rep.GetType().FullName + "]");
+ LogLog.Debug(declaringType, $"repository [{actualRepositoryName}] already exists, using repository type [{rep.GetType().FullName}]");
if (readAssemblyAttributes)
{
@@ -331,7 +302,7 @@
}
catch (Exception ex)
{
- LogLog.Error(declaringType, "Failed to configure repository [" + actualRepositoryName + "] from assembly attributes.", ex);
+ LogLog.Error(declaringType, $"Failed to configure repository [{actualRepositoryName}] from assembly attributes.", ex);
}
}
}
@@ -357,73 +328,66 @@
/// </remarks>
/// <exception cref="ArgumentNullException"><paramref name="repositoryName"/> is <see langword="null" />.</exception>
/// <exception cref="LogException"><paramref name="repositoryName"/> already exists.</exception>
- public ILoggerRepository CreateRepository(string repositoryName, Type repositoryType)
+ public ILoggerRepository CreateRepository(string repositoryName, Type? repositoryType)
{
- if (repositoryName == null)
+ if (repositoryName is null)
{
- throw new ArgumentNullException("repositoryName");
+ throw new ArgumentNullException(nameof(repositoryName));
}
// If the type is not set then use the default type
- if (repositoryType == null)
- {
- repositoryType = m_defaultRepositoryType;
- }
+ repositoryType ??= m_defaultRepositoryType;
- lock (this)
+ lock (m_lockObj)
{
- ILoggerRepository rep = null;
+ ILoggerRepository? rep = null;
// First check that the repository does not exist
- rep = m_name2repositoryMap[repositoryName] as ILoggerRepository;
- if (rep != null)
+ if (m_name2repositoryMap.ContainsKey(repositoryName))
{
- throw new LogException("Repository [" + repositoryName + "] is already defined. Repositories cannot be redefined.");
+ throw new LogException($"Repository [{repositoryName}] is already defined. Repositories cannot be redefined.");
}
- else
+
+ // Look up an alias before trying to create the new repository
+ if (m_alias2repositoryMap.TryGetValue(repositoryName, out ILoggerRepository? aliasedRepository))
{
- // Lookup an alias before trying to create the new repository
- ILoggerRepository aliasedRepository = m_alias2repositoryMap[repositoryName] as ILoggerRepository;
- if (aliasedRepository != null)
+ // Found an alias
+
+ // Check repository type
+ if (aliasedRepository.GetType() == repositoryType)
{
- // Found an alias
-
- // Check repository type
- if (aliasedRepository.GetType() == repositoryType)
- {
- // Repository type is compatible
- LogLog.Debug(declaringType, "Aliasing repository [" + repositoryName + "] to existing repository [" + aliasedRepository.Name + "]");
- rep = aliasedRepository;
-
- // Store in map
- m_name2repositoryMap[repositoryName] = rep;
- }
- else
- {
- // Invalid repository type for alias
- LogLog.Error(declaringType, "Failed to alias repository [" + repositoryName + "] to existing repository [" + aliasedRepository.Name + "]. Requested repository type [" + repositoryType.FullName + "] is not compatible with existing type [" + aliasedRepository.GetType().FullName + "]");
-
- // We now drop through to create the repository without aliasing
- }
- }
-
- // If we could not find an alias
- if (rep == null)
- {
- LogLog.Debug(declaringType, "Creating repository [" + repositoryName + "] using type [" + repositoryType + "]");
-
- // Call the no arg constructor for the repositoryType
- rep = (ILoggerRepository)Activator.CreateInstance(repositoryType);
-
- // Set the name of the repository
- rep.Name = repositoryName;
+ // Repository type is compatible
+ LogLog.Debug(declaringType, $"Aliasing repository [{repositoryName}] to existing repository [{aliasedRepository.Name}]");
+ rep = aliasedRepository;
// Store in map
m_name2repositoryMap[repositoryName] = rep;
-
- // Notify listeners that the repository has been created
- OnLoggerRepositoryCreatedEvent(rep);
}
+ else
+ {
+ // Invalid repository type for alias
+ LogLog.Error(declaringType, $"Failed to alias repository [{repositoryName}] to existing repository [{aliasedRepository.Name}]. Requested repository type [{repositoryType.FullName}] is not compatible with existing type [{aliasedRepository.GetType().FullName}]");
+
+ // We now drop through to create the repository without aliasing
+ }
+ }
+
+ // If we could not find an alias
+ if (rep is null)
+ {
+ LogLog.Debug(declaringType, $"Creating repository [{repositoryName}] using type [{repositoryType}]");
+
+ // Call the no arg constructor for the repositoryType
+ rep = (ILoggerRepository)Activator.CreateInstance(repositoryType);
+
+ // Set the name of the repository
+ rep.Name = repositoryName;
+
+ // Store in map
+ m_name2repositoryMap[repositoryName] = rep;
+
+ // Notify listeners that the repository has been created
+ OnLoggerRepositoryCreatedEvent(rep);
}
return rep;
@@ -444,7 +408,7 @@
/// </remarks>
public bool ExistsRepository(string repositoryName)
{
- lock (this)
+ lock (m_lockObj)
{
return m_name2repositoryMap.ContainsKey(repositoryName);
}
@@ -456,24 +420,17 @@
/// <returns>an array of all known <see cref="ILoggerRepository"/> objects</returns>
/// <remarks>
/// <para>
- /// Gets an array of all of the repositories created by this selector.
+ /// Gets an array of all repositories created by this selector.
/// </para>
/// </remarks>
public ILoggerRepository[] GetAllRepositories()
{
- lock (this)
+ lock (m_lockObj)
{
- ICollection reps = m_name2repositoryMap.Values;
- ILoggerRepository[] all = new ILoggerRepository[reps.Count];
- reps.CopyTo(all, 0);
- return all;
+ return m_name2repositoryMap.Values.ToArray();
}
}
- #endregion Implementation of IRepositorySelector
-
- #region Public Instance Methods
-
/// <summary>
/// Aliases a repository to an existing repository.
/// </summary>
@@ -496,35 +453,35 @@
/// </exception>
public void AliasRepository(string repositoryAlias, ILoggerRepository repositoryTarget)
{
- if (repositoryAlias == null)
+ if (repositoryAlias is null)
{
- throw new ArgumentNullException("repositoryAlias");
+ throw new ArgumentNullException(nameof(repositoryAlias));
}
- if (repositoryTarget == null)
+ if (repositoryTarget is null)
{
- throw new ArgumentNullException("repositoryTarget");
+ throw new ArgumentNullException(nameof(repositoryTarget));
}
- lock (this)
+ lock (m_lockObj)
{
// Check if the alias is already set
- if (m_alias2repositoryMap.Contains(repositoryAlias))
+ if (m_alias2repositoryMap.TryGetValue(repositoryAlias, out ILoggerRepository? existingTarget))
{
// Check if this is a duplicate of the current alias
- if (repositoryTarget != ((ILoggerRepository)m_alias2repositoryMap[repositoryAlias]))
+ if (repositoryTarget != existingTarget)
{
// Cannot redefine existing alias
- throw new InvalidOperationException("Repository [" + repositoryAlias + "] is already aliased to repository [" + ((ILoggerRepository)m_alias2repositoryMap[repositoryAlias]).Name + "]. Aliases cannot be redefined.");
+ throw new InvalidOperationException($"Repository [{repositoryAlias}] is already aliased to repository [{existingTarget.Name}]. Aliases cannot be redefined.");
}
}
// Check if the alias is already mapped to a repository
- else if (m_name2repositoryMap.Contains(repositoryAlias))
+ else if (m_name2repositoryMap.TryGetValue(repositoryAlias, out existingTarget))
{
// Check if this is a duplicate of the current mapping
- if (repositoryTarget != ((ILoggerRepository)m_name2repositoryMap[repositoryAlias]))
+ if (repositoryTarget != existingTarget)
{
// Cannot define alias for already mapped repository
- throw new InvalidOperationException("Repository [" + repositoryAlias + "] already exists and cannot be aliased to repository [" + repositoryTarget.Name + "].");
+ throw new InvalidOperationException($"Repository [{repositoryAlias}] already exists and cannot be aliased to repository [{repositoryTarget.Name}].");
}
}
else
@@ -534,11 +491,7 @@
}
}
}
-
- #endregion Public Instance Methods
-
- #region Protected Instance Methods
-
+
/// <summary>
/// Notifies the registered listeners that the repository has been created.
/// </summary>
@@ -550,17 +503,9 @@
/// </remarks>
protected virtual void OnLoggerRepositoryCreatedEvent(ILoggerRepository repository)
{
- LoggerRepositoryCreationEventHandler handler = m_loggerRepositoryCreatedEvent;
- if (handler != null)
- {
- handler(this, new LoggerRepositoryCreationEventArgs(repository));
- }
+ LoggerRepositoryCreatedEvent?.Invoke(this, new LoggerRepositoryCreationEventArgs(repository));
}
- #endregion Protected Instance Methods
-
- #region Private Instance Methods
-
/// <summary>
/// Gets the repository name and repository type for the specified assembly.
/// </summary>
@@ -570,14 +515,14 @@
/// <exception cref="ArgumentNullException"><paramref name="assembly" /> is <see langword="null" />.</exception>
private void GetInfoForAssembly(Assembly assembly, ref string repositoryName, ref Type repositoryType)
{
- if (assembly == null)
+ if (assembly is null)
{
- throw new ArgumentNullException("assembly");
+ throw new ArgumentNullException(nameof(assembly));
}
try
{
- LogLog.Debug(declaringType, "Assembly [" + assembly.FullName + "] Loaded From [" + SystemInfo.AssemblyLocationInfo(assembly) + "]");
+ LogLog.Debug(declaringType, $"Assembly [{assembly.FullName}] Loaded From [{SystemInfo.AssemblyLocationInfo(assembly)}]");
}
catch
{
@@ -587,49 +532,37 @@
try
{
// Look for the RepositoryAttribute on the assembly
-#if NETSTANDARD
- object[] repositoryAttributes = assembly.GetCustomAttributes(typeof(log4net.Config.RepositoryAttribute)).ToArray();
-#else
- object[] repositoryAttributes = Attribute.GetCustomAttributes(assembly, typeof(log4net.Config.RepositoryAttribute), false);
-#endif
- if (repositoryAttributes == null || repositoryAttributes.Length == 0)
+ object[] repositoryAttributes = Attribute.GetCustomAttributes(assembly, typeof(RepositoryAttribute), false);
+ if (repositoryAttributes.Length == 0)
{
- // This is not a problem, but its nice to know what is going on.
- LogLog.Debug(declaringType, "Assembly [" + assembly + "] does not have a RepositoryAttribute specified.");
+ // This is not a problem, but it's nice to know what is going on.
+ LogLog.Debug(declaringType, $"Assembly [{assembly}] does not have a {nameof(RepositoryAttribute)} specified.");
}
else
{
if (repositoryAttributes.Length > 1)
{
- LogLog.Error(declaringType, "Assembly [" + assembly + "] has multiple log4net.Config.RepositoryAttribute assembly attributes. Only using first occurrence.");
+ LogLog.Error(declaringType, $"Assembly [{assembly}] has multiple log4net.Config.RepositoryAttribute assembly attributes. Only using first occurrence.");
}
- log4net.Config.RepositoryAttribute domAttr = repositoryAttributes[0] as log4net.Config.RepositoryAttribute;
-
- if (domAttr == null)
+ RepositoryAttribute domAttr = (RepositoryAttribute)repositoryAttributes[0];
+ // If the Name property is set then override the default
+ if (domAttr.Name is not null)
{
- LogLog.Error(declaringType, "Assembly [" + assembly + "] has a RepositoryAttribute but it does not!.");
+ repositoryName = domAttr.Name;
}
- else
+
+ // If the RepositoryType property is set then override the default
+ if (domAttr.RepositoryType is not null)
{
- // If the Name property is set then override the default
- if (domAttr.Name != null)
+ // Check that the type is a repository
+ if (typeof(ILoggerRepository).IsAssignableFrom(domAttr.RepositoryType))
{
- repositoryName = domAttr.Name;
+ repositoryType = domAttr.RepositoryType;
}
-
- // If the RepositoryType property is set then override the default
- if (domAttr.RepositoryType != null)
+ else
{
- // Check that the type is a repository
- if (typeof(ILoggerRepository).IsAssignableFrom(domAttr.RepositoryType))
- {
- repositoryType = domAttr.RepositoryType;
- }
- else
- {
- LogLog.Error(declaringType, "DefaultRepositorySelector: Repository Type [" + domAttr.RepositoryType + "] must implement the ILoggerRepository interface.");
- }
+ LogLog.Error(declaringType, $"DefaultRepositorySelector: Repository Type [{domAttr.RepositoryType}] must implement the ILoggerRepository interface.");
}
}
}
@@ -653,130 +586,109 @@
/// </exception>
private void ConfigureRepository(Assembly assembly, ILoggerRepository repository)
{
- if (assembly == null)
+ if (assembly is null)
{
- throw new ArgumentNullException("assembly");
+ throw new ArgumentNullException(nameof(assembly));
}
- if (repository == null)
+ if (repository is null)
{
- throw new ArgumentNullException("repository");
+ throw new ArgumentNullException(nameof(repository));
}
// Look for the Configurator attributes (e.g. XmlConfiguratorAttribute) on the assembly
-#if NETSTANDARD
- object[] configAttributes = assembly.GetCustomAttributes(typeof(log4net.Config.ConfiguratorAttribute)).ToArray();
-#else
- object[] configAttributes = Attribute.GetCustomAttributes(assembly, typeof(log4net.Config.ConfiguratorAttribute), false);
-#endif
- if (configAttributes != null && configAttributes.Length > 0)
+ object[] configAttributes = Attribute.GetCustomAttributes(assembly, typeof(ConfiguratorAttribute), false);
+ if (configAttributes.Length > 0)
{
// Sort the ConfiguratorAttributes in priority order
Array.Sort(configAttributes);
// Delegate to the attribute the job of configuring the repository
- foreach (log4net.Config.ConfiguratorAttribute configAttr in configAttributes)
+ foreach (ConfiguratorAttribute configAttr in configAttributes)
{
- if (configAttr != null)
+ try
{
- try
- {
- configAttr.Configure(assembly, repository);
- }
- catch (Exception ex)
- {
- LogLog.Error(declaringType, "Exception calling [" + configAttr.GetType().FullName + "] .Configure method.", ex);
- }
+ configAttr.Configure(assembly, repository);
+ }
+ catch (Exception ex)
+ {
+ LogLog.Error(declaringType, $"Exception calling [{configAttr.GetType().FullName}] .Configure method.", ex);
}
}
}
-
+
if (repository.Name == DefaultRepositoryName)
{
// Try to configure the default repository using an AppSettings specified config file
// Do this even if the repository has been configured (or claims to be), this allows overriding
- // of the default config files etc, if that is required.
+ // of the default config files etc., if that is required.
- string repositoryConfigFile = SystemInfo.GetAppSetting("log4net.Config");
- if (repositoryConfigFile != null && repositoryConfigFile.Length > 0)
+ string? repositoryConfigFile = SystemInfo.GetAppSetting("log4net.Config");
+ if (repositoryConfigFile is not null && repositoryConfigFile.Length > 0)
{
- string applicationBaseDirectory = null;
+ string? applicationBaseDirectory = null;
try
{
applicationBaseDirectory = SystemInfo.ApplicationBaseDirectory;
}
catch (Exception ex)
{
- LogLog.Warn(declaringType, "Exception getting ApplicationBaseDirectory. appSettings log4net.Config path [" + repositoryConfigFile + "] will be treated as an absolute URI", ex);
+ LogLog.Warn(declaringType, $"Exception getting ApplicationBaseDirectory. appSettings log4net.Config path [{repositoryConfigFile}] will be treated as an absolute URI", ex);
}
string repositoryConfigFilePath = repositoryConfigFile;
- if (applicationBaseDirectory != null)
+ if (applicationBaseDirectory is not null)
{
repositoryConfigFilePath = Path.Combine(applicationBaseDirectory, repositoryConfigFile);
}
// Determine whether to watch the file or not based on an app setting value:
- bool watchRepositoryConfigFile = false;
-#if NET_2_0 || MONO_2_0 || MONO_3_5 || MONO_4_0 || NETSTANDARD
- Boolean.TryParse(SystemInfo.GetAppSetting("log4net.Config.Watch"), out watchRepositoryConfigFile);
-#else
- {
- string watch = SystemInfo.GetAppSetting("log4net.Config.Watch");
- if (watch != null && watch.Length > 0)
- {
- try
- {
- watchRepositoryConfigFile = Boolean.Parse(watch);
- }
- catch (FormatException)
- {
- // simply not a Boolean
- }
- }
- }
-#endif
+ Boolean.TryParse(SystemInfo.GetAppSetting("log4net.Config.Watch"), out bool watchRepositoryConfigFile);
if (watchRepositoryConfigFile)
{
// As we are going to watch the config file it is required to resolve it as a
// physical file system path pass that in a FileInfo object to the Configurator
- FileInfo repositoryConfigFileInfo = null;
+ FileInfo? repositoryConfigFileInfo = null;
try
{
repositoryConfigFileInfo = new FileInfo(repositoryConfigFilePath);
}
catch (Exception ex)
{
- LogLog.Error(declaringType, "DefaultRepositorySelector: Exception while parsing log4net.Config file physical path [" + repositoryConfigFilePath + "]", ex);
+ LogLog.Error(declaringType, $"DefaultRepositorySelector: Exception while parsing log4net.Config file physical path [{repositoryConfigFilePath}]", ex);
}
- try
- {
- LogLog.Debug(declaringType, "Loading and watching configuration for default repository from AppSettings specified Config path [" + repositoryConfigFilePath + "]");
- XmlConfigurator.ConfigureAndWatch(repository, repositoryConfigFileInfo);
- }
- catch (Exception ex)
+ if (repositoryConfigFileInfo is not null)
{
- LogLog.Error(declaringType, "DefaultRepositorySelector: Exception calling XmlConfigurator.ConfigureAndWatch method with ConfigFilePath [" + repositoryConfigFilePath + "]", ex);
+ try
+ {
+ LogLog.Debug(declaringType, $"Loading and watching configuration for default repository from AppSettings specified Config path [{repositoryConfigFilePath}]");
+
+ XmlConfigurator.ConfigureAndWatch(repository, repositoryConfigFileInfo);
+ }
+ catch (Exception ex)
+ {
+ LogLog.Error(declaringType, $"DefaultRepositorySelector: Exception calling XmlConfigurator.ConfigureAndWatch method with ConfigFilePath [{repositoryConfigFilePath}]", ex);
+ }
}
}
else
{
// As we are not going to watch the config file it is easiest to just resolve it as a
// URI and pass that to the Configurator
- Uri repositoryConfigUri = null;
+ Uri? repositoryConfigUri = null;
try
{
repositoryConfigUri = new Uri(repositoryConfigFilePath);
}
catch (Exception ex)
{
- LogLog.Error(declaringType, "Exception while parsing log4net.Config file path [" + repositoryConfigFile + "]", ex);
+ LogLog.Error(declaringType, $"Exception while parsing log4net.Config file path [{repositoryConfigFile}]", ex);
}
- if (repositoryConfigUri != null)
+ if (repositoryConfigUri is not null)
{
- LogLog.Debug(declaringType, "Loading configuration for default repository from AppSettings specified Config URI [" + repositoryConfigUri.ToString() + "]");
+ LogLog.Debug(declaringType, $"Loading configuration for default repository from AppSettings specified Config URI [{repositoryConfigUri}]");
try
{
@@ -785,7 +697,7 @@
}
catch (Exception ex)
{
- LogLog.Error(declaringType, "Exception calling XmlConfigurator.Configure method with ConfigUri [" + repositoryConfigUri + "]", ex);
+ LogLog.Error(declaringType, $"Exception calling XmlConfigurator.Configure method with ConfigUri [{repositoryConfigUri}]", ex);
}
}
}
@@ -805,24 +717,20 @@
/// </exception>
private void LoadPlugins(Assembly assembly, ILoggerRepository repository)
{
- if (assembly == null)
+ if (assembly is null)
{
- throw new ArgumentNullException("assembly");
+ throw new ArgumentNullException(nameof(assembly));
}
- if (repository == null)
+ if (repository is null)
{
- throw new ArgumentNullException("repository");
+ throw new ArgumentNullException(nameof(repository));
}
// Look for the PluginAttribute on the assembly
-#if NETSTANDARD
- object[] configAttributes = assembly.GetCustomAttributes(typeof(log4net.Config.PluginAttribute)).ToArray();
-#else
- object[] configAttributes = Attribute.GetCustomAttributes(assembly, typeof(log4net.Config.PluginAttribute), false);
-#endif
- if (configAttributes != null && configAttributes.Length > 0)
+ object[] configAttributes = Attribute.GetCustomAttributes(assembly, typeof(PluginAttribute), false);
+ if (configAttributes.Length > 0)
{
- foreach (log4net.Plugin.IPluginFactory configAttr in configAttributes)
+ foreach (PluginAttribute configAttr in configAttributes)
{
try
{
@@ -831,7 +739,7 @@
}
catch (Exception ex)
{
- LogLog.Error(declaringType, "Failed to create plugin. Attribute [" + configAttr.ToString() + "]", ex);
+ LogLog.Error(declaringType, $"Failed to create plugin. Attribute [{configAttr}]", ex);
}
}
}
@@ -849,24 +757,20 @@
/// </exception>
private void LoadAliases(Assembly assembly, ILoggerRepository repository)
{
- if (assembly == null)
+ if (assembly is null)
{
- throw new ArgumentNullException("assembly");
+ throw new ArgumentNullException(nameof(assembly));
}
- if (repository == null)
+ if (repository is null)
{
- throw new ArgumentNullException("repository");
+ throw new ArgumentNullException(nameof(repository));
}
// Look for the AliasRepositoryAttribute on the assembly
-#if NETSTANDARD
- object[] configAttributes = assembly.GetCustomAttributes(typeof(log4net.Config.AliasRepositoryAttribute)).ToArray();
-#else
- object[] configAttributes = Attribute.GetCustomAttributes(assembly, typeof(log4net.Config.AliasRepositoryAttribute), false);
-#endif
- if (configAttributes != null && configAttributes.Length > 0)
+ object[] configAttributes = Attribute.GetCustomAttributes(assembly, typeof(ConfiguratorAttribute), false);
+ if (configAttributes.Length > 0)
{
- foreach (log4net.Config.AliasRepositoryAttribute configAttr in configAttributes)
+ foreach (AliasRepositoryAttribute configAttr in configAttributes)
{
try
{
@@ -874,16 +778,12 @@
}
catch (Exception ex)
{
- LogLog.Error(declaringType, "Failed to alias repository [" + configAttr.Name + "]", ex);
+ LogLog.Error(declaringType, $"Failed to alias repository [{configAttr.Name}]", ex);
}
}
}
}
- #endregion Private Instance Methods
-
- #region Private Static Fields
-
/// <summary>
/// The fully qualified type of the DefaultRepositorySelector class.
/// </summary>
@@ -895,19 +795,10 @@
private const string DefaultRepositoryName = "log4net-default-repository";
- #endregion Private Static Fields
-
- #region Private Instance Fields
-
- private readonly Hashtable m_name2repositoryMap = new Hashtable();
- private readonly Hashtable m_assembly2repositoryMap = new Hashtable();
- private readonly Hashtable m_alias2repositoryMap = new Hashtable();
+ private readonly object m_lockObj = new();
+ private readonly Dictionary<string, ILoggerRepository> m_name2repositoryMap = new(StringComparer.Ordinal);
+ private readonly Dictionary<Assembly, ILoggerRepository> m_assembly2repositoryMap = new();
+ private readonly Dictionary<string, ILoggerRepository> m_alias2repositoryMap = new(StringComparer.Ordinal);
private readonly Type m_defaultRepositoryType;
-
- private event LoggerRepositoryCreationEventHandler m_loggerRepositoryCreatedEvent;
-
- #endregion Private Instance Fields
}
-}
-
-#endif // !NETCF
+}
\ No newline at end of file
diff --git a/src/log4net/Core/ExceptionEvaluator.cs b/src/log4net/Core/ExceptionEvaluator.cs
index adaeb49..ad1614e 100644
--- a/src/log4net/Core/ExceptionEvaluator.cs
+++ b/src/log4net/Core/ExceptionEvaluator.cs
@@ -35,16 +35,6 @@
public class ExceptionEvaluator : ITriggeringEventEvaluator
{
/// <summary>
- /// The type that causes the trigger to fire.
- /// </summary>
- private Type m_type;
-
- /// <summary>
- /// Causes subclasses of <see cref="ExceptionType"/> to cause the trigger to fire.
- /// </summary>
- private bool m_triggerOnSubclass;
-
- /// <summary>
/// Default ctor to allow dynamic creation through a configurator.
/// </summary>
public ExceptionEvaluator()
@@ -59,34 +49,24 @@
/// <param name="triggerOnSubClass">If true, this evaluator will trigger on subclasses of <see cref="ExceptionType"/>.</param>
public ExceptionEvaluator(Type exType, bool triggerOnSubClass)
{
- if (exType == null)
+ if (exType is null)
{
- throw new ArgumentNullException("exType");
+ throw new ArgumentNullException(nameof(exType));
}
- m_type = exType;
- m_triggerOnSubclass = triggerOnSubClass;
+ ExceptionType = exType;
+ TriggerOnSubclass = triggerOnSubClass;
}
/// <summary>
/// The type that triggers this evaluator.
/// </summary>
- public Type ExceptionType
- {
- get { return m_type; }
- set { m_type = value; }
- }
+ public Type ExceptionType { get; set; }
/// <summary>
/// If true, this evaluator will trigger on subclasses of <see cref="ExceptionType"/>.
/// </summary>
- public bool TriggerOnSubclass
- {
- get { return m_triggerOnSubclass; }
- set { m_triggerOnSubclass = value; }
- }
-
- #region ITriggeringEventEvaluator Members
+ public bool TriggerOnSubclass { get; set; }
/// <summary>
/// Is this <paramref name="loggingEvent"/> the triggering event?
@@ -104,27 +84,27 @@
/// </remarks>
public bool IsTriggeringEvent(LoggingEvent loggingEvent)
{
- if (loggingEvent == null)
+ if (loggingEvent is null)
{
- throw new ArgumentNullException("loggingEvent");
+ throw new ArgumentNullException(nameof(loggingEvent));
}
- if (m_triggerOnSubclass && loggingEvent.ExceptionObject != null)
+ if (TriggerOnSubclass && loggingEvent.ExceptionObject is not null)
{
// check if loggingEvent.ExceptionObject is of type ExceptionType or subclass of ExceptionType
Type exceptionObjectType = loggingEvent.ExceptionObject.GetType();
- return exceptionObjectType == m_type || m_type.IsAssignableFrom(exceptionObjectType);
+ return exceptionObjectType == ExceptionType || ExceptionType.IsAssignableFrom(exceptionObjectType);
}
- else if (!m_triggerOnSubclass && loggingEvent.ExceptionObject != null)
- { // check if loggingEvent.ExceptionObject is of type ExceptionType
- return loggingEvent.ExceptionObject.GetType() == m_type;
+ else if (!TriggerOnSubclass && loggingEvent.ExceptionObject is not null)
+ {
+ // check if loggingEvent.ExceptionObject is of type ExceptionType
+ return loggingEvent.ExceptionObject.GetType() == ExceptionType;
}
else
- { // loggingEvent.ExceptionObject is null
+ {
+ // loggingEvent.ExceptionObject is null
return false;
}
}
-
- #endregion
}
}
diff --git a/src/log4net/Core/FixFlags.cs b/src/log4net/Core/FixFlags.cs
index 1853f44..3508730 100644
--- a/src/log4net/Core/FixFlags.cs
+++ b/src/log4net/Core/FixFlags.cs
@@ -1,4 +1,23 @@
-using System;
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+using System;
namespace log4net.Core
{
diff --git a/src/log4net/Core/IAppenderAttachable.cs b/src/log4net/Core/IAppenderAttachable.cs
index 3632765..dd83c80 100644
--- a/src/log4net/Core/IAppenderAttachable.cs
+++ b/src/log4net/Core/IAppenderAttachable.cs
@@ -17,8 +17,6 @@
//
#endregion
-using System;
-
using log4net.Appender;
namespace log4net.Core
@@ -78,7 +76,7 @@
/// returned.
/// </para>
/// </remarks>
- IAppender GetAppender(string name);
+ IAppender? GetAppender(string? name);
/// <summary>
/// Removes all attached appenders.
@@ -102,7 +100,7 @@
/// <see cref="IAppender.Close"/> on the appender removed.
/// </para>
/// </remarks>
- IAppender RemoveAppender(IAppender appender);
+ IAppender? RemoveAppender(IAppender appender);
/// <summary>
/// Removes the appender with the specified name from the list of appenders.
@@ -116,6 +114,6 @@
/// <see cref="IAppender.Close"/> on the appender removed.
/// </para>
/// </remarks>
- IAppender RemoveAppender(string name);
+ IAppender? RemoveAppender(string name);
}
}
diff --git a/src/log4net/Core/IErrorHandler.cs b/src/log4net/Core/IErrorHandler.cs
index 06197de..9f7baab 100644
--- a/src/log4net/Core/IErrorHandler.cs
+++ b/src/log4net/Core/IErrorHandler.cs
@@ -19,6 +19,8 @@
using System;
+#nullable enable
+
namespace log4net.Core
{
/// <summary>
@@ -47,7 +49,7 @@
/// a parameter.
/// </para>
/// </remarks>
- void Error(string message, Exception e, ErrorCode errorCode);
+ void Error(string message, Exception? e, ErrorCode errorCode);
/// <summary>
/// Prints the error message passed as a parameter.
diff --git a/src/log4net/Core/IFixingRequired.cs b/src/log4net/Core/IFixingRequired.cs
index 58e84cf..2251135 100644
--- a/src/log4net/Core/IFixingRequired.cs
+++ b/src/log4net/Core/IFixingRequired.cs
@@ -17,8 +17,6 @@
//
#endregion
-using System;
-
namespace log4net.Core
{
/// <summary>
@@ -53,6 +51,6 @@
/// and logged from any thread with identical results.
/// </para>
/// </remarks>
- object GetFixedObject();
+ object? GetFixedObject();
}
}
diff --git a/src/log4net/Core/ILogger.cs b/src/log4net/Core/ILogger.cs
index 289a33f..fc6d943 100644
--- a/src/log4net/Core/ILogger.cs
+++ b/src/log4net/Core/ILogger.cs
@@ -19,7 +19,6 @@
using System;
-using log4net.Core;
using log4net.Repository;
namespace log4net.Core
@@ -69,7 +68,7 @@
/// the <paramref name="message"/> and <paramref name="exception"/>.
/// </para>
/// </remarks>
- void Log(Type callerStackBoundaryDeclaringType, Level level, object message, Exception exception);
+ void Log(Type callerStackBoundaryDeclaringType, Level? level, object message, Exception? exception);
/// <summary>
/// This is the most generic printing method that is intended to be used
@@ -95,7 +94,7 @@
/// Test if this logger is going to log events of the specified <paramref name="level"/>.
/// </para>
/// </remarks>
- bool IsEnabledFor(Level level);
+ bool IsEnabledFor(Level? level);
/// <summary>
/// Gets the <see cref="ILoggerRepository"/> where this
@@ -110,6 +109,6 @@
/// <c>Logger</c> instance is attached to.
/// </para>
/// </remarks>
- ILoggerRepository Repository { get; }
+ ILoggerRepository? Repository { get; }
}
}
diff --git a/src/log4net/Core/ILoggerWrapper.cs b/src/log4net/Core/ILoggerWrapper.cs
index fefbd20..3edde25 100644
--- a/src/log4net/Core/ILoggerWrapper.cs
+++ b/src/log4net/Core/ILoggerWrapper.cs
@@ -17,12 +17,6 @@
//
#endregion
-using System;
-
-using log4net;
-using log4net.Core;
-using log4net.Repository;
-
namespace log4net.Core
{
/// <summary>
@@ -40,18 +34,14 @@
public interface ILoggerWrapper
{
/// <summary>
- /// Get the implementation behind this wrapper object.
+ /// Gets the <see cref="ILogger"/> object that implements this object.
/// </summary>
/// <value>
- /// The <see cref="ILogger"/> object that in implementing this object.
/// </value>
/// <remarks>
/// <para>
- /// The <see cref="ILogger"/> object that in implementing this
- /// object. The <c>Logger</c> object may not
- /// be the same object as this object because of logger decorators.
- /// This gets the actual underlying objects that is used to process
- /// the log events.
+ /// The <c>Logger</c> object may not be the same object as this object because of logger decorators.
+ /// This gets the actual underlying objects that is used to process the log events.
/// </para>
/// </remarks>
ILogger Logger { get; }
diff --git a/src/log4net/Core/IOptionHandler.cs b/src/log4net/Core/IOptionHandler.cs
index 6d73ee1..aadf71c 100644
--- a/src/log4net/Core/IOptionHandler.cs
+++ b/src/log4net/Core/IOptionHandler.cs
@@ -17,8 +17,6 @@
//
#endregion
-using System;
-
namespace log4net.Core
{
/// <summary>
diff --git a/src/log4net/Core/IRepositorySelector.cs b/src/log4net/Core/IRepositorySelector.cs
index 4e34839..3381867 100644
--- a/src/log4net/Core/IRepositorySelector.cs
+++ b/src/log4net/Core/IRepositorySelector.cs
@@ -24,8 +24,6 @@
namespace log4net.Core
{
- #region LoggerRepositoryCreationEvent
-
/// <summary>
/// Delegate used to handle logger repository creation event notifications
/// </summary>
@@ -51,11 +49,6 @@
public class LoggerRepositoryCreationEventArgs : EventArgs
{
/// <summary>
- /// The <see cref="ILoggerRepository"/> created
- /// </summary>
- private ILoggerRepository m_repository;
-
- /// <summary>
/// Construct instance using <see cref="ILoggerRepository"/> specified
/// </summary>
/// <param name="repository">the <see cref="ILoggerRepository"/> that has been created</param>
@@ -66,7 +59,7 @@
/// </remarks>
public LoggerRepositoryCreationEventArgs(ILoggerRepository repository)
{
- m_repository = repository;
+ LoggerRepository = repository;
}
/// <summary>
@@ -80,14 +73,9 @@
/// The <see cref="ILoggerRepository"/> that has been created
/// </para>
/// </remarks>
- public ILoggerRepository LoggerRepository
- {
- get { return m_repository; }
- }
+ public ILoggerRepository LoggerRepository { get; }
}
- #endregion
-
/// <summary>
/// Interface used by the <see cref="LogManager"/> to select the <see cref="ILoggerRepository"/>.
/// </summary>
@@ -105,7 +93,7 @@
/// <summary>
/// Gets the <see cref="ILoggerRepository"/> for the specified assembly.
/// </summary>
- /// <param name="assembly">The assembly to use to lookup to the <see cref="ILoggerRepository"/></param>
+ /// <param name="assembly">The assembly to use to look up to the <see cref="ILoggerRepository"/></param>
/// <returns>The <see cref="ILoggerRepository"/> for the assembly.</returns>
/// <remarks>
/// <para>
@@ -124,7 +112,7 @@
/// <summary>
/// Gets the named <see cref="ILoggerRepository"/>.
/// </summary>
- /// <param name="repositoryName">The name to use to lookup to the <see cref="ILoggerRepository"/>.</param>
+ /// <param name="repositoryName">The name to use to look up to the <see cref="ILoggerRepository"/>.</param>
/// <returns>The named <see cref="ILoggerRepository"/></returns>
/// <remarks>
/// Lookup a named <see cref="ILoggerRepository"/>. This is the repository created by
@@ -165,7 +153,7 @@
/// same name will return the same repository instance.
/// </para>
/// </remarks>
- ILoggerRepository CreateRepository(string repositoryName, Type repositoryType);
+ ILoggerRepository CreateRepository(string repositoryName, Type? repositoryType);
/// <summary>
/// Test if a named repository exists
@@ -189,7 +177,7 @@
/// this <see cref="IRepositorySelector"/>.</returns>
/// <remarks>
/// <para>
- /// Gets an array of all of the repositories created by this selector.
+ /// Gets an array of all repositories created by this selector.
/// </para>
/// </remarks>
ILoggerRepository[] GetAllRepositories();
diff --git a/src/log4net/Core/Level.cs b/src/log4net/Core/Level.cs
index a200e2a..e7881f8 100644
--- a/src/log4net/Core/Level.cs
+++ b/src/log4net/Core/Level.cs
@@ -18,7 +18,6 @@
#endregion
using System;
-using System.Collections;
namespace log4net.Core
{
@@ -80,13 +79,9 @@
/// </remarks>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
-#if !NETCF
[Serializable]
-#endif
public sealed class Level : IComparable
{
- #region Public Instance Constructors
-
/// <summary>
/// Constructor
/// </summary>
@@ -101,22 +96,18 @@
/// </remarks>
public Level(int level, string levelName, string displayName)
{
- if (levelName == null)
+ if (levelName is null)
{
- throw new ArgumentNullException("levelName");
+ throw new ArgumentNullException(nameof(levelName));
}
- if (displayName == null)
+ if (displayName is null)
{
- throw new ArgumentNullException("displayName");
+ throw new ArgumentNullException(nameof(displayName));
}
- m_levelValue = level;
-#if NETSTANDARD1_3
- m_levelName = levelName;
-#else
- m_levelName = string.Intern(levelName);
-#endif
- m_levelDisplayName = displayName;
+ Value = level;
+ Name = string.Intern(levelName);
+ DisplayName = displayName;
}
/// <summary>
@@ -134,10 +125,6 @@
{
}
- #endregion Public Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
/// Gets the name of this level.
/// </summary>
@@ -149,46 +136,17 @@
/// Gets the name of this level.
/// </para>
/// </remarks>
- public string Name
- {
- get { return m_levelName; }
- }
+ public string Name { get; }
/// <summary>
/// Gets the value of this level.
/// </summary>
- /// <value>
- /// The value of this level.
- /// </value>
- /// <remarks>
- /// <para>
- /// Gets the value of this level.
- /// </para>
- /// </remarks>
- public int Value
- {
- get { return m_levelValue; }
- }
+ public int Value { get; }
/// <summary>
/// Gets the display name of this level.
/// </summary>
- /// <value>
- /// The display name of this level.
- /// </value>
- /// <remarks>
- /// <para>
- /// Gets the display name of this level.
- /// </para>
- /// </remarks>
- public string DisplayName
- {
- get { return m_levelDisplayName; }
- }
-
- #endregion Public Instance Properties
-
- #region Override implementation of Object
+ public string DisplayName { get; }
/// <summary>
/// Returns the <see cref="string" /> representation of the current
@@ -202,10 +160,7 @@
/// Returns the level <see cref="Name"/>.
/// </para>
/// </remarks>
- public override string ToString()
- {
- return m_levelName;
- }
+ public override string ToString() => Name;
/// <summary>
/// Compares levels.
@@ -221,15 +176,11 @@
/// </remarks>
public override bool Equals(object o)
{
- Level otherLevel = o as Level;
- if (otherLevel != null)
+ if (o is Level otherLevel)
{
- return m_levelValue == otherLevel.m_levelValue;
+ return Value == otherLevel.Value;
}
- else
- {
- return base.Equals(o);
- }
+ return base.Equals(o);
}
/// <summary>
@@ -245,14 +196,7 @@
/// Returns the hash code of the level <see cref="Value"/>.
/// </para>
/// </remarks>
- public override int GetHashCode()
- {
- return m_levelValue;
- }
-
- #endregion Override implementation of Object
-
- #region Implementation of IComparable
+ public override int GetHashCode() => Value;
/// <summary>
/// Compares this instance to a specified object and returns an
@@ -294,18 +238,13 @@
/// <exception cref="ArgumentException"><paramref name="r" /> is not a <see cref="Level" />.</exception>
public int CompareTo(object r)
{
- Level target = r as Level;
- if (target != null)
+ if (r is Level target)
{
return Compare(this, target);
}
- throw new ArgumentException("Parameter: r, Value: [" + r + "] is not an instance of Level");
+ throw new ArgumentException($"Parameter: r, Value: [{r}] is not an instance of Level");
}
- #endregion Implementation of IComparable
-
- #region Operators
-
/// <summary>
/// Returns a value indicating whether a specified <see cref="Level" />
/// is greater than another specified <see cref="Level" />.
@@ -323,7 +262,7 @@
/// </remarks>
public static bool operator >(Level l, Level r)
{
- return l.m_levelValue > r.m_levelValue;
+ return l.Value > r.Value;
}
/// <summary>
@@ -343,7 +282,7 @@
/// </remarks>
public static bool operator <(Level l, Level r)
{
- return l.m_levelValue < r.m_levelValue;
+ return l.Value < r.Value;
}
/// <summary>
@@ -363,7 +302,7 @@
/// </remarks>
public static bool operator >=(Level l, Level r)
{
- return l.m_levelValue >= r.m_levelValue;
+ return l.Value >= r.Value;
}
/// <summary>
@@ -376,14 +315,9 @@
/// <c>true</c> if <paramref name="l" /> is less than or equal to
/// <paramref name="r" />; otherwise, <c>false</c>.
/// </returns>
- /// <remarks>
- /// <para>
- /// Compares two levels.
- /// </para>
- /// </remarks>
public static bool operator <=(Level l, Level r)
{
- return l.m_levelValue <= r.m_levelValue;
+ return l.Value <= r.Value;
}
/// <summary>
@@ -396,21 +330,13 @@
/// <c>true</c> if the value of <paramref name="l" /> is the same as the
/// value of <paramref name="r" />; otherwise, <c>false</c>.
/// </returns>
- /// <remarks>
- /// <para>
- /// Compares two levels.
- /// </para>
- /// </remarks>
- public static bool operator ==(Level l, Level r)
+ public static bool operator ==(Level? l, Level? r)
{
- if (((object)l) != null && ((object)r) != null)
+ if (l is not null && r is not null)
{
- return l.m_levelValue == r.m_levelValue;
+ return l.Value == r.Value;
}
- else
- {
- return ((object)l) == ((object)r);
- }
+ return ReferenceEquals(l, r);
}
/// <summary>
@@ -423,20 +349,11 @@
/// <c>true</c> if the value of <paramref name="l" /> is different from
/// the value of <paramref name="r" />; otherwise, <c>false</c>.
/// </returns>
- /// <remarks>
- /// <para>
- /// Compares two levels.
- /// </para>
- /// </remarks>
public static bool operator !=(Level l, Level r)
{
return !(l == r);
}
- #endregion Operators
-
- #region Public Static Methods
-
/// <summary>
/// Compares two specified <see cref="Level"/> instances.
/// </summary>
@@ -464,152 +381,132 @@
/// </item>
/// </list>
/// </returns>
- /// <remarks>
- /// <para>
- /// Compares two levels.
- /// </para>
- /// </remarks>
- public static int Compare(Level l, Level r)
+ public static int Compare(Level? l, Level? r)
{
- // Reference equals
- if ((object)l == (object)r)
+ if (ReferenceEquals(l, r))
{
return 0;
}
- if (l == null && r == null)
+ if (l is null && r is null)
{
return 0;
}
- if (l == null)
+ if (l is null)
{
return -1;
}
- if (r == null)
+ if (r is null)
{
return 1;
}
- return l.m_levelValue.CompareTo(r.m_levelValue);
+ return l.Value.CompareTo(r.Value);
}
- #endregion Public Static Methods
-
- #region Public Static Fields
-
/// <summary>
/// The <see cref="Off" /> level designates a higher level than all the rest.
/// </summary>
- public static readonly Level Off = new Level(int.MaxValue, "OFF");
+ public static readonly Level Off = new(int.MaxValue, "OFF");
/// <summary>
/// The <see cref="Emergency" /> level designates very severe error events.
/// System unusable, emergencies.
/// </summary>
- public static readonly Level Log4Net_Debug = new Level(120000, "log4net:DEBUG");
+ public static readonly Level Log4Net_Debug = new(120000, "log4net:DEBUG");
/// <summary>
/// The <see cref="Emergency" /> level designates very severe error events.
/// System unusable, emergencies.
/// </summary>
- public static readonly Level Emergency = new Level(120000, "EMERGENCY");
+ public static readonly Level Emergency = new(120000, "EMERGENCY");
/// <summary>
/// The <see cref="Fatal" /> level designates very severe error events
/// that will presumably lead the application to abort.
/// </summary>
- public static readonly Level Fatal = new Level(110000, "FATAL");
+ public static readonly Level Fatal = new(110000, "FATAL");
/// <summary>
/// The <see cref="Alert" /> level designates very severe error events.
/// Take immediate action, alerts.
/// </summary>
- public static readonly Level Alert = new Level(100000, "ALERT");
+ public static readonly Level Alert = new(100000, "ALERT");
/// <summary>
/// The <see cref="Critical" /> level designates very severe error events.
/// Critical condition, critical.
/// </summary>
- public static readonly Level Critical = new Level(90000, "CRITICAL");
+ public static readonly Level Critical = new(90000, "CRITICAL");
/// <summary>
/// The <see cref="Severe" /> level designates very severe error events.
/// </summary>
- public static readonly Level Severe = new Level(80000, "SEVERE");
+ public static readonly Level Severe = new(80000, "SEVERE");
/// <summary>
/// The <see cref="Error" /> level designates error events that might
/// still allow the application to continue running.
/// </summary>
- public static readonly Level Error = new Level(70000, "ERROR");
+ public static readonly Level Error = new(70000, "ERROR");
/// <summary>
/// The <see cref="Warn" /> level designates potentially harmful
/// situations.
/// </summary>
- public static readonly Level Warn = new Level(60000, "WARN");
+ public static readonly Level Warn = new(60000, "WARN");
/// <summary>
/// The <see cref="Notice" /> level designates informational messages
/// that highlight the progress of the application at the highest level.
/// </summary>
- public static readonly Level Notice = new Level(50000, "NOTICE");
+ public static readonly Level Notice = new(50000, "NOTICE");
/// <summary>
/// The <see cref="Info" /> level designates informational messages that
/// highlight the progress of the application at coarse-grained level.
/// </summary>
- public static readonly Level Info = new Level(40000, "INFO");
+ public static readonly Level Info = new(40000, "INFO");
/// <summary>
/// The <see cref="Debug" /> level designates fine-grained informational
/// events that are most useful to debug an application.
/// </summary>
- public static readonly Level Debug = new Level(30000, "DEBUG");
+ public static readonly Level Debug = new(30000, "DEBUG");
/// <summary>
/// The <see cref="Fine" /> level designates fine-grained informational
/// events that are most useful to debug an application.
/// </summary>
- public static readonly Level Fine = new Level(30000, "FINE");
+ public static readonly Level Fine = new(30000, "FINE");
/// <summary>
/// The <see cref="Trace" /> level designates fine-grained informational
/// events that are most useful to debug an application.
/// </summary>
- public static readonly Level Trace = new Level(20000, "TRACE");
+ public static readonly Level Trace = new(20000, "TRACE");
/// <summary>
/// The <see cref="Finer" /> level designates fine-grained informational
/// events that are most useful to debug an application.
/// </summary>
- public static readonly Level Finer = new Level(20000, "FINER");
+ public static readonly Level Finer = new(20000, "FINER");
/// <summary>
/// The <see cref="Verbose" /> level designates fine-grained informational
/// events that are most useful to debug an application.
/// </summary>
- public static readonly Level Verbose = new Level(10000, "VERBOSE");
+ public static readonly Level Verbose = new(10000, "VERBOSE");
/// <summary>
/// The <see cref="Finest" /> level designates fine-grained informational
/// events that are most useful to debug an application.
/// </summary>
- public static readonly Level Finest = new Level(10000, "FINEST");
+ public static readonly Level Finest = new(10000, "FINEST");
/// <summary>
/// The <see cref="All" /> level designates the lowest level possible.
/// </summary>
- public static readonly Level All = new Level(int.MinValue, "ALL");
-
- #endregion Public Static Fields
-
- #region Private Instance Fields
-
- private readonly int m_levelValue;
- private readonly string m_levelName;
- private readonly string m_levelDisplayName;
-
- #endregion Private Instance Fields
+ public static readonly Level All = new(int.MinValue, "ALL");
}
}
diff --git a/src/log4net/Core/LevelCollection.cs b/src/log4net/Core/LevelCollection.cs
index 4f35882..081b142 100644
--- a/src/log4net/Core/LevelCollection.cs
+++ b/src/log4net/Core/LevelCollection.cs
@@ -17,8 +17,12 @@
//
#endregion
+using log4net.Util;
using System;
using System.Collections;
+using System.Collections.Generic;
+
+#nullable enable
namespace log4net.Core
{
@@ -26,13 +30,8 @@
/// A strongly-typed collection of <see cref="Level"/> objects.
/// </summary>
/// <author>Nicko Cadell</author>
- public class LevelCollection : ICollection, IList, IEnumerable
-#if !NETSTANDARD1_3
- , ICloneable
-#endif
+ public class LevelCollection : ICollection, IList, IEnumerable, ICloneable
{
- #region Interfaces
-
/// <summary>
/// Supports type-safe iteration over a <see cref="LevelCollection"/>.
/// </summary>
@@ -61,19 +60,10 @@
void Reset();
}
- #endregion
-
private const int DEFAULT_CAPACITY = 16;
- #region Implementation (data)
-
private Level[] m_array;
- private int m_count = 0;
- private int m_version = 0;
-
- #endregion
-
- #region Static Wrappers
+ private int m_version;
/// <summary>
/// Creates a read-only wrapper for a <c>LevelCollection</c> instance.
@@ -84,15 +74,14 @@
/// </returns>
public static LevelCollection ReadOnly(LevelCollection list)
{
- if (list == null) throw new ArgumentNullException("list");
+ if (list is null)
+ {
+ throw new ArgumentNullException(nameof(list));
+ }
return new ReadOnlyLevelCollection(list);
}
- #endregion
-
- #region Constructors
-
/// <summary>
/// Initializes a new instance of the <c>LevelCollection</c> class
/// that is empty and has the default initial capacity.
@@ -148,6 +137,17 @@
}
/// <summary>
+ /// Initializes a new instance of the <c>LevelCollection</c> class
+ /// that contains elements copied from the specified <see cref="Level"/> collection.
+ /// </summary>
+ /// <param name="col">The <see cref="Level"/> collection whose elements are copied to the new list.</param>
+ public LevelCollection(ICollection<Level> col)
+ {
+ m_array = new Level[col.Count];
+ AddRange((ICollection)col);
+ }
+
+ /// <summary>
/// Type visible only to our subclasses
/// Used to access protected constructor
/// </summary>
@@ -162,22 +162,15 @@
/// <summary>
/// Allow subclasses to avoid our default constructors
/// </summary>
- /// <param name="tag"></param>
- protected internal LevelCollection(Tag tag)
+ protected internal LevelCollection(Tag _)
{
- m_array = null;
+ m_array = Array.Empty<Level>();
}
- #endregion
-
- #region Operations (type-safe ICollection)
/// <summary>
/// Gets the number of elements actually contained in the <c>LevelCollection</c>.
/// </summary>
- public virtual int Count
- {
- get { return m_count; }
- }
+ public virtual int Count { get; private set; }
/// <summary>
/// Copies the entire <c>LevelCollection</c> to a one-dimensional
@@ -197,12 +190,12 @@
/// <param name="start">The zero-based index in <paramref name="array"/> at which copying begins.</param>
public virtual void CopyTo(Level[] array, int start)
{
- if (m_count > array.GetUpperBound(0) + 1 - start)
+ if (Count > array.GetUpperBound(0) + 1 - start)
{
throw new System.ArgumentException("Destination array was not long enough.");
}
- Array.Copy(m_array, 0, array, start, m_count);
+ Array.Copy(m_array, 0, array, start, Count);
}
/// <summary>
@@ -222,10 +215,6 @@
get { return m_array; }
}
- #endregion
-
- #region Operations (type-safe IList)
-
/// <summary>
/// Gets or sets the <see cref="Level"/> at the specified index.
/// </summary>
@@ -257,15 +246,15 @@
/// <returns>The index at which the value has been added.</returns>
public virtual int Add(Level item)
{
- if (m_count == m_array.Length)
+ if (Count == m_array.Length)
{
- EnsureCapacity(m_count + 1);
+ EnsureCapacity(Count + 1);
}
- m_array[m_count] = item;
+ m_array[Count] = item;
m_version++;
- return m_count++;
+ return Count++;
}
/// <summary>
@@ -275,7 +264,7 @@
{
++m_version;
m_array = new Level[DEFAULT_CAPACITY];
- m_count = 0;
+ Count = 0;
}
/// <summary>
@@ -284,9 +273,9 @@
/// <returns>A new <see cref="LevelCollection"/> with a shallow copy of the collection data.</returns>
public virtual object Clone()
{
- LevelCollection newCol = new LevelCollection(m_count);
- Array.Copy(m_array, 0, newCol.m_array, 0, m_count);
- newCol.m_count = m_count;
+ var newCol = new LevelCollection(Count);
+ Array.Copy(m_array, 0, newCol.m_array, 0, Count);
+ newCol.Count = Count;
newCol.m_version = m_version;
return newCol;
@@ -299,7 +288,7 @@
/// <returns><c>true</c> if <paramref name="item"/> is found in the <c>LevelCollection</c>; otherwise, <c>false</c>.</returns>
public virtual bool Contains(Level item)
{
- for (int i = 0; i != m_count; ++i)
+ for (int i = 0; i != Count; ++i)
{
if (m_array[i].Equals(item))
{
@@ -320,7 +309,7 @@
/// </returns>
public virtual int IndexOf(Level item)
{
- for (int i = 0; i != m_count; ++i)
+ for (int i = 0; i != Count; ++i)
{
if (m_array[i].Equals(item))
{
@@ -344,18 +333,18 @@
{
ValidateIndex(index, true); // throws
- if (m_count == m_array.Length)
+ if (Count == m_array.Length)
{
- EnsureCapacity(m_count + 1);
+ EnsureCapacity(Count + 1);
}
- if (index < m_count)
+ if (index < Count)
{
- Array.Copy(m_array, index, m_array, index + 1, m_count - index);
+ Array.Copy(m_array, index, m_array, index + 1, Count - index);
}
m_array[index] = item;
- m_count++;
+ Count++;
m_version++;
}
@@ -391,18 +380,18 @@
{
ValidateIndex(index); // throws
- m_count--;
+ Count--;
- if (index < m_count)
+ if (index < Count)
{
- Array.Copy(m_array, index + 1, m_array, index, m_count - index);
+ Array.Copy(m_array, index + 1, m_array, index, Count - index);
}
// We can't set the deleted entry equal to null, because it might be a value type.
// Instead, we'll create an empty single-element array of the right type and copy it
// over the entry we want to erase.
Level[] temp = new Level[1];
- Array.Copy(temp, 0, m_array, m_count, 1);
+ Array.Copy(temp, 0, m_array, Count, 1);
m_version++;
}
@@ -424,10 +413,6 @@
get { return false; }
}
- #endregion
-
- #region Operations (type-safe IEnumerable)
-
/// <summary>
/// Returns an enumerator that can iterate through the <c>LevelCollection</c>.
/// </summary>
@@ -437,10 +422,6 @@
return new Enumerator(this);
}
- #endregion
-
- #region Public helpers (just to mimic some nice features of ArrayList)
-
/// <summary>
/// Gets or sets the number of elements the <c>LevelCollection</c> can contain.
/// </summary>
@@ -452,9 +433,9 @@
}
set
{
- if (value < m_count)
+ if (value < Count)
{
- value = m_count;
+ value = Count;
}
if (value != m_array.Length)
@@ -462,7 +443,7 @@
if (value > 0)
{
Level[] temp = new Level[value];
- Array.Copy(m_array, 0, temp, 0, m_count);
+ Array.Copy(m_array, 0, temp, 0, Count);
m_array = temp;
}
else
@@ -480,16 +461,16 @@
/// <returns>The new <see cref="LevelCollection.Count"/> of the <c>LevelCollection</c>.</returns>
public virtual int AddRange(LevelCollection x)
{
- if (m_count + x.Count >= m_array.Length)
+ if (Count + x.Count >= m_array.Length)
{
- EnsureCapacity(m_count + x.Count);
+ EnsureCapacity(Count + x.Count);
}
- Array.Copy(x.m_array, 0, m_array, m_count, x.Count);
- m_count += x.Count;
+ Array.Copy(x.m_array, 0, m_array, Count, x.Count);
+ Count += x.Count;
m_version++;
- return m_count;
+ return Count;
}
/// <summary>
@@ -499,16 +480,16 @@
/// <returns>The new <see cref="LevelCollection.Count"/> of the <c>LevelCollection</c>.</returns>
public virtual int AddRange(Level[] x)
{
- if (m_count + x.Length >= m_array.Length)
+ if (Count + x.Length >= m_array.Length)
{
- EnsureCapacity(m_count + x.Length);
+ EnsureCapacity(Count + x.Length);
}
- Array.Copy(x, 0, m_array, m_count, x.Length);
- m_count += x.Length;
+ Array.Copy(x, 0, m_array, Count, x.Length);
+ Count += x.Length;
m_version++;
- return m_count;
+ return Count;
}
/// <summary>
@@ -518,9 +499,9 @@
/// <returns>The new <see cref="LevelCollection.Count"/> of the <c>LevelCollection</c>.</returns>
public virtual int AddRange(ICollection col)
{
- if (m_count + col.Count >= m_array.Length)
+ if (Count + col.Count >= m_array.Length)
{
- EnsureCapacity(m_count + col.Count);
+ EnsureCapacity(Count + col.Count);
}
foreach (object item in col)
@@ -528,7 +509,7 @@
Add((Level)item);
}
- return m_count;
+ return Count;
}
/// <summary>
@@ -536,13 +517,9 @@
/// </summary>
public virtual void TrimToSize()
{
- this.Capacity = m_count;
+ Capacity = Count;
}
- #endregion
-
- #region Implementation (helpers)
-
/// <exception cref="ArgumentOutOfRangeException">
/// <para><paramref name="i"/> is less than zero</para>
/// <para>-or-</para>
@@ -560,10 +537,10 @@
/// </exception>
private void ValidateIndex(int i, bool allowEqualEnd)
{
- int max = (allowEqualEnd) ? (m_count) : (m_count - 1);
+ int max = (allowEqualEnd) ? (Count) : (Count - 1);
if (i < 0 || i > max)
{
- throw log4net.Util.SystemInfo.CreateArgumentOutOfRangeException("i", (object)i, "Index was out of range. Must be non-negative and less than the size of the collection. [" + (object)i + "] Specified argument was out of the range of valid values.");
+ throw log4net.Util.SystemInfo.CreateArgumentOutOfRangeException(nameof(i), i, $"Index was out of range. Must be non-negative and less than the size of the collection. [{i}] Specified argument was out of the range of valid values.");
}
}
@@ -575,85 +552,63 @@
newCapacity = min;
}
- this.Capacity = newCapacity;
+ Capacity = newCapacity;
}
- #endregion
-
- #region Implementation (ICollection)
-
void ICollection.CopyTo(Array array, int start)
{
- Array.Copy(m_array, 0, array, start, m_count);
+ Array.Copy(m_array, 0, array, start, Count);
}
- #endregion
-
- #region Implementation (IList)
-
object IList.this[int i]
{
- get { return (object)this[i]; }
- set { this[i] = (Level)value; }
+ get => this[i];
+ set => this[i] = (Level)value;
}
int IList.Add(object x)
{
- return this.Add((Level)x);
+ return Add((Level)x);
}
bool IList.Contains(object x)
{
- return this.Contains((Level)x);
+ return Contains((Level)x);
}
int IList.IndexOf(object x)
{
- return this.IndexOf((Level)x);
+ return IndexOf((Level)x);
}
void IList.Insert(int pos, object x)
{
- this.Insert(pos, (Level)x);
+ Insert(pos, (Level)x);
}
void IList.Remove(object x)
{
- this.Remove((Level)x);
+ Remove((Level)x);
}
void IList.RemoveAt(int pos)
{
- this.RemoveAt(pos);
+ RemoveAt(pos);
}
- #endregion
-
- #region Implementation (IEnumerable)
-
IEnumerator IEnumerable.GetEnumerator()
{
- return (IEnumerator)(this.GetEnumerator());
+ return (IEnumerator)GetEnumerator();
}
- #endregion
-
- #region Nested enumerator class
-
/// <summary>
/// Supports simple iteration over a <see cref="LevelCollection"/>.
/// </summary>
private sealed class Enumerator : IEnumerator, ILevelCollectionEnumerator
{
- #region Implementation (data)
-
private readonly LevelCollection m_collection;
private int m_index;
- private int m_version;
-
- #endregion
-
- #region Construction
+ private readonly int m_version;
/// <summary>
/// Initializes a new instance of the <c>Enumerator</c> class.
@@ -666,17 +621,10 @@
m_version = tc.m_version;
}
- #endregion
-
- #region Operations (type-safe IEnumerator)
-
/// <summary>
/// Gets the current element in the collection.
/// </summary>
- public Level Current
- {
- get { return m_collection[m_index]; }
- }
+ public Level Current => m_collection[m_index];
/// <summary>
/// Advances the enumerator to the next element in the collection.
@@ -692,7 +640,7 @@
{
if (m_version != m_collection.m_version)
{
- throw new System.InvalidOperationException("Collection was modified; enumeration operation may not execute.");
+ throw new InvalidOperationException("Collection was modified; enumeration operation may not execute.");
}
++m_index;
@@ -707,41 +655,18 @@
m_index = -1;
}
- #endregion
-
- #region Implementation (IEnumerator)
-
- object IEnumerator.Current
- {
- get { return this.Current; }
- }
-
- #endregion
+ object IEnumerator.Current => Current;
}
- #endregion
-
- #region Nested Read Only Wrapper class
-
private sealed class ReadOnlyLevelCollection : LevelCollection
{
- #region Implementation (data)
-
private readonly LevelCollection m_collection;
- #endregion
-
- #region Construction
-
internal ReadOnlyLevelCollection(LevelCollection list) : base(Tag.Default)
{
m_collection = list;
}
- #endregion
-
- #region Type-safe ICollection
-
public override void CopyTo(Level[] array)
{
m_collection.CopyTo(array);
@@ -751,110 +676,73 @@
{
m_collection.CopyTo(array, start);
}
- public override int Count
- {
- get { return m_collection.Count; }
- }
+
+ public override int Count => m_collection.Count;
- public override bool IsSynchronized
- {
- get { return m_collection.IsSynchronized; }
- }
+ public override bool IsSynchronized => m_collection.IsSynchronized;
- public override object SyncRoot
- {
- get { return this.m_collection.SyncRoot; }
- }
-
- #endregion
-
- #region Type-safe IList
+ public override object SyncRoot => m_collection.SyncRoot;
public override Level this[int i]
{
- get { return m_collection[i]; }
- set { throw new NotSupportedException("This is a Read Only Collection and can not be modified"); }
+ get => m_collection[i];
+ set => throw SystemInfo.CreateReadOnlyCollectionNotModifiableException();
}
public override int Add(Level x)
{
- throw new NotSupportedException("This is a Read Only Collection and can not be modified");
+ throw SystemInfo.CreateReadOnlyCollectionNotModifiableException();
}
public override void Clear()
{
- throw new NotSupportedException("This is a Read Only Collection and can not be modified");
+ throw SystemInfo.CreateReadOnlyCollectionNotModifiableException();
}
- public override bool Contains(Level x)
- {
- return m_collection.Contains(x);
- }
+ public override bool Contains(Level x) => m_collection.Contains(x);
- public override int IndexOf(Level x)
- {
- return m_collection.IndexOf(x);
- }
+ public override int IndexOf(Level x) => m_collection.IndexOf(x);
public override void Insert(int pos, Level x)
{
- throw new NotSupportedException("This is a Read Only Collection and can not be modified");
+ throw SystemInfo.CreateReadOnlyCollectionNotModifiableException();
}
public override void Remove(Level x)
{
- throw new NotSupportedException("This is a Read Only Collection and can not be modified");
+ throw SystemInfo.CreateReadOnlyCollectionNotModifiableException();
}
public override void RemoveAt(int pos)
{
- throw new NotSupportedException("This is a Read Only Collection and can not be modified");
+ throw SystemInfo.CreateReadOnlyCollectionNotModifiableException();
}
- public override bool IsFixedSize
- {
- get { return true; }
- }
+ public override bool IsFixedSize => true;
- public override bool IsReadOnly
- {
- get { return true; }
- }
-
- #endregion
-
- #region Type-safe IEnumerable
+ public override bool IsReadOnly => true;
public override ILevelCollectionEnumerator GetEnumerator()
{
return m_collection.GetEnumerator();
}
- #endregion
-
- #region Public Helpers
-
// (just to mimic some nice features of ArrayList)
public override int Capacity
{
- get { return m_collection.Capacity; }
- set { throw new NotSupportedException("This is a Read Only Collection and can not be modified"); }
+ get => m_collection.Capacity;
+ set => throw SystemInfo.CreateReadOnlyCollectionNotModifiableException();
}
public override int AddRange(LevelCollection x)
{
- throw new NotSupportedException("This is a Read Only Collection and can not be modified");
+ throw SystemInfo.CreateReadOnlyCollectionNotModifiableException();
}
public override int AddRange(Level[] x)
{
- throw new NotSupportedException("This is a Read Only Collection and can not be modified");
+ throw SystemInfo.CreateReadOnlyCollectionNotModifiableException();
}
-
- #endregion
}
-
- #endregion
}
-
-}
+}
\ No newline at end of file
diff --git a/src/log4net/Core/LevelMap.cs b/src/log4net/Core/LevelMap.cs
index 75a2abb..2a73caa 100644
--- a/src/log4net/Core/LevelMap.cs
+++ b/src/log4net/Core/LevelMap.cs
@@ -18,47 +18,28 @@
#endregion
using System;
-using System.Collections;
-using System.Collections.Specialized;
-
+using System.Collections.Concurrent;
using log4net.Util;
namespace log4net.Core
{
/// <summary>
- /// Mapping between string name and Level object
+ /// Maps between string name and Level object.
/// </summary>
/// <remarks>
/// <para>
- /// Mapping between string name and <see cref="Level"/> object.
/// This mapping is held separately for each <see cref="log4net.Repository.ILoggerRepository"/>.
- /// The level name is case insensitive.
+ /// The level name is case-insensitive.
/// </para>
/// </remarks>
/// <author>Nicko Cadell</author>
public sealed class LevelMap
{
- #region Member Variables
-
/// <summary>
/// Mapping from level name to Level object. The
- /// level name is case insensitive
+ /// level name is case-insensitive
/// </summary>
- private Hashtable m_mapName2Level = SystemInfo.CreateCaseInsensitiveHashtable();
-
- #endregion
-
- /// <summary>
- /// Construct the level map
- /// </summary>
- /// <remarks>
- /// <para>
- /// Construct the level map.
- /// </para>
- /// </remarks>
- public LevelMap()
- {
- }
+ private readonly ConcurrentDictionary<string, Level> m_mapName2Level = new(StringComparer.OrdinalIgnoreCase);
/// <summary>
/// Clear the internal maps of all levels
@@ -86,19 +67,17 @@
/// found then <c>null</c> is returned.
/// </para>
/// </remarks>
- public Level this[string name]
+ public Level? this[string name]
{
get
{
- if (name == null)
+ if (name is null)
{
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
}
- lock (this)
- {
- return (Level)m_mapName2Level[name];
- }
+ m_mapName2Level.TryGetValue(name, out Level? level);
+ return level;
}
}
@@ -129,23 +108,23 @@
/// Create a new Level and add it to the map
/// </para>
/// </remarks>
- public void Add(string name, int value, string displayName)
+ public void Add(string name, int value, string? displayName)
{
- if (name == null)
+ if (name is null)
{
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
}
if (name.Length == 0)
{
- throw log4net.Util.SystemInfo.CreateArgumentOutOfRangeException("name", name, "Parameter: name, Value: [" + name + "] out of range. Level name must not be empty");
+ throw SystemInfo.CreateArgumentOutOfRangeException(nameof(name), name, $"Parameter: name, Value: [{name}] out of range. Level name must not be empty");
}
- if (displayName == null || displayName.Length == 0)
+ if (string.IsNullOrEmpty(displayName))
{
displayName = name;
}
- Add(new Level(value, name, displayName));
+ Add(new Level(value, name, displayName!));
}
/// <summary>
@@ -159,14 +138,11 @@
/// </remarks>
public void Add(Level level)
{
- if (level == null)
+ if (level is null)
{
- throw new ArgumentNullException("level");
+ throw new ArgumentNullException(nameof(level));
}
- lock (this)
- {
- m_mapName2Level[level.Name] = level;
- }
+ m_mapName2Level[level.Name] = level;
}
/// <summary>
@@ -178,16 +154,7 @@
/// Return all possible levels as a list of Level objects.
/// </para>
/// </remarks>
- public LevelCollection AllLevels
- {
- get
- {
- lock (this)
- {
- return new LevelCollection(m_mapName2Level.Values);
- }
- }
- }
+ public LevelCollection AllLevels => new(m_mapName2Level.Values);
/// <summary>
/// Lookup a named level from the map
@@ -209,21 +176,12 @@
/// </remarks>
public Level LookupWithDefault(Level defaultLevel)
{
- if (defaultLevel == null)
+ if (defaultLevel is null)
{
- throw new ArgumentNullException("defaultLevel");
+ throw new ArgumentNullException(nameof(defaultLevel));
}
- lock (this)
- {
- Level level = (Level)m_mapName2Level[defaultLevel.Name];
- if (level == null)
- {
- m_mapName2Level[defaultLevel.Name] = defaultLevel;
- return defaultLevel;
- }
- return level;
- }
+ return m_mapName2Level.GetOrAdd(defaultLevel.Name, defaultLevel);
}
}
}
diff --git a/src/log4net/Core/LocationInfo.cs b/src/log4net/Core/LocationInfo.cs
index a3633fd..a05adca 100644
--- a/src/log4net/Core/LocationInfo.cs
+++ b/src/log4net/Core/LocationInfo.cs
@@ -18,12 +18,10 @@
#endregion
using System;
-#if !NETCF && !NETSTANDARD1_3
using System.Collections;
using System.Diagnostics;
using log4net.Util;
-#endif
namespace log4net.Core
{
@@ -58,13 +56,9 @@
/// </remarks>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
-#if !NETCF
[Serializable]
-#endif
public class LocationInfo
{
- #region Public Instance Constructors
-
/// <summary>
/// Constructor
/// </summary>
@@ -76,23 +70,22 @@
/// class based on the current thread.
/// </para>
/// </remarks>
- public LocationInfo(Type callerStackBoundaryDeclaringType)
+ public LocationInfo(Type? callerStackBoundaryDeclaringType)
{
// Initialize all fields
- m_className = NA;
- m_fileName = NA;
- m_lineNumber = NA;
- m_methodName = NA;
- m_fullInfo = NA;
+ ClassName = NA;
+ FileName = NA;
+ LineNumber = NA;
+ MethodName = NA;
+ FullInfo = NA;
-#if !NETCF && !NETSTANDARD1_3 // StackTrace isn't fully implemented for NETSTANDARD1_3 https://github.com/dotnet/corefx/issues/1797
- if (callerStackBoundaryDeclaringType != null)
+ if (callerStackBoundaryDeclaringType is not null)
{
try
{
StackTrace st = new StackTrace(true);
int frameIndex = 0;
-
+
// skip frames not from fqnOfCallingClass
while (frameIndex < st.FrameCount)
{
@@ -120,45 +113,44 @@
// take into account the frames we skip above
int adjustedFrameCount = st.FrameCount - frameIndex;
ArrayList stackFramesList = new ArrayList(adjustedFrameCount);
- m_stackFrames = new StackFrameItem[adjustedFrameCount];
- for (int i = frameIndex; i < st.FrameCount; i++)
+ StackFrames = new StackFrameItem[adjustedFrameCount];
+ for (int i=frameIndex; i < st.FrameCount; i++)
{
stackFramesList.Add(new StackFrameItem(st.GetFrame(i)));
}
-
- stackFramesList.CopyTo(m_stackFrames, 0);
-
+
+ stackFramesList.CopyTo(StackFrames, 0);
+
// now frameIndex is the first 'user' caller frame
StackFrame locationFrame = st.GetFrame(frameIndex);
- if (locationFrame != null)
+ if (locationFrame is not null)
{
System.Reflection.MethodBase method = locationFrame.GetMethod();
- if (method != null)
+ if (method is not null)
{
- m_methodName = method.Name;
- if (method.DeclaringType != null)
+ MethodName = method.Name;
+ if (method.DeclaringType is not null)
{
- m_className = method.DeclaringType.FullName;
+ ClassName = method.DeclaringType.FullName;
}
}
- m_fileName = locationFrame.GetFileName();
- m_lineNumber = locationFrame.GetFileLineNumber().ToString(System.Globalization.NumberFormatInfo.InvariantInfo);
+ FileName = locationFrame.GetFileName();
+ LineNumber = locationFrame.GetFileLineNumber().ToString(System.Globalization.NumberFormatInfo.InvariantInfo);
// Combine all location info
- m_fullInfo = m_className + '.' + m_methodName + '(' + m_fileName + ':' + m_lineNumber + ')';
+ FullInfo = ClassName + '.' + MethodName + '(' + FileName + ':' + LineNumber + ')';
}
}
}
- catch (System.Security.SecurityException)
+ catch(System.Security.SecurityException)
{
// This security exception will occur if the caller does not have
// some undefined set of SecurityPermission flags.
LogLog.Debug(declaringType, "Security exception while trying to get caller stack frame. Error Ignored. Location Information Not Available.");
}
}
-#endif
}
/// <summary>
@@ -176,84 +168,33 @@
/// </remarks>
public LocationInfo(string className, string methodName, string fileName, string lineNumber)
{
- m_className = className;
- m_fileName = fileName;
- m_lineNumber = lineNumber;
- m_methodName = methodName;
- m_fullInfo = m_className + '.' + m_methodName + '(' + m_fileName +
- ':' + m_lineNumber + ')';
+ ClassName = className;
+ FileName = fileName;
+ LineNumber = lineNumber;
+ MethodName = methodName;
+ FullInfo = $"{ClassName}.{MethodName}({FileName}:{LineNumber})";
}
- #endregion Public Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
/// Gets the fully qualified class name of the caller making the logging
/// request.
/// </summary>
- /// <value>
- /// The fully qualified class name of the caller making the logging
- /// request.
- /// </value>
- /// <remarks>
- /// <para>
- /// Gets the fully qualified class name of the caller making the logging
- /// request.
- /// </para>
- /// </remarks>
- public string ClassName
- {
- get { return m_className; }
- }
+ public string? ClassName { get; }
/// <summary>
/// Gets the file name of the caller.
/// </summary>
- /// <value>
- /// The file name of the caller.
- /// </value>
- /// <remarks>
- /// <para>
- /// Gets the file name of the caller.
- /// </para>
- /// </remarks>
- public string FileName
- {
- get { return m_fileName; }
- }
+ public string? FileName { get; }
/// <summary>
/// Gets the line number of the caller.
/// </summary>
- /// <value>
- /// The line number of the caller.
- /// </value>
- /// <remarks>
- /// <para>
- /// Gets the line number of the caller.
- /// </para>
- /// </remarks>
- public string LineNumber
- {
- get { return m_lineNumber; }
- }
+ public string LineNumber { get; }
/// <summary>
/// Gets the method name of the caller.
/// </summary>
- /// <value>
- /// The method name of the caller.
- /// </value>
- /// <remarks>
- /// <para>
- /// Gets the method name of the caller.
- /// </para>
- /// </remarks>
- public string MethodName
- {
- get { return m_methodName; }
- }
+ public string MethodName { get; }
/// <summary>
/// Gets all available caller information
@@ -268,37 +209,12 @@
/// <c>fully.qualified.classname.of.caller.methodName(Filename:line)</c>
/// </para>
/// </remarks>
- public string FullInfo
- {
- get { return m_fullInfo; }
- }
+ public string FullInfo { get; }
-#if !NETCF && !NETSTANDARD1_3
/// <summary>
/// Gets the stack frames from the stack trace of the caller making the log request
/// </summary>
- public StackFrameItem[] StackFrames
- {
- get { return m_stackFrames; }
- }
-#endif
-
- #endregion Public Instance Properties
-
- #region Private Instance Fields
-
- private readonly string m_className;
- private readonly string m_fileName;
- private readonly string m_lineNumber;
- private readonly string m_methodName;
- private readonly string m_fullInfo;
-#if !NETCF && !NETSTANDARD1_3
- private readonly StackFrameItem[] m_stackFrames;
-#endif
-
- #endregion Private Instance Fields
-
- #region Private Static Fields
+ public StackFrameItem[]? StackFrames { get; }
/// <summary>
/// The fully qualified type of the LocationInfo class.
@@ -315,7 +231,5 @@
/// constant is <b>?</b>.
/// </summary>
private const string NA = "?";
-
- #endregion Private Static Fields
}
}
diff --git a/src/log4net/Core/LogException.cs b/src/log4net/Core/LogException.cs
index f9b8e25..5008450 100644
--- a/src/log4net/Core/LogException.cs
+++ b/src/log4net/Core/LogException.cs
@@ -18,9 +18,7 @@
#endregion
using System;
-#if !NETCF && !NETSTANDARD1_3
using System.Runtime.Serialization;
-#endif
namespace log4net.Core
{
@@ -36,17 +34,9 @@
/// </remarks>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
-#if !NETCF
[Serializable]
-#endif
-#if NETSTANDARD1_3
- public class LogException : Exception
-#else
public class LogException : ApplicationException
-#endif
{
- #region Public Instance Constructors
-
/// <summary>
/// Constructor
/// </summary>
@@ -69,7 +59,7 @@
/// the specified message.
/// </para>
/// </remarks>
- public LogException(String message) : base(message)
+ public LogException(string message) : base(message)
{
}
@@ -84,15 +74,10 @@
/// with the specified message and inner exception.
/// </para>
/// </remarks>
- public LogException(String message, Exception innerException) : base(message, innerException)
+ public LogException(string message, Exception innerException) : base(message, innerException)
{
}
- #endregion Public Instance Constructors
-
- #region Protected Instance Constructors
-
-#if !NETCF && !NETSTANDARD1_3
/// <summary>
/// Serialization constructor
/// </summary>
@@ -107,8 +92,5 @@
protected LogException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
-#endif
-
- #endregion Protected Instance Constructors
}
}
diff --git a/src/log4net/Core/LogImpl.cs b/src/log4net/Core/LogImpl.cs
index 6eae4fa..1b8ff35 100644
--- a/src/log4net/Core/LogImpl.cs
+++ b/src/log4net/Core/LogImpl.cs
@@ -98,8 +98,6 @@
/// <author>Gert Driesen</author>
public class LogImpl : LoggerWrapperImpl, ILog
{
- #region Public Instance Constructors
-
/// <summary>
/// Construct a new wrapper for the specified logger.
/// </summary>
@@ -118,8 +116,6 @@
ReloadLevels(logger.Repository);
}
- #endregion Public Instance Constructors
-
/// <summary>
/// Virtual method called when the configuration of the repository changes
/// </summary>
@@ -140,8 +136,6 @@
m_levelFatal = levelMap.LookupWithDefault(Level.Fatal);
}
- #region Implementation of ILog
-
/// <summary>
/// Logs a message object with the <c>DEBUG</c> level.
/// </summary>
@@ -247,7 +241,7 @@
{
if (IsDebugEnabled)
{
- Logger.Log(ThisDeclaringType, m_levelDebug, new SystemStringFormat(CultureInfo.InvariantCulture, format, new object[] { arg0 }), null);
+ Logger.Log(ThisDeclaringType, m_levelDebug, new SystemStringFormat(CultureInfo.InvariantCulture, format, new[] { arg0 }), null);
}
}
@@ -278,7 +272,7 @@
{
if (IsDebugEnabled)
{
- Logger.Log(ThisDeclaringType, m_levelDebug, new SystemStringFormat(CultureInfo.InvariantCulture, format, new object[] { arg0, arg1 }), null);
+ Logger.Log(ThisDeclaringType, m_levelDebug, new SystemStringFormat(CultureInfo.InvariantCulture, format, new[] { arg0, arg1 }), null);
}
}
@@ -310,7 +304,7 @@
{
if (IsDebugEnabled)
{
- Logger.Log(ThisDeclaringType, m_levelDebug, new SystemStringFormat(CultureInfo.InvariantCulture, format, new object[] { arg0, arg1, arg2 }), null);
+ Logger.Log(ThisDeclaringType, m_levelDebug, new SystemStringFormat(CultureInfo.InvariantCulture, format, new[] { arg0, arg1, arg2 }), null);
}
}
@@ -445,7 +439,7 @@
{
if (IsInfoEnabled)
{
- Logger.Log(ThisDeclaringType, m_levelInfo, new SystemStringFormat(CultureInfo.InvariantCulture, format, new object[] { arg0 }), null);
+ Logger.Log(ThisDeclaringType, m_levelInfo, new SystemStringFormat(CultureInfo.InvariantCulture, format, new[] { arg0 }), null);
}
}
@@ -476,7 +470,7 @@
{
if (IsInfoEnabled)
{
- Logger.Log(ThisDeclaringType, m_levelInfo, new SystemStringFormat(CultureInfo.InvariantCulture, format, new object[] { arg0, arg1 }), null);
+ Logger.Log(ThisDeclaringType, m_levelInfo, new SystemStringFormat(CultureInfo.InvariantCulture, format, new[] { arg0, arg1 }), null);
}
}
@@ -508,7 +502,7 @@
{
if (IsInfoEnabled)
{
- Logger.Log(ThisDeclaringType, m_levelInfo, new SystemStringFormat(CultureInfo.InvariantCulture, format, new object[] { arg0, arg1, arg2 }), null);
+ Logger.Log(ThisDeclaringType, m_levelInfo, new SystemStringFormat(CultureInfo.InvariantCulture, format, new[] { arg0, arg1, arg2 }), null);
}
}
@@ -643,7 +637,7 @@
{
if (IsWarnEnabled)
{
- Logger.Log(ThisDeclaringType, m_levelWarn, new SystemStringFormat(CultureInfo.InvariantCulture, format, new object[] { arg0 }), null);
+ Logger.Log(ThisDeclaringType, m_levelWarn, new SystemStringFormat(CultureInfo.InvariantCulture, format, new[] { arg0 }), null);
}
}
@@ -674,7 +668,7 @@
{
if (IsWarnEnabled)
{
- Logger.Log(ThisDeclaringType, m_levelWarn, new SystemStringFormat(CultureInfo.InvariantCulture, format, new object[] { arg0, arg1 }), null);
+ Logger.Log(ThisDeclaringType, m_levelWarn, new SystemStringFormat(CultureInfo.InvariantCulture, format, new[] { arg0, arg1 }), null);
}
}
@@ -706,7 +700,7 @@
{
if (IsWarnEnabled)
{
- Logger.Log(ThisDeclaringType, m_levelWarn, new SystemStringFormat(CultureInfo.InvariantCulture, format, new object[] { arg0, arg1, arg2 }), null);
+ Logger.Log(ThisDeclaringType, m_levelWarn, new SystemStringFormat(CultureInfo.InvariantCulture, format, new[] { arg0, arg1, arg2 }), null);
}
}
@@ -841,7 +835,7 @@
{
if (IsErrorEnabled)
{
- Logger.Log(ThisDeclaringType, m_levelError, new SystemStringFormat(CultureInfo.InvariantCulture, format, new object[] { arg0 }), null);
+ Logger.Log(ThisDeclaringType, m_levelError, new SystemStringFormat(CultureInfo.InvariantCulture, format, new[] { arg0 }), null);
}
}
@@ -872,7 +866,7 @@
{
if (IsErrorEnabled)
{
- Logger.Log(ThisDeclaringType, m_levelError, new SystemStringFormat(CultureInfo.InvariantCulture, format, new object[] { arg0, arg1 }), null);
+ Logger.Log(ThisDeclaringType, m_levelError, new SystemStringFormat(CultureInfo.InvariantCulture, format, new[] { arg0, arg1 }), null);
}
}
@@ -904,7 +898,7 @@
{
if (IsErrorEnabled)
{
- Logger.Log(ThisDeclaringType, m_levelError, new SystemStringFormat(CultureInfo.InvariantCulture, format, new object[] { arg0, arg1, arg2 }), null);
+ Logger.Log(ThisDeclaringType, m_levelError, new SystemStringFormat(CultureInfo.InvariantCulture, format, new[] { arg0, arg1, arg2 }), null);
}
}
@@ -1039,7 +1033,7 @@
{
if (IsFatalEnabled)
{
- Logger.Log(ThisDeclaringType, m_levelFatal, new SystemStringFormat(CultureInfo.InvariantCulture, format, new object[] { arg0 }), null);
+ Logger.Log(ThisDeclaringType, m_levelFatal, new SystemStringFormat(CultureInfo.InvariantCulture, format, new[] { arg0 }), null);
}
}
@@ -1070,7 +1064,7 @@
{
if (IsFatalEnabled)
{
- Logger.Log(ThisDeclaringType, m_levelFatal, new SystemStringFormat(CultureInfo.InvariantCulture, format, new object[] { arg0, arg1 }), null);
+ Logger.Log(ThisDeclaringType, m_levelFatal, new SystemStringFormat(CultureInfo.InvariantCulture, format, new[] { arg0, arg1 }), null);
}
}
@@ -1102,7 +1096,7 @@
{
if (IsFatalEnabled)
{
- Logger.Log(ThisDeclaringType, m_levelFatal, new SystemStringFormat(CultureInfo.InvariantCulture, format, new object[] { arg0, arg1, arg2 }), null);
+ Logger.Log(ThisDeclaringType, m_levelFatal, new SystemStringFormat(CultureInfo.InvariantCulture, format, new[] { arg0, arg1, arg2 }), null);
}
}
@@ -1175,10 +1169,7 @@
/// takes to actually log.
/// </para>
/// </remarks>
- public virtual bool IsDebugEnabled
- {
- get { return Logger.IsEnabledFor(m_levelDebug); }
- }
+ public virtual bool IsDebugEnabled => Logger.IsEnabledFor(m_levelDebug);
/// <summary>
/// Checks if this logger is enabled for the <c>INFO</c> level.
@@ -1194,10 +1185,7 @@
/// </para>
/// </remarks>
/// <seealso cref="LogImpl.IsDebugEnabled"/>
- public virtual bool IsInfoEnabled
- {
- get { return Logger.IsEnabledFor(m_levelInfo); }
- }
+ public virtual bool IsInfoEnabled => Logger.IsEnabledFor(m_levelInfo);
/// <summary>
/// Checks if this logger is enabled for the <c>WARN</c> level.
@@ -1213,10 +1201,7 @@
/// </para>
/// </remarks>
/// <seealso cref="ILog.IsDebugEnabled"/>
- public virtual bool IsWarnEnabled
- {
- get { return Logger.IsEnabledFor(m_levelWarn); }
- }
+ public virtual bool IsWarnEnabled => Logger.IsEnabledFor(m_levelWarn);
/// <summary>
/// Checks if this logger is enabled for the <c>ERROR</c> level.
@@ -1231,10 +1216,7 @@
/// </para>
/// </remarks>
/// <seealso cref="ILog.IsDebugEnabled"/>
- public virtual bool IsErrorEnabled
- {
- get { return Logger.IsEnabledFor(m_levelError); }
- }
+ public virtual bool IsErrorEnabled => Logger.IsEnabledFor(m_levelError);
/// <summary>
/// Checks if this logger is enabled for the <c>FATAL</c> level.
@@ -1249,14 +1231,7 @@
/// </para>
/// </remarks>
/// <seealso cref="ILog.IsDebugEnabled"/>
- public virtual bool IsFatalEnabled
- {
- get { return Logger.IsEnabledFor(m_levelFatal); }
- }
-
- #endregion Implementation of ILog
-
- #region Private Methods
+ public virtual bool IsFatalEnabled => Logger.IsEnabledFor(m_levelFatal);
/// <summary>
/// Event handler for the <see cref="log4net.Repository.ILoggerRepository.ConfigurationChanged"/> event
@@ -1265,32 +1240,21 @@
/// <param name="e">Empty</param>
private void LoggerRepositoryConfigurationChanged(object sender, EventArgs e)
{
- ILoggerRepository repository = sender as ILoggerRepository;
- if (repository != null)
+ if (sender is ILoggerRepository repository)
{
ReloadLevels(repository);
}
}
- #endregion
-
- #region Private Static Instance Fields
-
/// <summary>
/// The fully qualified name of this declaring type not the type of any subclass.
/// </summary>
private static readonly Type ThisDeclaringType = typeof(LogImpl);
- #endregion Private Static Instance Fields
-
- #region Private Fields
-
private Level m_levelDebug;
private Level m_levelInfo;
private Level m_levelWarn;
private Level m_levelError;
private Level m_levelFatal;
-
- #endregion
}
}
diff --git a/src/log4net/Core/LoggerManager.cs b/src/log4net/Core/LoggerManager.cs
index 565cd6a..0a9a691 100644
--- a/src/log4net/Core/LoggerManager.cs
+++ b/src/log4net/Core/LoggerManager.cs
@@ -18,14 +18,13 @@
#endregion
using System;
-#if NETSTANDARD1_3
-using System.Runtime.InteropServices;
-#endif
using System.Reflection;
-
+using System.Text;
using log4net.Util;
using log4net.Repository;
+#nullable enable
+
namespace log4net.Core
{
/// <summary>
@@ -36,7 +35,7 @@
/// Static manager that controls the creation of repositories
/// </para>
/// <para>
- /// This class is used by the wrapper managers (e.g. <see cref="log4net.LogManager"/>)
+ /// This class is used by the wrapper managers (e.g. <see cref="LogManager"/>)
/// to provide access to the <see cref="ILogger"/> objects.
/// </para>
/// <para>
@@ -49,26 +48,8 @@
/// </remarks>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
- public sealed class LoggerManager
+ public static class LoggerManager
{
- #region Private Instance Constructors
-
- /// <summary>
- /// Private constructor to prevent instances. Only static methods should be used.
- /// </summary>
- /// <remarks>
- /// <para>
- /// Private constructor to prevent instances. Only static methods should be used.
- /// </para>
- /// </remarks>
- private LoggerManager()
- {
- }
-
- #endregion Private Instance Constructors
-
- #region Static Constructor
-
/// <summary>
/// Hook the shutdown event
/// </summary>
@@ -76,7 +57,7 @@
/// <para>
/// On the full .NET runtime, the static constructor hooks up the
/// <c>AppDomain.ProcessExit</c> and <c>AppDomain.DomainUnload</c>> events.
- /// These are used to shutdown the log4net system as the application exits.
+ /// These are used to shut down the log4net system as the application exits.
/// </para>
/// </remarks>
static LoggerManager()
@@ -100,54 +81,46 @@
LogLog.Debug(declaringType, GetVersionInfo());
// Set the default repository selector
-#if NETCF
- s_repositorySelector = new CompactRepositorySelector(typeof(log4net.Repository.Hierarchy.Hierarchy));
- return;
-#elif !NETSTANDARD1_3
// Look for the RepositorySelector type specified in the AppSettings 'log4net.RepositorySelector'
- string appRepositorySelectorTypeName = SystemInfo.GetAppSetting("log4net.RepositorySelector");
- if (appRepositorySelectorTypeName != null && appRepositorySelectorTypeName.Length > 0)
+ string? appRepositorySelectorTypeName = SystemInfo.GetAppSetting("log4net.RepositorySelector");
+ if (!string.IsNullOrEmpty(appRepositorySelectorTypeName))
{
// Resolve the config string into a Type
- Type appRepositorySelectorType = null;
+ Type? appRepositorySelectorType = null;
try
{
- appRepositorySelectorType = SystemInfo.GetTypeFromString(appRepositorySelectorTypeName, false, true);
+ appRepositorySelectorType = SystemInfo.GetTypeFromString(appRepositorySelectorTypeName!, false, true);
}
catch (Exception ex)
{
- LogLog.Error(declaringType, "Exception while resolving RepositorySelector Type [" + appRepositorySelectorTypeName + "]", ex);
+ LogLog.Error(declaringType, $"Exception while resolving RepositorySelector Type [{appRepositorySelectorTypeName}]", ex);
}
- if (appRepositorySelectorType != null)
+ if (appRepositorySelectorType is not null)
{
// Create an instance of the RepositorySelectorType
- object appRepositorySelectorObj = null;
+ object? appRepositorySelectorObj = null;
try
{
appRepositorySelectorObj = Activator.CreateInstance(appRepositorySelectorType);
}
catch (Exception ex)
{
- LogLog.Error(declaringType, "Exception while creating RepositorySelector [" + appRepositorySelectorType.FullName + "]", ex);
+ LogLog.Error(declaringType, $"Exception while creating RepositorySelector [{appRepositorySelectorType.FullName}]", ex);
}
- if (appRepositorySelectorObj != null && appRepositorySelectorObj is IRepositorySelector)
+ if (appRepositorySelectorObj is IRepositorySelector sel)
{
- s_repositorySelector = (IRepositorySelector)appRepositorySelectorObj;
+ RepositorySelector = sel;
}
else
{
- LogLog.Error(declaringType, "RepositorySelector Type [" + appRepositorySelectorType.FullName + "] is not an IRepositorySelector");
+ LogLog.Error(declaringType, $"RepositorySelector Type [{appRepositorySelectorType.FullName}] is not an IRepositorySelector");
}
}
}
-#endif
// Create the DefaultRepositorySelector if not configured above
- if (s_repositorySelector == null)
- {
- s_repositorySelector = new DefaultRepositorySelector(typeof(log4net.Repository.Hierarchy.Hierarchy));
- }
+ RepositorySelector ??= new DefaultRepositorySelector(typeof(Repository.Hierarchy.Hierarchy));
}
/// <summary>
@@ -164,19 +137,13 @@
/// </remarks>
private static void RegisterAppDomainEvents()
{
-#if !NETCF && !NETSTANDARD1_3
// ProcessExit seems to be fired if we are part of the default domain
- AppDomain.CurrentDomain.ProcessExit += new EventHandler(OnProcessExit);
+ AppDomain.CurrentDomain.ProcessExit += OnProcessExit;
// Otherwise DomainUnload is fired
- AppDomain.CurrentDomain.DomainUnload += new EventHandler(OnDomainUnload);
-#endif
+ AppDomain.CurrentDomain.DomainUnload += OnDomainUnload;
}
- #endregion Static Constructor
-
- #region Public Static Methods
-
/// <summary>
/// Return the default <see cref="ILoggerRepository"/> instance.
/// </summary>
@@ -197,7 +164,7 @@
/// <summary>
/// Returns the default <see cref="ILoggerRepository"/> instance.
/// </summary>
- /// <param name="repositoryAssembly">The assembly to use to lookup the repository.</param>
+ /// <param name="repositoryAssembly">The assembly to use to look up the repository.</param>
/// <returns>The default <see cref="ILoggerRepository"/> instance.</returns>
[Obsolete("Use GetRepository instead of GetLoggerRepository")]
public static ILoggerRepository GetLoggerRepository(Assembly repositoryAssembly)
@@ -218,9 +185,9 @@
/// </remarks>
public static ILoggerRepository GetRepository(string repository)
{
- if (repository == null)
+ if (repository is null)
{
- throw new ArgumentNullException("repository");
+ throw new ArgumentNullException(nameof(repository));
}
return RepositorySelector.GetRepository(repository);
}
@@ -228,7 +195,7 @@
/// <summary>
/// Returns the default <see cref="ILoggerRepository"/> instance.
/// </summary>
- /// <param name="repositoryAssembly">The assembly to use to lookup the repository.</param>
+ /// <param name="repositoryAssembly">The assembly to use to look up the repository.</param>
/// <returns>The default <see cref="ILoggerRepository"/> instance.</returns>
/// <remarks>
/// <para>
@@ -237,9 +204,9 @@
/// </remarks>
public static ILoggerRepository GetRepository(Assembly repositoryAssembly)
{
- if (repositoryAssembly == null)
+ if (repositoryAssembly is null)
{
- throw new ArgumentNullException("repositoryAssembly");
+ throw new ArgumentNullException(nameof(repositoryAssembly));
}
return RepositorySelector.GetRepository(repositoryAssembly);
}
@@ -260,15 +227,15 @@
/// <c>null</c>.
/// </para>
/// </remarks>
- public static ILogger Exists(string repository, string name)
+ public static ILogger? Exists(string repository, string name)
{
- if (repository == null)
+ if (repository is null)
{
- throw new ArgumentNullException("repository");
+ throw new ArgumentNullException(nameof(repository));
}
- if (name == null)
+ if (name is null)
{
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
}
return RepositorySelector.GetRepository(repository).Exists(name);
}
@@ -276,7 +243,7 @@
/// <summary>
/// Returns the named logger if it exists.
/// </summary>
- /// <param name="repositoryAssembly">The assembly to use to lookup the repository.</param>
+ /// <param name="repositoryAssembly">The assembly to use to look up the repository.</param>
/// <param name="name">The fully qualified logger name to look for.</param>
/// <returns>
/// The logger found, or <c>null</c> if the named logger does not exist in the
@@ -289,15 +256,15 @@
/// <c>null</c>.
/// </para>
/// </remarks>
- public static ILogger Exists(Assembly repositoryAssembly, string name)
+ public static ILogger? Exists(Assembly repositoryAssembly, string name)
{
- if (repositoryAssembly == null)
+ if (repositoryAssembly is null)
{
- throw new ArgumentNullException("repositoryAssembly");
+ throw new ArgumentNullException(nameof(repositoryAssembly));
}
- if (name == null)
+ if (name is null)
{
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
}
return RepositorySelector.GetRepository(repositoryAssembly).Exists(name);
}
@@ -314,9 +281,9 @@
/// </remarks>
public static ILogger[] GetCurrentLoggers(string repository)
{
- if (repository == null)
+ if (repository is null)
{
- throw new ArgumentNullException("repository");
+ throw new ArgumentNullException(nameof(repository));
}
return RepositorySelector.GetRepository(repository).GetCurrentLoggers();
}
@@ -324,7 +291,7 @@
/// <summary>
/// Returns all the currently defined loggers in the specified assembly's repository.
/// </summary>
- /// <param name="repositoryAssembly">The assembly to use to lookup the repository.</param>
+ /// <param name="repositoryAssembly">The assembly to use to look up the repository.</param>
/// <returns>All the defined loggers.</returns>
/// <remarks>
/// <para>
@@ -333,9 +300,9 @@
/// </remarks>
public static ILogger[] GetCurrentLoggers(Assembly repositoryAssembly)
{
- if (repositoryAssembly == null)
+ if (repositoryAssembly is null)
{
- throw new ArgumentNullException("repositoryAssembly");
+ throw new ArgumentNullException(nameof(repositoryAssembly));
}
return RepositorySelector.GetRepository(repositoryAssembly).GetCurrentLoggers();
}
@@ -361,13 +328,13 @@
/// </remarks>
public static ILogger GetLogger(string repository, string name)
{
- if (repository == null)
+ if (repository is null)
{
- throw new ArgumentNullException("repository");
+ throw new ArgumentNullException(nameof(repository));
}
- if (name == null)
+ if (name is null)
{
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
}
return RepositorySelector.GetRepository(repository).GetLogger(name);
}
@@ -375,7 +342,7 @@
/// <summary>
/// Retrieves or creates a named logger.
/// </summary>
- /// <param name="repositoryAssembly">The assembly to use to lookup the repository.</param>
+ /// <param name="repositoryAssembly">The assembly to use to look up the repository.</param>
/// <param name="name">The name of the logger to retrieve.</param>
/// <returns>The logger with the name specified.</returns>
/// <remarks>
@@ -393,13 +360,13 @@
/// </remarks>
public static ILogger GetLogger(Assembly repositoryAssembly, string name)
{
- if (repositoryAssembly == null)
+ if (repositoryAssembly is null)
{
- throw new ArgumentNullException("repositoryAssembly");
+ throw new ArgumentNullException(nameof(repositoryAssembly));
}
- if (name == null)
+ if (name is null)
{
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
}
return RepositorySelector.GetRepository(repositoryAssembly).GetLogger(name);
}
@@ -417,13 +384,17 @@
/// </remarks>
public static ILogger GetLogger(string repository, Type type)
{
- if (repository == null)
+ if (repository is null)
{
- throw new ArgumentNullException("repository");
+ throw new ArgumentNullException(nameof(repository));
}
- if (type == null)
+ if (type is null)
{
- throw new ArgumentNullException("type");
+ throw new ArgumentNullException(nameof(type));
+ }
+ if (type.FullName is null)
+ {
+ throw new ArgumentException($"Type {type} does not have a full name", nameof(type));
}
return RepositorySelector.GetRepository(repository).GetLogger(type.FullName);
}
@@ -431,7 +402,7 @@
/// <summary>
/// Shorthand for <see cref="M:LogManager.GetLogger(string)"/>.
/// </summary>
- /// <param name="repositoryAssembly">the assembly to use to lookup the repository</param>
+ /// <param name="repositoryAssembly">the assembly to use to look up the repository</param>
/// <param name="type">The <paramref name="type"/> of which the fullname will be used as the name of the logger to retrieve.</param>
/// <returns>The logger with the name specified.</returns>
/// <remarks>
@@ -441,13 +412,17 @@
/// </remarks>
public static ILogger GetLogger(Assembly repositoryAssembly, Type type)
{
- if (repositoryAssembly == null)
+ if (repositoryAssembly is null)
{
- throw new ArgumentNullException("repositoryAssembly");
+ throw new ArgumentNullException(nameof(repositoryAssembly));
}
- if (type == null)
+ if (type is null)
{
- throw new ArgumentNullException("type");
+ throw new ArgumentNullException(nameof(type));
+ }
+ if (type.FullName is null)
+ {
+ throw new ArgumentException($"Type {type} does not have a full name", nameof(type));
}
return RepositorySelector.GetRepository(repositoryAssembly).GetLogger(type.FullName);
}
@@ -467,7 +442,7 @@
/// </para>
/// <para>
/// The <c>shutdown</c> method is careful to close nested
- /// appenders before closing regular appenders. This is allows
+ /// appenders before closing regular appenders. This allows
/// configurations where a regular appender is attached to a logger
/// and again to a nested appender.
/// </para>
@@ -483,7 +458,7 @@
/// <summary>
/// Shuts down the repository for the repository specified.
/// </summary>
- /// <param name="repository">The repository to shutdown.</param>
+ /// <param name="repository">The repository to shut down.</param>
/// <remarks>
/// <para>
/// Calling this method will <b>safely</b> close and remove all
@@ -496,16 +471,16 @@
/// </para>
/// <para>
/// The <c>shutdown</c> method is careful to close nested
- /// appenders before closing regular appenders. This is allows
+ /// appenders before closing regular appenders. This allows
/// configurations where a regular appender is attached to a logger
/// and again to a nested appender.
/// </para>
/// </remarks>
public static void ShutdownRepository(string repository)
{
- if (repository == null)
+ if (repository is null)
{
- throw new ArgumentNullException("repository");
+ throw new ArgumentNullException(nameof(repository));
}
RepositorySelector.GetRepository(repository).Shutdown();
}
@@ -513,7 +488,7 @@
/// <summary>
/// Shuts down the repository for the repository specified.
/// </summary>
- /// <param name="repositoryAssembly">The assembly to use to lookup the repository.</param>
+ /// <param name="repositoryAssembly">The assembly to use to look up the repository.</param>
/// <remarks>
/// <para>
/// Calling this method will <b>safely</b> close and remove all
@@ -527,16 +502,16 @@
/// </para>
/// <para>
/// The <c>shutdown</c> method is careful to close nested
- /// appenders before closing regular appenders. This is allows
+ /// appenders before closing regular appenders. This allows
/// configurations where a regular appender is attached to a logger
/// and again to a nested appender.
/// </para>
/// </remarks>
public static void ShutdownRepository(Assembly repositoryAssembly)
{
- if (repositoryAssembly == null)
+ if (repositoryAssembly is null)
{
- throw new ArgumentNullException("repositoryAssembly");
+ throw new ArgumentNullException(nameof(repositoryAssembly));
}
RepositorySelector.GetRepository(repositoryAssembly).Shutdown();
}
@@ -557,9 +532,9 @@
/// </remarks>
public static void ResetConfiguration(string repository)
{
- if (repository == null)
+ if (repository is null)
{
- throw new ArgumentNullException("repository");
+ throw new ArgumentNullException(nameof(repository));
}
RepositorySelector.GetRepository(repository).ResetConfiguration();
}
@@ -567,7 +542,7 @@
/// <summary>
/// Resets all values contained in this repository instance to their defaults.
/// </summary>
- /// <param name="repositoryAssembly">The assembly to use to lookup the repository to reset.</param>
+ /// <param name="repositoryAssembly">The assembly to use to look up the repository to reset.</param>
/// <remarks>
/// <para>
/// Resets all values contained in the repository instance to their
@@ -580,9 +555,9 @@
/// </remarks>
public static void ResetConfiguration(Assembly repositoryAssembly)
{
- if (repositoryAssembly == null)
+ if (repositoryAssembly is null)
{
- throw new ArgumentNullException("repositoryAssembly");
+ throw new ArgumentNullException(nameof(repositoryAssembly));
}
RepositorySelector.GetRepository(repositoryAssembly).ResetConfiguration();
}
@@ -630,9 +605,9 @@
/// <exception cref="LogException">The specified repository already exists.</exception>
public static ILoggerRepository CreateRepository(string repository)
{
- if (repository == null)
+ if (repository is null)
{
- throw new ArgumentNullException("repository");
+ throw new ArgumentNullException(nameof(repository));
}
return RepositorySelector.CreateRepository(repository, null);
}
@@ -678,13 +653,13 @@
/// <exception cref="LogException">The specified repository already exists.</exception>
public static ILoggerRepository CreateRepository(string repository, Type repositoryType)
{
- if (repository == null)
+ if (repository is null)
{
- throw new ArgumentNullException("repository");
+ throw new ArgumentNullException(nameof(repository));
}
- if (repositoryType == null)
+ if (repositoryType is null)
{
- throw new ArgumentNullException("repositoryType");
+ throw new ArgumentNullException(nameof(repositoryType));
}
return RepositorySelector.CreateRepository(repository, repositoryType);
}
@@ -730,13 +705,13 @@
/// </remarks>
public static ILoggerRepository CreateRepository(Assembly repositoryAssembly, Type repositoryType)
{
- if (repositoryAssembly == null)
+ if (repositoryAssembly is null)
{
- throw new ArgumentNullException("repositoryAssembly");
+ throw new ArgumentNullException(nameof(repositoryAssembly));
}
- if (repositoryType == null)
+ if (repositoryType is null)
{
- throw new ArgumentNullException("repositoryType");
+ throw new ArgumentNullException(nameof(repositoryType));
}
return RepositorySelector.CreateRepository(repositoryAssembly, repositoryType);
}
@@ -773,23 +748,10 @@
/// <see cref="M:Assembly.GetCallingAssembly()"/>).
/// </para>
/// <para>
- /// This context is used by the selector to lookup a specific repository.
- /// </para>
- /// <para>
- /// For the full .NET Framework, the default repository is <c>DefaultRepositorySelector</c>;
- /// for the .NET Compact Framework <c>CompactRepositorySelector</c> is the default
- /// repository.
+ /// This context is used by the selector to look up a specific repository.
/// </para>
/// </remarks>
- public static IRepositorySelector RepositorySelector
- {
- get { return s_repositorySelector; }
- set { s_repositorySelector = value; }
- }
-
- #endregion Public Static Methods
-
- #region Private Static Methods
+ public static IRepositorySelector RepositorySelector { get; set; }
/// <summary>
/// Internal method to get pertinent version info.
@@ -797,27 +759,17 @@
/// <returns>A string of version info.</returns>
private static string GetVersionInfo()
{
- System.Text.StringBuilder sb = new System.Text.StringBuilder();
+ var sb = new StringBuilder();
-#if NETSTANDARD1_3
- Assembly myAssembly = typeof(LoggerManager).GetTypeInfo().Assembly;
- sb.Append($"log4net assembly [{myAssembly.FullName}]. ");
- //sb.Append($"Loaded from [{myAssembly.Location}]. "); // TODO Assembly.Location available in netstandard1.5
- sb.Append($"(.NET Framework [{RuntimeInformation.FrameworkDescription}] on {RuntimeInformation.OSDescription}");
-#else
Assembly myAssembly = Assembly.GetExecutingAssembly();
sb.Append("log4net assembly [").Append(myAssembly.FullName).Append("]. ");
sb.Append("Loaded from [").Append(SystemInfo.AssemblyLocationInfo(myAssembly)).Append("]. ");
- sb.Append("(.NET Runtime [").Append(Environment.Version.ToString()).Append("]");
-#if (!SSCLI)
- sb.Append(" on ").Append(Environment.OSVersion.ToString());
-#endif
-#endif // NETSTANDARD1_3
+ sb.Append("(.NET Runtime [").Append(Environment.Version).Append("]");
+ sb.Append(" on ").Append(Environment.OSVersion);
sb.Append(")");
return sb.ToString();
}
-#if (!NETCF)
/// <summary>
/// Called when the <see cref="AppDomain.DomainUnload"/> event fires
/// </summary>
@@ -853,11 +805,6 @@
{
Shutdown();
}
-#endif
-
- #endregion Private Static Methods
-
- #region Private Static Fields
/// <summary>
/// The fully qualified type of the LoggerManager class.
@@ -867,12 +814,5 @@
/// log message.
/// </remarks>
private static readonly Type declaringType = typeof(LoggerManager);
-
- /// <summary>
- /// Initialize the default repository selector
- /// </summary>
- private static IRepositorySelector s_repositorySelector;
-
- #endregion Private Static Fields
}
-}
+}
\ No newline at end of file
diff --git a/src/log4net/Core/LoggerWrapperImpl.cs b/src/log4net/Core/LoggerWrapperImpl.cs
index 61e19eb..188b980 100644
--- a/src/log4net/Core/LoggerWrapperImpl.cs
+++ b/src/log4net/Core/LoggerWrapperImpl.cs
@@ -31,8 +31,6 @@
/// <author>Gert Driesen</author>
public abstract class LoggerWrapperImpl : ILoggerWrapper
{
- #region Protected Instance Constructors
-
/// <summary>
/// Constructs a new wrapper for the specified logger.
/// </summary>
@@ -44,13 +42,9 @@
/// </remarks>
protected LoggerWrapperImpl(ILogger logger)
{
- m_logger = logger;
+ Logger = logger;
}
- #endregion Public Instance Constructors
-
- #region Implementation of ILoggerWrapper
-
/// <summary>
/// Gets the implementation behind this wrapper object.
/// </summary>
@@ -67,20 +61,6 @@
/// the log events.
/// </para>
/// </remarks>
- public virtual ILogger Logger
- {
- get { return m_logger; }
- }
-
- #endregion
-
- #region Private Instance Fields
-
- /// <summary>
- /// The logger that this object is wrapping
- /// </summary>
- private readonly ILogger m_logger;
-
- #endregion Private Instance Fields
+ public virtual ILogger Logger { get; }
}
}
diff --git a/src/log4net/Core/LoggingEvent.cs b/src/log4net/Core/LoggingEvent.cs
index b4d2a00..1098b68 100644
--- a/src/log4net/Core/LoggingEvent.cs
+++ b/src/log4net/Core/LoggingEvent.cs
@@ -1,5 +1,4 @@
#region Apache License
-
//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
@@ -16,17 +15,16 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
-
#endregion
using System;
-using System.Collections;
+using System.Collections.Generic;
+using System.Globalization;
using System.IO;
using System.Runtime.Serialization;
using System.Security;
-#if !NETCF && !NETSTANDARD1_3
using System.Security.Principal;
-#endif
+using System.Threading;
using log4net.Util;
using log4net.Repository;
@@ -35,16 +33,9 @@
/// <summary>
/// Portable data structure used by <see cref="LoggingEvent"/>
/// </summary>
- /// <remarks>
- /// <para>
- /// Portable data structure used by <see cref="LoggingEvent"/>
- /// </para>
- /// </remarks>
/// <author>Nicko Cadell</author>
public struct LoggingEventData
{
- #region Public Instance Fields
-
/// <summary>
/// The logger name.
/// </summary>
@@ -53,7 +44,7 @@
/// The logger name.
/// </para>
/// </remarks>
- public string LoggerName;
+ public string? LoggerName;
/// <summary>
/// Level of logging event.
@@ -65,7 +56,7 @@
/// cannot be declared final either.
/// </para>
/// </remarks>
- public Level Level;
+ public Level? Level;
/// <summary>
/// The application supplied message.
@@ -75,7 +66,7 @@
/// The application supplied message of logging event.
/// </para>
/// </remarks>
- public string Message;
+ public string? Message;
/// <summary>
/// The name of thread
@@ -85,7 +76,7 @@
/// The name of thread in which this logging event was generated
/// </para>
/// </remarks>
- public string ThreadName;
+ public string? ThreadName;
/// <summary>
/// Gets or sets the local time the event was logged
@@ -112,8 +103,7 @@
{
get
{
- if (TimeStamp != default(DateTime) &&
- _timeStampUtc == default(DateTime))
+ if (TimeStamp != default && _timeStampUtc == default)
{
// TimeStamp field has been set explicitly but TimeStampUtc hasn't
// => use TimeStamp
@@ -141,7 +131,7 @@
/// Location information for the caller.
/// </para>
/// </remarks>
- public LocationInfo LocationInfo;
+ public LocationInfo? LocationInfo;
/// <summary>
/// String representation of the user
@@ -152,7 +142,7 @@
/// like DOMAIN\username
/// </para>
/// </remarks>
- public string UserName;
+ public string? UserName;
/// <summary>
/// String representation of the identity.
@@ -162,7 +152,7 @@
/// String representation of the current thread's principal identity.
/// </para>
/// </remarks>
- public string Identity;
+ public string? Identity;
/// <summary>
/// The string representation of the exception
@@ -172,7 +162,7 @@
/// The string representation of the exception
/// </para>
/// </remarks>
- public string ExceptionString;
+ public string? ExceptionString;
/// <summary>
/// String representation of the AppDomain.
@@ -182,7 +172,7 @@
/// String representation of the AppDomain.
/// </para>
/// </remarks>
- public string Domain;
+ public string? Domain;
/// <summary>
/// Additional event specific properties
@@ -194,9 +184,7 @@
/// have a string key and an object value.
/// </para>
/// </remarks>
- public PropertiesDictionary Properties;
-
- #endregion Public Instance Fields
+ public PropertiesDictionary? Properties;
}
/// <summary>
@@ -215,29 +203,22 @@
/// Some of the values in instances of <see cref="LoggingEvent"/>
/// are considered volatile, that is the values are correct at the
/// time the event is delivered to appenders, but will not be consistent
- /// at any time afterwards. If an event is to be stored and then processed
+ /// at any time afterward. If an event is to be stored and then processed
/// at a later time these volatile values must be fixed by calling
/// <see cref="M:FixVolatileData()"/>. There is a performance penalty
/// for incurred by calling <see cref="M:FixVolatileData()"/> but it
- /// is essential to maintaining data consistency.
+ /// is essential to maintain data consistency.
/// </para>
/// </remarks>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
/// <author>Douglas de la Torre</author>
/// <author>Daniel Cazzulino</author>
-#if !NETCF
[Serializable]
-#endif
- public class LoggingEvent
-#if !NETCF
- : ISerializable
-#endif
+ public class LoggingEvent : ISerializable
{
private static readonly Type declaringType = typeof(LoggingEvent);
- #region Public Instance Constructors
-
/// <summary>
/// Initializes a new instance of the <see cref="LoggingEvent" /> class
/// from the supplied parameters.
@@ -260,17 +241,18 @@
/// to create a logging event.
/// </para>
/// </remarks>
- public LoggingEvent(Type callerStackBoundaryDeclaringType,
- log4net.Repository.ILoggerRepository repository,
- string loggerName,
- Level level,
- object message,
- Exception exception)
+ public LoggingEvent(
+ Type? callerStackBoundaryDeclaringType,
+ ILoggerRepository? repository,
+ string? loggerName,
+ Level? level,
+ object? message,
+ Exception? exception)
{
m_callerStackBoundaryDeclaringType = callerStackBoundaryDeclaringType;
m_message = message;
- m_repository = repository;
- m_thrownException = exception;
+ Repository = repository;
+ ExceptionObject = exception;
m_data.LoggerName = loggerName;
m_data.Level = level;
@@ -304,13 +286,14 @@
/// will be captured from the environment if requested or fixed.
/// </para>
/// </remarks>
- public LoggingEvent(Type callerStackBoundaryDeclaringType,
- log4net.Repository.ILoggerRepository repository,
+ public LoggingEvent(
+ Type? callerStackBoundaryDeclaringType,
+ ILoggerRepository? repository,
LoggingEventData data,
FixFlags fixedData)
{
m_callerStackBoundaryDeclaringType = callerStackBoundaryDeclaringType;
- m_repository = repository;
+ Repository = repository;
m_data = data;
m_fixFlags = fixedData;
@@ -340,9 +323,11 @@
/// parameter and no other data should be captured from the environment.
/// </para>
/// </remarks>
- public LoggingEvent(Type callerStackBoundaryDeclaringType,
- log4net.Repository.ILoggerRepository repository,
- LoggingEventData data) : this(callerStackBoundaryDeclaringType, repository, data, FixFlags.All)
+ public LoggingEvent(
+ Type? callerStackBoundaryDeclaringType,
+ ILoggerRepository? repository,
+ LoggingEventData data)
+ : this(callerStackBoundaryDeclaringType, repository, data, FixFlags.All)
{
}
@@ -371,12 +356,6 @@
{
}
- #endregion Public Instance Constructors
-
- #region Protected Instance Constructors
-
-#if !NETCF
-
/// <summary>
/// Serialization constructor
/// </summary>
@@ -414,12 +393,6 @@
m_fixFlags = FixFlags.All;
}
-#endif
-
- #endregion Protected Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
/// Gets the time when the current process started.
/// </summary>
@@ -441,10 +414,7 @@
/// without the process start time being reset.
/// </para>
/// </remarks>
- public static DateTime StartTime
- {
- get { return SystemInfo.ProcessStartTimeUtc.ToLocalTime(); }
- }
+ public static DateTime StartTime => SystemInfo.ProcessStartTimeUtc.ToLocalTime();
/// <summary>
/// Gets the UTC time when the current process started.
@@ -464,10 +434,7 @@
/// without the process start time being reset.
/// </para>
/// </remarks>
- public static DateTime StartTimeUtc
- {
- get { return SystemInfo.ProcessStartTimeUtc; }
- }
+ public static DateTime StartTimeUtc => SystemInfo.ProcessStartTimeUtc;
/// <summary>
/// Gets the <see cref="Level" /> of the logging event.
@@ -480,10 +447,7 @@
/// Gets the <see cref="Level" /> of the logging event.
/// </para>
/// </remarks>
- public Level Level
- {
- get { return m_data.Level; }
- }
+ public Level? Level => m_data.Level;
/// <summary>
/// Gets the time of the logging event.
@@ -496,10 +460,7 @@
/// The TimeStamp is stored in UTC and converted to the local time zone for this computer.
/// </para>
/// </remarks>
- public DateTime TimeStamp
- {
- get { return m_data.TimeStampUtc.ToLocalTime(); }
- }
+ public DateTime TimeStamp => m_data.TimeStampUtc.ToLocalTime();
/// <summary>
/// Gets UTC the time of the logging event.
@@ -507,10 +468,7 @@
/// <value>
/// The UTC time of the logging event.
/// </value>
- public DateTime TimeStampUtc
- {
- get { return m_data.TimeStampUtc; }
- }
+ public DateTime TimeStampUtc => m_data.TimeStampUtc;
/// <summary>
/// Gets the name of the logger that logged the event.
@@ -523,10 +481,7 @@
/// Gets the name of the logger that logged the event.
/// </para>
/// </remarks>
- public string LoggerName
- {
- get { return m_data.LoggerName; }
- }
+ public string? LoggerName => m_data.LoggerName;
/// <summary>
/// Gets the location information for this logging event.
@@ -544,11 +499,11 @@
/// Release builds.
/// </para>
/// </remarks>
- public LocationInfo LocationInformation
+ public LocationInfo? LocationInformation
{
get
{
- if (m_data.LocationInfo == null && this.m_cacheUpdatable)
+ if (m_data.LocationInfo is null && m_cacheUpdatable)
{
m_data.LocationInfo = new LocationInfo(m_callerStackBoundaryDeclaringType);
}
@@ -577,7 +532,7 @@
/// null will be returned.
/// </para>
/// </remarks>
- public object MessageObject
+ public object? MessageObject
{
get { return m_message; }
protected set { m_message = value; }
@@ -603,10 +558,7 @@
/// null will be returned.
/// </para>
/// </remarks>
- public Exception ExceptionObject
- {
- get { return m_thrownException; }
- }
+ public Exception? ExceptionObject { get; }
/// <summary>
/// The <see cref="ILoggerRepository"/> that this event was created in.
@@ -616,20 +568,17 @@
/// The <see cref="ILoggerRepository"/> that this event was created in.
/// </para>
/// </remarks>
- public ILoggerRepository Repository
- {
- get { return m_repository; }
- }
+ public ILoggerRepository? Repository { get; private set; }
/// <summary>
/// Ensure that the repository is set.
/// </summary>
/// <param name="repository">the value for the repository</param>
- internal void EnsureRepository(ILoggerRepository repository)
+ internal void EnsureRepository(ILoggerRepository? repository)
{
- if (repository != null)
+ if (repository is not null)
{
- m_repository = repository;
+ Repository = repository;
}
}
@@ -644,23 +593,23 @@
/// The collected information is cached for future use.
/// </para>
/// </remarks>
- public virtual string RenderedMessage
+ public virtual string? RenderedMessage
{
get
{
- if (m_data.Message == null && this.m_cacheUpdatable)
+ if (m_data.Message is null && m_cacheUpdatable)
{
if (m_message == null)
{
- m_data.Message = "";
+ m_data.Message = string.Empty;
}
- else if (m_message is string)
+ else if (m_message is string s)
{
- m_data.Message = (m_message as string);
+ m_data.Message = s;
}
- else if (m_repository != null)
+ else if (Repository is not null)
{
- m_data.Message = m_repository.RendererMap.FindAndRender(m_message);
+ m_data.Message = Repository.RendererMap.FindAndRender(m_message);
}
else
{
@@ -688,21 +637,21 @@
/// </remarks>
public virtual void WriteRenderedMessage(TextWriter writer)
{
- if (m_data.Message != null)
+ if (m_data.Message is not null)
{
writer.Write(m_data.Message);
}
else
{
- if (m_message != null)
+ if (m_message is not null)
{
- if (m_message is string)
+ if (m_message is string s)
{
- writer.Write(m_message as string);
+ writer.Write(s);
}
- else if (m_repository != null)
+ else if (Repository is not null)
{
- m_repository.RendererMap.FindAndRender(m_message, writer);
+ Repository.RendererMap.FindAndRender(m_message, writer);
}
else
{
@@ -725,21 +674,16 @@
/// The collected information is cached for future use.
/// </para>
/// </remarks>
- public string ThreadName
+ public string? ThreadName
{
get
{
- if (m_data.ThreadName == null && this.m_cacheUpdatable)
+ if (m_data.ThreadName == null && m_cacheUpdatable)
{
-#if NETCF
- // Get thread ID only
- m_data.ThreadName =
- SystemInfo.CurrentThreadId.ToString(System.Globalization.NumberFormatInfo.InvariantInfo);
-#else
// '.NET ThreadPool Worker' appears as a default thread name in the .NET 6-7 thread pool.
// '.NET TP Worker' is the default thread name in the .NET 8+ thread pool.
// Prefer the numeric thread ID instead.
- string threadName = System.Threading.Thread.CurrentThread.Name;
+ string threadName = Thread.CurrentThread.Name;
if (!string.IsNullOrEmpty(threadName) && threadName != ".NET TP Worker" && threadName != ".NET ThreadPool Worker")
{
m_data.ThreadName = threadName;
@@ -751,9 +695,7 @@
// current thread. (Why don't Threads know their own ID?)
try
{
- m_data.ThreadName =
- SystemInfo.CurrentThreadId.ToString(System.Globalization.NumberFormatInfo
- .InvariantInfo);
+ m_data.ThreadName = SystemInfo.CurrentThreadId.ToString(NumberFormatInfo.InvariantInfo);
}
catch (SecurityException)
{
@@ -763,11 +705,9 @@
"Security exception while trying to get current thread ID. Error Ignored. Empty thread name.");
// As a last resort use the hash code of the Thread object
- m_data.ThreadName = System.Threading.Thread.CurrentThread.GetHashCode()
- .ToString(System.Globalization.CultureInfo.InvariantCulture);
+ m_data.ThreadName = Thread.CurrentThread.GetHashCode().ToString(CultureInfo.InvariantCulture);
}
}
-#endif
}
return m_data.ThreadName;
@@ -824,12 +764,8 @@
public string UserName =>
m_data.UserName ??= TryGetCurrentUserName() ?? SystemInfo.NotAvailableText;
- private string TryGetCurrentUserName()
+ private string? TryGetCurrentUserName()
{
-#if (NETCF || SSCLI || NETSTANDARD1_3)
- // On compact framework there's no notion of current Windows user
- return SystemInfo.NotAvailableText;
-#else
if (_platformDoesNotSupportWindowsIdentity)
{
// we've already received one PlatformNotSupportedException
@@ -861,79 +797,62 @@
{
return null;
}
-#endif
}
-#if (NETCF || SSCLI || NETSTANDARD1_3)
-#else
- private string _cachedWindowsIdentityUserName;
+ private string? _cachedWindowsIdentityUserName;
private static string TryReadWindowsIdentityUserName()
{
using var identity = WindowsIdentity.GetCurrent();
- return identity?.Name ?? "";
+ return identity?.Name ?? string.Empty;
}
-#endif
-#if (NETCF || SSCLI || NETSTANDARD1_3)
-#else
private static bool _platformDoesNotSupportWindowsIdentity;
-#endif
/// <summary>
/// Gets the identity of the current thread principal.
/// </summary>
- /// <value>
- /// The string name of the identity of the current thread principal.
- /// </value>
/// <remarks>
/// <para>
/// Calls <c>System.Threading.Thread.CurrentPrincipal.Identity.Name</c> to get
/// the name of the current thread principal.
/// </para>
/// </remarks>
- public string Identity
+ public string? Identity
{
get
{
- if (m_data.Identity == null && this.m_cacheUpdatable)
+ if (m_data.Identity is null && m_cacheUpdatable)
{
-#if (NETCF || SSCLI || NETSTANDARD1_3)
- // On compact framework there's no notion of current thread principals
- m_data.Identity = SystemInfo.NotAvailableText;
-#else
try
{
- if (System.Threading.Thread.CurrentPrincipal != null &&
- System.Threading.Thread.CurrentPrincipal.Identity != null &&
- System.Threading.Thread.CurrentPrincipal.Identity.Name != null)
+ if (Thread.CurrentPrincipal?.Identity?.Name is string name)
{
- m_data.Identity = System.Threading.Thread.CurrentPrincipal.Identity.Name;
+ m_data.Identity = name;
}
else
{
- m_data.Identity = "";
+ m_data.Identity = string.Empty;
}
}
catch (ObjectDisposedException)
{
- // This exception will occur if System.Threading.Thread.CurrentPrincipal.Identity is not null but
+ // This exception will occur if Thread.CurrentPrincipal.Identity is not null but
// the getter of the property Name tries to access disposed objects.
// Seen to happen on IIS 7 or greater with windows authentication.
LogLog.Debug(declaringType,
"Object disposed exception while trying to get current thread principal. Error Ignored. Empty identity name.");
- m_data.Identity = "";
+ m_data.Identity = string.Empty;
}
- catch (System.Security.SecurityException)
+ catch (SecurityException)
{
// This security exception will occur if the caller does not have
// some undefined set of SecurityPermission flags.
LogLog.Debug(declaringType,
"Security exception while trying to get current thread principal. Error Ignored. Empty identity name.");
- m_data.Identity = "";
+ m_data.Identity = string.Empty;
}
-#endif
}
return m_data.Identity;
@@ -943,19 +862,11 @@
/// <summary>
/// Gets the AppDomain friendly name.
/// </summary>
- /// <value>
- /// The AppDomain friendly name.
- /// </value>
- /// <remarks>
- /// <para>
- /// Gets the AppDomain friendly name.
- /// </para>
- /// </remarks>
- public string Domain
+ public string? Domain
{
get
{
- if (m_data.Domain == null && this.m_cacheUpdatable)
+ if (m_data.Domain is null && m_cacheUpdatable)
{
m_data.Domain = SystemInfo.ApplicationFriendlyName;
}
@@ -995,16 +906,12 @@
get
{
// If we have cached properties then return that otherwise changes will be lost
- if (m_data.Properties != null)
+ if (m_data.Properties is not null)
{
return m_data.Properties;
}
- if (m_eventProperties == null)
- {
- m_eventProperties = new PropertiesDictionary();
- }
-
+ m_eventProperties ??= new PropertiesDictionary();
return m_eventProperties;
}
}
@@ -1012,9 +919,6 @@
/// <summary>
/// The fixed fields in this event
/// </summary>
- /// <value>
- /// The set of fields that are fixed in this event
- /// </value>
/// <remarks>
/// <para>
/// Fields will not be fixed if they have previously been fixed.
@@ -1023,16 +927,10 @@
/// </remarks>
public FixFlags Fix
{
- get { return m_fixFlags; }
- set { this.FixVolatileData(value); }
+ get => m_fixFlags;
+ set => FixVolatileData(value);
}
- #endregion Public Instance Properties
-
- #region Implementation of ISerializable
-
-#if !NETCF
-
/// <summary>
/// Serializes this object into the <see cref="SerializationInfo" /> provided.
/// </summary>
@@ -1048,13 +946,9 @@
/// is to be used outside that method.
/// </para>
/// </remarks>
-#if NET_4_0 || MONO_4_0 || NETSTANDARD
- [System.Security.SecurityCritical]
-#endif
-#if !NETCF && !NETSTANDARD1_3
+ [SecurityCritical]
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand,
SerializationFormatter = true)]
-#endif
public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
{
// The caller must call FixVolatileData before this object
@@ -1078,12 +972,6 @@
info.AddValue("Identity", m_data.Identity);
}
-#endif
-
- #endregion Implementation of ISerializable
-
- #region Public Instance Methods
-
/// <summary>
/// Gets the portable data for this <see cref="LoggingEvent" />.
/// </summary>
@@ -1133,7 +1021,7 @@
/// </para>
/// </remarks>
[Obsolete("Use GetExceptionString instead")]
- public string GetExceptionStrRep()
+ public string? GetExceptionStrRep()
{
return GetExceptionString();
}
@@ -1151,26 +1039,26 @@
/// <see cref="ILoggerRepository.RendererMap" />.
/// </para>
/// </remarks>
- public string GetExceptionString()
+ public string? GetExceptionString()
{
- if (m_data.ExceptionString == null && this.m_cacheUpdatable)
+ if (m_data.ExceptionString is null && m_cacheUpdatable)
{
- if (m_thrownException != null)
+ if (ExceptionObject is not null)
{
- if (m_repository != null)
+ if (Repository is not null)
{
// Render exception using the repositories renderer map
- m_data.ExceptionString = m_repository.RendererMap.FindAndRender(m_thrownException);
+ m_data.ExceptionString = Repository.RendererMap.FindAndRender(ExceptionObject);
}
else
{
// Very last resort
- m_data.ExceptionString = m_thrownException.ToString();
+ m_data.ExceptionString = ExceptionObject.ToString();
}
}
else
{
- m_data.ExceptionString = "";
+ m_data.ExceptionString = string.Empty;
}
}
@@ -1185,11 +1073,11 @@
/// Some of the values in instances of <see cref="LoggingEvent"/>
/// are considered volatile, that is the values are correct at the
/// time the event is delivered to appenders, but will not be consistent
- /// at any time afterwards. If an event is to be stored and then processed
+ /// at any time afterward. If an event is to be stored and then processed
/// at a later time these volatile values must be fixed by calling
/// <see cref="M:FixVolatileData()"/>. There is a performance penalty
/// incurred by calling <see cref="M:FixVolatileData()"/> but it
- /// is essential to maintaining data consistency.
+ /// is essential to maintain data consistency.
/// </para>
/// <para>
/// Calling <see cref="M:FixVolatileData()"/> is equivalent to
@@ -1216,11 +1104,11 @@
/// Some of the values in instances of <see cref="LoggingEvent"/>
/// are considered volatile, that is the values are correct at the
/// time the event is delivered to appenders, but will not be consistent
- /// at any time afterwards. If an event is to be stored and then processed
+ /// at any time afterward. If an event is to be stored and then processed
/// at a later time these volatile values must be fixed by calling
/// <see cref="M:FixVolatileData()"/>. There is a performance penalty
/// for incurred by calling <see cref="M:FixVolatileData()"/> but it
- /// is essential to maintaining data consistency.
+ /// is essential to maintain data consistency.
/// </para>
/// <para>
/// The <paramref name="fastButLoose"/> param controls the data that
@@ -1261,22 +1149,20 @@
/// </remarks>
protected virtual void FixVolatileData(FixFlags flags)
{
- object forceCreation = null;
-
- //Unlock the cache so that new values can be stored
- //This may not be ideal if we are no longer in the correct context
- //and someone calls fix.
+ // Unlock the cache so that new values can be stored
+ // This may not be ideal if we are no longer in the correct context
+ // and someone calls fix.
m_cacheUpdatable = true;
// determine the flags that we are actually fixing
- var updateFlags = (FixFlags)((flags ^ m_fixFlags) & flags);
+ FixFlags updateFlags = (flags ^ m_fixFlags) & flags;
if (updateFlags > 0)
{
if ((updateFlags & FixFlags.Message) != 0)
{
// Force the message to be rendered
- forceCreation = this.RenderedMessage;
+ _ = RenderedMessage;
m_fixFlags |= FixFlags.Message;
}
@@ -1284,7 +1170,7 @@
if ((updateFlags & FixFlags.ThreadName) != 0)
{
// Grab the thread name
- forceCreation = this.ThreadName;
+ _ = ThreadName;
m_fixFlags |= FixFlags.ThreadName;
}
@@ -1292,7 +1178,7 @@
if ((updateFlags & FixFlags.LocationInfo) != 0)
{
// Force the location information to be loaded
- forceCreation = this.LocationInformation;
+ _ = LocationInformation;
m_fixFlags |= FixFlags.LocationInfo;
}
@@ -1300,7 +1186,7 @@
if ((updateFlags & FixFlags.UserName) != 0)
{
// Grab the user name
- forceCreation = this.UserName;
+ _ = UserName;
m_fixFlags |= FixFlags.UserName;
}
@@ -1308,7 +1194,7 @@
if ((updateFlags & FixFlags.Domain) != 0)
{
// Grab the domain name
- forceCreation = this.Domain;
+ _ = Domain;
m_fixFlags |= FixFlags.Domain;
}
@@ -1316,7 +1202,7 @@
if ((updateFlags & FixFlags.Identity) != 0)
{
// Grab the identity
- forceCreation = this.Identity;
+ _ = Identity;
m_fixFlags |= FixFlags.Identity;
}
@@ -1324,7 +1210,7 @@
if ((updateFlags & FixFlags.Exception) != 0)
{
// Force the exception text to be loaded
- forceCreation = GetExceptionString();
+ _ = GetExceptionString();
m_fixFlags |= FixFlags.Exception;
}
@@ -1337,36 +1223,24 @@
}
}
- // avoid warning CS0219
- if (forceCreation != null)
- {
- }
-
- //Finaly lock everything we've cached.
+ // Finally lock everything we've cached.
m_cacheUpdatable = false;
}
- #endregion Public Instance Methods
-
- #region Protected Instance Methods
-
private void CreateCompositeProperties()
{
var compositeProperties = new CompositeProperties();
- if (m_eventProperties != null)
+ if (m_eventProperties is not null)
{
compositeProperties.Add(m_eventProperties);
}
-#if !NETCF
var logicalThreadProperties = LogicalThreadContext.Properties.GetProperties(false);
- if (logicalThreadProperties != null)
+ if (logicalThreadProperties is not null)
{
compositeProperties.Add(logicalThreadProperties);
}
-#endif
- var threadProperties = ThreadContext.Properties.GetProperties(false);
- if (threadProperties != null)
+ if (ThreadContext.Properties.GetProperties(false) is PropertiesDictionary threadProperties)
{
compositeProperties.Add(threadProperties);
}
@@ -1398,38 +1272,32 @@
private void CacheProperties()
{
- if (m_data.Properties == null && this.m_cacheUpdatable)
+ if (m_data.Properties is null && m_cacheUpdatable)
{
- if (m_compositeProperties == null)
+ if (m_compositeProperties is null)
{
CreateCompositeProperties();
}
- var flattenedProperties = m_compositeProperties.Flatten();
+ var flattenedProperties = m_compositeProperties!.Flatten();
var fixedProperties = new PropertiesDictionary();
// Validate properties
- foreach (DictionaryEntry entry in flattenedProperties)
+ foreach (KeyValuePair<string, object?> entry in flattenedProperties)
{
- var key = entry.Key as string;
+ object? val = entry.Value;
- if (key != null)
+ // Fix any IFixingRequired objects
+ if (entry.Value is IFixingRequired fixingRequired)
{
- var val = entry.Value;
+ val = fixingRequired.GetFixedObject();
+ }
- // Fix any IFixingRequired objects
- var fixingRequired = val as IFixingRequired;
- if (fixingRequired != null)
- {
- val = fixingRequired.GetFixedObject();
- }
-
- // Strip keys with null values
- if (val != null)
- {
- fixedProperties[key] = val;
- }
+ // Strip keys with null values
+ if (val is not null)
+ {
+ fixedProperties[entry.Key] = val;
}
}
@@ -1438,17 +1306,17 @@
}
/// <summary>
- /// Lookup a composite property in this event
+ /// Looks up a composite property in this event
/// </summary>
/// <param name="key">the key for the property to lookup</param>
/// <returns>the value for the property</returns>
/// <remarks>
/// <para>
- /// This event has composite properties that combine together properties from
+ /// This event has composite properties that combine properties from
/// several different contexts in the following order:
/// <list type="definition">
/// <item>
- /// <term>this events properties</term>
+ /// <term>this event's properties</term>
/// <description>
/// This event has <see cref="Properties"/> that can be set. These
/// properties are specific to this event only.
@@ -1471,19 +1339,19 @@
/// </list>
/// </para>
/// </remarks>
- public object LookupProperty(string key)
+ public object? LookupProperty(string key)
{
- if (m_data.Properties != null)
+ if (m_data.Properties is not null)
{
return m_data.Properties[key];
}
- if (m_compositeProperties == null)
+ if (m_compositeProperties is null)
{
CreateCompositeProperties();
}
- return m_compositeProperties[key];
+ return m_compositeProperties![key];
}
/// <summary>
@@ -1512,55 +1380,39 @@
CreateCompositeProperties();
}
- return m_compositeProperties.Flatten();
+ return m_compositeProperties!.Flatten();
}
- #endregion Public Instance Methods
-
- #region Private Instance Fields
-
/// <summary>
/// The internal logging event data.
/// </summary>
private LoggingEventData m_data;
/// <summary>
- /// The internal logging event data.
+ /// Location information for the caller.
/// </summary>
- private CompositeProperties m_compositeProperties;
+ public LocationInfo? LocationInfo => m_data.LocationInfo;
/// <summary>
/// The internal logging event data.
/// </summary>
- private PropertiesDictionary m_eventProperties;
+ private CompositeProperties? m_compositeProperties;
+
+ /// <summary>
+ /// The internal logging event data.
+ /// </summary>
+ private PropertiesDictionary? m_eventProperties;
/// <summary>
/// The fully qualified Type of the calling
/// logger class in the stack frame (i.e. the declaring type of the method).
/// </summary>
- private readonly Type m_callerStackBoundaryDeclaringType;
+ private readonly Type? m_callerStackBoundaryDeclaringType;
/// <summary>
/// The application supplied message of logging event.
/// </summary>
- private object m_message;
-
- /// <summary>
- /// The exception that was thrown.
- /// </summary>
- /// <remarks>
- /// This is not serialized. The string representation
- /// is serialized instead.
- /// </remarks>
- private readonly Exception m_thrownException;
-
- /// <summary>
- /// The repository that generated the logging event
- /// </summary>
- /// <remarks>
- /// This is not serialized.
- /// </remarks>
- private ILoggerRepository m_repository = null;
+ private object? m_message;
/// <summary>
/// The fix state for this event
@@ -1575,15 +1427,11 @@
/// Indicated that the internal cache is updateable (ie not fixed)
/// </summary>
/// <remarks>
- /// This is a seperate flag to m_fixFlags as it allows incrementel fixing and simpler
+ /// This is a separate flag to m_fixFlags as it allows incremental fixing and simpler
/// changes in the caching strategy.
/// </remarks>
private bool m_cacheUpdatable = true;
- #endregion Private Instance Fields
-
- #region Constants
-
/// <summary>
/// The key into the Properties map for the host name value.
/// </summary>
@@ -1598,7 +1446,5 @@
/// The key into the Properties map for the user name value.
/// </summary>
public const string UserNameProperty = "log4net:UserName";
-
- #endregion
}
}
\ No newline at end of file
diff --git a/src/log4net/Core/MethodItem.cs b/src/log4net/Core/MethodItem.cs
index 113cd37..5e8314b 100644
--- a/src/log4net/Core/MethodItem.cs
+++ b/src/log4net/Core/MethodItem.cs
@@ -16,9 +16,9 @@
// limitations under the License.
//
#endregion
-using System;
-using System.Collections;
+using System;
+using System.Collections.Generic;
using log4net.Util;
namespace log4net.Core
@@ -28,20 +28,16 @@
/// as that would require that the containing assembly is loaded.
/// </summary>
///
-#if !NETCF
[Serializable]
-#endif
public class MethodItem
{
- #region Public Instance Constructors
-
/// <summary>
/// constructs a method item for an unknown method.
/// </summary>
public MethodItem()
{
- m_name = NA;
- m_parameters = new string[0];
+ Name = NA;
+ Parameters = Array.Empty<string>();
}
/// <summary>
@@ -51,7 +47,7 @@
public MethodItem(string name)
: this()
{
- m_name = name;
+ Name = name;
}
/// <summary>
@@ -62,7 +58,7 @@
public MethodItem(string name, string[] parameters)
: this(name)
{
- m_parameters = parameters;
+ Parameters = parameters;
}
/// <summary>
@@ -74,11 +70,9 @@
{
}
- #endregion
-
private static string[] GetMethodParameterNames(System.Reflection.MethodBase methodBase)
{
- ArrayList methodParameterNames = new ArrayList();
+ var methodParameterNames = new List<string>();
try
{
System.Reflection.ParameterInfo[] methodBaseGetParameters = methodBase.GetParameters();
@@ -95,11 +89,9 @@
LogLog.Error(declaringType, "An exception ocurred while retreiving method parameters.", ex);
}
- return (string[])methodParameterNames.ToArray(typeof(string));
+ return methodParameterNames.ToArray();
}
- #region Public Instance Properties
-
/// <summary>
/// Gets the method name of the caller making the logging
/// request.
@@ -114,10 +106,7 @@
/// request.
/// </para>
/// </remarks>
- public string Name
- {
- get { return m_name; }
- }
+ public string Name { get; }
/// <summary>
/// Gets the method parameters of the caller making
@@ -133,21 +122,7 @@
/// the logging request.
/// </para>
/// </remarks>
- public string[] Parameters
- {
- get { return m_parameters; }
- }
-
- #endregion
-
- #region Private Instance Fields
-
- private readonly string m_name;
- private readonly string[] m_parameters;
-
- #endregion
-
- #region Private Static Fields
+ public string[] Parameters { get; }
/// <summary>
/// The fully qualified type of the StackFrameItem class.
@@ -164,7 +139,5 @@
/// constant is <b>?</b>.
/// </summary>
private const string NA = "?";
-
- #endregion Private Static Fields
}
}
diff --git a/src/log4net/Core/StackFrameItem.cs b/src/log4net/Core/StackFrameItem.cs
index abad979..fee7303 100644
--- a/src/log4net/Core/StackFrameItem.cs
+++ b/src/log4net/Core/StackFrameItem.cs
@@ -1,4 +1,3 @@
-#if !NETCF
#region Apache License
//
// Licensed to the Apache Software Foundation (ASF) under one or more
@@ -17,6 +16,7 @@
// limitations under the License.
//
#endregion
+
using System;
using System.Diagnostics;
using System.Reflection;
@@ -25,40 +25,39 @@
namespace log4net.Core
{
/// <summary>
- /// provides stack frame information without actually referencing a System.Diagnostics.StackFrame
+ /// Provides stack frame information without actually referencing a System.Diagnostics.StackFrame
/// as that would require that the containing assembly is loaded.
/// </summary>
- ///
[Serializable]
public class StackFrameItem
{
- #region Public Instance Constructors
-
/// <summary>
- /// returns a stack frame item from a stack frame. This
+ /// Creates a stack frame item from a stack frame.
/// </summary>
/// <param name="frame"></param>
- /// <returns></returns>
public StackFrameItem(StackFrame frame)
{
// set default values
- m_lineNumber = NA;
- m_fileName = NA;
- m_method = new MethodItem();
- m_className = NA;
+ LineNumber = NA;
+ FileName = NA;
+ Method = new MethodItem();
+ ClassName = NA;
try
{
// get frame values
- m_lineNumber = frame.GetFileLineNumber().ToString(System.Globalization.NumberFormatInfo.InvariantInfo);
- m_fileName = frame.GetFileName();
+ LineNumber = frame.GetFileLineNumber().ToString(System.Globalization.NumberFormatInfo.InvariantInfo);
+ FileName = frame.GetFileName();
+
// get method values
- MethodBase method = frame.GetMethod();
- if (method != null)
+ if (frame.GetMethod() is MethodBase method)
{
- if (method.DeclaringType != null)
- m_className = method.DeclaringType.FullName;
- m_method = new MethodItem(method);
+ if (method.DeclaringType?.FullName is string className)
+ {
+ ClassName = className;
+ }
+
+ Method = new MethodItem(method);
}
}
catch (Exception ex)
@@ -67,111 +66,35 @@
}
// set full info
- m_fullInfo = m_className + '.' + m_method.Name + '(' + m_fileName + ':' + m_lineNumber + ')';
+ FullInfo = $"{ClassName}.{Method.Name}({FileName}:{LineNumber})";
}
- #endregion
-
- #region Public Instance Properties
-
/// <summary>
/// Gets the fully qualified class name of the caller making the logging
/// request.
/// </summary>
- /// <value>
- /// The fully qualified class name of the caller making the logging
- /// request.
- /// </value>
- /// <remarks>
- /// <para>
- /// Gets the fully qualified class name of the caller making the logging
- /// request.
- /// </para>
- /// </remarks>
- public string ClassName
- {
- get { return m_className; }
- }
+ public string ClassName { get; }
/// <summary>
/// Gets the file name of the caller.
/// </summary>
- /// <value>
- /// The file name of the caller.
- /// </value>
- /// <remarks>
- /// <para>
- /// Gets the file name of the caller.
- /// </para>
- /// </remarks>
- public string FileName
- {
- get { return m_fileName; }
- }
+ public string FileName { get; }
/// <summary>
/// Gets the line number of the caller.
/// </summary>
- /// <value>
- /// The line number of the caller.
- /// </value>
- /// <remarks>
- /// <para>
- /// Gets the line number of the caller.
- /// </para>
- /// </remarks>
- public string LineNumber
- {
- get { return m_lineNumber; }
- }
+ public string LineNumber { get; }
/// <summary>
/// Gets the method name of the caller.
/// </summary>
- /// <value>
- /// The method name of the caller.
- /// </value>
- /// <remarks>
- /// <para>
- /// Gets the method name of the caller.
- /// </para>
- /// </remarks>
- public MethodItem Method
- {
- get { return m_method; }
- }
+ public MethodItem Method { get; }
/// <summary>
- /// Gets all available caller information
+ /// Gets all available caller information in the format
+ /// <c>fully.qualified.classname.of.caller.methodName(Filename:line)</c>
/// </summary>
- /// <value>
- /// All available caller information, in the format
- /// <c>fully.qualified.classname.of.caller.methodName(Filename:line)</c>
- /// </value>
- /// <remarks>
- /// <para>
- /// Gets all available caller information, in the format
- /// <c>fully.qualified.classname.of.caller.methodName(Filename:line)</c>
- /// </para>
- /// </remarks>
- public string FullInfo
- {
- get { return m_fullInfo; }
- }
-
- #endregion Public Instance Properties
-
- #region Private Instance Fields
-
- private readonly string m_lineNumber;
- private readonly string m_fileName;
- private readonly string m_className;
- private readonly string m_fullInfo;
- private readonly MethodItem m_method;
-
- #endregion
-
- #region Private Static Fields
+ public string FullInfo { get; }
/// <summary>
/// The fully qualified type of the StackFrameItem class.
@@ -188,8 +111,5 @@
/// constant is <b>?</b>.
/// </summary>
private const string NA = "?";
-
- #endregion Private Static Fields
}
-}
-#endif
+}
\ No newline at end of file
diff --git a/src/log4net/Core/WrapperMap.cs b/src/log4net/Core/WrapperMap.cs
index b2b30e5..16613ac 100644
--- a/src/log4net/Core/WrapperMap.cs
+++ b/src/log4net/Core/WrapperMap.cs
@@ -24,8 +24,6 @@
namespace log4net.Core
{
- #region WrapperCreationHandler
-
/// <summary>
/// Delegate used to handle creation of new wrappers.
/// </summary>
@@ -43,8 +41,6 @@
/// </remarks>
public delegate ILoggerWrapper WrapperCreationHandler(ILogger logger);
- #endregion WrapperCreationHandler
-
/// <summary>
/// Maps between logger objects and wrapper objects.
/// </summary>
@@ -52,7 +48,7 @@
/// <para>
/// This class maintains a mapping between <see cref="ILogger"/> objects and
/// <see cref="ILoggerWrapper"/> objects. Use the <see cref="GetWrapper"/> method to
- /// lookup the <see cref="ILoggerWrapper"/> for the specified <see cref="ILogger"/>.
+ /// look up the <see cref="ILoggerWrapper"/> for the specified <see cref="ILogger"/>.
/// </para>
/// <para>
/// New wrapper instances are created by the <see cref="CreateNewWrapperObject"/>
@@ -66,8 +62,6 @@
/// <author>Gert Driesen</author>
public class WrapperMap
{
- #region Public Instance Constructors
-
/// <summary>
/// Initializes a new instance of the <see cref="WrapperMap" />
/// </summary>
@@ -83,13 +77,9 @@
m_createWrapperHandler = createWrapperHandler;
// Create the delegates for the event callbacks
- m_shutdownHandler = new LoggerRepositoryShutdownEventHandler(ILoggerRepository_Shutdown);
+ m_shutdownHandler = ILoggerRepository_Shutdown;
}
- #endregion Public Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
/// Gets the wrapper object for the specified logger.
/// </summary>
@@ -99,41 +89,37 @@
/// If the logger is null then the corresponding wrapper is null.
/// </para>
/// <para>
- /// Looks up the wrapper it it has previously been requested and
+ /// Looks up the wrapper it has previously been requested and
/// returns it. If the wrapper has never been requested before then
/// the <see cref="CreateNewWrapperObject"/> virtual method is
/// called.
/// </para>
/// </remarks>
- public virtual ILoggerWrapper GetWrapper(ILogger logger)
+ public virtual ILoggerWrapper? GetWrapper(ILogger? logger)
{
// If the logger is null then the corresponding wrapper is null
- if (logger == null)
+ if (logger is null)
{
return null;
}
lock (this)
{
- // Lookup hierarchy in map.
- Hashtable wrappersMap = (Hashtable)m_repositories[logger.Repository];
-
- if (wrappersMap == null)
+ // Look up hierarchy in map.
+ Hashtable? wrappersMap = (Hashtable?)Repositories[logger.Repository];
+ if (wrappersMap is null)
{
// Hierarchy does not exist in map.
// Must register with hierarchy
-
wrappersMap = new Hashtable();
- m_repositories[logger.Repository] = wrappersMap;
+ Repositories[logger.Repository] = wrappersMap;
// Register for config reset & shutdown on repository
logger.Repository.ShutdownEvent += m_shutdownHandler;
}
// Look for the wrapper object in the map
- ILoggerWrapper wrapperObject = wrappersMap[logger] as ILoggerWrapper;
-
- if (wrapperObject == null)
+ if (wrappersMap[logger] is not ILoggerWrapper wrapperObject)
{
// No wrapper object exists for the specified logger
@@ -148,10 +134,6 @@
}
}
- #endregion Public Instance Properties
-
- #region Protected Instance Properties
-
/// <summary>
/// Gets the map of logger repositories.
/// </summary>
@@ -165,14 +147,7 @@
/// value being the corresponding <see cref="ILoggerWrapper"/>.
/// </para>
/// </remarks>
- protected Hashtable Repositories
- {
- get { return this.m_repositories; }
- }
-
- #endregion Protected Instance Properties
-
- #region Protected Instance Methods
+ protected Hashtable Repositories { get; } = new();
/// <summary>
/// Creates the wrapper object for the specified logger.
@@ -186,13 +161,9 @@
/// can be overridden in a subclass.
/// </para>
/// </remarks>
- protected virtual ILoggerWrapper CreateNewWrapperObject(ILogger logger)
+ protected virtual ILoggerWrapper? CreateNewWrapperObject(ILogger logger)
{
- if (m_createWrapperHandler != null)
- {
- return m_createWrapperHandler(logger);
- }
- return null;
+ return m_createWrapperHandler?.Invoke(logger);
}
/// <summary>
@@ -213,7 +184,7 @@
lock (this)
{
// Remove the repository from map
- m_repositories.Remove(repository);
+ Repositories.Remove(repository);
// Unhook events from the repository
repository.ShutdownEvent -= m_shutdownHandler;
@@ -227,33 +198,21 @@
/// <param name="e">The event args.</param>
private void ILoggerRepository_Shutdown(object sender, EventArgs e)
{
- ILoggerRepository repository = sender as ILoggerRepository;
- if (repository != null)
+ if (sender is ILoggerRepository repository)
{
// Remove all repository from map
RepositoryShutdown(repository);
}
}
- #endregion Protected Instance Methods
-
- #region Private Instance Variables
-
- /// <summary>
- /// Map of logger repositories to hashtables of ILogger to ILoggerWrapper mappings
- /// </summary>
- private readonly Hashtable m_repositories = new Hashtable();
-
/// <summary>
/// The handler to use to create the extension wrapper objects.
/// </summary>
- private readonly WrapperCreationHandler m_createWrapperHandler;
+ private readonly WrapperCreationHandler? m_createWrapperHandler;
/// <summary>
/// Internal reference to the delegate used to register for repository shutdown events.
/// </summary>
private readonly LoggerRepositoryShutdownEventHandler m_shutdownHandler;
-
- #endregion Private Instance Variables
}
}
diff --git a/src/log4net/DateFormatter/AbsoluteTimeDateFormatter.cs b/src/log4net/DateFormatter/AbsoluteTimeDateFormatter.cs
index d510c56..6b08bf8 100644
--- a/src/log4net/DateFormatter/AbsoluteTimeDateFormatter.cs
+++ b/src/log4net/DateFormatter/AbsoluteTimeDateFormatter.cs
@@ -18,7 +18,7 @@
#endregion
using System;
-using System.Collections;
+using System.Collections.Concurrent;
using System.IO;
using System.Text;
@@ -36,8 +36,6 @@
/// <author>Gert Driesen</author>
public class AbsoluteTimeDateFormatter : IDateFormatter
{
- #region Protected Instance Methods
-
/// <summary>
/// Renders the date into a string. Format is <c>"HH:mm:ss"</c>.
/// </summary>
@@ -58,16 +56,14 @@
{
buffer.Append('0');
}
- buffer.Append(hour);
- buffer.Append(':');
+ buffer.Append(hour).Append(':');
int mins = dateToFormat.Minute;
if (mins < 10)
{
buffer.Append('0');
}
- buffer.Append(mins);
- buffer.Append(':');
+ buffer.Append(mins).Append(':');
int secs = dateToFormat.Second;
if (secs < 10)
@@ -77,10 +73,6 @@
buffer.Append(secs);
}
- #endregion Protected Instance Methods
-
- #region Implementation of IDateFormatter
-
/// <summary>
/// Renders the date into a string. Format is "HH:mm:ss,fff".
/// </summary>
@@ -95,83 +87,52 @@
/// per second.
/// </para>
/// <para>
- /// Sub classes should override <see cref="FormatDateWithoutMillis"/>
+ /// Subclasses should override <see cref="FormatDateWithoutMillis"/>
/// rather than <see cref="FormatDate"/>.
/// </para>
/// </remarks>
public virtual void FormatDate(DateTime dateToFormat, TextWriter writer)
{
- lock (s_lastTimeStrings)
- {
- // Calculate the current time precise only to the second
- long currentTimeToTheSecond = (dateToFormat.Ticks - (dateToFormat.Ticks % TimeSpan.TicksPerSecond));
-
- string timeString = null;
- // Compare this time with the stored last time
- // If we are in the same second then append
- // the previously calculated time string
- if (s_lastTimeToTheSecond != currentTimeToTheSecond)
+ string timeString = s_lastTimeStrings.AddOrUpdate(GetType(),
+ _ => BuildTimeString(),
+ (_, existing) =>
{
- s_lastTimeStrings.Clear();
- }
- else
- {
- timeString = (string)s_lastTimeStrings[GetType()];
- }
+ // Calculate the current time precise only to the second
+ long currentTimeToTheSecond = (dateToFormat.Ticks - (dateToFormat.Ticks % TimeSpan.TicksPerSecond));
- if (timeString == null)
- {
- // lock so that only one thread can use the buffer and
- // update the s_lastTimeToTheSecond and s_lastTimeStrings
-
- // PERF: Try removing this lock and using a new StringBuilder each time
- lock (s_lastTimeBuf)
+ // Compare this time with the stored last time
+ // If we are in the same second then append
+ // the previously calculated time string
+ if (s_lastTimeToTheSecond == currentTimeToTheSecond)
{
- timeString = (string)s_lastTimeStrings[GetType()];
-
- if (timeString == null)
- {
- // We are in a new second.
- s_lastTimeBuf.Length = 0;
-
- // Calculate the new string for this second
- FormatDateWithoutMillis(dateToFormat, s_lastTimeBuf);
-
- // Render the string buffer to a string
- timeString = s_lastTimeBuf.ToString();
-
-#if NET_1_1
- // Ensure that the above string is written into the variable NOW on all threads.
- // This is only required on multiprocessor machines with weak memeory models
- System.Threading.Thread.MemoryBarrier();
-#endif
- // Store the time as a string (we only have to do this once per second)
- s_lastTimeStrings[GetType()] = timeString;
- s_lastTimeToTheSecond = currentTimeToTheSecond;
- }
+ return existing;
}
- }
- writer.Write(timeString);
+ s_lastTimeToTheSecond = currentTimeToTheSecond;
+ return BuildTimeString();
+ });
+ writer.Write(timeString);
- // Append the current millisecond info
- writer.Write(',');
- int millis = dateToFormat.Millisecond;
- if (millis < 100)
- {
- writer.Write('0');
- }
- if (millis < 10)
- {
- writer.Write('0');
- }
- writer.Write(millis);
+ // Append the current millisecond info
+ writer.Write(',');
+ int millis = dateToFormat.Millisecond;
+ if (millis < 100)
+ {
+ writer.Write('0');
+ }
+ if (millis < 10)
+ {
+ writer.Write('0');
+ }
+ writer.Write(millis);
+
+ string BuildTimeString()
+ {
+ var sb = new StringBuilder();
+ FormatDateWithoutMillis(dateToFormat, sb);
+ return sb.ToString();
}
}
- #endregion Implementation of IDateFormatter
-
- #region Public Static Fields
-
/// <summary>
/// String constant used to specify AbsoluteTimeDateFormat in layouts. Current value is <b>ABSOLUTE</b>.
/// </summary>
@@ -187,27 +148,15 @@
/// </summary>
public const string Iso8601TimeDateFormat = "ISO8601";
- #endregion Public Static Fields
-
- #region Private Static Fields
-
/// <summary>
/// Last stored time with precision up to the second.
/// </summary>
- private static long s_lastTimeToTheSecond = 0;
+ private static long s_lastTimeToTheSecond;
/// <summary>
/// Last stored time with precision up to the second, formatted
/// as a string.
/// </summary>
- private static StringBuilder s_lastTimeBuf = new StringBuilder();
-
- /// <summary>
- /// Last stored time with precision up to the second, formatted
- /// as a string.
- /// </summary>
- private static Hashtable s_lastTimeStrings = new Hashtable();
-
- #endregion Private Static Fields
+ private static readonly ConcurrentDictionary<Type, string> s_lastTimeStrings = new();
}
}
diff --git a/src/log4net/DateFormatter/DateTimeDateFormatter.cs b/src/log4net/DateFormatter/DateTimeDateFormatter.cs
index 4a9364b..3219334 100644
--- a/src/log4net/DateFormatter/DateTimeDateFormatter.cs
+++ b/src/log4net/DateFormatter/DateTimeDateFormatter.cs
@@ -38,25 +38,6 @@
/// <author>Angelika Schnagl</author>
public class DateTimeDateFormatter : AbsoluteTimeDateFormatter
{
- #region Public Instance Constructors
-
- /// <summary>
- /// Default constructor.
- /// </summary>
- /// <remarks>
- /// <para>
- /// Initializes a new instance of the <see cref="DateTimeDateFormatter" /> class.
- /// </para>
- /// </remarks>
- public DateTimeDateFormatter()
- {
- m_dateTimeFormatInfo = DateTimeFormatInfo.InvariantInfo;
- }
-
- #endregion Public Instance Constructors
-
- #region Override implementation of AbsoluteTimeDateFormatter
-
/// <summary>
/// Formats the date without the milliseconds part
/// </summary>
@@ -79,28 +60,13 @@
{
buffer.Append('0');
}
- buffer.Append(day);
- buffer.Append(' ');
-
- buffer.Append(m_dateTimeFormatInfo.GetAbbreviatedMonthName(dateToFormat.Month));
- buffer.Append(' ');
-
- buffer.Append(dateToFormat.Year);
- buffer.Append(' ');
+ buffer
+ .Append(day).Append(' ')
+ .Append(DateTimeFormatInfo.InvariantInfo.GetAbbreviatedMonthName(dateToFormat.Month)).Append(' ')
+ .Append(dateToFormat.Year).Append(' ');
// Append the 'HH:mm:ss'
base.FormatDateWithoutMillis(dateToFormat, buffer);
}
-
- #endregion Override implementation of AbsoluteTimeDateFormatter
-
- #region Private Instance Fields
-
- /// <summary>
- /// The format info for the invariant culture.
- /// </summary>
- private readonly DateTimeFormatInfo m_dateTimeFormatInfo;
-
- #endregion Private Instance Fields
}
}
diff --git a/src/log4net/DateFormatter/Iso8601DateFormatter.cs b/src/log4net/DateFormatter/Iso8601DateFormatter.cs
index a78dbb7..458c7ba 100644
--- a/src/log4net/DateFormatter/Iso8601DateFormatter.cs
+++ b/src/log4net/DateFormatter/Iso8601DateFormatter.cs
@@ -34,24 +34,6 @@
/// <author>Gert Driesen</author>
public class Iso8601DateFormatter : AbsoluteTimeDateFormatter
{
- #region Public Instance Constructors
-
- /// <summary>
- /// Default constructor
- /// </summary>
- /// <remarks>
- /// <para>
- /// Initializes a new instance of the <see cref="Iso8601DateFormatter" /> class.
- /// </para>
- /// </remarks>
- public Iso8601DateFormatter()
- {
- }
-
- #endregion Public Instance Constructors
-
- #region Override implementation of AbsoluteTimeDateFormatter
-
/// <summary>
/// Formats the date without the milliseconds part
/// </summary>
@@ -68,29 +50,24 @@
/// </remarks>
protected override void FormatDateWithoutMillis(DateTime dateToFormat, StringBuilder buffer)
{
- buffer.Append(dateToFormat.Year);
+ buffer.Append(dateToFormat.Year).Append('-');
- buffer.Append('-');
int month = dateToFormat.Month;
if (month < 10)
{
buffer.Append('0');
}
- buffer.Append(month);
- buffer.Append('-');
+ buffer.Append(month).Append('-');
int day = dateToFormat.Day;
if (day < 10)
{
buffer.Append('0');
}
- buffer.Append(day);
- buffer.Append(' ');
+ buffer.Append(day).Append(' ');
// Append the 'HH:mm:ss'
base.FormatDateWithoutMillis(dateToFormat, buffer);
}
-
- #endregion Override implementation of AbsoluteTimeDateFormatter
}
}
diff --git a/src/log4net/DateFormatter/SimpleDateFormatter.cs b/src/log4net/DateFormatter/SimpleDateFormatter.cs
index 05e5e86..25b8456 100644
--- a/src/log4net/DateFormatter/SimpleDateFormatter.cs
+++ b/src/log4net/DateFormatter/SimpleDateFormatter.cs
@@ -34,8 +34,6 @@
/// <author>Gert Driesen</author>
public class SimpleDateFormatter : IDateFormatter
{
- #region Public Instance Constructors
-
/// <summary>
/// Constructor
/// </summary>
@@ -55,10 +53,6 @@
m_formatString = format;
}
- #endregion Public Instance Constructors
-
- #region Implementation of IDateFormatter
-
/// <summary>
/// Formats the date using <see cref="M:DateTime.ToString(string, IFormatProvider)"/>.
/// </summary>
@@ -75,21 +69,6 @@
writer.Write(dateToFormat.ToString(m_formatString, System.Globalization.DateTimeFormatInfo.InvariantInfo));
}
- #endregion
-
- #region Private Instance Fields
-
- /// <summary>
- /// The format string used to format the <see cref="DateTime" />.
- /// </summary>
- /// <remarks>
- /// <para>
- /// The format string must be compatible with the options
- /// that can be supplied to <see cref="M:DateTime.ToString(string, IFormatProvider)"/>.
- /// </para>
- /// </remarks>
private readonly string m_formatString;
-
- #endregion Private Instance Fields
}
}
diff --git a/src/log4net/Filter/DenyAllFilter.cs b/src/log4net/Filter/DenyAllFilter.cs
index 562fbc1..3f766d2 100644
--- a/src/log4net/Filter/DenyAllFilter.cs
+++ b/src/log4net/Filter/DenyAllFilter.cs
@@ -17,8 +17,6 @@
//
#endregion
-using System;
-
using log4net.Core;
namespace log4net.Filter
@@ -38,21 +36,8 @@
/// <author>Gert Driesen</author>
public sealed class DenyAllFilter : FilterSkeleton
{
- #region Constructors
-
/// <summary>
- /// Default constructor
- /// </summary>
- public DenyAllFilter()
- {
- }
-
- #endregion
-
- #region Override implementation of FilterSkeleton
-
- /// <summary>
- /// Always returns the integer constant <see cref="FilterDecision.Deny"/>
+ /// Always returns <see cref="FilterDecision.Deny"/>.
/// </summary>
/// <param name="loggingEvent">the LoggingEvent to filter</param>
/// <returns>Always returns <see cref="FilterDecision.Deny"/></returns>
@@ -69,7 +54,5 @@
{
return FilterDecision.Deny;
}
-
- #endregion
}
}
diff --git a/src/log4net/Filter/FilterSkeleton.cs b/src/log4net/Filter/FilterSkeleton.cs
index 3bab116..f08e64a 100644
--- a/src/log4net/Filter/FilterSkeleton.cs
+++ b/src/log4net/Filter/FilterSkeleton.cs
@@ -17,7 +17,6 @@
//
#endregion
-using System;
using log4net.Core;
namespace log4net.Filter
@@ -68,22 +67,6 @@
/// <author>Gert Driesen</author>
public abstract class FilterSkeleton : IFilter
{
- #region Member Variables
-
- /// <summary>
- /// Points to the next filter in the filter chain.
- /// </summary>
- /// <remarks>
- /// <para>
- /// See <see cref="Next"/> for more information.
- /// </para>
- /// </remarks>
- private IFilter m_next;
-
- #endregion
-
- #region Implementation of IOptionHandler
-
/// <summary>
/// Initialize the filter with the options set
/// </summary>
@@ -108,10 +91,6 @@
{
}
- #endregion
-
- #region Implementation of IFilter
-
/// <summary>
/// Decide if the <see cref="LoggingEvent"/> should be logged through an appender.
/// </summary>
@@ -133,23 +112,14 @@
public abstract FilterDecision Decide(LoggingEvent loggingEvent);
/// <summary>
- /// Property to get and set the next filter
+ /// Gets or sets the next filter in the filter chain.
/// </summary>
- /// <value>
- /// The next filter in the chain
- /// </value>
/// <remarks>
/// <para>
/// Filters are typically composed into chains. This property allows the next filter in
/// the chain to be accessed.
/// </para>
/// </remarks>
- public IFilter Next
- {
- get { return m_next; }
- set { m_next = value; }
- }
-
- #endregion
+ public IFilter? Next { get; set; }
}
}
diff --git a/src/log4net/Filter/LevelMatchFilter.cs b/src/log4net/Filter/LevelMatchFilter.cs
index e257286..9ac6244 100644
--- a/src/log4net/Filter/LevelMatchFilter.cs
+++ b/src/log4net/Filter/LevelMatchFilter.cs
@@ -19,9 +19,7 @@
using System;
-using log4net;
using log4net.Core;
-using log4net.Util;
namespace log4net.Filter
{
@@ -44,31 +42,6 @@
/// <author>Gert Driesen</author>
public class LevelMatchFilter : FilterSkeleton
{
- #region Member Variables
-
- /// <summary>
- /// flag to indicate if the filter should <see cref="FilterDecision.Accept"/> on a match
- /// </summary>
- private bool m_acceptOnMatch = true;
-
- /// <summary>
- /// the <see cref="Level"/> to match against
- /// </summary>
- private Level m_levelToMatch;
-
- #endregion
-
- #region Constructors
-
- /// <summary>
- /// Default constructor
- /// </summary>
- public LevelMatchFilter()
- {
- }
-
- #endregion
-
/// <summary>
/// <see cref="FilterDecision.Accept"/> when matching <see cref="LevelToMatch"/>
/// </summary>
@@ -83,11 +56,7 @@
/// The default is <c>true</c> i.e. to <see cref="FilterDecision.Accept"/> the event.
/// </para>
/// </remarks>
- public bool AcceptOnMatch
- {
- get { return m_acceptOnMatch; }
- set { m_acceptOnMatch = value; }
- }
+ public bool AcceptOnMatch { get; set; } = true;
/// <summary>
/// The <see cref="Level"/> that the filter will match
@@ -99,13 +68,7 @@
/// the result depends on the value of <see cref="AcceptOnMatch"/>.
/// </para>
/// </remarks>
- public Level LevelToMatch
- {
- get { return m_levelToMatch; }
- set { m_levelToMatch = value; }
- }
-
- #region Override implementation of FilterSkeleton
+ public Level? LevelToMatch { get; set; }
/// <summary>
/// Tests if the <see cref="Level"/> of the logging event matches that of the filter
@@ -124,19 +87,17 @@
/// </remarks>
public override FilterDecision Decide(LoggingEvent loggingEvent)
{
- if (loggingEvent == null)
+ if (loggingEvent is null)
{
- throw new ArgumentNullException("loggingEvent");
+ throw new ArgumentNullException(nameof(loggingEvent));
}
- if (m_levelToMatch != null && m_levelToMatch == loggingEvent.Level)
+ if (LevelToMatch is not null && LevelToMatch == loggingEvent.Level)
{
// Found match
- return m_acceptOnMatch ? FilterDecision.Accept : FilterDecision.Deny;
+ return AcceptOnMatch ? FilterDecision.Accept : FilterDecision.Deny;
}
return FilterDecision.Neutral;
}
-
- #endregion
}
}
diff --git a/src/log4net/Filter/LevelRangeFilter.cs b/src/log4net/Filter/LevelRangeFilter.cs
index f29c7fa..cb5c61a 100644
--- a/src/log4net/Filter/LevelRangeFilter.cs
+++ b/src/log4net/Filter/LevelRangeFilter.cs
@@ -19,9 +19,7 @@
using System;
-using log4net;
using log4net.Core;
-using log4net.Util;
namespace log4net.Filter
{
@@ -43,36 +41,6 @@
/// <author>Gert Driesen</author>
public class LevelRangeFilter : FilterSkeleton
{
- #region Member Variables
-
- /// <summary>
- /// Flag to indicate the behavior when matching a <see cref="Level"/>
- /// </summary>
- private bool m_acceptOnMatch = true;
-
- /// <summary>
- /// the minimum <see cref="Level"/> value to match
- /// </summary>
- private Level m_levelMin;
-
- /// <summary>
- /// the maximum <see cref="Level"/> value to match
- /// </summary>
- private Level m_levelMax;
-
- #endregion
-
- #region Constructors
-
- /// <summary>
- /// Default constructor
- /// </summary>
- public LevelRangeFilter()
- {
- }
-
- #endregion
-
/// <summary>
/// <see cref="FilterDecision.Accept"/> when matching <see cref="LevelMin"/> and <see cref="LevelMax"/>
/// </summary>
@@ -87,11 +55,7 @@
/// The default is <c>true</c> i.e. to <see cref="FilterDecision.Accept"/> the event.
/// </para>
/// </remarks>
- public bool AcceptOnMatch
- {
- get { return m_acceptOnMatch; }
- set { m_acceptOnMatch = value; }
- }
+ public bool AcceptOnMatch { get; set; } = true;
/// <summary>
/// Set the minimum matched <see cref="Level"/>
@@ -103,11 +67,7 @@
/// the result depends on the value of <see cref="AcceptOnMatch"/>.
/// </para>
/// </remarks>
- public Level LevelMin
- {
- get { return m_levelMin; }
- set { m_levelMin = value; }
- }
+ public Level? LevelMin { get; set; }
/// <summary>
/// Sets the maximum matched <see cref="Level"/>
@@ -119,13 +79,7 @@
/// the result depends on the value of <see cref="AcceptOnMatch"/>.
/// </para>
/// </remarks>
- public Level LevelMax
- {
- get { return m_levelMax; }
- set { m_levelMax = value; }
- }
-
- #region Override implementation of FilterSkeleton
+ public Level? LevelMax { get; set; }
/// <summary>
/// Check if the event should be logged.
@@ -146,28 +100,28 @@
{
if (loggingEvent == null)
{
- throw new ArgumentNullException("loggingEvent");
+ throw new ArgumentNullException(nameof(loggingEvent));
}
- if (m_levelMin != null)
+ if (LevelMin is not null)
{
- if (loggingEvent.Level < m_levelMin)
+ if (loggingEvent.Level < LevelMin)
{
// level of event is less than minimum
return FilterDecision.Deny;
}
}
- if (m_levelMax != null)
+ if (LevelMax is not null)
{
- if (loggingEvent.Level > m_levelMax)
+ if (loggingEvent.Level > LevelMax)
{
// level of event is greater than maximum
return FilterDecision.Deny;
}
}
- if (m_acceptOnMatch)
+ if (AcceptOnMatch)
{
// this filter set up to bypass later filters and always return
// accept if level in range
@@ -179,7 +133,5 @@
return FilterDecision.Neutral;
}
}
-
- #endregion
}
}
diff --git a/src/log4net/Filter/LoggerMatchFilter.cs b/src/log4net/Filter/LoggerMatchFilter.cs
index 8f57744..dc44fc6 100644
--- a/src/log4net/Filter/LoggerMatchFilter.cs
+++ b/src/log4net/Filter/LoggerMatchFilter.cs
@@ -19,9 +19,7 @@
using System;
-using log4net;
using log4net.Core;
-using log4net.Util;
namespace log4net.Filter
{
@@ -42,33 +40,6 @@
/// <author>Daniel Cazzulino</author>
public class LoggerMatchFilter : FilterSkeleton
{
- #region Member Variables
-
- /// <summary>
- /// Flag to indicate the behavior when we have a match
- /// </summary>
- private bool m_acceptOnMatch = true;
-
- /// <summary>
- /// The logger name string to substring match against the event
- /// </summary>
- private string m_loggerToMatch;
-
- #endregion
-
- #region Constructors
-
- /// <summary>
- /// Default constructor
- /// </summary>
- public LoggerMatchFilter()
- {
- }
-
- #endregion
-
- #region Properties
-
/// <summary>
/// <see cref="FilterDecision.Accept"/> when matching <see cref="LoggerToMatch"/>
/// </summary>
@@ -83,11 +54,7 @@
/// The default is <c>true</c> i.e. to <see cref="FilterDecision.Accept"/> the event.
/// </para>
/// </remarks>
- public bool AcceptOnMatch
- {
- get { return m_acceptOnMatch; }
- set { m_acceptOnMatch = value; }
- }
+ public bool AcceptOnMatch { get; set; } = true;
/// <summary>
/// The <see cref="LoggingEvent.LoggerName"/> that the filter will match
@@ -101,15 +68,7 @@
/// the result depends on the value of <see cref="AcceptOnMatch"/>.
/// </para>
/// </remarks>
- public string LoggerToMatch
- {
- get { return m_loggerToMatch; }
- set { m_loggerToMatch = value; }
- }
-
- #endregion
-
- #region Override implementation of FilterSkeleton
+ public string? LoggerToMatch { get; set; }
/// <summary>
/// Check if this filter should allow the event to be logged
@@ -131,17 +90,17 @@
/// </remarks>
public override FilterDecision Decide(LoggingEvent loggingEvent)
{
- if (loggingEvent == null)
+ if (loggingEvent is null)
{
- throw new ArgumentNullException("loggingEvent");
+ throw new ArgumentNullException(nameof(loggingEvent));
}
// Check if we have been setup to filter
- if ((m_loggerToMatch != null && m_loggerToMatch.Length != 0) &&
- loggingEvent.LoggerName.StartsWith(m_loggerToMatch))
+ if (!string.IsNullOrEmpty(LoggerToMatch) &&
+ loggingEvent.LoggerName.StartsWith(LoggerToMatch))
{
// we've got a match
- if (m_acceptOnMatch)
+ if (AcceptOnMatch)
{
return FilterDecision.Accept;
}
@@ -154,7 +113,5 @@
return FilterDecision.Neutral;
}
}
-
- #endregion
}
}
diff --git a/src/log4net/Filter/NdcFilter.cs b/src/log4net/Filter/NdcFilter.cs
index 4b0a3e0..b7b1c87 100644
--- a/src/log4net/Filter/NdcFilter.cs
+++ b/src/log4net/Filter/NdcFilter.cs
@@ -17,13 +17,6 @@
//
#endregion
-using System;
-using System.Text.RegularExpressions;
-
-using log4net;
-using log4net.Core;
-using log4net.Util;
-
namespace log4net.Filter
{
/// <summary>
@@ -34,7 +27,7 @@
/// Simple filter to match a string in the <see cref="NDC"/>
/// </para>
/// <para>
- /// As the MDC has been replaced with named stacks stored in the
+ /// As the NDC has been replaced with named stacks stored in the
/// properties collections the <see cref="PropertyFilter"/> should
/// be used instead.
/// </para>
@@ -54,7 +47,7 @@
/// </remarks>
public NdcFilter()
{
- base.Key = "NDC";
+ Key = "NDC";
}
}
}
diff --git a/src/log4net/Filter/PropertyFilter.cs b/src/log4net/Filter/PropertyFilter.cs
index c443807..1888ba1 100644
--- a/src/log4net/Filter/PropertyFilter.cs
+++ b/src/log4net/Filter/PropertyFilter.cs
@@ -18,11 +18,8 @@
#endregion
using System;
-using System.Text.RegularExpressions;
-using log4net;
using log4net.Core;
-using log4net.Util;
namespace log4net.Filter
{
@@ -38,26 +35,6 @@
/// <author>Nicko Cadell</author>
public class PropertyFilter : StringMatchFilter
{
- #region Member Variables
-
- /// <summary>
- /// The key to use to lookup the string from the event properties
- /// </summary>
- private string m_key;
-
- #endregion
-
- #region Constructors
-
- /// <summary>
- /// Default constructor
- /// </summary>
- public PropertyFilter()
- {
- }
-
- #endregion
-
/// <summary>
/// The key to lookup in the event properties and then match against.
/// </summary>
@@ -68,13 +45,7 @@
/// the value of this property if it exists.
/// </para>
/// </remarks>
- public string Key
- {
- get { return m_key; }
- set { m_key = value; }
- }
-
- #region Override implementation of FilterSkeleton
+ public string? Key { get; set; }
/// <summary>
/// Check if this filter should allow the event to be logged
@@ -96,13 +67,13 @@
/// </remarks>
public override FilterDecision Decide(LoggingEvent loggingEvent)
{
- if (loggingEvent == null)
+ if (loggingEvent is null)
{
- throw new ArgumentNullException("loggingEvent");
+ throw new ArgumentNullException(nameof(loggingEvent));
}
// Check if we have a key to lookup the event property value with
- if (m_key == null)
+ if (Key is null)
{
// We cannot filter so allow the filter chain
// to continue processing
@@ -111,13 +82,13 @@
// Lookup the string to match in from the properties using
// the key specified.
- object msgObj = loggingEvent.LookupProperty(m_key);
+ object msgObj = loggingEvent.LookupProperty(Key);
// Use an ObjectRenderer to convert the property value to a string
- string msg = loggingEvent.Repository.RendererMap.FindAndRender(msgObj);
+ string? msg = loggingEvent.Repository.RendererMap.FindAndRender(msgObj);
// Check if we have been setup to filter
- if (msg == null || (m_stringToMatch == null && m_regexToMatch == null))
+ if (msg is null || (StringToMatch is null && m_regexToMatch is null))
{
// We cannot filter so allow the filter chain
// to continue processing
@@ -125,7 +96,7 @@
}
// Firstly check if we are matching using a regex
- if (m_regexToMatch != null)
+ if (m_regexToMatch is not null)
{
// Check the regex
if (m_regexToMatch.Match(msg).Success == false)
@@ -135,23 +106,23 @@
}
// we've got a match
- if (m_acceptOnMatch)
+ if (AcceptOnMatch)
{
return FilterDecision.Accept;
}
return FilterDecision.Deny;
}
- else if (m_stringToMatch != null)
+ else if (StringToMatch is not null)
{
// Check substring match
- if (msg.IndexOf(m_stringToMatch) == -1)
+ if (msg.IndexOf(StringToMatch) == -1)
{
// No match, continue processing
return FilterDecision.Neutral;
}
// we've got a match
- if (m_acceptOnMatch)
+ if (AcceptOnMatch)
{
return FilterDecision.Accept;
}
@@ -159,7 +130,5 @@
}
return FilterDecision.Neutral;
}
-
- #endregion
}
}
diff --git a/src/log4net/Filter/StringMatchFilter.cs b/src/log4net/Filter/StringMatchFilter.cs
index 0c4bb7e..c89a272 100644
--- a/src/log4net/Filter/StringMatchFilter.cs
+++ b/src/log4net/Filter/StringMatchFilter.cs
@@ -20,61 +20,22 @@
using System;
using System.Text.RegularExpressions;
-using log4net;
using log4net.Core;
-using log4net.Util;
namespace log4net.Filter
{
/// <summary>
- /// Simple filter to match a string in the rendered message
+ /// Simple filter to match a string in the rendered message.
/// </summary>
- /// <remarks>
- /// <para>
- /// Simple filter to match a string in the rendered message
- /// </para>
- /// </remarks>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
public class StringMatchFilter : FilterSkeleton
{
- #region Member Variables
-
- /// <summary>
- /// Flag to indicate the behavior when we have a match
- /// </summary>
- protected bool m_acceptOnMatch = true;
-
- /// <summary>
- /// The string to substring match against the message
- /// </summary>
- protected string m_stringToMatch;
-
- /// <summary>
- /// A string regex to match
- /// </summary>
- protected string m_stringRegexToMatch;
-
/// <summary>
/// A regex object to match (generated from m_stringRegexToMatch)
/// </summary>
protected Regex m_regexToMatch;
- #endregion
-
- #region Constructors
-
- /// <summary>
- /// Default constructor
- /// </summary>
- public StringMatchFilter()
- {
- }
-
- #endregion
-
- #region Implementation of IOptionHandler
-
/// <summary>
/// Initialize and precompile the Regex if required
/// </summary>
@@ -91,20 +52,14 @@
/// <see cref="ActivateOptions"/> must be called again.
/// </para>
/// </remarks>
- public override void ActivateOptions()
+ public override void ActivateOptions()
{
- if (m_stringRegexToMatch != null)
+ if (RegexToMatch is not null)
{
-#if NETSTANDARD1_3
- m_regexToMatch = new Regex(m_stringRegexToMatch);
-#else
- m_regexToMatch = new Regex(m_stringRegexToMatch, RegexOptions.Compiled);
-#endif
+ m_regexToMatch = new Regex(RegexToMatch, RegexOptions.Compiled);
}
}
- #endregion
-
/// <summary>
/// <see cref="FilterDecision.Accept"/> when matching <see cref="StringToMatch"/> or <see cref="RegexToMatch"/>
/// </summary>
@@ -119,11 +74,7 @@
/// The default is <c>true</c> i.e. to <see cref="FilterDecision.Accept"/> the event.
/// </para>
/// </remarks>
- public bool AcceptOnMatch
- {
- get { return m_acceptOnMatch; }
- set { m_acceptOnMatch = value; }
- }
+ public bool AcceptOnMatch { get; set; } = true;
/// <summary>
/// Sets the static string to match
@@ -140,11 +91,7 @@
/// must be specified.
/// </para>
/// </remarks>
- public string StringToMatch
- {
- get { return m_stringToMatch; }
- set { m_stringToMatch = value; }
- }
+ public string? StringToMatch { get; set; }
/// <summary>
/// Sets the regular expression to match
@@ -161,13 +108,7 @@
/// must be specified.
/// </para>
/// </remarks>
- public string RegexToMatch
- {
- get { return m_stringRegexToMatch; }
- set { m_stringRegexToMatch = value; }
- }
-
- #region Override implementation of FilterSkeleton
+ public string? RegexToMatch { get; set; }
/// <summary>
/// Check if this filter should allow the event to be logged
@@ -186,60 +127,58 @@
/// <see cref="FilterDecision.Deny"/> is returned.
/// </para>
/// </remarks>
- public override FilterDecision Decide(LoggingEvent loggingEvent)
+ public override FilterDecision Decide(LoggingEvent loggingEvent)
{
- if (loggingEvent == null)
+ if (loggingEvent is null)
{
- throw new ArgumentNullException("loggingEvent");
+ throw new ArgumentNullException(nameof(loggingEvent));
}
- string msg = loggingEvent.RenderedMessage;
+ string? msg = loggingEvent.RenderedMessage;
// Check if we have been setup to filter
- if (msg == null || (m_stringToMatch == null && m_regexToMatch == null))
+ if (msg is null || (StringToMatch is null && m_regexToMatch is null))
{
// We cannot filter so allow the filter chain
// to continue processing
return FilterDecision.Neutral;
}
-
+
// Firstly check if we are matching using a regex
- if (m_regexToMatch != null)
+ if (m_regexToMatch is not null)
{
// Check the regex
if (m_regexToMatch.Match(msg).Success == false)
{
// No match, continue processing
return FilterDecision.Neutral;
- }
+ }
// we've got a match
- if (m_acceptOnMatch)
+ if (AcceptOnMatch)
{
return FilterDecision.Accept;
- }
+ }
return FilterDecision.Deny;
}
- else if (m_stringToMatch != null)
+ else if (StringToMatch is not null)
{
// Check substring match
- if (msg.IndexOf(m_stringToMatch) == -1)
+ if (msg.IndexOf(StringToMatch) == -1)
{
// No match, continue processing
return FilterDecision.Neutral;
- }
+ }
// we've got a match
- if (m_acceptOnMatch)
+ if (AcceptOnMatch)
{
return FilterDecision.Accept;
- }
+ }
return FilterDecision.Deny;
}
+
return FilterDecision.Neutral;
-
}
-
- #endregion
}
}
diff --git a/src/log4net/GlobalContext.cs b/src/log4net/GlobalContext.cs
index d698858..af5f135 100644
--- a/src/log4net/GlobalContext.cs
+++ b/src/log4net/GlobalContext.cs
@@ -49,54 +49,14 @@
/// </example>
/// <threadsafety static="true" instance="true" />
/// <author>Nicko Cadell</author>
- public sealed class GlobalContext
+ public static class GlobalContext
{
- #region Private Instance Constructors
-
- /// <summary>
- /// Private Constructor.
- /// </summary>
- /// <remarks>
- /// Uses a private access modifier to prevent instantiation of this class.
- /// </remarks>
- private GlobalContext()
- {
- }
-
- #endregion Private Instance Constructors
-
- static GlobalContext()
- {
- Properties[log4net.Core.LoggingEvent.HostNameProperty] = SystemInfo.HostName;
- }
-
- #region Public Static Properties
-
/// <summary>
/// The global properties map.
/// </summary>
- /// <value>
- /// The global properties map.
- /// </value>
- /// <remarks>
- /// <para>
- /// The global properties map.
- /// </para>
- /// </remarks>
- public static GlobalContextProperties Properties
+ public static GlobalContextProperties Properties { get; } = new()
{
- get { return s_properties; }
- }
-
- #endregion Public Static Properties
-
- #region Private Static Fields
-
- /// <summary>
- /// The global context properties instance
- /// </summary>
- private static readonly GlobalContextProperties s_properties = new GlobalContextProperties();
-
- #endregion Private Static Fields
+ [Core.LoggingEvent.HostNameProperty] = SystemInfo.HostName
+ };
}
}
diff --git a/src/log4net/Layout/DynamicPatternLayout.cs b/src/log4net/Layout/DynamicPatternLayout.cs
index ef6c4bc..8dd206d 100644
--- a/src/log4net/Layout/DynamicPatternLayout.cs
+++ b/src/log4net/Layout/DynamicPatternLayout.cs
@@ -113,7 +113,7 @@
base.Header = value;
m_headerPatternString = new PatternString(value);
}
- } /* property DynamicPatternLayout Header */
+ } /* property DynamicPatternLayout Header */
/// <summary>
/// The footer for the layout format.
@@ -137,7 +137,7 @@
base.Footer = value;
m_footerPatternString = new PatternString(value);
}
- } /* property DynamicPatternLayout Footer */
+ } /* property DynamicPatternLayout Footer */
#endregion
} /* class DynamicPatternLayout */
} /* namespace log4net.Layout */
diff --git a/src/log4net/Layout/ILayout.cs b/src/log4net/Layout/ILayout.cs
index 6e2e997..516bee6 100644
--- a/src/log4net/Layout/ILayout.cs
+++ b/src/log4net/Layout/ILayout.cs
@@ -20,7 +20,6 @@
using System;
using System.IO;
-using log4net;
using log4net.Core;
namespace log4net.Layout
@@ -90,7 +89,7 @@
/// are formatted and appended.
/// </para>
/// </remarks>
- string Header { get; }
+ string? Header { get; }
/// <summary>
/// The footer for the layout format.
@@ -102,7 +101,7 @@
/// have been formatted and appended.
/// </para>
/// </remarks>
- string Footer { get; }
+ string? Footer { get; }
/// <summary>
/// Flag indicating if this layout handle exceptions
diff --git a/src/log4net/Layout/Internal/XmlWriterExtensions.cs b/src/log4net/Layout/Internal/XmlWriterExtensions.cs
new file mode 100644
index 0000000..48294a4
--- /dev/null
+++ b/src/log4net/Layout/Internal/XmlWriterExtensions.cs
@@ -0,0 +1,74 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.
+//
+#endregion
+
+using System.IO;
+using System.Xml;
+using log4net.Util;
+
+namespace log4net.Layout.Internal;
+
+/// <summary>
+/// Extensions for <see cref="XmlWriter"/>
+/// </summary>
+/// <author>Jan Friedrich</author>
+[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter",
+ Justification = "Compatibility between net4 and netstandard")]
+internal static partial class XmlWriterExtensions
+{
+#if NETSTANDARD2_0_OR_GREATER
+ private static readonly XmlWriterSettings settings = new XmlWriterSettings
+ {
+ Indent = false,
+ OmitXmlDeclaration = true
+ };
+#endif
+
+ /// <summary>
+ /// writes the specified start tag and associates it with the given namespace and prefix
+ /// </summary>
+ /// <param name="writer">Writer</param>
+ /// <param name="fullName">The full name of the element</param>
+ /// <param name="prefix">The namespace prefix of the element</param>
+ /// <param name="localName">The local name of the element</param>
+ /// <param name="ns">The namespace URI to associate with the element</param>
+ internal static void WriteStartElement(this XmlWriter writer,
+ string fullName, string prefix, string localName, string ns)
+#if NETSTANDARD2_0_OR_GREATER
+ => writer.WriteStartElement(prefix, localName, ns);
+#else
+ => writer.WriteStartElement(fullName);
+#endif
+
+
+ /// <summary>
+ /// Creates an XmlWriter
+ /// </summary>
+ /// <param name="writer">TextWriter</param>
+ /// <returns>XmlWriter</returns>
+ internal static XmlWriter CreateXmlWriter(TextWriter writer)
+#if NETSTANDARD2_0_OR_GREATER
+ => XmlWriter.Create(new ProtectCloseTextWriter(writer), settings);
+#else
+ => new XmlTextWriter(new ProtectCloseTextWriter(writer))
+ {
+ Formatting = Formatting.None,
+ Namespaces = false
+ };
+#endif
+}
\ No newline at end of file
diff --git a/src/log4net/Layout/LayoutSkeleton.cs b/src/log4net/Layout/LayoutSkeleton.cs
index 348eb07..06b959f 100644
--- a/src/log4net/Layout/LayoutSkeleton.cs
+++ b/src/log4net/Layout/LayoutSkeleton.cs
@@ -17,10 +17,8 @@
//
#endregion
-using System;
using System.IO;
-using log4net;
using log4net.Core;
namespace log4net.Layout
@@ -50,42 +48,6 @@
/// <author>Gert Driesen</author>
public abstract class LayoutSkeleton : ILayout, IOptionHandler
{
- #region Member Variables
-
- /// <summary>
- /// The header text
- /// </summary>
- /// <remarks>
- /// <para>
- /// See <see cref="Header"/> for more information.
- /// </para>
- /// </remarks>
- private string m_header = null;
-
- /// <summary>
- /// The footer text
- /// </summary>
- /// <remarks>
- /// <para>
- /// See <see cref="Footer"/> for more information.
- /// </para>
- /// </remarks>
- private string m_footer = null;
-
- /// <summary>
- /// Flag indicating if this layout handles exceptions
- /// </summary>
- /// <remarks>
- /// <para>
- /// <c>false</c> if this layout handles exceptions
- /// </para>
- /// </remarks>
- private bool m_ignoresException = true;
-
- #endregion
-
- #region Constructors
-
/// <summary>
/// Empty default constructor
/// </summary>
@@ -98,10 +60,6 @@
{
}
- #endregion
-
- #region Implementation of IOptionHandler
-
/// <summary>
/// Activate component options
/// </summary>
@@ -123,10 +81,6 @@
/// </remarks>
public abstract void ActivateOptions();
- #endregion
-
- #region Implementation of ILayout
-
/// <summary>
/// Implement this method to create your own layout format.
/// </summary>
@@ -149,7 +103,7 @@
/// </remarks>
public string Format(LoggingEvent loggingEvent)
{
- using StringWriter writer = new StringWriter(System.Globalization.CultureInfo.InvariantCulture);
+ using var writer = new StringWriter(System.Globalization.CultureInfo.InvariantCulture);
Format(writer, loggingEvent);
return writer.ToString();
}
@@ -168,10 +122,7 @@
/// property.
/// </para>
/// </remarks>
- public virtual string ContentType
- {
- get { return "text/plain"; }
- }
+ public virtual string ContentType => "text/plain";
/// <summary>
/// The header for the layout format.
@@ -183,11 +134,7 @@
/// are formatted and appended.
/// </para>
/// </remarks>
- public virtual string Header
- {
- get { return m_header; }
- set { m_header = value; }
- }
+ public virtual string? Header { get; set; }
/// <summary>
/// The footer for the layout format.
@@ -199,11 +146,7 @@
/// have been formatted and appended.
/// </para>
/// </remarks>
- public virtual string Footer
- {
- get { return m_footer; }
- set { m_footer = value; }
- }
+ public virtual string? Footer { get; set; }
/// <summary>
/// Flag indicating if this layout handles exceptions
@@ -217,16 +160,10 @@
/// object, then the layout should return <c>true</c>.
/// </para>
/// <para>
- /// Set this value to override a this default setting. The default
+ /// Set this value to override the default setting. The default
/// value is <c>true</c>, this layout does not handle the exception.
/// </para>
/// </remarks>
- public virtual bool IgnoresException
- {
- get { return m_ignoresException; }
- set { m_ignoresException = value; }
- }
-
- #endregion
+ public virtual bool IgnoresException { get; set; } = true;
}
}
diff --git a/src/log4net/Layout/Pattern/AspNetCachePatternConverter.cs b/src/log4net/Layout/Pattern/AspNetCachePatternConverter.cs
index 32c8cca..f87020b 100644
--- a/src/log4net/Layout/Pattern/AspNetCachePatternConverter.cs
+++ b/src/log4net/Layout/Pattern/AspNetCachePatternConverter.cs
@@ -1,4 +1,4 @@
-#if NET_2_0
+#if NET462_OR_GREATER
#region Apache License
//
// Licensed to the Apache Software Foundation (ASF) under one or more
@@ -18,10 +18,6 @@
//
#endregion
-// .NET Compact Framework 1.0 has no support for ASP.NET
-// SSCLI 1.0 has no support for ASP.NET
-#if !NETCF && !SSCLI && !CLIENT_PROFILE
-
using System.IO;
using System.Web;
using log4net.Core;
@@ -75,5 +71,4 @@
}
}
-#endif // !NETCF && !SSCLI && !CLIENT_PROFILE
-#endif // NET_2_0
\ No newline at end of file
+#endif // NET462_OR_GREATER
\ No newline at end of file
diff --git a/src/log4net/Layout/Pattern/AspNetContextPatternConverter.cs b/src/log4net/Layout/Pattern/AspNetContextPatternConverter.cs
index 1cd902f..e2253e1 100644
--- a/src/log4net/Layout/Pattern/AspNetContextPatternConverter.cs
+++ b/src/log4net/Layout/Pattern/AspNetContextPatternConverter.cs
@@ -1,4 +1,4 @@
-#if NET_2_0
+#if NET462_OR_GREATER
#region Apache License
//
// Licensed to the Apache Software Foundation (ASF) under one or more
@@ -18,10 +18,6 @@
//
#endregion
-// .NET Compact Framework 1.0 has no support for ASP.NET
-// SSCLI 1.0 has no support for ASP.NET
-#if !NETCF && !SSCLI && !CLIENT_PROFILE
-
using System.IO;
using System.Web;
using log4net.Core;
@@ -66,5 +62,4 @@
}
}
-#endif // !NETCF && !SSCLI && !CLIENT_PROFILE
-#endif // NET_2_0
\ No newline at end of file
+#endif // NET462_OR_GREATER
\ No newline at end of file
diff --git a/src/log4net/Layout/Pattern/AspNetPatternConverter.cs b/src/log4net/Layout/Pattern/AspNetPatternConverter.cs
index 17d2ca1..f43dccc 100644
--- a/src/log4net/Layout/Pattern/AspNetPatternConverter.cs
+++ b/src/log4net/Layout/Pattern/AspNetPatternConverter.cs
@@ -1,4 +1,4 @@
-#if NET_2_0
+#if NET462_OR_GREATER
#region Apache License
//
// Licensed to the Apache Software Foundation (ASF) under one or more
@@ -18,10 +18,6 @@
//
#endregion
-// .NET Compact Framework 1.0 has no support for ASP.NET
-// SSCLI 1.0 has no support for ASP.NET
-#if !NETCF && !SSCLI && !CLIENT_PROFILE
-
using System.IO;
using System.Web;
using log4net.Core;
@@ -62,6 +58,4 @@
protected abstract void Convert(TextWriter writer, LoggingEvent loggingEvent, HttpContext httpContext);
}
}
-
-#endif // !NETCF && !SSCLI && !CLIENT_PROFILE
-#endif // NET_2_0
\ No newline at end of file
+#endif // NET462_OR_GREATER
\ No newline at end of file
diff --git a/src/log4net/Layout/Pattern/AspNetRequestPatternConverter.cs b/src/log4net/Layout/Pattern/AspNetRequestPatternConverter.cs
index 01b203e..037ed9d 100644
--- a/src/log4net/Layout/Pattern/AspNetRequestPatternConverter.cs
+++ b/src/log4net/Layout/Pattern/AspNetRequestPatternConverter.cs
@@ -1,4 +1,4 @@
-#if NET_2_0
+#if NET462_OR_GREATER
#region Apache License
//
// Licensed to the Apache Software Foundation (ASF) under one or more
@@ -18,10 +18,6 @@
//
#endregion
-// .NET Compact Framework 1.0 has no support for ASP.NET
-// SSCLI 1.0 has no support for ASP.NET
-#if !NETCF && !SSCLI && !CLIENT_PROFILE
-
using System.IO;
using System.Web;
using log4net.Core;
@@ -87,5 +83,4 @@
}
}
-#endif // !NETCF && !SSCLI && !CLIENT_PROFILE
-#endif // NET_2_0
\ No newline at end of file
+#endif // NET462_OR_GREATER
\ No newline at end of file
diff --git a/src/log4net/Layout/Pattern/AspNetSessionPatternConverter.cs b/src/log4net/Layout/Pattern/AspNetSessionPatternConverter.cs
index 8cbcae6..14f7997 100644
--- a/src/log4net/Layout/Pattern/AspNetSessionPatternConverter.cs
+++ b/src/log4net/Layout/Pattern/AspNetSessionPatternConverter.cs
@@ -1,4 +1,4 @@
-#if NET_2_0
+#if NET462_OR_GREATER
#region Apache License
//
// Licensed to the Apache Software Foundation (ASF) under one or more
@@ -18,10 +18,6 @@
//
#endregion
-// .NET Compact Framework 1.0 has no support for ASP.NET
-// SSCLI 1.0 has no support for ASP.NET
-#if !NETCF && !SSCLI && !CLIENT_PROFILE
-
using System.IO;
using System.Web;
using log4net.Core;
@@ -75,5 +71,4 @@
}
}
-#endif // !NETCF && !SSCLI && !CLIENT_PROFILE
-#endif // NET_2_0
\ No newline at end of file
+#endif // NET462_OR_GREATER
\ No newline at end of file
diff --git a/src/log4net/Layout/Pattern/ExceptionPatternConverter.cs b/src/log4net/Layout/Pattern/ExceptionPatternConverter.cs
index b2262d4..6f3d3e8 100644
--- a/src/log4net/Layout/Pattern/ExceptionPatternConverter.cs
+++ b/src/log4net/Layout/Pattern/ExceptionPatternConverter.cs
@@ -99,22 +99,18 @@
case "message":
WriteObject(writer, loggingEvent.Repository, loggingEvent.ExceptionObject.Message);
break;
-#if !NETCF
case "source":
WriteObject(writer, loggingEvent.Repository, loggingEvent.ExceptionObject.Source);
break;
case "stacktrace":
WriteObject(writer, loggingEvent.Repository, loggingEvent.ExceptionObject.StackTrace);
break;
-#if !NETSTANDARD
case "targetsite":
WriteObject(writer, loggingEvent.Repository, loggingEvent.ExceptionObject.TargetSite);
break;
-#endif
case "helplink":
WriteObject(writer, loggingEvent.Repository, loggingEvent.ExceptionObject.HelpLink);
break;
-#endif
default:
// do not output SystemInfo.NotAvailableText
break;
diff --git a/src/log4net/Layout/Pattern/NdcPatternConverter.cs b/src/log4net/Layout/Pattern/NdcPatternConverter.cs
index a64dbb9..cc2293b 100644
--- a/src/log4net/Layout/Pattern/NdcPatternConverter.cs
+++ b/src/log4net/Layout/Pattern/NdcPatternConverter.cs
@@ -17,8 +17,6 @@
//
#endregion
-using System;
-using System.Text;
using System.IO;
using log4net.Core;
diff --git a/src/log4net/Layout/Pattern/PatternLayoutConverter.cs b/src/log4net/Layout/Pattern/PatternLayoutConverter.cs
index 2337149..197d328 100644
--- a/src/log4net/Layout/Pattern/PatternLayoutConverter.cs
+++ b/src/log4net/Layout/Pattern/PatternLayoutConverter.cs
@@ -18,13 +18,10 @@
#endregion
using System;
-using System.Text;
using System.IO;
-using System.Collections;
using log4net.Core;
using log4net.Util;
-using log4net.Repository;
namespace log4net.Layout.Pattern
{
@@ -97,17 +94,12 @@
/// </summary>
/// <param name="writer"><see cref="TextWriter" /> that will receive the formatted result.</param>
/// <param name="state">The state object on which the pattern converter should be executed.</param>
- protected override void Convert(TextWriter writer, object state)
+ public override void Convert(TextWriter writer, object state)
{
- LoggingEvent loggingEvent = state as LoggingEvent;
- if (loggingEvent != null)
- {
- Convert(writer, loggingEvent);
- }
- else
- {
- throw new ArgumentException("state must be of type [" + typeof(LoggingEvent).FullName + "]", "state");
- }
+ if (state is not LoggingEvent loggingEvent)
+ throw new ArgumentException($"state must be of type [{typeof(LoggingEvent).FullName}]", "state");
+
+ Convert(writer, loggingEvent);
}
#endregion Protected Methods
@@ -120,4 +112,4 @@
/// </remarks>
private bool m_ignoresException = true;
}
-}
+}
\ No newline at end of file
diff --git a/src/log4net/Layout/Pattern/PropertyPatternConverter.cs b/src/log4net/Layout/Pattern/PropertyPatternConverter.cs
index bb66c96..e1b8f61 100644
--- a/src/log4net/Layout/Pattern/PropertyPatternConverter.cs
+++ b/src/log4net/Layout/Pattern/PropertyPatternConverter.cs
@@ -17,13 +17,9 @@
//
#endregion
-using System;
-using System.Text;
using System.IO;
-using System.Collections;
using log4net.Core;
-using log4net.Repository;
namespace log4net.Layout.Pattern
{
diff --git a/src/log4net/Layout/Pattern/StackTraceDetailPatternConverter.cs b/src/log4net/Layout/Pattern/StackTraceDetailPatternConverter.cs
index a97a1b5..862a619 100644
--- a/src/log4net/Layout/Pattern/StackTraceDetailPatternConverter.cs
+++ b/src/log4net/Layout/Pattern/StackTraceDetailPatternConverter.cs
@@ -18,8 +18,6 @@
* under the License.
*
*/
-#if !NETCF && (NET_2_0 || NETSTANDARD2_0)
-
using System;
using System.Text;
@@ -86,5 +84,4 @@
#endregion Private Static Fields
}
-}
-#endif // !NETCF && NET_2_0
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/src/log4net/Layout/Pattern/StackTracePatternConverter.cs b/src/log4net/Layout/Pattern/StackTracePatternConverter.cs
index df3ccb5..d3be2ff 100644
--- a/src/log4net/Layout/Pattern/StackTracePatternConverter.cs
+++ b/src/log4net/Layout/Pattern/StackTracePatternConverter.cs
@@ -16,7 +16,7 @@
// limitations under the License.
//
#endregion
-#if !NETCF && (NET_2_0 || NETSTANDARD2_0)
+
using System;
using System.IO;
@@ -146,4 +146,3 @@
#endregion Private Static Fields
}
}
-#endif // !NETCF && NET_2_0
diff --git a/src/log4net/Layout/PatternLayout.cs b/src/log4net/Layout/PatternLayout.cs
index bbf131c..807a44f 100644
--- a/src/log4net/Layout/PatternLayout.cs
+++ b/src/log4net/Layout/PatternLayout.cs
@@ -859,9 +859,8 @@
s_globalRulesRegistry.Add("newline", typeof(NewLinePatternConverter));
s_globalRulesRegistry.Add("n", typeof(NewLinePatternConverter));
- // .NET Compact Framework 1.0 has no support for ASP.NET
- // SSCLI 1.0 has no support for ASP.NET
-#if !NETCF && !SSCLI && !CLIENT_PROFILE && !NETSTANDARD
+ // .NET Standard has no support for ASP.NET
+#if NET462_OR_GREATER
s_globalRulesRegistry.Add("aspnet-cache", typeof(AspNetCachePatternConverter));
s_globalRulesRegistry.Add("aspnet-context", typeof(AspNetContextPatternConverter));
s_globalRulesRegistry.Add("aspnet-request", typeof(AspNetRequestPatternConverter));
@@ -905,10 +904,8 @@
s_globalRulesRegistry.Add("r", typeof(RelativeTimePatternConverter));
s_globalRulesRegistry.Add("timestamp", typeof(RelativeTimePatternConverter));
-#if !NETCF && !NETSTANDARD1_3
s_globalRulesRegistry.Add("stacktrace", typeof(StackTracePatternConverter));
s_globalRulesRegistry.Add("stacktracedetail", typeof(StackTraceDetailPatternConverter));
-#endif
s_globalRulesRegistry.Add("t", typeof(ThreadPatternConverter));
s_globalRulesRegistry.Add("thread", typeof(ThreadPatternConverter));
diff --git a/src/log4net/Layout/XmlLayout.cs b/src/log4net/Layout/XmlLayout.cs
index b30686a..c165074 100644
--- a/src/log4net/Layout/XmlLayout.cs
+++ b/src/log4net/Layout/XmlLayout.cs
@@ -18,10 +18,12 @@
#endregion
using System;
+using System.Collections.Generic;
using System.Text;
using System.Xml;
using log4net.Core;
+using log4net.Layout.Internal;
using log4net.Util;
namespace log4net.Layout
@@ -71,12 +73,10 @@
/// <author>Gert Driesen</author>
public class XmlLayout : XmlLayoutBase
{
- #region Public Instance Constructors
-
/// <summary>
/// Constructs an XmlLayout
/// </summary>
- public XmlLayout() : base()
+ public XmlLayout()
{
}
@@ -87,7 +87,7 @@
/// <para>
/// The <b>LocationInfo</b> option takes a boolean value. By
/// default, it is set to false which means there will be no location
- /// information output by this layout. If the the option is set to
+ /// information output by this layout. If the option is set to
/// true, then the file name and line number of the statement
/// at the origin of the log statement will be output.
/// </para>
@@ -101,10 +101,6 @@
{
}
- #endregion Public Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
/// The prefix to use for all element names
/// </summary>
@@ -115,15 +111,10 @@
/// then no prefix will be written.
/// </para>
/// </remarks>
- public string Prefix
- {
- get { return m_prefix; }
- set { m_prefix = value; }
- }
-
-
+ public string Prefix { get; set; } = PREFIX;
+
/// <summary>
- /// Set whether or not to base64 encode the message.
+ /// Set whether to base64 encode the message.
/// </summary>
/// <remarks>
/// <para>
@@ -135,14 +126,10 @@
/// on the log message.
/// </para>
/// </remarks>
- public bool Base64EncodeMessage
- {
- get { return m_base64Message; }
- set { m_base64Message = value; }
- }
+ public bool Base64EncodeMessage { get; set; }
/// <summary>
- /// Set whether or not to base64 encode the property values.
+ /// Set whether to base64 encode the property values.
/// </summary>
/// <remarks>
/// <para>
@@ -154,15 +141,7 @@
/// on the property values.
/// </para>
/// </remarks>
- public bool Base64EncodeProperties
- {
- get { return m_base64Properties; }
- set { m_base64Properties = value; }
- }
-
- #endregion Public Instance Properties
-
- #region Implementation of IOptionHandler
+ public bool Base64EncodeProperties { get; set; }
/// <summary>
/// Initialize layout options
@@ -188,21 +167,17 @@
base.ActivateOptions();
// Cache the full element names including the prefix
- if (m_prefix != null && m_prefix.Length > 0)
+ if (Prefix.Length > 0)
{
- m_elmEvent = m_prefix + ":" + ELM_EVENT;
- m_elmMessage = m_prefix + ":" + ELM_MESSAGE;
- m_elmProperties = m_prefix + ":" + ELM_PROPERTIES;
- m_elmData = m_prefix + ":" + ELM_DATA;
- m_elmException = m_prefix + ":" + ELM_EXCEPTION;
- m_elmLocation = m_prefix + ":" + ELM_LOCATION;
+ m_elmEvent = Prefix + ":" + ELM_EVENT;
+ m_elmMessage = Prefix + ":" + ELM_MESSAGE;
+ m_elmProperties = Prefix + ":" + ELM_PROPERTIES;
+ m_elmData = Prefix + ":" + ELM_DATA;
+ m_elmException = Prefix + ":" + ELM_EXCEPTION;
+ m_elmLocation = Prefix + ":" + ELM_LOCATION;
}
}
- #endregion Implementation of IOptionHandler
-
- #region Override implementation of XMLLayoutBase
-
/// <summary>
/// Does the actual writing of the XML.
/// </summary>
@@ -216,22 +191,13 @@
/// </remarks>
protected override void FormatXml(XmlWriter writer, LoggingEvent loggingEvent)
{
-#if NETSTANDARD
- writer.WriteStartElement(m_prefix, ELM_EVENT, m_prefix);
- // writer.WriteAttributeString("xmlns", "log4net", null, "http://logging.apache.org/log4net/schemas/log4net-events-1.2");
-#else
- writer.WriteStartElement(m_elmEvent);
-#endif
- writer.WriteAttributeString(ATTR_LOGGER, loggingEvent.LoggerName);
+ writer.WriteStartElement(m_elmEvent, Prefix, ELM_EVENT, Prefix);
+ writer.WriteAttributeString(ATTR_LOGGER, loggingEvent.LoggerName!);
-#if NET_2_0 || NETCF_2_0 || MONO_2_0 || NETSTANDARD
writer.WriteAttributeString(ATTR_TIMESTAMP, XmlConvert.ToString(loggingEvent.TimeStamp, XmlDateTimeSerializationMode.Local));
-#else
- writer.WriteAttributeString(ATTR_TIMESTAMP, XmlConvert.ToString(loggingEvent.TimeStamp));
-#endif
writer.WriteAttributeString(ATTR_LEVEL, loggingEvent.Level.DisplayName);
- writer.WriteAttributeString(ATTR_THREAD, loggingEvent.ThreadName);
+ writer.WriteAttributeString(ATTR_THREAD, loggingEvent.ThreadName!);
if (loggingEvent.Domain != null && loggingEvent.Domain.Length > 0)
{
@@ -241,18 +207,14 @@
{
writer.WriteAttributeString(ATTR_IDENTITY, loggingEvent.Identity);
}
- if (loggingEvent.UserName != null && loggingEvent.UserName.Length > 0)
+ if (loggingEvent.UserName.Length > 0)
{
writer.WriteAttributeString(ATTR_USERNAME, loggingEvent.UserName);
}
// Append the message text
-#if NETSTANDARD
- writer.WriteStartElement(m_prefix, ELM_MESSAGE, m_prefix);
-#else
- writer.WriteStartElement(m_elmMessage);
-#endif
- if (!this.Base64EncodeMessage)
+ writer.WriteStartElement(m_elmMessage, Prefix, ELM_MESSAGE, Prefix);
+ if (!Base64EncodeMessage)
{
Transform.WriteEscapedXmlString(writer, loggingEvent.RenderedMessage, this.InvalidCharReplacement);
}
@@ -269,25 +231,17 @@
// Append the properties text
if (properties.Count > 0)
{
-#if NETSTANDARD
- writer.WriteStartElement(m_prefix, ELM_PROPERTIES, m_prefix);
-#else
- writer.WriteStartElement(m_elmProperties);
-#endif
- foreach (System.Collections.DictionaryEntry entry in properties)
+ writer.WriteStartElement(m_elmProperties, Prefix, ELM_PROPERTIES, Prefix);
+ foreach (KeyValuePair<string, object?> entry in properties)
{
-#if NETSTANDARD
- writer.WriteStartElement(m_prefix, ELM_DATA, m_prefix);
-#else
- writer.WriteStartElement(m_elmData);
-#endif
- writer.WriteAttributeString(ATTR_NAME, Transform.MaskXmlInvalidCharacters((string)entry.Key, this.InvalidCharReplacement));
+ writer.WriteStartElement(m_elmData, Prefix, ELM_DATA, Prefix);
+ writer.WriteAttributeString(ATTR_NAME, Transform.MaskXmlInvalidCharacters(entry.Key, InvalidCharReplacement));
// Use an ObjectRenderer to convert the object to a string
- string valueStr = null;
- if (!this.Base64EncodeProperties)
+ string valueStr;
+ if (!Base64EncodeProperties)
{
- valueStr = Transform.MaskXmlInvalidCharacters(loggingEvent.Repository.RendererMap.FindAndRender(entry.Value), this.InvalidCharReplacement);
+ valueStr = Transform.MaskXmlInvalidCharacters(loggingEvent.Repository.RendererMap.FindAndRender(entry.Value), InvalidCharReplacement);
}
else
{
@@ -305,12 +259,8 @@
if (exceptionStr != null && exceptionStr.Length > 0)
{
// Append the stack trace line
-#if NETSTANDARD
- writer.WriteStartElement(m_prefix, ELM_EXCEPTION, m_prefix);
-#else
- writer.WriteStartElement(m_elmException);
-#endif
- Transform.WriteEscapedXmlString(writer, exceptionStr, this.InvalidCharReplacement);
+ writer.WriteStartElement(m_elmException, Prefix, ELM_EXCEPTION, Prefix);
+ Transform.WriteEscapedXmlString(writer, exceptionStr, InvalidCharReplacement);
writer.WriteEndElement();
}
@@ -318,11 +268,7 @@
{
LocationInfo locationInfo = loggingEvent.LocationInformation;
-#if NETSTANDARD
- writer.WriteStartElement(m_prefix, ELM_LOCATION, m_prefix);
-#else
- writer.WriteStartElement(m_elmLocation);
-#endif
+ writer.WriteStartElement(m_elmLocation, Prefix, ELM_LOCATION, Prefix);
writer.WriteAttributeString(ATTR_CLASS, locationInfo.ClassName);
writer.WriteAttributeString(ATTR_METHOD, locationInfo.MethodName);
writer.WriteAttributeString(ATTR_FILE, locationInfo.FileName);
@@ -333,15 +279,6 @@
writer.WriteEndElement();
}
- #endregion Override implementation of XMLLayoutBase
-
- #region Private Instance Fields
-
- /// <summary>
- /// The prefix to use for all generated element names
- /// </summary>
- private string m_prefix = PREFIX;
-
private string m_elmEvent = ELM_EVENT;
private string m_elmMessage = ELM_MESSAGE;
private string m_elmData = ELM_DATA;
@@ -349,19 +286,11 @@
private string m_elmException = ELM_EXCEPTION;
private string m_elmLocation = ELM_LOCATION;
- private bool m_base64Message = false;
- private bool m_base64Properties = false;
-
- #endregion Private Instance Fields
-
- #region Private Static Fields
-
private const string PREFIX = "log4net";
private const string ELM_EVENT = "event";
private const string ELM_MESSAGE = "message";
private const string ELM_PROPERTIES = "properties";
- private const string ELM_GLOBAL_PROPERTIES = "global-properties";
private const string ELM_DATA = "data";
private const string ELM_EXCEPTION = "exception";
private const string ELM_LOCATION = "locationInfo";
@@ -379,9 +308,6 @@
private const string ATTR_LINE = "line";
private const string ATTR_NAME = "name";
private const string ATTR_VALUE = "value";
-
-
- #endregion Private Static Fields
}
}
diff --git a/src/log4net/Layout/XmlLayoutBase.cs b/src/log4net/Layout/XmlLayoutBase.cs
index eb57228..0002c46 100644
--- a/src/log4net/Layout/XmlLayoutBase.cs
+++ b/src/log4net/Layout/XmlLayoutBase.cs
@@ -19,11 +19,11 @@
using System;
using System.IO;
-using System.Text;
using System.Xml;
using log4net.Util;
using log4net.Core;
+using log4net.Layout.Internal;
namespace log4net.Layout
{
@@ -43,8 +43,6 @@
/// <author>Gert Driesen</author>
public abstract class XmlLayoutBase : LayoutSkeleton
{
- #region Protected Instance Constructors
-
/// <summary>
/// Protected constructor to support subclasses
/// </summary>
@@ -79,13 +77,9 @@
protected XmlLayoutBase(bool locationInfo)
{
IgnoresException = false;
- m_locationInfo = locationInfo;
+ LocationInfo = locationInfo;
}
- #endregion Protected Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
/// Gets a value indicating whether to include location information in
/// the XML events.
@@ -106,11 +100,8 @@
/// appender as well.
/// </para>
/// </remarks>
- public bool LocationInfo
- {
- get { return m_locationInfo; }
- set { m_locationInfo = value; }
- }
+ public bool LocationInfo { get; set; }
+
/// <summary>
/// The string to replace characters that can not be expressed in XML with.
/// <remarks>
@@ -124,14 +115,7 @@
/// </para>
/// </remarks>
/// </summary>
- public string InvalidCharReplacement
- {
- get { return m_invalidCharReplacement; }
- set { m_invalidCharReplacement = value; }
- }
- #endregion
-
- #region Implementation of IOptionHandler
+ public string InvalidCharReplacement { get; set; } = "?";
/// <summary>
/// Initialize layout options
@@ -154,10 +138,6 @@
// nothing to do
}
- #endregion Implementation of IOptionHandler
-
- #region Override implementation of LayoutSkeleton
-
/// <summary>
/// Gets the content type output by this layout.
/// </summary>
@@ -192,22 +172,11 @@
/// </remarks>
public override void Format(TextWriter writer, LoggingEvent loggingEvent)
{
- if (loggingEvent == null)
+ if (loggingEvent is null)
{
- throw new ArgumentNullException("loggingEvent");
+ throw new ArgumentNullException(nameof(loggingEvent));
}
-#if NETSTANDARD
- var settings = new XmlWriterSettings
- {
- Indent = false,
- OmitXmlDeclaration = true
- };
- using var xmlWriter = XmlWriter.Create(new ProtectCloseTextWriter(writer), settings);
-#else
- using XmlTextWriter xmlWriter = new XmlTextWriter(new ProtectCloseTextWriter(writer));
- xmlWriter.Formatting = Formatting.None;
- xmlWriter.Namespaces = false;
-#endif
+ using XmlWriter xmlWriter = XmlWriterExtensions.CreateXmlWriter(writer);
// Write the event to the writer
FormatXml(xmlWriter, loggingEvent);
@@ -218,10 +187,6 @@
// -> Dispose from using var will close & flush
}
- #endregion Override implementation of LayoutSkeleton
-
- #region Protected Instance Methods
-
/// <summary>
/// Does the actual writing of the XML.
/// </summary>
@@ -234,22 +199,5 @@
/// </para>
/// </remarks>
protected abstract void FormatXml(XmlWriter writer, LoggingEvent loggingEvent);
-
- #endregion Protected Instance Methods
-
- #region Private Instance Fields
-
- /// <summary>
- /// Flag to indicate if location information should be included in
- /// the XML events.
- /// </summary>
- private bool m_locationInfo = false;
-
- /// <summary>
- /// The string to replace invalid chars with
- /// </summary>
- private string m_invalidCharReplacement = "?";
-
- #endregion Private Instance Fields
}
-}
+}
\ No newline at end of file
diff --git a/src/log4net/Layout/XmlLayoutSchemaLog4j.cs b/src/log4net/Layout/XmlLayoutSchemaLog4j.cs
index 448b145..734a164 100644
--- a/src/log4net/Layout/XmlLayoutSchemaLog4j.cs
+++ b/src/log4net/Layout/XmlLayoutSchemaLog4j.cs
@@ -18,12 +18,12 @@
#endregion
using System;
-using System.Text;
+using System.Collections.Generic;
using System.Xml;
-using System.IO;
using log4net.Core;
using log4net.Util;
+using log4net.Layout.Internal;
namespace log4net.Layout
{
@@ -38,21 +38,15 @@
/// <author>Nicko Cadell</author>
public class XmlLayoutSchemaLog4j : XmlLayoutBase
{
- #region Static Members
-
/// <summary>
/// The 1st of January 1970 in UTC
/// </summary>
- private static readonly DateTime s_date1970 = new DateTime(1970, 1, 1);
-
- #endregion
-
- #region Constructors
+ private static readonly DateTime s_date1970 = new(1970, 1, 1);
/// <summary>
/// Constructs an XMLLayoutSchemaLog4j
/// </summary>
- public XmlLayoutSchemaLog4j() : base()
+ public XmlLayoutSchemaLog4j()
{
}
@@ -63,7 +57,7 @@
/// <para>
/// The <b>LocationInfo</b> option takes a boolean value. By
/// default, it is set to false which means there will be no location
- /// information output by this layout. If the the option is set to
+ /// information output by this layout. If the option is set to
/// true, then the file name and line number of the statement
/// at the origin of the log statement will be output.
/// </para>
@@ -77,10 +71,6 @@
{
}
- #endregion
-
- #region Public Properties
-
/// <summary>
/// The version of the log4j schema to use.
/// </summary>
@@ -101,8 +91,6 @@
}
}
- #endregion
-
/* Example log4j schema event
<log4j:event logger="first logger" level="ERROR" thread="Thread-3" timestamp="1051494121460">
@@ -112,7 +100,7 @@
<log4j:data name="some string" value="some valuethird"/>
</log4j:MDC>
<log4j:throwable><![CDATA[java.lang.Exception: someexception-third
- at org.apache.log4j.chainsaw.Generator.run(Generator.java:94)
+ at org.apache.log4j.chainsaw.Generator.run(Generator.java:94)
]]></log4j:throwable>
<log4j:locationInfo class="org.apache.log4j.chainsaw.Generator"
method="run" file="Generator.java" line="94"/>
@@ -141,42 +129,37 @@
// Translate logging events for log4j
// Translate hostname property
- if (loggingEvent.LookupProperty(LoggingEvent.HostNameProperty) != null &&
- loggingEvent.LookupProperty("log4jmachinename") == null)
+ if (loggingEvent.LookupProperty(LoggingEvent.HostNameProperty) is not null &&
+ loggingEvent.LookupProperty("log4jmachinename") is null)
{
loggingEvent.GetProperties()["log4jmachinename"] = loggingEvent.LookupProperty(LoggingEvent.HostNameProperty);
}
// translate appdomain name
- if (loggingEvent.LookupProperty("log4japp") == null &&
- loggingEvent.Domain != null &&
+ if (loggingEvent.LookupProperty("log4japp") is null &&
+ loggingEvent.Domain is not null &&
loggingEvent.Domain.Length > 0)
{
loggingEvent.GetProperties()["log4japp"] = loggingEvent.Domain;
}
// translate identity name
- if (loggingEvent.Identity != null &&
+ if (loggingEvent.Identity is not null &&
loggingEvent.Identity.Length > 0 &&
- loggingEvent.LookupProperty(LoggingEvent.IdentityProperty) == null)
+ loggingEvent.LookupProperty(LoggingEvent.IdentityProperty) is null)
{
loggingEvent.GetProperties()[LoggingEvent.IdentityProperty] = loggingEvent.Identity;
}
// translate user name
- if (loggingEvent.UserName != null &&
- loggingEvent.UserName.Length > 0 &&
- loggingEvent.LookupProperty(LoggingEvent.UserNameProperty) == null)
+ if (loggingEvent.UserName.Length > 0 &&
+ loggingEvent.LookupProperty(LoggingEvent.UserNameProperty) is null)
{
loggingEvent.GetProperties()[LoggingEvent.UserNameProperty] = loggingEvent.UserName;
}
// Write the start element
-#if NETSTANDARD
- writer.WriteStartElement("log4j", "event", "log4net");
-#else
- writer.WriteStartElement("log4j:event");
-#endif
+ writer.WriteStartElement("log4j:event", "log4j", "event", "log4net");
writer.WriteAttributeString("logger", loggingEvent.LoggerName);
// Calculate the timestamp as the number of milliseconds since january 1970
@@ -191,28 +174,20 @@
writer.WriteAttributeString("thread", loggingEvent.ThreadName);
// Append the message text
-#if NETSTANDARD
- writer.WriteStartElement("log4j", "message", "log4net");
-#else
- writer.WriteStartElement("log4j:message");
-#endif
- Transform.WriteEscapedXmlString(writer, loggingEvent.RenderedMessage, this.InvalidCharReplacement);
+ writer.WriteStartElement("log4j:message", "log4j", "message", "log4net");
+ Transform.WriteEscapedXmlString(writer, loggingEvent.RenderedMessage, InvalidCharReplacement);
writer.WriteEndElement();
object ndcObj = loggingEvent.LookupProperty("NDC");
- if (ndcObj != null)
+ if (ndcObj is not null)
{
- string valueStr = loggingEvent.Repository.RendererMap.FindAndRender(ndcObj);
+ string? valueStr = loggingEvent.Repository.RendererMap.FindAndRender(ndcObj);
- if (valueStr != null && valueStr.Length > 0)
+ if (valueStr is not null && valueStr.Length > 0)
{
// Append the NDC text
-#if NETSTANDARD
- writer.WriteStartElement("log4j", "NDC", "log4net");
-#else
- writer.WriteStartElement("log4j:NDC");
-#endif
- Transform.WriteEscapedXmlString(writer, valueStr, this.InvalidCharReplacement);
+ writer.WriteStartElement("log4j:NDC", "log4j", "NDC", "log4net");
+ Transform.WriteEscapedXmlString(writer, valueStr, InvalidCharReplacement);
writer.WriteEndElement();
}
}
@@ -221,19 +196,11 @@
PropertiesDictionary properties = loggingEvent.GetProperties();
if (properties.Count > 0)
{
-#if NETSTANDARD
- writer.WriteStartElement("log4j", "properties", "log4net");
-#else
- writer.WriteStartElement("log4j:properties");
-#endif
- foreach (System.Collections.DictionaryEntry entry in properties)
+ writer.WriteStartElement("log4j:properties", "log4j", "properties", "log4net");
+ foreach (KeyValuePair<string, object?> entry in properties)
{
-#if NETSTANDARD
- writer.WriteStartElement("log4j", "data", "log4net");
-#else
- writer.WriteStartElement("log4j:data");
-#endif
- writer.WriteAttributeString("name", (string)entry.Key);
+ writer.WriteStartElement("log4j:data", "log4j", "data", "log4net");
+ writer.WriteAttributeString("name", entry.Key);
// Use an ObjectRenderer to convert the object to a string
string valueStr = loggingEvent.Repository.RendererMap.FindAndRender(entry.Value);
@@ -248,24 +215,16 @@
if (exceptionStr != null && exceptionStr.Length > 0)
{
// Append the stack trace line
-#if NETSTANDARD
- writer.WriteStartElement("log4j", "throwable", "log4net");
-#else
- writer.WriteStartElement("log4j:throwable");
-#endif
- Transform.WriteEscapedXmlString(writer, exceptionStr, this.InvalidCharReplacement);
+ writer.WriteStartElement("log4j:throwable", "log4j", "data", "log4net");
+ Transform.WriteEscapedXmlString(writer, exceptionStr, InvalidCharReplacement);
writer.WriteEndElement();
}
if (LocationInfo)
{
- LocationInfo locationInfo = loggingEvent.LocationInformation;
+ LocationInfo? locationInfo = loggingEvent.LocationInformation;
-#if NETSTANDARD
- writer.WriteStartElement("log4j", "locationInfo", "log4net");
-#else
- writer.WriteStartElement("log4j:locationInfo");
-#endif
+ writer.WriteStartElement("log4j:locationInfo", "log4j", "locationInfo", "log4net");
writer.WriteAttributeString("class", locationInfo.ClassName);
writer.WriteAttributeString("method", locationInfo.MethodName);
writer.WriteAttributeString("file", locationInfo.FileName);
@@ -276,5 +235,4 @@
writer.WriteEndElement();
}
}
-}
-
+}
\ No newline at end of file
diff --git a/src/log4net/Log4netAssemblyInfo.cs b/src/log4net/Log4netAssemblyInfo.cs
deleted file mode 100644
index 78f1a01..0000000
--- a/src/log4net/Log4netAssemblyInfo.cs
+++ /dev/null
@@ -1,96 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-namespace log4net {
-
- /// <summary>
- /// Provides information about the environment the assembly has
- /// been built for.
- /// </summary>
- public sealed class AssemblyInfo {
- /// <summary>Version of the assembly</summary>
- public const string Version = "2.0.9";
-
- /// <summary>Version of the framework targeted</summary>
-#if NET_1_1
- public const decimal TargetFrameworkVersion = 1.1M;
-#elif NET_4_5
- public const decimal TargetFrameworkVersion = 4.5M;
-#elif NET_4_0 || MONO_4_0
- public const decimal TargetFrameworkVersion = 4.5M;
-#elif FRAMEWORK_4_0_OR_ABOVE
- public const decimal TargetFrameworkVersion = 4.0M;
-#elif MONO_3_5
- public const decimal TargetFrameworkVersion = 3.5M;
-#elif NET_2_0 || NETCF_2_0 || MONO_2_0
-#if !CLIENT_PROFILE
- public const decimal TargetFrameworkVersion = 2.0M;
-#else
- public const decimal TargetFrameworkVersion = 3.5M;
-#endif // Client Profile
-#else
- public const decimal TargetFrameworkVersion = 1.0M;
-#endif
-
- /// <summary>Type of framework targeted</summary>
-#if CLI
- public const string TargetFramework = "CLI Compatible Frameworks";
-#elif NET
- public const string TargetFramework = ".NET Framework";
-#elif NETCF
- public const string TargetFramework = ".NET Compact Framework";
-#elif MONO
- public const string TargetFramework = "Mono";
-#elif SSCLI
- public const string TargetFramework = "Shared Source CLI";
-#elif NETSTANDARD1_3
- public const string TargetFramework = ".NET Core";
-#else
- public const string TargetFramework = "Unknown";
-#endif
-
- /// <summary>Does it target a client profile?</summary>
-#if !CLIENT_PROFILE
- public const bool ClientProfile = false;
-#else
- public const bool ClientProfile = true;
-#endif
-
- /// <summary>
- /// Identifies the version and target for this assembly.
- /// </summary>
- public static string Info {
- get {
- return string.Format("Apache log4net version {0} compiled for {1}{2} {3}",
- Version, TargetFramework,
- /* Can't use
- ClientProfile && true ? " Client Profile" :
- or the compiler whines about unreachable expressions
- */
-#if !CLIENT_PROFILE
- string.Empty,
-#else
- " Client Profile",
-#endif
- TargetFrameworkVersion);
- }
- }
- }
-
-}
diff --git a/src/log4net/LogManager.cs b/src/log4net/LogManager.cs
index 0eb25ce..c78b7f0 100644
--- a/src/log4net/LogManager.cs
+++ b/src/log4net/LogManager.cs
@@ -19,7 +19,7 @@
using System;
using System.Reflection;
-
+using log4net.Appender;
using log4net.Core;
using log4net.Repository;
@@ -55,25 +55,8 @@
/// <seealso cref="ILog"/>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
- public sealed class LogManager
+ public static class LogManager
{
- #region Private Instance Constructors
-
- /// <summary>
- /// Initializes a new instance of the <see cref="LogManager" /> class.
- /// </summary>
- /// <remarks>
- /// Uses a private access modifier to prevent instantiation of this class.
- /// </remarks>
- private LogManager()
- {
- }
-
- #endregion Private Instance Constructors
-
- #region Type Specific Manager Methods
-
-#if !NETSTANDARD1_3 // Excluded because GetCallingAssembly() is not available in CoreFX (https://github.com/dotnet/corefx/issues/2221).
/// <overloads>Returns the named logger if it exists.</overloads>
/// <summary>
/// Returns the named logger if it exists.
@@ -86,7 +69,7 @@
/// </remarks>
/// <param name="name">The fully qualified logger name to look for.</param>
/// <returns>The logger found, or <c>null</c> if no logger could be found.</returns>
- public static ILog Exists(string name)
+ public static ILog? Exists(string name)
{
return Exists(Assembly.GetCallingAssembly(), name);
}
@@ -126,7 +109,6 @@
{
return GetLogger(Assembly.GetCallingAssembly(), name);
}
-#endif // !NETSTANDARD1_3
/// <summary>
/// Returns the named logger if it exists.
@@ -144,7 +126,7 @@
/// The logger found, or <c>null</c> if the logger doesn't exist in the specified
/// repository.
/// </returns>
- public static ILog Exists(string repository, string name)
+ public static ILog? Exists(string repository, string name)
{
return WrapLogger(LoggerManager.Exists(repository, name));
}
@@ -159,13 +141,13 @@
/// <c>null</c>.
/// </para>
/// </remarks>
- /// <param name="repositoryAssembly">The assembly to use to lookup the repository.</param>
+ /// <param name="repositoryAssembly">The assembly to use to look up the repository.</param>
/// <param name="name">The fully qualified logger name to look for.</param>
/// <returns>
/// The logger, or <c>null</c> if the logger doesn't exist in the specified
/// assembly's repository.
/// </returns>
- public static ILog Exists(Assembly repositoryAssembly, string name)
+ public static ILog? Exists(Assembly repositoryAssembly, string name)
{
return WrapLogger(LoggerManager.Exists(repositoryAssembly, name));
}
@@ -186,7 +168,7 @@
/// <summary>
/// Returns all the currently defined loggers in the specified assembly's repository.
/// </summary>
- /// <param name="repositoryAssembly">The assembly to use to lookup the repository.</param>
+ /// <param name="repositoryAssembly">The assembly to use to look up the repository.</param>
/// <remarks>
/// The root logger is <b>not</b> included in the returned array.
/// </remarks>
@@ -217,7 +199,7 @@
/// <returns>The logger with the name specified.</returns>
public static ILog GetLogger(string repository, string name)
{
- return WrapLogger(LoggerManager.GetLogger(repository, name));
+ return WrapLogger(LoggerManager.GetLogger(repository, name))!;
}
/// <summary>
@@ -236,12 +218,12 @@
/// log4net.
/// </para>
/// </remarks>
- /// <param name="repositoryAssembly">The assembly to use to lookup the repository.</param>
+ /// <param name="repositoryAssembly">The assembly to use to look up the repository.</param>
/// <param name="name">The name of the logger to retrieve.</param>
/// <returns>The logger with the name specified.</returns>
public static ILog GetLogger(Assembly repositoryAssembly, string name)
{
- return WrapLogger(LoggerManager.GetLogger(repositoryAssembly, name));
+ return WrapLogger(LoggerManager.GetLogger(repositoryAssembly, name))!;
}
/// <summary>
@@ -254,11 +236,7 @@
/// <returns>The logger with the name specified.</returns>
public static ILog GetLogger(Type type)
{
-#if NETSTANDARD1_3
- return GetLogger(type.GetTypeInfo().Assembly, type.FullName);
-#else
- return GetLogger(Assembly.GetCallingAssembly(), type.FullName);
-#endif
+ return GetLogger(Assembly.GetCallingAssembly(), type.FullName!);
}
/// <summary>
@@ -272,7 +250,7 @@
/// <returns>The logger with the name specified.</returns>
public static ILog GetLogger(string repository, Type type)
{
- return WrapLogger(LoggerManager.GetLogger(repository, type));
+ return WrapLogger(LoggerManager.GetLogger(repository, type))!;
}
/// <summary>
@@ -281,18 +259,14 @@
/// <remarks>
/// Gets the logger for the fully qualified name of the type specified.
/// </remarks>
- /// <param name="repositoryAssembly">The assembly to use to lookup the repository.</param>
+ /// <param name="repositoryAssembly">The assembly to use to look up the repository.</param>
/// <param name="type">The full name of <paramref name="type"/> will be used as the name of the logger to retrieve.</param>
/// <returns>The logger with the name specified.</returns>
public static ILog GetLogger(Assembly repositoryAssembly, Type type)
{
- return WrapLogger(LoggerManager.GetLogger(repositoryAssembly, type));
+ return WrapLogger(LoggerManager.GetLogger(repositoryAssembly, type))!;
}
- #endregion Type Specific Manager Methods
-
- #region Domain & Repository Manager Methods
-
/// <summary>
/// Shuts down the log4net system.
/// </summary>
@@ -307,7 +281,7 @@
/// Otherwise, pending logging events might be lost.
/// </para>
/// <para>The <c>shutdown</c> method is careful to close nested
- /// appenders before closing regular appenders. This is allows
+ /// appenders before closing regular appenders. This allows
/// configurations where a regular appender is attached to a logger
/// and again to a nested appender.
/// </para>
@@ -317,7 +291,6 @@
LoggerManager.Shutdown();
}
-#if !NETSTANDARD1_3
/// <overloads>Shutdown a logger repository.</overloads>
/// <summary>
/// Shuts down the default repository.
@@ -332,7 +305,7 @@
/// Otherwise, pending logging events might be lost.
/// </para>
/// <para>The <c>shutdown</c> method is careful to close nested
- /// appenders before closing regular appenders. This is allows
+ /// appenders before closing regular appenders. This allows
/// configurations where a regular appender is attached to a logger
/// and again to a nested appender.
/// </para>
@@ -341,7 +314,6 @@
{
ShutdownRepository(Assembly.GetCallingAssembly());
}
-#endif
/// <summary>
/// Shuts down the repository for the repository specified.
@@ -357,12 +329,12 @@
/// Otherwise, pending logging events might be lost.
/// </para>
/// <para>The <c>shutdown</c> method is careful to close nested
- /// appenders before closing regular appenders. This is allows
+ /// appenders before closing regular appenders. This allows
/// configurations where a regular appender is attached to a logger
/// and again to a nested appender.
/// </para>
/// </remarks>
- /// <param name="repository">The repository to shutdown.</param>
+ /// <param name="repository">The repository to shut down.</param>
public static void ShutdownRepository(string repository)
{
LoggerManager.ShutdownRepository(repository);
@@ -384,18 +356,17 @@
/// </para>
/// <para>
/// The <c>shutdown</c> method is careful to close nested
- /// appenders before closing regular appenders. This is allows
+ /// appenders before closing regular appenders. This allows
/// configurations where a regular appender is attached to a logger
/// and again to a nested appender.
/// </para>
/// </remarks>
- /// <param name="repositoryAssembly">The assembly to use to lookup the repository.</param>
+ /// <param name="repositoryAssembly">The assembly to use to look up the repository.</param>
public static void ShutdownRepository(Assembly repositoryAssembly)
{
LoggerManager.ShutdownRepository(repositoryAssembly);
}
-#if !NETSTANDARD1_3
/// <overloads>Reset the configuration of a repository</overloads>
/// <summary>
/// Resets all values contained in this repository instance to their defaults.
@@ -414,7 +385,6 @@
{
ResetConfiguration(Assembly.GetCallingAssembly());
}
-#endif
/// <summary>
/// Resets all values contained in this repository instance to their defaults.
@@ -448,13 +418,12 @@
/// message disabling is set to its default "off" value.
/// </para>
/// </remarks>
- /// <param name="repositoryAssembly">The assembly to use to lookup the repository to reset.</param>
+ /// <param name="repositoryAssembly">The assembly to use to look up the repository to reset.</param>
public static void ResetConfiguration(Assembly repositoryAssembly)
{
LoggerManager.ResetConfiguration(repositoryAssembly);
}
-#if !NETSTANDARD1_3
/// <overloads>Get the logger repository.</overloads>
/// <summary>
/// Returns the default <see cref="ILoggerRepository"/> instance.
@@ -471,7 +440,6 @@
{
return GetRepository(Assembly.GetCallingAssembly());
}
-#endif
/// <summary>
/// Returns the default <see cref="ILoggerRepository"/> instance.
@@ -500,14 +468,13 @@
/// by the <paramref name="repositoryAssembly"/> argument.
/// </para>
/// </remarks>
- /// <param name="repositoryAssembly">The assembly to use to lookup the repository.</param>
+ /// <param name="repositoryAssembly">The assembly to use to look up the repository.</param>
[Obsolete("Use GetRepository instead of GetLoggerRepository")]
public static ILoggerRepository GetLoggerRepository(Assembly repositoryAssembly)
{
return GetRepository(repositoryAssembly);
}
-#if !NETSTANDARD1_3
/// <overloads>Get a logger repository.</overloads>
/// <summary>
/// Returns the default <see cref="ILoggerRepository"/> instance.
@@ -523,7 +490,6 @@
{
return GetRepository(Assembly.GetCallingAssembly());
}
-#endif
/// <summary>
/// Returns the default <see cref="ILoggerRepository"/> instance.
@@ -551,13 +517,12 @@
/// by the <paramref name="repositoryAssembly"/> argument.
/// </para>
/// </remarks>
- /// <param name="repositoryAssembly">The assembly to use to lookup the repository.</param>
+ /// <param name="repositoryAssembly">The assembly to use to look up the repository.</param>
public static ILoggerRepository GetRepository(Assembly repositoryAssembly)
{
return LoggerManager.GetRepository(repositoryAssembly);
}
-#if !NETSTANDARD1_3
/// <overloads>Create a domain</overloads>
/// <summary>
/// Creates a repository with the specified repository type.
@@ -601,7 +566,6 @@
{
return CreateRepository(Assembly.GetCallingAssembly(), repositoryType);
}
-#endif
/// <summary>
/// Creates a repository with the specified name.
@@ -754,37 +718,26 @@
/// <summary>
/// Flushes logging events buffered in all configured appenders in the default repository.
/// </summary>
- /// <param name="millisecondsTimeout">The maximum time in milliseconds to wait for logging events from asycnhronous appenders to be flushed.</param>
+ /// <param name="millisecondsTimeout">The maximum time in milliseconds to wait for logging events from asynchronous appenders to be flushed.</param>
/// <returns><c>True</c> if all logging events were flushed successfully, else <c>false</c>.</returns>
public static bool Flush(int millisecondsTimeout)
{
-#if !NETSTANDARD1_3 // Excluded because GetCallingAssembly() is not available in CoreFX (https://github.com/dotnet/corefx/issues/2221).
- Appender.IFlushable flushableRepository = LoggerManager.GetRepository(Assembly.GetCallingAssembly()) as Appender.IFlushable;
- if (flushableRepository == null)
+ if (LoggerManager.GetRepository(Assembly.GetCallingAssembly()) is not IFlushable flushableRepository)
{
return false;
}
- else
- {
- return flushableRepository.Flush(millisecondsTimeout);
- }
-#else
- return false;
-#endif
+
+ return flushableRepository.Flush(millisecondsTimeout);
}
- #endregion Domain & Repository Manager Methods
-
- #region Extension Handlers
-
/// <summary>
/// Looks up the wrapper object for the logger specified.
/// </summary>
/// <param name="logger">The logger to get the wrapper for.</param>
/// <returns>The wrapper for the logger specified.</returns>
- private static ILog WrapLogger(ILogger logger)
+ private static ILog? WrapLogger(ILogger? logger)
{
- return (ILog)s_wrapperMap.GetWrapper(logger);
+ return (ILog?)s_wrapperMap.GetWrapper(logger);
}
/// <summary>
@@ -813,15 +766,9 @@
return new LogImpl(logger);
}
- #endregion
-
- #region Private Static Fields
-
/// <summary>
/// The wrapper map to use to hold the <see cref="LogImpl"/> objects.
/// </summary>
- private static readonly WrapperMap s_wrapperMap = new WrapperMap(new WrapperCreationHandler(WrapperCreationHandler));
-
- #endregion Private Static Fields
+ private static readonly WrapperMap s_wrapperMap = new(WrapperCreationHandler);
}
-}
+}
\ No newline at end of file
diff --git a/src/log4net/LogicalThreadContext.cs b/src/log4net/LogicalThreadContext.cs
index 79da8fc..f19e230 100644
--- a/src/log4net/LogicalThreadContext.cs
+++ b/src/log4net/LogicalThreadContext.cs
@@ -17,11 +17,15 @@
//
#endregion
-// .NET Compact Framework 1.0 has no support for System.Runtime.Remoting.Messaging.CallContext
-#if !NETCF
-
using log4net.Util;
+#if NET462_OR_GREATER
+using CallContext = System.Runtime.Remoting.Messaging.CallContext;
+#endif
+#if NETSTANDARD2_0_OR_GREATER
+using CallContext = System.Threading.AsyncLocal<log4net.Util.PropertiesDictionary>;
+#endif
+
namespace log4net
{
/// <summary>
@@ -29,15 +33,14 @@
/// </summary>
/// <remarks>
/// <para>
- /// The <c>LogicalThreadContext</c> provides a location for <see cref="System.Runtime.Remoting.Messaging.CallContext"/> specific debugging
+ /// The <c>LogicalThreadContext</c> provides a location for <see cref="CallContext"/> specific debugging
/// information to be stored.
/// The <c>LogicalThreadContext</c> properties override any <see cref="ThreadContext"/> or <see cref="GlobalContext"/>
/// properties with the same name.
/// </para>
/// <para>
/// For .NET Standard 1.3 this class uses
- /// System.Threading.AsyncLocal rather than <see
- /// cref="System.Runtime.Remoting.Messaging.CallContext"/>.
+ /// System.Threading.AsyncLocal rather than <see cref="CallContext"/>.
/// </para>
/// <para>
/// The Logical Thread Context has a properties map and a stack.
@@ -52,10 +55,10 @@
/// when a server handles multiple clients near-simultaneously.
/// </para>
/// <para>
- /// The Logical Thread Context is managed on a per <see cref="System.Runtime.Remoting.Messaging.CallContext"/> basis.
+ /// The Logical Thread Context is managed on a per <see cref="CallContext"/> basis.
/// </para>
/// <para>
- /// The <see cref="System.Runtime.Remoting.Messaging.CallContext"/> requires a link time
+ /// The <see cref="CallContext"/> requires a link time
/// <see cref="System.Security.Permissions.SecurityPermission"/> for the
/// <see cref="System.Security.Permissions.SecurityPermissionFlag.Infrastructure"/>.
/// If the calling code does not have this permission then this context will be disabled.
@@ -79,75 +82,22 @@
/// </example>
/// <threadsafety static="true" instance="true" />
/// <author>Nicko Cadell</author>
- public sealed class LogicalThreadContext
+ public static class LogicalThreadContext
{
- #region Private Instance Constructors
-
- /// <summary>
- /// Private Constructor.
- /// </summary>
- /// <remarks>
- /// <para>
- /// Uses a private access modifier to prevent instantiation of this class.
- /// </para>
- /// </remarks>
- private LogicalThreadContext()
- {
- }
-
- #endregion Private Instance Constructors
-
- #region Public Static Properties
-
/// <summary>
/// The thread properties map
/// </summary>
- /// <value>
- /// The thread properties map
- /// </value>
/// <remarks>
/// <para>
/// The <c>LogicalThreadContext</c> properties override any <see cref="ThreadContext"/>
/// or <see cref="GlobalContext"/> properties with the same name.
/// </para>
/// </remarks>
- public static LogicalThreadContextProperties Properties
- {
- get { return s_properties; }
- }
+ public static LogicalThreadContextProperties Properties { get; } = new();
/// <summary>
- /// The thread stacks
- /// </summary>
- /// <value>
- /// stack map
- /// </value>
- /// <remarks>
- /// <para>
/// The logical thread stacks.
- /// </para>
- /// </remarks>
- public static LogicalThreadContextStacks Stacks
- {
- get { return s_stacks; }
- }
-
- #endregion Public Static Properties
-
- #region Private Static Fields
-
- /// <summary>
- /// The thread context properties instance
/// </summary>
- private static readonly LogicalThreadContextProperties s_properties = new LogicalThreadContextProperties();
-
- /// <summary>
- /// The thread context stacks instance
- /// </summary>
- private static readonly LogicalThreadContextStacks s_stacks = new LogicalThreadContextStacks(s_properties);
-
- #endregion Private Static Fields
+ public static LogicalThreadContextStacks Stacks { get; } = new(Properties);
}
-}
-
-#endif
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/src/log4net/NDC.cs b/src/log4net/NDC.cs
index c1ded53..ea939c9 100644
--- a/src/log4net/NDC.cs
+++ b/src/log4net/NDC.cs
@@ -20,10 +20,6 @@
using System;
using System.Collections;
-#if NETCF_1_0
-using Stack = log4net.Util.ThreadContextStack.Stack;
-#endif
-
namespace log4net
{
/// <summary>
@@ -48,7 +44,7 @@
/// come into play.
/// </para>
/// <para>
- /// Note that NDCs are managed on a per thread basis. The NDC class
+ /// Note that NDCs are managed on a per-thread basis. The NDC class
/// is made up of static methods that operate on the context of the
/// calling thread.
/// </para>
@@ -66,24 +62,8 @@
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
/*[Obsolete("NDC has been replaced by ThreadContext.Stacks")]*/
- public sealed class NDC
+ public static class NDC
{
- #region Private Instance Constructors
-
- /// <summary>
- /// Initializes a new instance of the <see cref="NDC" /> class.
- /// </summary>
- /// <remarks>
- /// Uses a private access modifier to prevent instantiation of this class.
- /// </remarks>
- private NDC()
- {
- }
-
- #endregion Private Instance Constructors
-
- #region Public Static Properties
-
/// <summary>
/// Gets the current context depth.
/// </summary>
@@ -110,10 +90,6 @@
get { return ThreadContext.Stacks["NDC"].Count; }
}
- #endregion Public Static Properties
-
- #region Public Static Methods
-
/// <summary>
/// Clears all the contextual information held on the current thread.
/// </summary>
@@ -205,7 +181,7 @@
/// </para>
/// </remarks>
/*[Obsolete("NDC has been replaced by ThreadContext.Stacks")]*/
- public static string Pop()
+ public static string? Pop()
{
return ThreadContext.Stacks["NDC"].Pop();
}
@@ -328,7 +304,7 @@
{
if (maxDepth >= 0)
{
- log4net.Util.ThreadContextStack stack = ThreadContext.Stacks["NDC"];
+ Util.ThreadContextStack stack = ThreadContext.Stacks["NDC"];
if (maxDepth == 0)
{
@@ -343,7 +319,5 @@
}
}
}
-
- #endregion Public Static Methods
}
}
diff --git a/src/log4net/NetStandardCompatibilityExtensions.cs b/src/log4net/NetStandardCompatibilityExtensions.cs
deleted file mode 100644
index b9bdc60..0000000
--- a/src/log4net/NetStandardCompatibilityExtensions.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-#region Apache License
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you 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.
-//
-#endregion
-
-#if NETSTANDARD1_3
-
-using System;
-using System.Globalization;
-using System.IO;
-using System.Linq;
-using System.Net;
-using System.Net.Sockets;
-using System.Reflection;
-using System.Threading;
-using System.Xml;
-
-namespace log4net
-{
- internal static class NetStandardCompatibilityExtensions
- {
- public static void Close(this Mutex mutex) => mutex.Dispose();
- public static void Close(this Socket socket) => socket.Dispose();
- public static void Close(this Stream stream) => stream.Dispose();
- public static void Close(this StreamWriter streamWriter) => streamWriter.Dispose();
- public static void Close(this StreamReader streamReader) => streamReader.Dispose();
- public static void Close(this UdpClient client) => client.Dispose();
- public static void Close(this WebResponse response) => response.Dispose();
- public static void Close(this XmlWriter xmlWriter) => xmlWriter.Dispose();
- public static void Close(this TextWriter textWriter) => textWriter.Dispose();
-
- public static Attribute[] GetCustomAttributes(this Type type, Type other, bool inherit) => type.GetTypeInfo().GetCustomAttributes(other, inherit).Cast<Attribute>().ToArray();
- public static bool IsAssignableFrom(this Type type, Type other) => type.GetTypeInfo().IsAssignableFrom(other.GetTypeInfo());
- public static bool IsSubclassOf(this Type type, Type t) => type.GetTypeInfo().IsSubclassOf(t);
-
- public static string ToLower(this string s, CultureInfo cultureInfo) => cultureInfo.TextInfo.ToLower(s);
- public static string ToUpper(this string s, CultureInfo cultureInfo) => cultureInfo.TextInfo.ToUpper(s);
- }
-}
-
-#endif
diff --git a/src/log4net/ObjectRenderer/RendererMap.cs b/src/log4net/ObjectRenderer/RendererMap.cs
index 0e4284d..4d5b025 100644
--- a/src/log4net/ObjectRenderer/RendererMap.cs
+++ b/src/log4net/ObjectRenderer/RendererMap.cs
@@ -19,26 +19,22 @@
using System;
using System.IO;
-#if NETSTANDARD1_3
-using System.Reflection;
-#endif
-using System.Collections;
+using System.Collections.Concurrent;
using log4net.Util;
+#nullable enable
+
namespace log4net.ObjectRenderer
{
/// <summary>
- /// Map class objects to an <see cref="IObjectRenderer"/>.
+ /// Maps types to <see cref="IObjectRenderer"/> instances for types that require custom
+ /// rendering.
/// </summary>
/// <remarks>
/// <para>
- /// Maintains a mapping between types that require special
- /// rendering and the <see cref="IObjectRenderer"/> that
- /// is used to render them.
- /// </para>
- /// <para>
/// The <see cref="M:FindAndRender(object)"/> method is used to render an
- /// <c>object</c> using the appropriate renderers defined in this map.
+ /// <c>object</c> using the appropriate renderers defined in this map,
+ /// using a default renderer if no custom renderer is defined for a type.
/// </para>
/// </remarks>
/// <author>Nicko Cadell</author>
@@ -47,20 +43,16 @@
{
private static readonly Type declaringType = typeof(RendererMap);
- #region Member Variables
+ private readonly ConcurrentDictionary<Type, IObjectRenderer> m_map = new();
+ private readonly ConcurrentDictionary<Type, IObjectRenderer> m_cache = new();
- private readonly Hashtable m_map = new();
- private readonly Hashtable m_cache = new();
-
- private static IObjectRenderer s_defaultRenderer = new DefaultRenderer();
-
- #endregion
+ private static readonly IObjectRenderer s_defaultRenderer = new DefaultRenderer();
/// <summary>
- /// Render <paramref name="obj"/> using the appropriate renderer.
+ /// Renders <paramref name="obj"/> using the appropriate renderer.
/// </summary>
/// <param name="obj">the object to render to a string</param>
- /// <returns>the object rendered as a string</returns>
+ /// <returns>The object rendered as a string.</returns>
/// <remarks>
/// <para>
/// This is a convenience method used to render an object to a string.
@@ -71,8 +63,7 @@
public string FindAndRender(object obj)
{
// Optimisation for strings
- string strData = obj as String;
- if (strData != null)
+ if (obj is string strData)
{
return strData;
}
@@ -96,17 +87,16 @@
/// as a <see cref="string"/>.
/// </para>
/// </remarks>
- public void FindAndRender(object obj, TextWriter writer)
+ public void FindAndRender(object? obj, TextWriter writer)
{
- if (obj == null)
+ if (obj is null)
{
writer.Write(SystemInfo.NullText);
}
else
{
// Optimisation for strings
- string str = obj as string;
- if (str != null)
+ if (obj is string str)
{
writer.Write(str);
}
@@ -120,31 +110,24 @@
catch (Exception ex)
{
// Exception rendering the object
- LogLog.Error(declaringType, "Exception while rendering object of type [" + obj.GetType().FullName + "]", ex);
+ LogLog.Error(declaringType, $"Exception while rendering object of type [{obj.GetType().FullName}]", ex);
// return default message
- string objectTypeName = "";
- if (obj != null && obj.GetType() != null)
+ string objectTypeName = obj.GetType().FullName ?? string.Empty;
+
+ writer.Write($"<log4net.Error>Exception rendering object type [{objectTypeName}]");
+
+ string? exceptionText = null;
+ try
{
- objectTypeName = obj.GetType().FullName;
+ exceptionText = ex.ToString();
+ }
+ catch
+ {
+ // Ignore exception
}
- writer.Write("<log4net.Error>Exception rendering object type [" + objectTypeName + "]");
- if (ex != null)
- {
- string exceptionText = null;
-
- try
- {
- exceptionText = ex.ToString();
- }
- catch
- {
- // Ignore exception
- }
-
- writer.Write("<stackTrace>" + exceptionText + "</stackTrace>");
- }
+ writer.Write($"<stackTrace>{exceptionText}</stackTrace>");
writer.Write("</log4net.Error>");
}
}
@@ -152,9 +135,9 @@
}
/// <summary>
- /// Gets the renderer for the specified object type
+ /// Gets the renderer for the specified object type.
/// </summary>
- /// <param name="obj">the object to lookup the renderer for</param>
+ /// <param name="obj">The object for which to look up the renderer.</param>
/// <returns>the renderer for <paramref name="obj"/></returns>
/// <remarks>
/// <param>
@@ -165,49 +148,32 @@
/// with the type of the object parameter.
/// </param>
/// </remarks>
- public IObjectRenderer Get(Object obj)
+ public IObjectRenderer? Get(object? obj)
{
- if (obj == null)
+ if (obj is null)
{
return null;
}
- else
- {
- return Get(obj.GetType());
- }
+
+ return Get(obj.GetType());
}
/// <summary>
/// Gets the renderer for the specified type
/// </summary>
- /// <param name="type">the type to lookup the renderer for</param>
- /// <returns>the renderer for the specified type</returns>
- /// <remarks>
- /// <para>
- /// Returns the renderer for the specified type.
- /// If no specific renderer has been defined the
- /// <see cref="DefaultRenderer"/> will be returned.
- /// </para>
- /// </remarks>
+ /// <param name="type">the type to look up the renderer for</param>
+ /// <returns>The renderer for the specified type, or <see cref="DefaultRenderer"/> if no specific renderer has been defined.</returns>
public IObjectRenderer Get(Type type)
{
- if (type == null)
+ if (type is null)
{
- throw new ArgumentNullException("type");
+ throw new ArgumentNullException(nameof(type));
}
- IObjectRenderer result = null;
-
// Check cache
- result = (IObjectRenderer)m_cache[type];
-
- if (result == null)
+ if (!m_cache.TryGetValue(type, out IObjectRenderer? result))
{
-#if NETSTANDARD1_3
- for (Type cur = type; cur != null; cur = cur.GetTypeInfo().BaseType)
-#else
- for (Type cur = type; cur != null; cur = cur.BaseType)
-#endif
+ for (Type? cur = type; cur != null; cur = cur.BaseType)
{
// Search the type's interfaces
result = SearchTypeAndInterfaces(cur);
@@ -218,116 +184,71 @@
}
// if not set then use the default renderer
- if (result == null)
- {
- result = s_defaultRenderer;
- }
+ result ??= s_defaultRenderer;
// Add to cache
- lock (m_cache)
- {
- m_cache[type] = result;
- }
+ m_cache.TryAdd(type, result);
}
return result;
}
/// <summary>
- /// Internal function to recursively search interfaces
+ /// Recursively searches interfaces.
/// </summary>
- /// <param name="type">the type to lookup the renderer for</param>
- /// <returns>the renderer for the specified type</returns>
- private IObjectRenderer SearchTypeAndInterfaces(Type type)
+ /// <param name="type">The type for which to look up the renderer.</param>
+ /// <returns>The renderer for the specified type, or <c>null</c> if not found.</returns>
+ private IObjectRenderer? SearchTypeAndInterfaces(Type type)
{
- IObjectRenderer r = (IObjectRenderer)m_map[type];
- if (r != null)
+ if (m_map.TryGetValue(type, out IObjectRenderer? r))
{
return r;
}
- else
+
+ foreach (Type t in type.GetInterfaces())
{
- foreach (Type t in type.GetInterfaces())
+ r = SearchTypeAndInterfaces(t);
+ if (r != null)
{
- r = SearchTypeAndInterfaces(t);
- if (r != null)
- {
- return r;
- }
+ return r;
}
}
return null;
}
/// <summary>
- /// Get the default renderer instance
+ /// Gets the default renderer instance
/// </summary>
- /// <value>the default renderer</value>
- /// <remarks>
- /// <para>
- /// Get the default renderer
- /// </para>
- /// </remarks>
- public IObjectRenderer DefaultRenderer
- {
- get { return s_defaultRenderer; }
- }
+ public IObjectRenderer DefaultRenderer => s_defaultRenderer;
/// <summary>
- /// Clear the map of renderers
+ /// Clears the map of custom renderers. The <see cref="DefaultRenderer"/>
+ /// is not removed.
/// </summary>
- /// <remarks>
- /// <para>
- /// Clear the custom renderers defined by using
- /// <see cref="Put"/>. The <see cref="DefaultRenderer"/>
- /// cannot be removed.
- /// </para>
- /// </remarks>
public void Clear()
{
- lock (m_map)
- {
- m_map.Clear();
- }
-
- lock (m_cache)
- {
- m_cache.Clear();
- }
+ m_map.Clear();
+ m_cache.Clear();
}
/// <summary>
- /// Register an <see cref="IObjectRenderer"/> for <paramref name="typeToRender"/>.
+ /// Registers an <see cref="IObjectRenderer"/> for <paramref name="typeToRender"/>.
/// </summary>
- /// <param name="typeToRender">the type that will be rendered by <paramref name="renderer"/></param>
- /// <param name="renderer">the renderer for <paramref name="typeToRender"/></param>
- /// <remarks>
- /// <para>
- /// Register an object renderer for a specific source type.
- /// This renderer will be returned from a call to <see cref="M:Get(Type)"/>
- /// specifying the same <paramref name="typeToRender"/> as an argument.
- /// </para>
- /// </remarks>
+ /// <param name="typeToRender">The type that will be rendered by <paramref name="renderer"/>.</param>
+ /// <param name="renderer">The renderer for <paramref name="typeToRender"/>.</param>
public void Put(Type typeToRender, IObjectRenderer renderer)
{
- lock (m_cache)
+ if (typeToRender is null)
{
- m_cache.Clear();
+ throw new ArgumentNullException(nameof(typeToRender));
+ }
+ if (renderer is null)
+ {
+ throw new ArgumentNullException(nameof(renderer));
}
- if (typeToRender == null)
- {
- throw new ArgumentNullException("typeToRender");
- }
- if (renderer == null)
- {
- throw new ArgumentNullException("renderer");
- }
-
- lock (m_map)
- {
- m_map[typeToRender] = renderer;
- }
+ m_cache.Clear();
+ m_map[typeToRender] = renderer;
}
}
}
diff --git a/src/log4net/Plugin/PluginCollection.cs b/src/log4net/Plugin/PluginCollection.cs
index 4019d67..88af41d 100644
--- a/src/log4net/Plugin/PluginCollection.cs
+++ b/src/log4net/Plugin/PluginCollection.cs
@@ -17,22 +17,18 @@
//
#endregion
+using log4net.Util;
using System;
using System.Collections;
namespace log4net.Plugin
{
/// <summary>
- /// A strongly-typed collection of <see cref="IPlugin"/> objects.
+ /// A strongly-typed collection of <see cref="IPlugin"/> objects.
/// </summary>
/// <author>Nicko Cadell</author>
- public class PluginCollection : ICollection, IList, IEnumerable
-#if !NETSTANDARD1_3
- , ICloneable
-#endif
+ public class PluginCollection : ICollection, IList, IEnumerable, ICloneable
{
- #region Interfaces
-
/// <summary>
/// Supports type-safe iteration over a <see cref="PluginCollection"/>.
/// </summary>
@@ -62,19 +58,11 @@
void Reset();
}
- #endregion Interfaces
-
private const int DEFAULT_CAPACITY = 16;
- #region Implementation (data)
-
private IPlugin[] m_array;
- private int m_count = 0;
- private int m_version = 0;
-
- #endregion Implementation (data)
-
- #region Static Wrappers
+ private int m_count;
+ private int m_version;
/// <summary>
/// Creates a read-only wrapper for a <c>PluginCollection</c> instance.
@@ -85,15 +73,14 @@
/// </returns>
public static PluginCollection ReadOnly(PluginCollection list)
{
- if (list == null) throw new ArgumentNullException("list");
+ if (list is null)
+ {
+ throw new ArgumentNullException(nameof(list));
+ }
return new ReadOnlyPluginCollection(list);
}
- #endregion
-
- #region Constructors
-
/// <summary>
/// Initializes a new instance of the <c>PluginCollection</c> class
/// that is empty and has the default initial capacity.
@@ -164,24 +151,16 @@
/// <summary>
/// Allow subclasses to avoid our default constructors
/// </summary>
- /// <param name="tag"></param>
/// <exclude/>
- protected internal PluginCollection(Tag tag)
+ protected internal PluginCollection(Tag _)
{
m_array = null;
}
- #endregion
-
- #region Operations (type-safe ICollection)
-
/// <summary>
/// Gets the number of elements actually contained in the <c>PluginCollection</c>.
/// </summary>
- public virtual int Count
- {
- get { return m_count; }
- }
+ public virtual int Count => m_count;
/// <summary>
/// Copies the entire <c>PluginCollection</c> to a one-dimensional
@@ -190,7 +169,7 @@
/// <param name="array">The one-dimensional <see cref="IPlugin"/> array to copy to.</param>
public virtual void CopyTo(IPlugin[] array)
{
- this.CopyTo(array, 0);
+ CopyTo(array, 0);
}
/// <summary>
@@ -203,7 +182,7 @@
{
if (m_count > array.GetUpperBound(0) + 1 - start)
{
- throw new System.ArgumentException("Destination array was not long enough.");
+ throw new ArgumentException("Destination array was not long enough.");
}
Array.Copy(m_array, 0, array, start, m_count);
@@ -213,25 +192,12 @@
/// Gets a value indicating whether access to the collection is synchronized (thread-safe).
/// </summary>
/// <returns>false, because the backing type is an array, which is never thread-safe.</returns>
- public virtual bool IsSynchronized
- {
- get { return false; }
- }
+ public virtual bool IsSynchronized => false;
/// <summary>
/// Gets an object that can be used to synchronize access to the collection.
/// </summary>
- /// <value>
- /// An object that can be used to synchronize access to the collection.
- /// </value>
- public virtual object SyncRoot
- {
- get { return m_array; }
- }
-
- #endregion
-
- #region Operations (type-safe IList)
+ public virtual object SyncRoot => m_array;
/// <summary>
/// Gets or sets the <see cref="IPlugin"/> at the specified index.
@@ -381,7 +347,7 @@
int i = IndexOf(item);
if (i < 0)
{
- throw new System.ArgumentException("Cannot remove the specified item because it was not found in the specified Collection.");
+ throw new ArgumentException("Cannot remove the specified item because it was not found in the specified Collection.");
}
++m_version;
RemoveAt(i);
@@ -419,23 +385,13 @@
/// Gets a value indicating whether the collection has a fixed size.
/// </summary>
/// <value><c>true</c> if the collection has a fixed size; otherwise, <c>false</c>. The default is <c>false</c>.</value>
- public virtual bool IsFixedSize
- {
- get { return false; }
- }
+ public virtual bool IsFixedSize => false;
/// <summary>
/// Gets a value indicating whether the IList is read-only.
/// </summary>
/// <value><c>true</c> if the collection is read-only; otherwise, <c>false</c>. The default is <c>false</c>.</value>
- public virtual bool IsReadOnly
- {
- get { return false; }
- }
-
- #endregion
-
- #region Operations (type-safe IEnumerable)
+ public virtual bool IsReadOnly => false;
/// <summary>
/// Returns an enumerator that can iterate through the <c>PluginCollection</c>.
@@ -446,10 +402,6 @@
return new Enumerator(this);
}
- #endregion
-
- #region Public helpers (just to mimic some nice features of ArrayList)
-
/// <summary>
/// Gets or sets the number of elements the <c>PluginCollection</c> can contain.
/// </summary>
@@ -458,10 +410,7 @@
/// </value>
public virtual int Capacity
{
- get
- {
- return m_array.Length;
- }
+ get => m_array.Length;
set
{
if (value < m_count)
@@ -548,13 +497,9 @@
/// </summary>
public virtual void TrimToSize()
{
- this.Capacity = m_count;
+ Capacity = m_count;
}
- #endregion
-
- #region Implementation (helpers)
-
/// <exception cref="ArgumentOutOfRangeException">
/// <para><paramref name="i"/> is less than zero.</para>
/// <para>-or-</para>
@@ -575,7 +520,7 @@
int max = (allowEqualEnd) ? (m_count) : (m_count - 1);
if (i < 0 || i > max)
{
- throw log4net.Util.SystemInfo.CreateArgumentOutOfRangeException("i", (object)i, "Index was out of range. Must be non-negative and less than the size of the collection. [" + (object)i + "] Specified argument was out of the range of valid values.");
+ throw SystemInfo.CreateArgumentOutOfRangeException(nameof(i), i, $"Index was out of range. Must be non-negative and less than the size of the collection. [{i}] Specified argument was out of the range of valid values.");
}
}
@@ -587,86 +532,64 @@
newCapacity = min;
}
- this.Capacity = newCapacity;
+ Capacity = newCapacity;
}
- #endregion
-
- #region Implementation (ICollection)
-
void ICollection.CopyTo(Array array, int start)
{
Array.Copy(m_array, 0, array, start, m_count);
}
- #endregion
-
- #region Implementation (IList)
-
object IList.this[int i]
{
- get { return (object)this[i]; }
- set { this[i] = (IPlugin)value; }
+ get => this[i];
+ set => this[i] = (IPlugin)value;
}
int IList.Add(object x)
{
- return this.Add((IPlugin)x);
+ return Add((IPlugin)x);
}
bool IList.Contains(object x)
{
- return this.Contains((IPlugin)x);
+ return Contains((IPlugin)x);
}
int IList.IndexOf(object x)
{
- return this.IndexOf((IPlugin)x);
+ return IndexOf((IPlugin)x);
}
void IList.Insert(int pos, object x)
{
- this.Insert(pos, (IPlugin)x);
+ Insert(pos, (IPlugin)x);
}
void IList.Remove(object x)
{
- this.Remove((IPlugin)x);
+ Remove((IPlugin)x);
}
void IList.RemoveAt(int pos)
{
- this.RemoveAt(pos);
+ RemoveAt(pos);
}
- #endregion
-
- #region Implementation (IEnumerable)
-
IEnumerator IEnumerable.GetEnumerator()
{
- return (IEnumerator)(this.GetEnumerator());
+ return (IEnumerator)GetEnumerator();
}
- #endregion Implementation (IEnumerable)
-
- #region Nested enumerator class
-
/// <summary>
/// Supports simple iteration over a <see cref="PluginCollection"/>.
/// </summary>
/// <exclude/>
private sealed class Enumerator : IEnumerator, IPluginCollectionEnumerator
{
- #region Implementation (data)
-
private readonly PluginCollection m_collection;
private int m_index;
- private int m_version;
-
- #endregion Implementation (data)
-
- #region Construction
+ private readonly int m_version;
/// <summary>
/// Initializes a new instance of the <c>Enumerator</c> class.
@@ -679,20 +602,13 @@
m_version = tc.m_version;
}
- #endregion
-
- #region Operations (type-safe IEnumerator)
-
/// <summary>
/// Gets the current element in the collection.
/// </summary>
/// <value>
/// The current element in the collection.
/// </value>
- public IPlugin Current
- {
- get { return m_collection[m_index]; }
- }
+ public IPlugin Current => m_collection[m_index];
/// <summary>
/// Advances the enumerator to the next element in the collection.
@@ -708,7 +624,7 @@
{
if (m_version != m_collection.m_version)
{
- throw new System.InvalidOperationException("Collection was modified; enumeration operation may not execute.");
+ throw new InvalidOperationException("Collection was modified; enumeration operation may not execute.");
}
++m_index;
@@ -723,42 +639,19 @@
m_index = -1;
}
- #endregion
-
- #region Implementation (IEnumerator)
-
- object IEnumerator.Current
- {
- get { return this.Current; }
- }
-
- #endregion
+ object IEnumerator.Current => Current;
}
- #endregion
-
- #region Nested Read Only Wrapper class
-
/// <exclude/>
private sealed class ReadOnlyPluginCollection : PluginCollection
{
- #region Implementation (data)
-
private readonly PluginCollection m_collection;
- #endregion
-
- #region Construction
-
internal ReadOnlyPluginCollection(PluginCollection list) : base(Tag.Default)
{
m_collection = list;
}
- #endregion
-
- #region Type-safe ICollection
-
public override void CopyTo(IPlugin[] array)
{
m_collection.CopyTo(array);
@@ -768,109 +661,70 @@
{
m_collection.CopyTo(array, start);
}
- public override int Count
- {
- get { return m_collection.Count; }
- }
- public override bool IsSynchronized
- {
- get { return m_collection.IsSynchronized; }
- }
+ public override int Count => m_collection.Count;
- public override object SyncRoot
- {
- get { return this.m_collection.SyncRoot; }
- }
+ public override bool IsSynchronized => m_collection.IsSynchronized;
- #endregion
-
- #region Type-safe IList
+ public override object SyncRoot => m_collection.SyncRoot;
public override IPlugin this[int i]
{
- get { return m_collection[i]; }
- set { throw new NotSupportedException("This is a Read Only Collection and can not be modified"); }
+ get => m_collection[i];
+ set => throw SystemInfo.CreateReadOnlyCollectionNotModifiableException();
}
public override int Add(IPlugin x)
{
- throw new NotSupportedException("This is a Read Only Collection and can not be modified");
+ throw SystemInfo.CreateReadOnlyCollectionNotModifiableException();
}
public override void Clear()
{
- throw new NotSupportedException("This is a Read Only Collection and can not be modified");
+ throw SystemInfo.CreateReadOnlyCollectionNotModifiableException();
}
- public override bool Contains(IPlugin x)
- {
- return m_collection.Contains(x);
- }
+ public override bool Contains(IPlugin x) => m_collection.Contains(x);
- public override int IndexOf(IPlugin x)
- {
- return m_collection.IndexOf(x);
- }
+ public override int IndexOf(IPlugin x) => m_collection.IndexOf(x);
public override void Insert(int pos, IPlugin x)
{
- throw new NotSupportedException("This is a Read Only Collection and can not be modified");
+ throw SystemInfo.CreateReadOnlyCollectionNotModifiableException();
}
public override void Remove(IPlugin x)
{
- throw new NotSupportedException("This is a Read Only Collection and can not be modified");
+ throw SystemInfo.CreateReadOnlyCollectionNotModifiableException();
}
public override void RemoveAt(int pos)
{
- throw new NotSupportedException("This is a Read Only Collection and can not be modified");
+ throw SystemInfo.CreateReadOnlyCollectionNotModifiableException();
}
- public override bool IsFixedSize
- {
- get { return true; }
- }
+ public override bool IsFixedSize => true;
- public override bool IsReadOnly
- {
- get { return true; }
- }
+ public override bool IsReadOnly => true;
- #endregion
-
- #region Type-safe IEnumerable
-
- public override IPluginCollectionEnumerator GetEnumerator()
- {
- return m_collection.GetEnumerator();
- }
-
- #endregion
-
- #region Public Helpers
+ public override IPluginCollectionEnumerator GetEnumerator() => m_collection.GetEnumerator();
// (just to mimic some nice features of ArrayList)
public override int Capacity
{
- get { return m_collection.Capacity; }
- set { throw new NotSupportedException("This is a Read Only Collection and can not be modified"); }
+ get => m_collection.Capacity;
+ set => throw SystemInfo.CreateReadOnlyCollectionNotModifiableException();
}
public override int AddRange(PluginCollection x)
{
- throw new NotSupportedException("This is a Read Only Collection and can not be modified");
+ throw SystemInfo.CreateReadOnlyCollectionNotModifiableException();
}
public override int AddRange(IPlugin[] x)
{
- throw new NotSupportedException("This is a Read Only Collection and can not be modified");
+ throw SystemInfo.CreateReadOnlyCollectionNotModifiableException();
}
-
- #endregion
}
-
- #endregion
}
-}
+}
\ No newline at end of file
diff --git a/src/log4net/Plugin/RemoteLoggingServerPlugin.cs b/src/log4net/Plugin/RemoteLoggingServerPlugin.cs
index bee95b4..5b7dab4 100644
--- a/src/log4net/Plugin/RemoteLoggingServerPlugin.cs
+++ b/src/log4net/Plugin/RemoteLoggingServerPlugin.cs
@@ -18,8 +18,8 @@
//
#endregion
-// .NET Compact Framework 1.0 && netstandard has no support for System.Runtime.Remoting
-#if NET_2_0
+// netstandard has no support for System.Runtime.Remoting
+#if NET462_OR_GREATER
using System;
using System.Runtime.Remoting;
@@ -120,9 +120,7 @@
/// This method is called when the plugin is attached to the repository.
/// </para>
/// </remarks>
-#if NET_4_0 || MONO_4_0
[System.Security.SecuritySafeCritical]
-#endif
public override void Attach(ILoggerRepository repository)
{
base.Attach(repository);
@@ -149,9 +147,7 @@
/// sink is disconnected.
/// </para>
/// </remarks>
-#if NET_4_0 || MONO_4_0
- [System.Security.SecuritySafeCritical]
-#endif
+ [System.Security.SecuritySafeCritical]
public override void Shutdown()
{
// Stops the sink from receiving messages
@@ -254,9 +250,7 @@
/// therefore this implementation returns <c>null</c>.
/// </para>
/// </remarks>
-#if NET_4_0 || MONO_4_0
- [System.Security.SecurityCritical]
-#endif
+ [System.Security.SecurityCritical]
public override object InitializeLifetimeService()
{
return null;
@@ -277,4 +271,4 @@
}
}
-#endif // NET_2_0
\ No newline at end of file
+#endif // NET462_OR_GREATER
\ No newline at end of file
diff --git a/src/log4net/Repository/Hierarchy/DefaultLoggerFactory.cs b/src/log4net/Repository/Hierarchy/DefaultLoggerFactory.cs
index 2f55243..3aea766 100644
--- a/src/log4net/Repository/Hierarchy/DefaultLoggerFactory.cs
+++ b/src/log4net/Repository/Hierarchy/DefaultLoggerFactory.cs
@@ -35,55 +35,27 @@
/// <author>Gert Driesen</author>
internal class DefaultLoggerFactory : ILoggerFactory
{
- #region Internal Instance Constructors
-
/// <summary>
- /// Default constructor
- /// </summary>
- /// <remarks>
- /// <para>
- /// Initializes a new instance of the <see cref="DefaultLoggerFactory" /> class.
- /// </para>
- /// </remarks>
- internal DefaultLoggerFactory()
- {
- }
-
- #endregion Internal Instance Constructors
-
- #region Implementation of ILoggerFactory
-
- /// <summary>
- /// Create a new <see cref="Logger" /> instance
+ /// Create a new <see cref="Logger" /> instance with the specified name.
/// </summary>
/// <param name="repository">The <see cref="ILoggerRepository" /> that will own the <see cref="Logger" />.</param>
- /// <param name="name">The name of the <see cref="Logger" />.</param>
+ /// <param name="name">The name of the <see cref="Logger" />. If <c>null</c>, the root logger is returned.</param>
/// <returns>The <see cref="Logger" /> instance for the specified name.</returns>
/// <remarks>
/// <para>
- /// Create a new <see cref="Logger" /> instance with the
- /// specified name.
- /// </para>
- /// <para>
/// Called by the <see cref="Hierarchy"/> to create
/// new named <see cref="Logger"/> instances.
/// </para>
- /// <para>
- /// If the <paramref name="name"/> is <c>null</c> then the root logger
- /// must be returned.
- /// </para>
/// </remarks>
- public Logger CreateLogger(ILoggerRepository repository, string name)
+ public Logger CreateLogger(ILoggerRepository repository, string? name)
{
- if (name == null)
+ if (name is null)
{
return new RootLogger(repository.LevelMap.LookupWithDefault(Level.Debug));
}
return new LoggerImpl(name);
}
- #endregion
-
/// <summary>
/// Default internal subclass of <see cref="Logger"/>
/// </summary>
@@ -97,15 +69,10 @@
internal sealed class LoggerImpl : Logger
{
/// <summary>
- /// Construct a new Logger
- /// </summary>
- /// <param name="name">the name of the logger</param>
- /// <remarks>
- /// <para>
/// Initializes a new instance of the <see cref="LoggerImpl" /> class
/// with the specified name.
- /// </para>
- /// </remarks>
+ /// </summary>
+ /// <param name="name">the name of the logger</param>
internal LoggerImpl(string name) : base(name)
{
}
diff --git a/src/log4net/Repository/Hierarchy/Hierarchy.cs b/src/log4net/Repository/Hierarchy/Hierarchy.cs
index 144b5c4..56dd296 100644
--- a/src/log4net/Repository/Hierarchy/Hierarchy.cs
+++ b/src/log4net/Repository/Hierarchy/Hierarchy.cs
@@ -18,16 +18,15 @@
#endregion
using System;
-using System.Collections;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Linq;
using log4net.Appender;
using log4net.Core;
-using log4net.Repository;
using log4net.Util;
namespace log4net.Repository.Hierarchy
{
- #region LoggerCreationEvent
-
/// <summary>
/// Delegate used to handle logger creation event notifications.
/// </summary>
@@ -51,12 +50,7 @@
/// </remarks>
public class LoggerCreationEventArgs : EventArgs
{
- /// <summary>
- /// The <see cref="Logger"/> created
- /// </summary>
- private Logger m_log;
-
- /// <summary>
+ /// <summary>
/// Constructor
/// </summary>
/// <param name="log">The <see cref="Logger"/> that has been created.</param>
@@ -68,7 +62,7 @@
/// </remarks>
public LoggerCreationEventArgs(Logger log)
{
- m_log = log;
+ Logger = log;
}
/// <summary>
@@ -82,14 +76,9 @@
/// The <see cref="Logger"/> that has been created.
/// </para>
/// </remarks>
- public Logger Logger
- {
- get { return m_log; }
- }
+ public Logger Logger { get; }
}
- #endregion LoggerCreationEvent
-
/// <summary>
/// Hierarchical organization of loggers
/// </summary>
@@ -121,8 +110,6 @@
/// <author>Gert Driesen</author>
public class Hierarchy : LoggerRepositorySkeleton, IBasicRepositoryConfigurator, IXmlRepositoryConfigurator
{
- #region Public Events
-
/// <summary>
/// Event used to notify that a logger has been created.
/// </summary>
@@ -131,15 +118,7 @@
/// Event raised when a logger is created.
/// </para>
/// </remarks>
- public event LoggerCreationEventHandler LoggerCreatedEvent
- {
- add { m_loggerCreatedEvent += value; }
- remove { m_loggerCreatedEvent -= value; }
- }
-
- #endregion Public Events
-
- #region Public Instance Constructors
+ public event LoggerCreationEventHandler? LoggerCreatedEvent;
/// <summary>
/// Default constructor
@@ -193,20 +172,14 @@
/// </remarks>
public Hierarchy(PropertiesDictionary properties, ILoggerFactory loggerFactory) : base(properties)
{
- if (loggerFactory == null)
+ if (loggerFactory is null)
{
- throw new ArgumentNullException("loggerFactory");
+ throw new ArgumentNullException(nameof(loggerFactory));
}
m_defaultFactory = loggerFactory;
-
- m_ht = System.Collections.Hashtable.Synchronized(new System.Collections.Hashtable());
}
- #endregion Public Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
/// Has no appender warning been emitted
/// </summary>
@@ -216,11 +189,7 @@
/// about not having an appender warning.
/// </para>
/// </remarks>
- public bool EmittedNoAppenderWarning
- {
- get { return m_emittedNoAppenderWarning; }
- set { m_emittedNoAppenderWarning = value; }
- }
+ public bool EmittedNoAppenderWarning { get; set; }
/// <summary>
/// Get the root of this hierarchy
@@ -234,11 +203,11 @@
{
get
{
- if (m_root == null)
+ if (m_root is null)
{
lock (this)
{
- if (m_root == null)
+ if (m_root is null)
{
// Create the root logger
Logger root = m_defaultFactory.CreateLogger(this, null);
@@ -256,7 +225,6 @@
/// <summary>
/// Gets or sets the default <see cref="ILoggerFactory" /> instance.
/// </summary>
- /// <value>The default <see cref="ILoggerFactory" /></value>
/// <remarks>
/// <para>
/// The logger factory is used to create logger instances.
@@ -264,21 +232,13 @@
/// </remarks>
public ILoggerFactory LoggerFactory
{
- get { return m_defaultFactory; }
+ get => m_defaultFactory;
set
{
- if (value == null)
- {
- throw new ArgumentNullException("value");
- }
- m_defaultFactory = value;
+ m_defaultFactory = value ?? throw new ArgumentNullException(nameof(value));
}
}
- #endregion Public Instance Properties
-
- #region Override Implementation of LoggerRepositorySkeleton
-
/// <summary>
/// Test if a logger exists
/// </summary>
@@ -290,17 +250,15 @@
/// its reference, otherwise returns <c>null</c>.
/// </para>
/// </remarks>
- public override ILogger Exists(string name)
+ public override ILogger? Exists(string name)
{
- if (name == null)
+ if (name is null)
{
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
}
- lock (m_ht)
- {
- return m_ht[new LoggerKey(name)] as Logger;
- }
+ m_ht.TryGetValue(new LoggerKey(name), out object? o);
+ return o as Logger;
}
/// <summary>
@@ -319,20 +277,17 @@
// The accumulation in loggers is necessary because not all elements in
// ht are Logger objects as there might be some ProvisionNodes
// as well.
- lock (m_ht)
- {
- System.Collections.ArrayList loggers = new System.Collections.ArrayList(m_ht.Count);
+ var loggers = new List<ILogger>(m_ht.Count);
- // Iterate through m_ht values
- foreach (object node in m_ht.Values)
+ // Iterate through m_ht values
+ foreach (object node in m_ht.Values)
+ {
+ if (node is Logger logger)
{
- if (node is Logger)
- {
- loggers.Add(node);
- }
+ loggers.Add(logger);
}
- return (Logger[])loggers.ToArray(typeof(Logger));
}
+ return loggers.ToArray();
}
/// <summary>
@@ -356,7 +311,7 @@
{
if (name == null)
{
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
}
return GetLogger(name, m_defaultFactory);
@@ -378,34 +333,31 @@
/// </para>
/// <para>
/// The <c>Shutdown</c> method is careful to close nested
- /// appenders before closing regular appenders. This is allows
+ /// appenders before closing regular appenders. This allows
/// configurations where a regular appender is attached to a logger
/// and again to a nested appender.
/// </para>
/// </remarks>
public override void Shutdown()
{
- LogLog.Debug(declaringType, "Shutdown called on Hierarchy [" + this.Name + "]");
+ LogLog.Debug(declaringType, $"Shutdown called on Hierarchy [{Name}]");
// begin by closing nested appenders
Root.CloseNestedAppenders();
- lock (m_ht)
+ ILogger[] currentLoggers = GetCurrentLoggers();
+
+ foreach (Logger logger in currentLoggers.OfType<Logger>())
{
- ILogger[] currentLoggers = this.GetCurrentLoggers();
+ logger.CloseNestedAppenders();
+ }
- foreach (Logger logger in currentLoggers)
- {
- logger.CloseNestedAppenders();
- }
+ // then, remove all appenders
+ Root.RemoveAllAppenders();
- // then, remove all appenders
- Root.RemoveAllAppenders();
-
- foreach (Logger logger in currentLoggers)
- {
- logger.RemoveAllAppenders();
- }
+ foreach (Logger logger in currentLoggers.OfType<Logger>())
+ {
+ logger.RemoveAllAppenders();
}
base.Shutdown();
@@ -436,16 +388,12 @@
Root.Level = LevelMap.LookupWithDefault(Level.Debug);
Threshold = LevelMap.LookupWithDefault(Level.All);
- // the synchronization is needed to prevent hashtable surprises
- lock (m_ht)
- {
- Shutdown(); // nested locks are OK
+ Shutdown(); // nested locks are OK
- foreach (Logger l in this.GetCurrentLoggers())
- {
- l.Level = null;
- l.Additivity = true;
- }
+ foreach (Logger logger in GetCurrentLoggers().OfType<Logger>())
+ {
+ logger.Level = null;
+ logger.Additivity = true;
}
base.ResetConfiguration();
@@ -472,12 +420,15 @@
/// </remarks>
public override void Log(LoggingEvent logEvent)
{
- if (logEvent == null)
+ if (logEvent is null)
{
- throw new ArgumentNullException("logEvent");
+ throw new ArgumentNullException(nameof(logEvent));
}
- this.GetLogger(logEvent.LoggerName, m_defaultFactory).Log(logEvent);
+ if (logEvent.LoggerName is not null)
+ {
+ GetLogger(logEvent.LoggerName, m_defaultFactory).Log(logEvent);
+ }
}
/// <summary>
@@ -494,38 +445,31 @@
/// The list returned is unordered but does not contain duplicates.
/// </para>
/// </remarks>
- public override Appender.IAppender[] GetAppenders()
+ public override IAppender[] GetAppenders()
{
- System.Collections.ArrayList appenderList = new System.Collections.ArrayList();
+ var appenderList = new List<IAppender>();
CollectAppenders(appenderList, Root);
- foreach (Logger logger in GetCurrentLoggers())
+ foreach (Logger logger in GetCurrentLoggers().OfType<Logger>())
{
CollectAppenders(appenderList, logger);
}
- return (Appender.IAppender[])appenderList.ToArray(typeof(Appender.IAppender));
+ return appenderList.ToArray();
}
- #endregion Override Implementation of LoggerRepositorySkeleton
-
- #region Private Static Methods
-
/// <summary>
/// Collect the appenders from an <see cref="IAppenderAttachable"/>.
/// The appender may also be a container.
/// </summary>
- /// <param name="appenderList"></param>
- /// <param name="appender"></param>
- private static void CollectAppender(System.Collections.ArrayList appenderList, Appender.IAppender appender)
+ private static void CollectAppender(List<IAppender> appenderList, IAppender appender)
{
if (!appenderList.Contains(appender))
{
appenderList.Add(appender);
- IAppenderAttachable container = appender as IAppenderAttachable;
- if (container != null)
+ if (appender is IAppenderAttachable container)
{
CollectAppenders(appenderList, container);
}
@@ -535,20 +479,14 @@
/// <summary>
/// Collect the appenders from an <see cref="IAppenderAttachable"/> container
/// </summary>
- /// <param name="appenderList"></param>
- /// <param name="container"></param>
- private static void CollectAppenders(System.Collections.ArrayList appenderList, IAppenderAttachable container)
+ private static void CollectAppenders(List<IAppender> appenderList, IAppenderAttachable container)
{
- foreach (Appender.IAppender appender in container.Appenders)
+ foreach (IAppender appender in container.Appenders)
{
CollectAppender(appenderList, appender);
}
}
- #endregion
-
- #region Implementation of IBasicRepositoryConfigurator
-
/// <summary>
/// Initialize the log4net system using the specified appender
/// </summary>
@@ -580,7 +518,7 @@
/// </remarks>
protected void BasicRepositoryConfigure(params IAppender[] appenders)
{
- ArrayList configurationMessages = new ArrayList();
+ var configurationMessages = new List<LogLog>();
using (new LogLog.LogReceivedAdapter(configurationMessages))
{
@@ -598,10 +536,6 @@
OnConfigurationChanged(new ConfigurationChangedEventArgs(configurationMessages));
}
- #endregion Implementation of IBasicRepositoryConfigurator
-
- #region Implementation of IXmlRepositoryConfigurator
-
/// <summary>
/// Initialize the log4net system using the specified config
/// </summary>
@@ -624,11 +558,11 @@
/// </remarks>
protected void XmlRepositoryConfigure(System.Xml.XmlElement element)
{
- ArrayList configurationMessages = new ArrayList();
+ var configurationMessages = new List<LogLog>();
using (new LogLog.LogReceivedAdapter(configurationMessages))
{
- XmlHierarchyConfigurator config = new XmlHierarchyConfigurator(this);
+ var config = new XmlHierarchyConfigurator(this);
config.Configure(element);
}
@@ -640,10 +574,6 @@
OnConfigurationChanged(new ConfigurationChangedEventArgs(configurationMessages));
}
- #endregion Implementation of IXmlRepositoryConfigurator
-
- #region Public Instance Methods
-
/// <summary>
/// Test if this hierarchy is disabled for the specified <see cref="Level"/>.
/// </summary>
@@ -667,10 +597,9 @@
/// </remarks>
public bool IsDisabled(Level level)
{
- // Cast level to object for performance
- if ((object)level == null)
+ if (level is null)
{
- throw new ArgumentNullException("level");
+ throw new ArgumentNullException(nameof(level));
}
if (Configured)
@@ -700,10 +629,7 @@
/// </remarks>
public void Clear()
{
- lock (m_ht)
- {
- m_ht.Clear();
- }
+ m_ht.Clear();
}
/// <summary>
@@ -725,61 +651,52 @@
{
if (name == null)
{
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
}
if (factory == null)
{
- throw new ArgumentNullException("factory");
+ throw new ArgumentNullException(nameof(factory));
}
- LoggerKey key = new LoggerKey(name);
+ var key = new LoggerKey(name);
// Synchronize to prevent write conflicts. Read conflicts (in
// GetEffectiveLevel() method) are possible only if variable
// assignments are non-atomic.
- lock (m_ht)
+ if (!m_ht.TryGetValue(key, out object? node))
{
- Logger logger = null;
+ return CreateLogger(null);
+ }
- Object node = m_ht[key];
- if (node == null)
+ if (node is Logger nodeLogger)
+ {
+ return nodeLogger;
+ }
+
+ if (node is ProvisionNode nodeProvisionNode)
+ {
+ return CreateLogger(l => UpdateChildren(nodeProvisionNode, l));
+ }
+
+ // It should be impossible to arrive here but let's keep the compiler happy.
+ return null!;
+
+ Logger CreateLogger(Action<Logger>? extraInit)
+ {
+ // Use GetOrAdd in case the logger was added after checking above.
+ return (Logger)m_ht.GetOrAdd(key, _ =>
{
- logger = factory.CreateLogger(this, name);
+ Logger logger = factory.CreateLogger(this, name);
logger.Hierarchy = this;
- m_ht[key] = logger;
+ extraInit?.Invoke(logger);
UpdateParents(logger);
OnLoggerCreationEvent(logger);
return logger;
- }
-
- Logger nodeLogger = node as Logger;
- if (nodeLogger != null)
- {
- return nodeLogger;
- }
-
- ProvisionNode nodeProvisionNode = node as ProvisionNode;
- if (nodeProvisionNode != null)
- {
- logger = factory.CreateLogger(this, name);
- logger.Hierarchy = this;
- m_ht[key] = logger;
- UpdateChildren(nodeProvisionNode, logger);
- UpdateParents(logger);
- OnLoggerCreationEvent(logger);
- return logger;
- }
-
- // It should be impossible to arrive here but let's keep the compiler happy.
- return null;
+ });
}
}
- #endregion Public Instance Methods
-
- #region Protected Instance Methods
-
/// <summary>
/// Sends a logger creation event to all registered listeners
/// </summary>
@@ -789,17 +706,9 @@
/// </remarks>
protected virtual void OnLoggerCreationEvent(Logger logger)
{
- LoggerCreationEventHandler handler = m_loggerCreatedEvent;
- if (handler != null)
- {
- handler(this, new LoggerCreationEventArgs(logger));
- }
+ LoggerCreatedEvent?.Invoke(this, new LoggerCreationEventArgs(logger));
}
- #endregion Protected Instance Methods
-
- #region Private Instance Methods
-
/// <summary>
/// Updates all the parents of the specified logger
/// </summary>
@@ -822,7 +731,7 @@
/// <description>
/// The entry is <paramref name="log"/>'s nearest existing parent. We
/// update <paramref name="log"/>'s parent field with this entry. We also break from
- /// he loop because updating our parent's parent is our parent's
+ /// the loop because updating our parent's parent is our parent's
/// responsibility.
/// </description>
/// </item>
@@ -846,40 +755,35 @@
{
string substr = name.Substring(0, i);
- LoggerKey key = new LoggerKey(substr); // simple constructor
- Object node = m_ht[key];
+ var key = new LoggerKey(substr);
+ m_ht.TryGetValue(key, out object? node);
+
// Create a provision node for a future parent.
- if (node == null)
+ if (node is null)
{
- ProvisionNode pn = new ProvisionNode(log);
- m_ht[key] = pn;
+ m_ht[key] = new ProvisionNode(log);
}
else
{
- Logger nodeLogger = node as Logger;
- if (nodeLogger != null)
+ if (node is Logger nodeLogger)
{
parentFound = true;
log.Parent = nodeLogger;
break; // no need to update the ancestors of the closest ancestor
}
+
+ if (node is ProvisionNode nodeProvisionNode)
+ {
+ nodeProvisionNode.Add(log);
+ }
else
{
- ProvisionNode nodeProvisionNode = node as ProvisionNode;
- if (nodeProvisionNode != null)
- {
- nodeProvisionNode.Add(log);
- }
- else
- {
- LogLog.Error(declaringType, "Unexpected object type [" + node.GetType() + "] in ht.", new LogException());
- }
+ LogLog.Error(declaringType, $"Unexpected object type [{node.GetType()}] in ht.", new LogException());
}
}
if (i == 0)
{
- // logger name starts with a dot
- // and we've hit the start
+ // logger name starts with a dot and we've hit the start
break;
}
}
@@ -887,15 +791,13 @@
// If we could not find any existing parents, then link with root.
if (!parentFound)
{
- log.Parent = this.Root;
+ log.Parent = Root;
}
}
/// <summary>
/// Replace a <see cref="ProvisionNode"/> with a <see cref="Logger"/> in the hierarchy.
/// </summary>
- /// <param name="pn"></param>
- /// <param name="log"></param>
/// <remarks>
/// <para>
/// We update the links for all the children that placed themselves
@@ -917,13 +819,11 @@
/// </remarks>
private static void UpdateChildren(ProvisionNode pn, Logger log)
{
- for (int i = 0; i < pn.Count; i++)
+ foreach (Logger childLogger in pn)
{
- Logger childLogger = (Logger)pn[i];
-
// Unless this child already points to a correct (lower) parent,
// make log.Parent point to childLogger.Parent and childLogger.Parent to log.
- if (!childLogger.Parent.Name.StartsWith(log.Name))
+ if (childLogger.Parent is not null && !childLogger.Parent.Name.StartsWith(log.Name, StringComparison.Ordinal))
{
log.Parent = childLogger.Parent;
childLogger.Parent = log;
@@ -937,27 +837,31 @@
/// <param name="levelEntry">the level values</param>
/// <remarks>
/// <para>
- /// Define or redefine a Level using the values in the <see cref="LevelEntry"/> argument
- /// </para>
- /// <para>
/// Supports setting levels via the configuration file.
/// </para>
/// </remarks>
internal void AddLevel(LevelEntry levelEntry)
{
- if (levelEntry == null) throw new ArgumentNullException("levelEntry");
- if (levelEntry.Name == null) throw new ArgumentNullException("levelEntry.Name");
+ if (levelEntry is null)
+ {
+ throw new ArgumentNullException(nameof(levelEntry));
+ }
+ if (levelEntry.Name is null)
+ {
+ throw new ArgumentNullException("levelEntry.Name");
+ }
// Lookup replacement value
if (levelEntry.Value == -1)
{
- Level previousLevel = LevelMap[levelEntry.Name];
- if (previousLevel == null)
+ if (LevelMap[levelEntry.Name] is Level previousLevel)
{
- throw new InvalidOperationException("Cannot redefine level [" + levelEntry.Name + "] because it is not defined in the LevelMap. To define the level supply the level value.");
+ levelEntry.Value = previousLevel.Value;
}
-
- levelEntry.Value = previousLevel.Value;
+ else
+ {
+ throw new InvalidOperationException($"Cannot redefine level [{levelEntry.Name}] because it is not defined in the LevelMap. To define the level supply the level value.");
+ }
}
LevelMap.Add(levelEntry.Name, levelEntry.Value, levelEntry.DisplayName);
@@ -971,12 +875,8 @@
/// A class to hold the value, name and display name for a level
/// </para>
/// </remarks>
- internal class LevelEntry
+ internal sealed class LevelEntry
{
- private int m_levelValue = -1;
- private string m_levelName = null;
- private string m_levelDisplayName = null;
-
/// <summary>
/// Value of the level
/// </summary>
@@ -986,11 +886,7 @@
/// up for the current level with the same name.
/// </para>
/// </remarks>
- public int Value
- {
- get { return m_levelValue; }
- set { m_levelValue = value; }
- }
+ public int Value { get; set; } = -1;
/// <summary>
/// Name of the level
@@ -1003,11 +899,7 @@
/// The name of the level.
/// </para>
/// </remarks>
- public string Name
- {
- get { return m_levelName; }
- set { m_levelName = value; }
- }
+ public string? Name { get; set; }
/// <summary>
/// Display name for the level
@@ -1020,11 +912,7 @@
/// The display name of the level.
/// </para>
/// </remarks>
- public string DisplayName
- {
- get { return m_levelDisplayName; }
- set { m_levelDisplayName = value; }
- }
+ public string? DisplayName { get; set; }
/// <summary>
/// Override <c>Object.ToString</c> to return sensible debug info
@@ -1032,7 +920,7 @@
/// <returns>string info about this object</returns>
public override string ToString()
{
- return "LevelEntry(Value=" + m_levelValue + ", Name=" + m_levelName + ", DisplayName=" + m_levelDisplayName + ")";
+ return $"LevelEntry(Value={Value}, Name={Name}, DisplayName={DisplayName})";
}
}
@@ -1050,28 +938,22 @@
/// </remarks>
internal void AddProperty(PropertyEntry propertyEntry)
{
- if (propertyEntry == null) throw new ArgumentNullException("propertyEntry");
- if (propertyEntry.Key == null) throw new ArgumentNullException("propertyEntry.Key");
+ if (propertyEntry is null)
+ {
+ throw new ArgumentNullException(nameof(propertyEntry));
+ }
+ if (propertyEntry.Key is null)
+ {
+ throw new ArgumentNullException("propertyEntry.Key");
+ }
Properties[propertyEntry.Key] = propertyEntry.Value;
}
- #endregion Private Instance Methods
-
- #region Private Instance Fields
-
private ILoggerFactory m_defaultFactory;
- private System.Collections.Hashtable m_ht;
- private Logger m_root;
-
- private bool m_emittedNoAppenderWarning = false;
-
- private event LoggerCreationEventHandler m_loggerCreatedEvent;
-
- #endregion Private Instance Fields
-
- #region Private Static Fields
+ private readonly ConcurrentDictionary<LoggerKey, object> m_ht = new(LoggerKey.ComparerInstance);
+ private Logger? m_root;
/// <summary>
/// The fully qualified type of the Hierarchy class.
@@ -1081,7 +963,5 @@
/// log message.
/// </remarks>
private static readonly Type declaringType = typeof(Hierarchy);
-
- #endregion Private Static Fields
}
}
diff --git a/src/log4net/Repository/Hierarchy/ILoggerFactory.cs b/src/log4net/Repository/Hierarchy/ILoggerFactory.cs
index 9826a97..5720d4e 100644
--- a/src/log4net/Repository/Hierarchy/ILoggerFactory.cs
+++ b/src/log4net/Repository/Hierarchy/ILoggerFactory.cs
@@ -59,6 +59,6 @@
/// must be returned.
/// </para>
/// </remarks>
- Logger CreateLogger(ILoggerRepository repository, string name);
+ Logger CreateLogger(ILoggerRepository repository, string? name);
}
}
diff --git a/src/log4net/Repository/Hierarchy/Logger.cs b/src/log4net/Repository/Hierarchy/Logger.cs
index 0ec41db..e04da5b 100644
--- a/src/log4net/Repository/Hierarchy/Logger.cs
+++ b/src/log4net/Repository/Hierarchy/Logger.cs
@@ -52,8 +52,6 @@
/// <author>Douglas de la Torre</author>
public abstract class Logger : IAppenderAttachable, ILogger
{
- #region Protected Instance Constructors
-
/// <summary>
/// This constructor created a new <see cref="Logger" /> instance and
/// sets its name.
@@ -70,20 +68,11 @@
/// logger creator.
/// </para>
/// </remarks>
- protected Logger(string name)
+ protected Logger(string name)
{
-#if NETCF || NETSTANDARD1_3
- // NETCF: String.Intern causes Native Exception
- m_name = name;
-#else
- m_name = string.Intern(name);
-#endif
+ Name = string.Intern(name);
}
- #endregion Protected Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
/// Gets or sets the parent logger in the hierarchy.
/// </summary>
@@ -96,10 +85,10 @@
/// The hierarchy is parent linked rather than child linked.
/// </para>
/// </remarks>
- public virtual Logger Parent
+ public virtual Logger? Parent
{
- get { return m_parent; }
- set { m_parent = value; }
+ get => m_parent;
+ set => m_parent = value;
}
/// <summary>
@@ -119,12 +108,8 @@
/// the user manual for more details.
/// </para>
/// </remarks>
- public virtual bool Additivity
- {
- get { return m_additive; }
- set { m_additive = value; }
- }
-
+ public virtual bool Additivity { get; set; } = true;
+
/// <summary>
/// Gets the effective level for this logger.
/// </summary>
@@ -140,19 +125,16 @@
/// </remarks>
public virtual Level EffectiveLevel
{
- get
+ get
{
- for (Logger c = this; c != null; c = c.m_parent)
+ for (Logger? c = this; c is not null; c = c.m_parent)
{
- Level level = c.m_level;
-
- // Casting level to Object for performance, otherwise the overloaded operator is called
- if ((object)level != null)
+ if (c.Level is Level level)
{
return level;
}
}
- return null; // If reached will cause an NullPointerException.
+ return null!; // If reached will cause an NullPointerException.
}
}
@@ -160,16 +142,15 @@
/// Gets or sets the <see cref="Hierarchy"/> where this
/// <c>Logger</c> instance is attached to.
/// </summary>
- /// <value>The hierarchy that this logger belongs to.</value>
/// <remarks>
/// <para>
/// This logger must be attached to a single <see cref="Hierarchy"/>.
/// </para>
/// </remarks>
- public virtual Hierarchy Hierarchy
+ public virtual Hierarchy? Hierarchy
{
- get { return m_hierarchy; }
- set { m_hierarchy = value; }
+ get => m_hierarchy;
+ set => m_hierarchy = value;
}
/// <summary>
@@ -178,20 +159,7 @@
/// <value>
/// The <see cref="Level"/> of this logger.
/// </value>
- /// <remarks>
- /// <para>
- /// The assigned <see cref="Level"/> can be <c>null</c>.
- /// </para>
- /// </remarks>
- public virtual Level Level
- {
- get { return m_level; }
- set { m_level = value; }
- }
-
- #endregion Public Instance Properties
-
- #region Implementation of IAppenderAttachable
+ public virtual Level? Level { get; set; }
/// <summary>
/// Add <paramref name="newAppender"/> to the list of appenders of this
@@ -200,28 +168,21 @@
/// <param name="newAppender">An appender to add to this logger</param>
/// <remarks>
/// <para>
- /// Add <paramref name="newAppender"/> to the list of appenders of this
- /// Logger instance.
- /// </para>
- /// <para>
/// If <paramref name="newAppender"/> is already in the list of
/// appenders, then it won't be added again.
/// </para>
/// </remarks>
- public virtual void AddAppender(IAppender newAppender)
+ public virtual void AddAppender(IAppender newAppender)
{
- if (newAppender == null)
+ if (newAppender is null)
{
- throw new ArgumentNullException("newAppender");
+ throw new ArgumentNullException(nameof(newAppender));
}
m_appenderLock.AcquireWriterLock();
try
{
- if (m_appenderAttachedImpl == null)
- {
- m_appenderAttachedImpl = new log4net.Util.AppenderAttachedImpl();
- }
+ m_appenderAttachedImpl ??= new AppenderAttachedImpl();
m_appenderAttachedImpl.AddAppender(newAppender);
}
finally
@@ -234,26 +195,22 @@
/// Get the appenders contained in this logger as an
/// <see cref="System.Collections.ICollection"/>.
/// </summary>
- /// <returns>A collection of the appenders in this logger</returns>
- /// <remarks>
- /// <para>
- /// Get the appenders contained in this logger as an
- /// <see cref="System.Collections.ICollection"/>. If no appenders
+ /// <returns>
+ /// A collection of the appenders in this logger. If no appenders
/// can be found, then a <see cref="EmptyCollection"/> is returned.
- /// </para>
- /// </remarks>
- public virtual AppenderCollection Appenders
+ /// </returns>
+ public virtual AppenderCollection Appenders
{
get
{
m_appenderLock.AcquireReaderLock();
try
{
- if (m_appenderAttachedImpl == null)
+ if (m_appenderAttachedImpl is null)
{
return AppenderCollection.EmptyCollection;
}
- else
+ else
{
return m_appenderAttachedImpl.Appenders;
}
@@ -270,17 +227,12 @@
/// </summary>
/// <param name="name">The name of the appender to lookup</param>
/// <returns>The appender with the name specified, or <c>null</c>.</returns>
- /// <remarks>
- /// <para>
- /// Returns the named appender, or null if the appender is not found.
- /// </para>
- /// </remarks>
- public virtual IAppender GetAppender(string name)
+ public virtual IAppender? GetAppender(string? name)
{
m_appenderLock.AcquireReaderLock();
try
{
- if (m_appenderAttachedImpl == null || name == null)
+ if (m_appenderAttachedImpl is null || name is null)
{
return null;
}
@@ -294,22 +246,19 @@
}
/// <summary>
- /// Remove all previously added appenders from this Logger instance.
+ /// Removes all previously added appenders from this Logger instance.
/// </summary>
/// <remarks>
/// <para>
- /// Remove all previously added appenders from this Logger instance.
- /// </para>
- /// <para>
/// This is useful when re-reading configuration information.
/// </para>
/// </remarks>
- public virtual void RemoveAllAppenders()
+ public virtual void RemoveAllAppenders()
{
m_appenderLock.AcquireWriterLock();
try
{
- if (m_appenderAttachedImpl != null)
+ if (m_appenderAttachedImpl is not null)
{
m_appenderAttachedImpl.RemoveAllAppenders();
m_appenderAttachedImpl = null;
@@ -328,18 +277,17 @@
/// <returns>The appender removed from the list</returns>
/// <remarks>
/// <para>
- /// Remove the appender passed as parameter form the list of appenders.
/// The appender removed is not closed.
/// If you are discarding the appender you must call
/// <see cref="IAppender.Close"/> on the appender removed.
/// </para>
/// </remarks>
- public virtual IAppender RemoveAppender(IAppender appender)
+ public virtual IAppender? RemoveAppender(IAppender? appender)
{
m_appenderLock.AcquireWriterLock();
try
{
- if (appender != null && m_appenderAttachedImpl != null)
+ if (appender is not null && m_appenderAttachedImpl is not null)
{
return m_appenderAttachedImpl.RemoveAppender(appender);
}
@@ -358,18 +306,17 @@
/// <returns>The appender removed from the list</returns>
/// <remarks>
/// <para>
- /// Remove the named appender passed as parameter form the list of appenders.
/// The appender removed is not closed.
/// If you are discarding the appender you must call
/// <see cref="IAppender.Close"/> on the appender removed.
/// </para>
/// </remarks>
- public virtual IAppender RemoveAppender(string name)
+ public virtual IAppender? RemoveAppender(string? name)
{
m_appenderLock.AcquireWriterLock();
try
{
- if (name != null && m_appenderAttachedImpl != null)
+ if (name is not null && m_appenderAttachedImpl is not null)
{
return m_appenderAttachedImpl.RemoveAppender(name);
}
@@ -380,29 +327,15 @@
}
return null;
}
-
- #endregion
-
- #region Implementation of ILogger
-
+
/// <summary>
/// Gets the logger name.
/// </summary>
- /// <value>
- /// The name of the logger.
- /// </value>
- /// <remarks>
- /// <para>
- /// The name of this logger
- /// </para>
- /// </remarks>
- public virtual string Name
- {
- get { return m_name; }
- }
+ public virtual string Name { get; }
/// <summary>
- /// This generic form is intended to be used by wrappers.
+ /// Generates a logging event for the specified <paramref name="level"/> using
+ /// the <paramref name="message"/> and <paramref name="exception"/>.
/// </summary>
/// <param name="callerStackBoundaryDeclaringType">The declaring type of the method that is
/// the stack boundary into the logging system for this call.</param>
@@ -411,52 +344,45 @@
/// <param name="exception">The exception to log, including its stack trace.</param>
/// <remarks>
/// <para>
- /// Generate a logging event for the specified <paramref name="level"/> using
- /// the <paramref name="message"/> and <paramref name="exception"/>.
+ /// This generic form is intended to be used by wrappers.
/// </para>
/// <para>
/// This method must not throw any exception to the caller.
/// </para>
/// </remarks>
- public virtual void Log(Type callerStackBoundaryDeclaringType, Level level, object message, Exception exception)
+ public virtual void Log(Type? callerStackBoundaryDeclaringType, Level? level, object message, Exception? exception)
{
try
{
if (IsEnabledFor(level))
{
- ForcedLog((callerStackBoundaryDeclaringType != null) ? callerStackBoundaryDeclaringType : declaringType, level, message, exception);
+ ForcedLog(callerStackBoundaryDeclaringType ?? declaringType, level, message, exception);
}
}
catch (Exception ex)
{
- log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex);
+ LogLog.Error(declaringType, "Exception while logging", ex);
}
-#if !NET_2_0 && !MONO_2_0 && !MONO_3_5 && !MONO_4_0 && !NETSTANDARD
- catch
- {
- log4net.Util.LogLog.Error(declaringType, "Exception while logging");
- }
-#endif
}
/// <summary>
- /// This is the most generic printing method that is intended to be used
- /// by wrappers.
+ /// Logs the specified logging event through this logger.
/// </summary>
/// <param name="logEvent">The event being logged.</param>
/// <remarks>
/// <para>
- /// Logs the specified logging event through this logger.
+ /// This is the most generic printing method that is intended to be used
+ /// by wrappers.
/// </para>
/// <para>
/// This method must not throw any exception to the caller.
/// </para>
/// </remarks>
- public virtual void Log(LoggingEvent logEvent)
+ public virtual void Log(LoggingEvent? logEvent)
{
try
{
- if (logEvent != null)
+ if (logEvent is not null)
{
if (IsEnabledFor(logEvent.Level))
{
@@ -466,14 +392,8 @@
}
catch (Exception ex)
{
- log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex);
+ LogLog.Error(declaringType, "Exception while logging", ex);
}
-#if !NET_2_0 && !MONO_2_0 && !MONO_3_5 && !MONO_4_0 && !NETSTANDARD
- catch
- {
- log4net.Util.LogLog.Error(declaringType, "Exception while logging");
- }
-#endif
}
/// <summary>
@@ -485,35 +405,26 @@
/// </returns>
/// <remarks>
/// <para>
- /// Test if this logger is going to log events of the specified <paramref name="level"/>.
- /// </para>
- /// <para>
/// This method must not throw any exception to the caller.
/// </para>
/// </remarks>
- public virtual bool IsEnabledFor(Level level)
+ public virtual bool IsEnabledFor(Level? level)
{
try
{
- if (level != null)
+ if (level is not null)
{
- if (m_hierarchy.IsDisabled(level))
+ if (m_hierarchy is not null && m_hierarchy.IsDisabled(level))
{
return false;
}
- return level >= this.EffectiveLevel;
+ return level >= EffectiveLevel;
}
}
catch (Exception ex)
{
- log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex);
+ LogLog.Error(declaringType, "Exception while logging", ex);
}
-#if !NET_2_0 && !MONO_2_0 && !MONO_3_5 && !MONO_4_0 && !NETSTANDARD
- catch
- {
- log4net.Util.LogLog.Error(declaringType, "Exception while logging");
- }
-#endif
return false;
}
@@ -521,21 +432,7 @@
/// Gets the <see cref="ILoggerRepository"/> where this
/// <c>Logger</c> instance is attached to.
/// </summary>
- /// <value>
- /// The <see cref="ILoggerRepository" /> that this logger belongs to.
- /// </value>
- /// <remarks>
- /// <para>
- /// Gets the <see cref="ILoggerRepository"/> where this
- /// <c>Logger</c> instance is attached to.
- /// </para>
- /// </remarks>
- public ILoggerRepository Repository
- {
- get { return m_hierarchy; }
- }
-
- #endregion Implementation of ILogger
+ public ILoggerRepository? Repository => m_hierarchy;
/// <summary>
/// Deliver the <see cref="LoggingEvent"/> to the attached appenders.
@@ -553,24 +450,24 @@
/// to log the particular log request.
/// </para>
/// </remarks>
- protected virtual void CallAppenders(LoggingEvent loggingEvent)
+ protected virtual void CallAppenders(LoggingEvent loggingEvent)
{
- if (loggingEvent == null)
+ if (loggingEvent is null)
{
- throw new ArgumentNullException("loggingEvent");
+ throw new ArgumentNullException(nameof(loggingEvent));
}
int writes = 0;
- for (Logger c = this; c != null; c = c.m_parent)
+ for(Logger? c = this; c is not null; c = c.m_parent)
{
- if (c.m_appenderAttachedImpl != null)
+ if (c.m_appenderAttachedImpl is not null)
{
// Protected against simultaneous call to addAppender, removeAppender,...
c.m_appenderLock.AcquireReaderLock();
try
{
- if (c.m_appenderAttachedImpl != null)
+ if (c.m_appenderAttachedImpl is not null)
{
writes += c.m_appenderAttachedImpl.AppendLoopOnAppenders(loggingEvent);
}
@@ -581,12 +478,12 @@
}
}
- if (!c.m_additive)
+ if (!c.Additivity)
{
break;
}
}
-
+
// No appenders in hierarchy, warn user only once.
//
// Note that by including the AppDomain values for the currently running
@@ -596,21 +493,19 @@
// or impossible to determine which .config file is missing appender
// definitions.
//
- if (!m_hierarchy.EmittedNoAppenderWarning && writes == 0)
+ if (m_hierarchy is not null && !m_hierarchy.EmittedNoAppenderWarning && writes == 0)
{
m_hierarchy.EmittedNoAppenderWarning = true;
- LogLog.Debug(declaringType, "No appenders could be found for logger [" + Name + "] repository [" + Repository.Name + "]");
+ LogLog.Debug(declaringType, "No appenders could be found for logger [" + Name + "] repository [" + Repository?.Name + "]");
LogLog.Debug(declaringType, "Please initialize the log4net system properly.");
try
{
LogLog.Debug(declaringType, " Current AppDomain context information: ");
LogLog.Debug(declaringType, " BaseDirectory : " + SystemInfo.ApplicationBaseDirectory);
-#if !NETCF && !NETSTANDARD1_3
LogLog.Debug(declaringType, " FriendlyName : " + AppDomain.CurrentDomain.FriendlyName);
LogLog.Debug(declaringType, " DynamicDirectory: " + AppDomain.CurrentDomain.DynamicDirectory);
-#endif
}
- catch (System.Security.SecurityException)
+ catch(System.Security.SecurityException)
{
// Insufficient permissions to display info from the AppDomain
}
@@ -625,15 +520,15 @@
/// Used to ensure that the appenders are correctly shutdown.
/// </para>
/// </remarks>
- public virtual void CloseNestedAppenders()
+ public virtual void CloseNestedAppenders()
{
m_appenderLock.AcquireWriterLock();
try
{
- if (m_appenderAttachedImpl != null)
+ if (m_appenderAttachedImpl is not null)
{
AppenderCollection appenders = m_appenderAttachedImpl.Appenders;
- foreach (IAppender appender in appenders)
+ foreach(IAppender appender in appenders)
{
if (appender is IAppenderAttachable)
{
@@ -660,7 +555,7 @@
/// the <paramref name="message"/>.
/// </para>
/// </remarks>
- public virtual void Log(Level level, object message, Exception exception)
+ public virtual void Log(Level level, object message, Exception? exception)
{
if (IsEnabledFor(level))
{
@@ -682,9 +577,9 @@
/// appenders.
/// </para>
/// </remarks>
- protected virtual void ForcedLog(Type callerStackBoundaryDeclaringType, Level level, object message, Exception exception)
+ protected virtual void ForcedLog(Type callerStackBoundaryDeclaringType, Level? level, object message, Exception? exception)
{
- CallAppenders(new LoggingEvent(callerStackBoundaryDeclaringType, this.Hierarchy, this.Name, level, message, exception));
+ CallAppenders(new LoggingEvent(callerStackBoundaryDeclaringType, Hierarchy, Name, level, message, exception));
}
/// <summary>
@@ -696,44 +591,21 @@
/// Delivers the logging event to the attached appenders.
/// </para>
/// </remarks>
- protected virtual void ForcedLog(LoggingEvent logEvent)
+ protected virtual void ForcedLog(LoggingEvent logEvent)
{
// The logging event may not have been created by this logger
// the Repository may not be correctly set on the event. This
// is required for the appenders to correctly lookup renderers etc...
- logEvent.EnsureRepository(this.Hierarchy);
+ logEvent.EnsureRepository(Hierarchy);
CallAppenders(logEvent);
}
- #region Private Static Fields
-
/// <summary>
/// The fully qualified type of the Logger class.
/// </summary>
private static readonly Type declaringType = typeof(Logger);
- #endregion Private Static Fields
-
- #region Private Instance Fields
-
- /// <summary>
- /// The name of this logger.
- /// </summary>
- private readonly string m_name;
-
- /// <summary>
- /// The assigned level of this logger.
- /// </summary>
- /// <remarks>
- /// <para>
- /// The <c>level</c> variable need not be
- /// assigned a value in which case it is inherited
- /// form the hierarchy.
- /// </para>
- /// </remarks>
- private Level m_level;
-
/// <summary>
/// The parent of this logger.
/// </summary>
@@ -743,7 +615,7 @@
/// All loggers have at least one ancestor which is the root logger.
/// </para>
/// </remarks>
- private Logger m_parent;
+ private Logger? m_parent;
/// <summary>
/// Loggers need to know what Hierarchy they are in.
@@ -755,34 +627,16 @@
/// here.
/// </para>
/// </remarks>
- private Hierarchy m_hierarchy;
+ private Hierarchy? m_hierarchy;
/// <summary>
/// Helper implementation of the <see cref="IAppenderAttachable"/> interface
/// </summary>
- private log4net.Util.AppenderAttachedImpl m_appenderAttachedImpl;
-
- /// <summary>
- /// Flag indicating if child loggers inherit their parents appenders
- /// </summary>
- /// <remarks>
- /// <para>
- /// Additivity is set to true by default, that is children inherit
- /// the appenders of their ancestors by default. If this variable is
- /// set to <c>false</c> then the appenders found in the
- /// ancestors of this logger are not used. However, the children
- /// of this logger will inherit its appenders, unless the children
- /// have their additivity flag set to <c>false</c> too. See
- /// the user manual for more details.
- /// </para>
- /// </remarks>
- private bool m_additive = true;
+ private AppenderAttachedImpl? m_appenderAttachedImpl;
/// <summary>
/// Lock to protect AppenderAttachedImpl variable m_appenderAttachedImpl
/// </summary>
- private readonly ReaderWriterLock m_appenderLock = new ReaderWriterLock();
-
- #endregion
+ private readonly ReaderWriterLock m_appenderLock = new();
}
}
diff --git a/src/log4net/Repository/Hierarchy/LoggerKey.cs b/src/log4net/Repository/Hierarchy/LoggerKey.cs
index 7d74ad8..de16cbc 100644
--- a/src/log4net/Repository/Hierarchy/LoggerKey.cs
+++ b/src/log4net/Repository/Hierarchy/LoggerKey.cs
@@ -18,6 +18,7 @@
#endregion
using System;
+using System.Collections.Generic;
namespace log4net.Repository.Hierarchy
{
@@ -38,10 +39,8 @@
/// </remarks>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
- internal sealed class LoggerKey
+ internal readonly struct LoggerKey
{
- #region Internal Instance Constructors
-
/// <summary>
/// Construct key with string name
/// </summary>
@@ -64,19 +63,10 @@
/// <param name="name">The name of the logger.</param>
internal LoggerKey(string name)
{
-#if NETCF || NETSTANDARD1_3
- // NETCF: String.Intern causes Native Exception
- m_name = name;
-#else
m_name = string.Intern(name);
-#endif
m_hashCache = name.GetHashCode();
}
- #endregion Internal Instance Constructors
-
- #region Override implementation of Object
-
/// <summary>
/// Returns a hash code for the current instance.
/// </summary>
@@ -91,48 +81,19 @@
return m_hashCache;
}
- /// <summary>
- /// Determines whether two <see cref="LoggerKey" /> instances
- /// are equal.
- /// </summary>
- /// <param name="obj">The <see cref="object" /> to compare with the current <see cref="LoggerKey" />.</param>
- /// <returns>
- /// <c>true</c> if the specified <see cref="object" /> is equal to the current <see cref="LoggerKey" />; otherwise, <c>false</c>.
- /// </returns>
- /// <remarks>
- /// <para>
- /// Compares the references of the interned strings.
- /// </para>
- /// </remarks>
- public override bool Equals(object obj)
- {
- // Compare reference type of this against argument
- if (((object)this) == obj)
- {
- return true;
- }
-
- LoggerKey objKey = obj as LoggerKey;
- if (objKey != null)
- {
-#if NETCF || NETSTANDARD1_3
- return ( m_name == objKey.m_name );
-#else
- // Compare reference types rather than string's overloaded ==
- return (((object)m_name) == ((object)objKey.m_name));
-#endif
- }
- return false;
- }
-
- #endregion
-
- #region Private Instance Fields
-
private readonly string m_name;
private readonly int m_hashCache;
- #endregion Private Instance Fields
+ public static Comparer ComparerInstance { get; } = new();
+
+ public sealed class Comparer : IEqualityComparer<LoggerKey>
+ {
+ public bool Equals(LoggerKey x, LoggerKey y)
+ {
+ return x.m_hashCache == y.m_hashCache && x.m_name == y.m_name;
+ }
+
+ public int GetHashCode(LoggerKey obj) => obj.m_hashCache;
+ }
}
}
-
diff --git a/src/log4net/Repository/Hierarchy/ProvisionNode.cs b/src/log4net/Repository/Hierarchy/ProvisionNode.cs
index 9262a47..4762851 100644
--- a/src/log4net/Repository/Hierarchy/ProvisionNode.cs
+++ b/src/log4net/Repository/Hierarchy/ProvisionNode.cs
@@ -17,8 +17,7 @@
//
#endregion
-using System;
-using System.Collections;
+using System.Collections.Generic;
namespace log4net.Repository.Hierarchy
{
@@ -38,7 +37,7 @@
/// </remarks>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
- internal sealed class ProvisionNode : ArrayList
+ internal sealed class ProvisionNode : List<Logger>
{
/// <summary>
/// Create a new provision node with child node
@@ -50,9 +49,9 @@
/// with the specified child logger.
/// </para>
/// </remarks>
- internal ProvisionNode(Logger log) : base()
+ internal ProvisionNode(Logger log)
{
- this.Add(log);
+ Add(log);
}
}
}
diff --git a/src/log4net/Repository/Hierarchy/XmlHierarchyConfigurator.cs b/src/log4net/Repository/Hierarchy/XmlHierarchyConfigurator.cs
index 164933f..a1d7769 100644
--- a/src/log4net/Repository/Hierarchy/XmlHierarchyConfigurator.cs
+++ b/src/log4net/Repository/Hierarchy/XmlHierarchyConfigurator.cs
@@ -19,6 +19,7 @@
using System;
using System.Collections;
+using System.Collections.Generic;
using System.Globalization;
using System.Reflection;
using System.Xml;
@@ -48,8 +49,6 @@
Overwrite
}
- #region Public Instance Constructors
-
/// <summary>
/// Construct the configurator for a hierarchy
/// </summary>
@@ -63,13 +62,8 @@
public XmlHierarchyConfigurator(Hierarchy hierarchy)
{
m_hierarchy = hierarchy;
- m_appenderBag = new Hashtable();
}
- #endregion Public Instance Constructors
-
- #region Public Instance Methods
-
/// <summary>
/// Configure the hierarchy by parsing a DOM tree of XML elements.
/// </summary>
@@ -79,9 +73,9 @@
/// Configure the hierarchy by parsing a DOM tree of XML elements.
/// </para>
/// </remarks>
- public void Configure(XmlElement element)
+ public void Configure(XmlElement? element)
{
- if (element == null || m_hierarchy == null)
+ if (element is null)
{
return;
}
@@ -90,7 +84,7 @@
if (rootElementName != CONFIGURATION_TAG)
{
- LogLog.Error(declaringType, "Xml element is - not a <" + CONFIGURATION_TAG + "> element.");
+ LogLog.Error(declaringType, $"Xml element is - not a <{CONFIGURATION_TAG}> element.");
return;
}
@@ -98,7 +92,7 @@
{
// Look for a emitDebug attribute to enable internal debug
string emitDebugAttribute = element.GetAttribute(EMIT_INTERNAL_DEBUG_ATTR);
- LogLog.Debug(declaringType, EMIT_INTERNAL_DEBUG_ATTR + " attribute [" + emitDebugAttribute + "].");
+ LogLog.Debug(declaringType, $"{EMIT_INTERNAL_DEBUG_ATTR} attribute [{emitDebugAttribute}].");
if (emitDebugAttribute.Length > 0 && emitDebugAttribute != "null")
{
@@ -106,7 +100,7 @@
}
else
{
- LogLog.Debug(declaringType, "Ignoring " + EMIT_INTERNAL_DEBUG_ATTR + " attribute.");
+ LogLog.Debug(declaringType, $"Ignoring {EMIT_INTERNAL_DEBUG_ATTR} attribute.");
}
}
@@ -114,7 +108,7 @@
{
// Look for a debug attribute to enable internal debug
string debugAttribute = element.GetAttribute(INTERNAL_DEBUG_ATTR);
- LogLog.Debug(declaringType, INTERNAL_DEBUG_ATTR + " attribute [" + debugAttribute + "].");
+ LogLog.Debug(declaringType, $"{INTERNAL_DEBUG_ATTR} attribute [{debugAttribute}].");
if (debugAttribute.Length > 0 && debugAttribute != "null")
{
@@ -122,38 +116,45 @@
}
else
{
- LogLog.Debug(declaringType, "Ignoring " + INTERNAL_DEBUG_ATTR + " attribute.");
+ LogLog.Debug(declaringType, $"Ignoring {INTERNAL_DEBUG_ATTR} attribute.");
}
string confDebug = element.GetAttribute(CONFIG_DEBUG_ATTR);
if (confDebug.Length > 0 && confDebug != "null")
{
- LogLog.Warn(declaringType, "The \"" + CONFIG_DEBUG_ATTR + "\" attribute is deprecated.");
- LogLog.Warn(declaringType, "Use the \"" + INTERNAL_DEBUG_ATTR + "\" attribute instead.");
+ LogLog.Warn(declaringType, $"The \"{CONFIG_DEBUG_ATTR}\" attribute is deprecated.");
+ LogLog.Warn(declaringType, $"Use the \"{INTERNAL_DEBUG_ATTR}\" attribute instead.");
LogLog.InternalDebugging = OptionConverter.ToBoolean(confDebug, true);
}
}
// Default mode is merge
- ConfigUpdateMode configUpdateMode = ConfigUpdateMode.Merge;
+ ConfigUpdateMode? configUpdateMode = ConfigUpdateMode.Merge;
// Look for the config update attribute
- string configUpdateModeAttribute = element.GetAttribute(CONFIG_UPDATE_MODE_ATTR);
- if (configUpdateModeAttribute != null && configUpdateModeAttribute.Length > 0)
+ string? configUpdateModeAttribute = element.GetAttribute(CONFIG_UPDATE_MODE_ATTR);
+ if (!string.IsNullOrEmpty(configUpdateModeAttribute))
{
// Parse the attribute
try
{
- configUpdateMode = (ConfigUpdateMode)OptionConverter.ConvertStringTo(typeof(ConfigUpdateMode), configUpdateModeAttribute);
+ if (OptionConverter.ConvertStringTo(typeof(ConfigUpdateMode), configUpdateModeAttribute) is ConfigUpdateMode mode)
+ {
+ configUpdateMode = mode;
+ }
+ else
+ {
+ LogLog.Error(declaringType, $"Invalid {CONFIG_UPDATE_MODE_ATTR} attribute value [{configUpdateModeAttribute}]");
+ }
}
catch
{
- LogLog.Error(declaringType, "Invalid " + CONFIG_UPDATE_MODE_ATTR + " attribute value [" + configUpdateModeAttribute + "]");
+ LogLog.Error(declaringType, $"Invalid {CONFIG_UPDATE_MODE_ATTR} attribute value [{configUpdateModeAttribute}]");
}
}
// IMPL: The IFormatProvider argument to Enum.ToString() is deprecated in .NET 2.0
- LogLog.Debug(declaringType, "Configuration update mode [" + configUpdateMode.ToString() + "].");
+ LogLog.Debug(declaringType, $"Configuration update mode [{configUpdateMode}].");
// Only reset configuration if overwrite flag specified
if (configUpdateMode == ConfigUpdateMode.Overwrite)
@@ -206,27 +207,23 @@
// Lastly set the hierarchy threshold
string thresholdStr = element.GetAttribute(THRESHOLD_ATTR);
- LogLog.Debug(declaringType, "Hierarchy Threshold [" + thresholdStr + "]");
+ LogLog.Debug(declaringType, $"Hierarchy Threshold [{thresholdStr}]");
if (thresholdStr.Length > 0 && thresholdStr != "null")
{
Level thresholdLevel = (Level)ConvertStringTo(typeof(Level), thresholdStr);
- if (thresholdLevel != null)
+ if (thresholdLevel is not null)
{
m_hierarchy.Threshold = thresholdLevel;
}
else
{
- LogLog.Warn(declaringType, "Unable to set hierarchy threshold using value [" + thresholdStr + "] (with acceptable conversion types)");
+ LogLog.Warn(declaringType, $"Unable to set hierarchy threshold using value [{thresholdStr}] (with acceptable conversion types)");
}
}
// Done reading config
}
- #endregion Public Instance Methods
-
- #region Protected Instance Methods
-
/// <summary>
/// Parse appenders by IDREF.
/// </summary>
@@ -238,47 +235,42 @@
/// the appender.
/// </para>
/// </remarks>
- protected IAppender FindAppenderByReference(XmlElement appenderRef)
+ protected IAppender? FindAppenderByReference(XmlElement appenderRef)
{
- string appenderName = appenderRef.GetAttribute(REF_ATTR);
+ string? appenderName = appenderRef.GetAttribute(REF_ATTR);
- IAppender appender = (IAppender)m_appenderBag[appenderName];
- if (appender != null)
+ if (m_appenderBag.TryGetValue(appenderName, out IAppender? appender))
{
return appender;
}
- else
+
+ // Find the element with that id
+ XmlElement? element = null;
+
+ if (!string.IsNullOrEmpty(appenderName) && appenderRef.OwnerDocument is not null)
{
- // Find the element with that id
- XmlElement element = null;
-
- if (appenderName != null && appenderName.Length > 0)
+ foreach (XmlElement curAppenderElement in appenderRef.OwnerDocument.GetElementsByTagName(APPENDER_TAG))
{
- foreach (XmlElement curAppenderElement in appenderRef.OwnerDocument.GetElementsByTagName(APPENDER_TAG))
+ if (curAppenderElement.GetAttribute("name") == appenderName)
{
- if (curAppenderElement.GetAttribute("name") == appenderName)
- {
- element = curAppenderElement;
- break;
- }
+ element = curAppenderElement;
+ break;
}
}
-
- if (element == null)
- {
- LogLog.Error(declaringType, "XmlHierarchyConfigurator: No appender named [" + appenderName + "] could be found.");
- return null;
- }
- else
- {
- appender = ParseAppender(element);
- if (appender != null)
- {
- m_appenderBag[appenderName] = appender;
- }
- return appender;
- }
}
+
+ if (element is null)
+ {
+ LogLog.Error(declaringType, $"XmlHierarchyConfigurator: No appender named [{appenderName}] could be found.");
+ return null;
+ }
+
+ appender = ParseAppender(element);
+ if (appender is not null)
+ {
+ m_appenderBag[appenderName] = appender;
+ }
+ return appender;
}
/// <summary>
@@ -292,24 +284,20 @@
/// the appender instance.
/// </para>
/// </remarks>
- protected IAppender ParseAppender(XmlElement appenderElement)
+ protected IAppender? ParseAppender(XmlElement appenderElement)
{
string appenderName = appenderElement.GetAttribute(NAME_ATTR);
string typeName = appenderElement.GetAttribute(TYPE_ATTR);
- LogLog.Debug(declaringType, "Loading Appender [" + appenderName + "] type: [" + typeName + "]");
+ LogLog.Debug(declaringType, $"Loading Appender [{appenderName}] type: [{typeName}]");
try
{
-#if NETSTANDARD1_3
- IAppender appender = (IAppender)Activator.CreateInstance(SystemInfo.GetTypeFromString(this.GetType().GetTypeInfo().Assembly, typeName, true, true));
-#else
- IAppender appender = (IAppender)Activator.CreateInstance(SystemInfo.GetTypeFromString(typeName, true, true));
-#endif
+ IAppender appender = (IAppender)Activator.CreateInstance(SystemInfo.GetTypeFromString(typeName, true, true)!);
appender.Name = appenderName;
foreach (XmlNode currentNode in appenderElement.ChildNodes)
{
- /* We're only interested in Elements */
+ // We're only interested in Elements
if (currentNode.NodeType == XmlNodeType.Element)
{
XmlElement currentElement = (XmlElement)currentNode;
@@ -319,20 +307,19 @@
{
string refName = currentElement.GetAttribute(REF_ATTR);
- IAppenderAttachable appenderContainer = appender as IAppenderAttachable;
- if (appenderContainer != null)
+ if (appender is IAppenderAttachable appenderContainer)
{
- LogLog.Debug(declaringType, "Attaching appender named [" + refName + "] to appender named [" + appender.Name + "].");
+ LogLog.Debug(declaringType, $"Attaching appender named [{refName}] to appender named [{appender.Name}].");
IAppender referencedAppender = FindAppenderByReference(currentElement);
- if (referencedAppender != null)
+ if (referencedAppender is not null)
{
appenderContainer.AddAppender(referencedAppender);
}
}
else
{
- LogLog.Error(declaringType, "Requesting attachment of appender named [" + refName + "] to appender named [" + appender.Name + "] which does not implement log4net.Core.IAppenderAttachable.");
+ LogLog.Error(declaringType, $"Requesting attachment of appender named [{refName}] to appender named [{appender.Name}] which does not implement log4net.Core.IAppenderAttachable.");
}
}
else
@@ -343,20 +330,19 @@
}
}
- IOptionHandler optionHandler = appender as IOptionHandler;
- if (optionHandler != null)
+ if (appender is IOptionHandler optionHandler)
{
optionHandler.ActivateOptions();
}
- LogLog.Debug(declaringType, "Created Appender [" + appenderName + "]");
+ LogLog.Debug(declaringType, $"Created Appender [{appenderName}]");
return appender;
}
catch (Exception ex)
{
// Yes, it's ugly. But all exceptions point to the same problem: we can't create an Appender
- LogLog.Error(declaringType, "Could not create Appender [" + appenderName + "] of type [" + typeName + "]. Reported error follows.", ex);
+ LogLog.Error(declaringType, $"Could not create Appender [{appenderName}] of type [{typeName}]. Reported error follows.", ex);
return null;
}
}
@@ -375,19 +361,21 @@
// Create a new log4net.Logger object from the <logger> element.
string loggerName = loggerElement.GetAttribute(NAME_ATTR);
- LogLog.Debug(declaringType, "Retrieving an instance of log4net.Repository.Logger for logger [" + loggerName + "].");
- Logger log = m_hierarchy.GetLogger(loggerName) as Logger;
+ LogLog.Debug(declaringType, $"Retrieving an instance of log4net.Repository.Logger for logger [{loggerName}].");
// Setting up a logger needs to be an atomic operation, in order
// to protect potential log operations while logger
// configuration is in progress.
- lock (log)
+ if (m_hierarchy.GetLogger(loggerName) is Logger log)
{
- bool additivity = OptionConverter.ToBoolean(loggerElement.GetAttribute(ADDITIVITY_ATTR), true);
+ lock (log)
+ {
+ bool additivity = OptionConverter.ToBoolean(loggerElement.GetAttribute(ADDITIVITY_ATTR), true);
- LogLog.Debug(declaringType, "Setting [" + log.Name + "] additivity to [" + additivity + "].");
- log.Additivity = additivity;
- ParseChildrenOfLoggerElement(loggerElement, log, false);
+ LogLog.Debug(declaringType, $"Setting [{log.Name}] additivity to [{additivity}].");
+ log.Additivity = additivity;
+ ParseChildrenOfLoggerElement(loggerElement, log, false);
+ }
}
}
@@ -437,17 +425,17 @@
{
IAppender appender = FindAppenderByReference(currentElement);
string refName = currentElement.GetAttribute(REF_ATTR);
- if (appender != null)
+ if (appender is not null)
{
- LogLog.Debug(declaringType, "Adding appender named [" + refName + "] to logger [" + log.Name + "].");
+ LogLog.Debug(declaringType, $"Adding appender named [{refName}] to logger [{log.Name}].");
log.AddAppender(appender);
}
else
{
- LogLog.Error(declaringType, "Appender named [" + refName + "] not found.");
+ LogLog.Error(declaringType, $"Appender named [{refName}] not found.");
}
}
- else if (currentElement.LocalName == LEVEL_TAG || currentElement.LocalName == PRIORITY_TAG)
+ else if (currentElement.LocalName is LEVEL_TAG or PRIORITY_TAG)
{
ParseLevel(currentElement, log, isRoot);
}
@@ -458,8 +446,7 @@
}
}
- IOptionHandler optionHandler = log as IOptionHandler;
- if (optionHandler != null)
+ if (log is IOptionHandler optionHandler)
{
optionHandler.ActivateOptions();
}
@@ -479,27 +466,21 @@
string renderingClassName = element.GetAttribute(RENDERING_TYPE_ATTR);
string renderedClassName = element.GetAttribute(RENDERED_TYPE_ATTR);
- LogLog.Debug(declaringType, "Rendering class [" + renderingClassName + "], Rendered class [" + renderedClassName + "].");
+ LogLog.Debug(declaringType, $"Rendering class [{renderingClassName}], Rendered class [{renderedClassName}].");
IObjectRenderer renderer = (IObjectRenderer)OptionConverter.InstantiateByClassName(renderingClassName, typeof(IObjectRenderer), null);
- if (renderer == null)
+ if (renderer is null)
{
- LogLog.Error(declaringType, "Could not instantiate renderer [" + renderingClassName + "].");
+ LogLog.Error(declaringType, $"Could not instantiate renderer [{renderingClassName}].");
return;
}
- else
+
+ try
{
- try
- {
-#if NETSTANDARD1_3
- m_hierarchy.RendererMap.Put(SystemInfo.GetTypeFromString(this.GetType().GetTypeInfo().Assembly, renderedClassName, true, true), renderer);
-#else
- m_hierarchy.RendererMap.Put(SystemInfo.GetTypeFromString(renderedClassName, true, true), renderer);
-#endif
- }
- catch (Exception e)
- {
- LogLog.Error(declaringType, "Could not find class [" + renderedClassName + "].", e);
- }
+ m_hierarchy.RendererMap.Put(SystemInfo.GetTypeFromString(renderedClassName, true, true)!, renderer);
+ }
+ catch (Exception e)
+ {
+ LogLog.Error(declaringType, $"Could not find class [{renderedClassName}].", e);
}
}
@@ -523,7 +504,7 @@
}
string levelStr = element.GetAttribute(VALUE_ATTR);
- LogLog.Debug(declaringType, "Logger [" + loggerName + "] Level string is [" + levelStr + "].");
+ LogLog.Debug(declaringType, $"Logger [{loggerName}] Level string is [{levelStr}].");
if (INHERITED == levelStr)
{
@@ -533,20 +514,20 @@
}
else
{
- LogLog.Debug(declaringType, "Logger [" + loggerName + "] level set to inherit from parent.");
+ LogLog.Debug(declaringType, $"Logger [{loggerName}] level set to inherit from parent.");
log.Level = null;
}
}
else
{
- log.Level = log.Hierarchy.LevelMap[levelStr];
- if (log.Level == null)
+ log.Level = log.Hierarchy?.LevelMap[levelStr];
+ if (log.Level is null)
{
- LogLog.Error(declaringType, "Undefined level [" + levelStr + "] on Logger [" + loggerName + "].");
+ LogLog.Error(declaringType, $"Undefined level [{levelStr}] on Logger [{loggerName}].");
}
else
{
- LogLog.Debug(declaringType, "Logger [" + loggerName + "] level set to [name=\"" + log.Level.Name + "\",value=" + log.Level.Value + "].");
+ LogLog.Debug(declaringType, $"Logger [{loggerName}] level set to [name=\"{log.Level.Name}\",value={log.Level.Value}].");
}
}
}
@@ -573,21 +554,20 @@
string name = element.GetAttribute(NAME_ATTR);
// If the name attribute does not exist then use the name of the element
- if (element.LocalName != PARAM_TAG || name == null || name.Length == 0)
+ if (element.LocalName != PARAM_TAG || name.Length == 0)
{
name = element.LocalName;
}
// Look for the property on the target object
Type targetType = target.GetType();
- Type propertyType = null;
+ Type? propertyType = null;
- PropertyInfo propInfo = null;
- MethodInfo methInfo = null;
+ MethodInfo? methInfo = null;
// Try to find a writable property
- propInfo = targetType.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.IgnoreCase);
- if (propInfo != null && propInfo.CanWrite)
+ PropertyInfo? propInfo = targetType.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.IgnoreCase);
+ if (propInfo is not null && propInfo.CanWrite)
{
// found a property
propertyType = propInfo.PropertyType;
@@ -598,22 +578,21 @@
// look for a method with the signature Add<property>(type)
methInfo = FindMethodInfo(targetType, name);
-
- if (methInfo != null)
+ if (methInfo is not null)
{
propertyType = methInfo.GetParameters()[0].ParameterType;
}
}
- if (propertyType == null)
+ if (propertyType is null)
{
- LogLog.Error(declaringType, "XmlHierarchyConfigurator: Cannot find Property [" + name + "] to set object on [" + target.ToString() + "]");
+ LogLog.Error(declaringType, $"XmlHierarchyConfigurator: Cannot find Property [{name}] to set object on [{target}]");
}
else
{
- string propertyValue = null;
+ string? propertyValue = null;
- if (element.GetAttributeNode(VALUE_ATTR) != null)
+ if (element.GetAttributeNode(VALUE_ATTR) is not null)
{
propertyValue = element.GetAttribute(VALUE_ATTR);
}
@@ -622,9 +601,9 @@
// Concatenate the CDATA and Text nodes together
foreach (XmlNode childNode in element.ChildNodes)
{
- if (childNode.NodeType == XmlNodeType.CDATA || childNode.NodeType == XmlNodeType.Text)
+ if (childNode.NodeType is XmlNodeType.CDATA or XmlNodeType.Text)
{
- if (propertyValue == null)
+ if (propertyValue is null)
{
propertyValue = childNode.InnerText;
}
@@ -636,9 +615,8 @@
}
}
- if (propertyValue != null)
+ if (propertyValue is not null)
{
-#if !NETCF && !NETSTANDARD1_3 // NETSTANDARD1_3: System.Runtime.InteropServices.RuntimeInformation not available on desktop 4.6
try
{
// Expand environment variables in the string.
@@ -656,24 +634,19 @@
// will be skipped with the following warning message.
LogLog.Debug(declaringType, "Security exception while trying to expand environment variables. Error Ignored. No Expansion.");
}
-#endif
Type parsedObjectConversionTargetType = null;
// Check if a specific subtype is specified on the element using the 'type' attribute
string subTypeString = element.GetAttribute(TYPE_ATTR);
- if (subTypeString != null && subTypeString.Length > 0)
+ if (subTypeString.Length > 0)
{
// Read the explicit subtype
try
{
-#if NETSTANDARD1_3
- Type subType = SystemInfo.GetTypeFromString(this.GetType().GetTypeInfo().Assembly, subTypeString, true, true);
-#else
- Type subType = SystemInfo.GetTypeFromString(subTypeString, true, true);
-#endif
+ Type subType = SystemInfo.GetTypeFromString(subTypeString, true, true)!;
- LogLog.Debug(declaringType, "Parameter [" + name + "] specified subtype [" + subType.FullName + "]");
+ LogLog.Debug(declaringType, $"Parameter [{name}] specified subtype [{subType.FullName}]");
if (!propertyType.IsAssignableFrom(subType))
{
@@ -683,12 +656,12 @@
// Must re-convert to the real property type
parsedObjectConversionTargetType = propertyType;
- // Use sub type as intermediary type
+ // Use subtype as intermediary type
propertyType = subType;
}
else
{
- LogLog.Error(declaringType, "subtype [" + subType.FullName + "] set on [" + name + "] is not a subclass of property type [" + propertyType.FullName + "] and there are no acceptable type conversions.");
+ LogLog.Error(declaringType, $"subtype [{subType.FullName}] set on [{name}] is not a subclass of property type [{propertyType.FullName}] and there are no acceptable type conversions.");
}
}
else
@@ -700,71 +673,63 @@
}
catch (Exception ex)
{
- LogLog.Error(declaringType, "Failed to find type [" + subTypeString + "] set on [" + name + "]", ex);
+ LogLog.Error(declaringType, $"Failed to find type [{subTypeString}] set on [{name}]", ex);
}
}
// Now try to convert the string value to an acceptable type
// to pass to this property.
- object convertedValue = ConvertStringTo(propertyType, propertyValue);
+ object? convertedValue = ConvertStringTo(propertyType, propertyValue);
// Check if we need to do an additional conversion
- if (convertedValue != null && parsedObjectConversionTargetType != null)
+ if (convertedValue is not null && parsedObjectConversionTargetType is not null)
{
- LogLog.Debug(declaringType, "Performing additional conversion of value from [" + convertedValue.GetType().Name + "] to [" + parsedObjectConversionTargetType.Name + "]");
+ LogLog.Debug(declaringType, $"Performing additional conversion of value from [{convertedValue.GetType().Name}] to [{parsedObjectConversionTargetType.Name}]");
convertedValue = OptionConverter.ConvertTypeTo(convertedValue, parsedObjectConversionTargetType);
}
- if (convertedValue != null)
+ if (convertedValue is not null)
{
- if (propInfo != null)
+ if (propInfo is not null)
{
// Got a converted result
- LogLog.Debug(declaringType, "Setting Property [" + propInfo.Name + "] to " + convertedValue.GetType().Name + " value [" + convertedValue.ToString() + "]");
+ LogLog.Debug(declaringType, $"Setting Property [{propInfo.Name}] to {convertedValue.GetType().Name} value [{convertedValue}]");
try
{
// Pass to the property
-#if NETSTANDARD1_3 // TODO BindingFlags is available for netstandard1.5
- propInfo.SetValue(target, convertedValue, null);
-#else
propInfo.SetValue(target, convertedValue, BindingFlags.SetProperty, null, null, CultureInfo.InvariantCulture);
-#endif
}
catch (TargetInvocationException targetInvocationEx)
{
- LogLog.Error(declaringType, "Failed to set parameter [" + propInfo.Name + "] on object [" + target + "] using value [" + convertedValue + "]", targetInvocationEx.InnerException);
+ LogLog.Error(declaringType, $"Failed to set parameter [{propInfo.Name}] on object [{target}] using value [{convertedValue}]", targetInvocationEx.InnerException);
}
}
- else if (methInfo != null)
+ else
{
// Got a converted result
- LogLog.Debug(declaringType, "Setting Collection Property [" + methInfo.Name + "] to " + convertedValue.GetType().Name + " value [" + convertedValue.ToString() + "]");
+ LogLog.Debug(declaringType, $"Setting Collection Property [{methInfo.Name}] to {convertedValue.GetType().Name} value [{convertedValue}]");
try
{
// Pass to the property
-#if NETSTANDARD1_3 // TODO BindingFlags is available for netstandard1.5
- methInfo.Invoke(target, new[] { convertedValue });
-#else
- methInfo.Invoke(target, BindingFlags.InvokeMethod, null, new object[] { convertedValue }, CultureInfo.InvariantCulture);
-#endif
+ methInfo.Invoke(target, BindingFlags.InvokeMethod, null, new[] { convertedValue }, CultureInfo.InvariantCulture);
}
catch (TargetInvocationException targetInvocationEx)
{
- LogLog.Error(declaringType, "Failed to set parameter [" + name + "] on object [" + target + "] using value [" + convertedValue + "]", targetInvocationEx.InnerException);
+ LogLog.Error(declaringType, $"Failed to set parameter [{name}] on object [{target}] using value [{convertedValue}]", targetInvocationEx.InnerException);
}
}
}
else
{
- LogLog.Warn(declaringType, "Unable to set property [" + name + "] on object [" + target + "] using value [" + propertyValue + "] (with acceptable conversion types)");
+ LogLog.Warn(declaringType, $"Unable to set property [{name}] on object [{target}] using value [{propertyValue}] (with acceptable conversion types)");
}
}
else
{
- object createdObject = null;
+ object? createdObject;
if (propertyType == typeof(string) && !HasAttributesOrElements(element))
{
@@ -773,12 +738,12 @@
// This is necessary because while the String is a class it does not have
// a default constructor that creates an empty string, which is the behavior
// we are trying to simulate and would be expected from CreateObjectFromXml
- createdObject = "";
+ createdObject = string.Empty;
}
else
{
// No value specified
- Type defaultObjectType = null;
+ Type? defaultObjectType = null;
if (IsTypeConstructible(propertyType))
{
defaultObjectType = propertyType;
@@ -787,48 +752,40 @@
createdObject = CreateObjectFromXml(element, defaultObjectType, propertyType);
}
- if (createdObject == null)
+ if (createdObject is null)
{
- LogLog.Error(declaringType, "Failed to create object to set param: " + name);
+ LogLog.Error(declaringType, $"Failed to create object to set param: {name}");
}
else
{
- if (propInfo != null)
+ if (propInfo is not null)
{
// Got a converted result
- LogLog.Debug(declaringType, "Setting Property [" + propInfo.Name + "] to object [" + createdObject + "]");
+ LogLog.Debug(declaringType, $"Setting Property [{propInfo.Name}] to object [{createdObject}]");
try
{
// Pass to the property
-#if NETSTANDARD1_3 // TODO BindingFlags is available for netstandard1.5
- propInfo.SetValue(target, createdObject, null);
-#else
propInfo.SetValue(target, createdObject, BindingFlags.SetProperty, null, null, CultureInfo.InvariantCulture);
-#endif
}
catch (TargetInvocationException targetInvocationEx)
{
- LogLog.Error(declaringType, "Failed to set parameter [" + propInfo.Name + "] on object [" + target + "] using value [" + createdObject + "]", targetInvocationEx.InnerException);
+ LogLog.Error(declaringType, $"Failed to set parameter [{propInfo.Name}] on object [{target}] using value [{createdObject}]", targetInvocationEx.InnerException);
}
}
- else if (methInfo != null)
+ else
{
// Got a converted result
- LogLog.Debug(declaringType, "Setting Collection Property [" + methInfo.Name + "] to object [" + createdObject + "]");
+ LogLog.Debug(declaringType, $"Setting Collection Property [{methInfo.Name}] to object [{createdObject}]");
try
{
// Pass to the property
-#if NETSTANDARD1_3 // TODO BindingFlags is available for netstandard1.5
- methInfo.Invoke(target, new[] { createdObject });
-#else
- methInfo.Invoke(target, BindingFlags.InvokeMethod, null, new object[] { createdObject }, CultureInfo.InvariantCulture);
-#endif
+ methInfo.Invoke(target, BindingFlags.InvokeMethod, null, new[] { createdObject }, CultureInfo.InvariantCulture);
}
catch (TargetInvocationException targetInvocationEx)
{
- LogLog.Error(declaringType, "Failed to set parameter [" + methInfo.Name + "] on object [" + target + "] using value [" + createdObject + "]", targetInvocationEx.InnerException);
+ LogLog.Error(declaringType, $"Failed to set parameter [{methInfo.Name}] on object [{target}] using value [{createdObject}]", targetInvocationEx.InnerException);
}
}
}
@@ -860,15 +817,10 @@
/// <returns><c>true</c> if the type is creatable using a default constructor, <c>false</c> otherwise</returns>
private static bool IsTypeConstructible(Type type)
{
-#if NETSTANDARD1_3
- TypeInfo typeInfo = type.GetTypeInfo();
- if (typeInfo.IsClass && !typeInfo.IsAbstract)
-#else
if (type.IsClass && !type.IsAbstract)
-#endif
{
- ConstructorInfo defaultConstructor = type.GetConstructor(new Type[0]);
- if (defaultConstructor != null && !defaultConstructor.IsAbstract && !defaultConstructor.IsPrivate)
+ ConstructorInfo defaultConstructor = type.GetConstructor(Type.EmptyTypes);
+ if (defaultConstructor is not null && !defaultConstructor.IsAbstract && !defaultConstructor.IsPrivate)
{
return true;
}
@@ -889,7 +841,7 @@
/// The method must take a single parameter.
/// </para>
/// </remarks>
- private MethodInfo FindMethodInfo(Type targetType, string name)
+ private static MethodInfo? FindMethodInfo(Type targetType, string name)
{
string requiredMethodNameA = name;
string requiredMethodNameB = "Add" + name;
@@ -908,7 +860,7 @@
// Found matching method name
// Look for version with one arg only
- System.Reflection.ParameterInfo[] methParams = methInfo.GetParameters();
+ ParameterInfo[] methParams = methInfo.GetParameters();
if (methParams.Length == 1)
{
return methInfo;
@@ -930,17 +882,17 @@
/// <c>null</c> when the conversion could not be performed.
/// </para>
/// </returns>
- protected object ConvertStringTo(Type type, string value)
+ protected object? ConvertStringTo(Type type, string value)
{
// Hack to allow use of Level in property
if (typeof(Level) == type)
{
// Property wants a level
- Level levelValue = m_hierarchy.LevelMap[value];
+ Level? levelValue = m_hierarchy.LevelMap[value];
- if (levelValue == null)
+ if (levelValue is null)
{
- LogLog.Error(declaringType, "XmlHierarchyConfigurator: Unknown Level Specified [" + value + "]");
+ LogLog.Error(declaringType, $"XmlHierarchyConfigurator: Unknown Level Specified [{value}]");
}
return levelValue;
@@ -967,39 +919,33 @@
/// <paramref name="typeConstraint"/> type.
/// </para>
/// </remarks>
- protected object CreateObjectFromXml(XmlElement element, Type defaultTargetType, Type typeConstraint)
+ protected object? CreateObjectFromXml(XmlElement element, Type? defaultTargetType, Type? typeConstraint)
{
- Type objectType = null;
+ Type? objectType;
// Get the object type
string objectTypeString = element.GetAttribute(TYPE_ATTR);
- if (objectTypeString == null || objectTypeString.Length == 0)
+ if (objectTypeString.Length == 0)
{
- if (defaultTargetType == null)
+ if (defaultTargetType is null)
{
- LogLog.Error(declaringType, "Object type not specified. Cannot create object of type [" + typeConstraint.FullName + "]. Missing Value or Type.");
+ LogLog.Error(declaringType, $"Object type not specified. Cannot create object of type [{typeConstraint?.FullName}]. Missing Value or Type.");
return null;
}
- else
- {
- // Use the default object type
- objectType = defaultTargetType;
- }
+
+ // Use the default object type
+ objectType = defaultTargetType;
}
else
{
// Read the explicit object type
try
{
-#if NETSTANDARD1_3
- objectType = SystemInfo.GetTypeFromString(this.GetType().GetTypeInfo().Assembly, objectTypeString, true, true);
-#else
objectType = SystemInfo.GetTypeFromString(objectTypeString, true, true);
-#endif
}
catch (Exception ex)
{
- LogLog.Error(declaringType, "Failed to find type [" + objectTypeString + "]", ex);
+ LogLog.Error(declaringType, $"Failed to find type [{objectTypeString}]", ex);
return null;
}
}
@@ -1007,7 +953,7 @@
bool requiresConversion = false;
// Got the object type. Check that it meets the typeConstraint
- if (typeConstraint != null)
+ if (typeConstraint is not null)
{
if (!typeConstraint.IsAssignableFrom(objectType))
{
@@ -1018,21 +964,22 @@
}
else
{
- LogLog.Error(declaringType, "Object type [" + objectType.FullName + "] is not assignable to type [" + typeConstraint.FullName + "]. There are no acceptable type conversions.");
+ LogLog.Error(declaringType, $"Object type [{objectType!.FullName}] is not assignable to type [{typeConstraint.FullName}]. There are no acceptable type conversions.");
return null;
}
}
}
// Create using the default constructor
- object createdObject = null;
+ object? createdObject;
try
{
- createdObject = Activator.CreateInstance(objectType);
+ createdObject = Activator.CreateInstance(objectType!);
}
catch (Exception createInstanceEx)
{
- LogLog.Error(declaringType, "XmlHierarchyConfigurator: Failed to construct object of type [" + objectType.FullName + "] Exception: " + createInstanceEx.ToString());
+ LogLog.Error(declaringType, $"XmlHierarchyConfigurator: Failed to construct object of type [{objectType!.FullName}] Exception: {createInstanceEx}");
+ return null;
}
// Set any params on object
@@ -1045,8 +992,7 @@
}
// Check if we need to call ActivateOptions
- IOptionHandler optionHandler = createdObject as IOptionHandler;
- if (optionHandler != null)
+ if (createdObject is IOptionHandler optionHandler)
{
optionHandler.ActivateOptions();
}
@@ -1058,39 +1004,22 @@
// Convert the object type
return OptionConverter.ConvertTypeTo(createdObject, typeConstraint);
}
- else
- {
- // The object is of the correct type
- return createdObject;
- }
+
+ // The object is of the correct type
+ return createdObject;
}
- #endregion Protected Instance Methods
-
-#if !NETCF && !NETSTANDARD1_3 // NETSTANDARD1_3: System.Runtime.InteropServices.RuntimeInformation not available on desktop 4.6
- private bool HasCaseInsensitiveEnvironment
+ private static bool HasCaseInsensitiveEnvironment
{
get
{
-#if NET_1_0 || NET_1_1 || CLI_1_0
- // actually there is no guarantee, but we don't know better
- return true;
-#elif MONO_1_0
- // see above
- return false;
-#else
PlatformID platform = Environment.OSVersion.Platform;
return platform != PlatformID.Unix && platform != PlatformID.MacOSX;
-#endif
}
}
- private IDictionary CreateCaseInsensitiveWrapper(IDictionary dict)
+ private static IDictionary CreateCaseInsensitiveWrapper(IDictionary dict)
{
- if (dict == null)
- {
- return dict;
- }
Hashtable hash = SystemInfo.CreateCaseInsensitiveHashtable();
foreach (DictionaryEntry entry in dict)
{
@@ -1098,9 +1027,6 @@
}
return hash;
}
-#endif
-
- #region Private Constants
// String constants used while parsing the XML data
private const string CONFIGURATION_TAG = "log4net";
@@ -1133,24 +1059,16 @@
// flag used on the level element
private const string INHERITED = "inherited";
- #endregion Private Constants
-
- #region Private Instance Fields
-
/// <summary>
/// key: appenderName, value: appender.
/// </summary>
- private Hashtable m_appenderBag;
+ private readonly Dictionary<string, IAppender> m_appenderBag = new(StringComparer.Ordinal);
/// <summary>
/// The Hierarchy being configured.
/// </summary>
private readonly Hierarchy m_hierarchy;
- #endregion Private Instance Fields
-
- #region Private Static Fields
-
/// <summary>
/// The fully qualified type of the XmlHierarchyConfigurator class.
/// </summary>
@@ -1159,7 +1077,5 @@
/// log message.
/// </remarks>
private static readonly Type declaringType = typeof(XmlHierarchyConfigurator);
-
- #endregion Private Static Fields
}
}
diff --git a/src/log4net/Repository/ILoggerRepository.cs b/src/log4net/Repository/ILoggerRepository.cs
index 29d64ea..ad0b0d9 100644
--- a/src/log4net/Repository/ILoggerRepository.cs
+++ b/src/log4net/Repository/ILoggerRepository.cs
@@ -19,175 +19,80 @@
using System;
using System.Collections;
-using log4net;
+using log4net.Appender;
using log4net.ObjectRenderer;
using log4net.Core;
using log4net.Plugin;
-using log4net.Repository.Hierarchy;
using log4net.Util;
+#nullable enable
+
namespace log4net.Repository
{
- #region LoggerRepositoryShutdownEvent
-
/// <summary>
- /// Delegate used to handle logger repository shutdown event notifications
+ /// Delegate used to handle logger repository shutdown event notifications.
/// </summary>
/// <param name="sender">The <see cref="ILoggerRepository"/> that is shutting down.</param>
/// <param name="e">Empty event args</param>
- /// <remarks>
- /// <para>
- /// Delegate used to handle logger repository shutdown event notifications.
- /// </para>
- /// </remarks>
public delegate void LoggerRepositoryShutdownEventHandler(object sender, EventArgs e);
- #endregion
-
- #region LoggerRepositoryConfigurationResetEventHandler
-
/// <summary>
- /// Delegate used to handle logger repository configuration reset event notifications
+ /// Delegate used to handle logger repository configuration reset event notifications.
/// </summary>
/// <param name="sender">The <see cref="ILoggerRepository"/> that has had its configuration reset.</param>
/// <param name="e">Empty event args</param>
- /// <remarks>
- /// <para>
- /// Delegate used to handle logger repository configuration reset event notifications.
- /// </para>
- /// </remarks>
public delegate void LoggerRepositoryConfigurationResetEventHandler(object sender, EventArgs e);
- #endregion
-
- #region LoggerRepositoryConfigurationChangedEventHandler
-
/// <summary>
/// Delegate used to handle event notifications for logger repository configuration changes.
/// </summary>
/// <param name="sender">The <see cref="ILoggerRepository"/> that has had its configuration changed.</param>
/// <param name="e">Empty event arguments.</param>
- /// <remarks>
- /// <para>
- /// Delegate used to handle event notifications for logger repository configuration changes.
- /// </para>
- /// </remarks>
public delegate void LoggerRepositoryConfigurationChangedEventHandler(object sender, EventArgs e);
- #endregion
-
/// <summary>
- /// Interface implemented by logger repositories.
+ /// Interface implemented by logger repositories, e.g. <see cref="Hierarchy"/>, and used by the
+ /// <see cref="LogManager"/> to obtain <see cref="ILog"/> instances.
/// </summary>
- /// <remarks>
- /// <para>
- /// This interface is implemented by logger repositories. e.g.
- /// <see cref="Hierarchy"/>.
- /// </para>
- /// <para>
- /// This interface is used by the <see cref="LogManager"/>
- /// to obtain <see cref="ILog"/> interfaces.
- /// </para>
- /// </remarks>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
public interface ILoggerRepository
{
/// <summary>
- /// The name of the repository
+ /// Gets or sets the name of the repository.
/// </summary>
- /// <value>
- /// The name of the repository
- /// </value>
- /// <remarks>
- /// <para>
- /// The name of the repository.
- /// </para>
- /// </remarks>
string Name { get; set; }
/// <summary>
- /// RendererMap accesses the object renderer map for this repository.
+ /// Gets the map from types to <see cref="IObjectRenderer"/> instances for custom rendering.
/// </summary>
- /// <value>
- /// RendererMap accesses the object renderer map for this repository.
- /// </value>
- /// <remarks>
- /// <para>
- /// RendererMap accesses the object renderer map for this repository.
- /// </para>
- /// <para>
- /// The RendererMap holds a mapping between types and
- /// <see cref="IObjectRenderer"/> objects.
- /// </para>
- /// </remarks>
RendererMap RendererMap { get; }
/// <summary>
- /// The plugin map for this repository.
+ /// Gets the map from plugin name to plugin value for plugins attacked to this repository.
/// </summary>
- /// <value>
- /// The plugin map for this repository.
- /// </value>
- /// <remarks>
- /// <para>
- /// The plugin map holds the <see cref="IPlugin"/> instances
- /// that have been attached to this repository.
- /// </para>
- /// </remarks>
PluginMap PluginMap { get; }
/// <summary>
- /// Get the level map for the Repository.
+ /// Gets the map from level names and <see cref="Level"/> values for this repository.
/// </summary>
- /// <remarks>
- /// <para>
- /// Get the level map for the Repository.
- /// </para>
- /// <para>
- /// The level map defines the mappings between
- /// level names and <see cref="Level"/> objects in
- /// this repository.
- /// </para>
- /// </remarks>
LevelMap LevelMap { get; }
/// <summary>
- /// The threshold for all events in this repository
+ /// Gets or sets the threshold for all events in this repository.
/// </summary>
- /// <value>
- /// The threshold for all events in this repository
- /// </value>
- /// <remarks>
- /// <para>
- /// The threshold for all events in this repository.
- /// </para>
- /// </remarks>
Level Threshold { get; set; }
/// <summary>
- /// Check if the named logger exists in the repository. If so return
- /// its reference, otherwise returns <c>null</c>.
+ /// Gets the named logger, or <c>null</c>.
/// </summary>
- /// <param name="name">The name of the logger to lookup</param>
- /// <returns>The Logger object with the name specified</returns>
- /// <remarks>
- /// <para>
- /// If the names logger exists it is returned, otherwise
- /// <c>null</c> is returned.
- /// </para>
- /// </remarks>
- ILogger Exists(string name);
+ /// <param name="name">The name of the logger to look up.</param>
+ /// <returns>The logger if found, or <c>null</c>.</returns>
+ ILogger? Exists(string name);
/// <summary>
- /// Returns all the currently defined loggers as an Array.
+ /// Gets all the currently defined loggers.
/// </summary>
- /// <returns>All the defined loggers</returns>
- /// <remarks>
- /// <para>
- /// Returns all the currently defined loggers as an Array.
- /// </para>
- /// </remarks>
ILogger[] GetCurrentLoggers();
/// <summary>
@@ -207,12 +112,11 @@
/// </remarks>
ILogger GetLogger(string name);
- /// <summary>Shutdown the repository</summary>
- /// <remarks>
- /// <para>
- /// Shutting down a repository will <i>safely</i> close and remove
+ /// <summary>
+ /// Shuts down the repository, <i>safely</i> closing and removing
/// all appenders in all loggers including the root logger.
- /// </para>
+ /// </summary>
+ /// <remarks>
/// <para>
/// Some appenders need to be closed before the
/// application exists. Otherwise, pending logging events might be
@@ -220,7 +124,7 @@
/// </para>
/// <para>
/// The <see cref="M:Shutdown()"/> method is careful to close nested
- /// appenders before closing regular appenders. This is allows
+ /// appenders before closing regular appenders. This allows
/// configurations where a regular appender is attached to a logger
/// and again to a nested appender.
/// </para>
@@ -228,17 +132,10 @@
void Shutdown();
/// <summary>
- /// Reset the repositories configuration to a default state
+ /// Resets the repository configuration to a default state. Loggers are reset but not removed.
/// </summary>
/// <remarks>
/// <para>
- /// Reset all values contained in this instance to their
- /// default state.
- /// </para>
- /// <para>
- /// Existing loggers are not removed. They are just reset.
- /// </para>
- /// <para>
/// This method should be used sparingly and with care as it will
/// block all logging until it is completed.
/// </para>
@@ -246,9 +143,9 @@
void ResetConfiguration();
/// <summary>
- /// Log the <see cref="LoggingEvent"/> through this repository.
+ /// Logs a <see cref="LoggingEvent"/> through this repository.
/// </summary>
- /// <param name="logEvent">the event to log</param>
+ /// <param name="logEvent">The event to log.</param>
/// <remarks>
/// <para>
/// This method should not normally be used to log.
@@ -264,16 +161,8 @@
void Log(LoggingEvent logEvent);
/// <summary>
- /// Flag indicates if this repository has been configured.
+ /// Gets or sets a value that indicates whether this repository has been configured.
/// </summary>
- /// <value>
- /// Flag indicates if this repository has been configured.
- /// </value>
- /// <remarks>
- /// <para>
- /// Flag indicates if this repository has been configured.
- /// </para>
- /// </remarks>
bool Configured { get; set; }
/// <summary>
@@ -283,67 +172,28 @@
ICollection ConfigurationMessages { get; set; }
/// <summary>
- /// Event to notify that the repository has been shutdown.
+ /// Event to notify that the repository has been shut down.
/// </summary>
- /// <value>
- /// Event to notify that the repository has been shutdown.
- /// </value>
- /// <remarks>
- /// <para>
- /// Event raised when the repository has been shutdown.
- /// </para>
- /// </remarks>
- event LoggerRepositoryShutdownEventHandler ShutdownEvent;
+ event LoggerRepositoryShutdownEventHandler? ShutdownEvent;
/// <summary>
- /// Event to notify that the repository has had its configuration reset.
+ /// Event to notify that the repository has had its configuration reset to default.
/// </summary>
- /// <value>
- /// Event to notify that the repository has had its configuration reset.
- /// </value>
- /// <remarks>
- /// <para>
- /// Event raised when the repository's configuration has been
- /// reset to default.
- /// </para>
- /// </remarks>
- event LoggerRepositoryConfigurationResetEventHandler ConfigurationReset;
+ event LoggerRepositoryConfigurationResetEventHandler? ConfigurationReset;
/// <summary>
- /// Event to notify that the repository has had its configuration changed.
+ /// Event to notify that the repository's configuration has changed.
/// </summary>
- /// <value>
- /// Event to notify that the repository has had its configuration changed.
- /// </value>
- /// <remarks>
- /// <para>
- /// Event raised when the repository's configuration has been changed.
- /// </para>
- /// </remarks>
- event LoggerRepositoryConfigurationChangedEventHandler ConfigurationChanged;
+ event LoggerRepositoryConfigurationChangedEventHandler? ConfigurationChanged;
/// <summary>
- /// Repository specific properties
+ /// Repository specific properties.
/// </summary>
- /// <value>
- /// Repository specific properties
- /// </value>
- /// <remarks>
- /// <para>
- /// These properties can be specified on a repository specific basis.
- /// </para>
- /// </remarks>
PropertiesDictionary Properties { get; }
/// <summary>
- /// Returns all the Appenders that are configured as an Array.
+ /// Gets all Appenders that are configured for this repository.
/// </summary>
- /// <returns>All the Appenders</returns>
- /// <remarks>
- /// <para>
- /// Returns all the Appenders that are configured as an Array.
- /// </para>
- /// </remarks>
- log4net.Appender.IAppender[] GetAppenders();
+ IAppender[] GetAppenders();
}
}
diff --git a/src/log4net/Repository/LoggerRepositorySkeleton.cs b/src/log4net/Repository/LoggerRepositorySkeleton.cs
index 11afa00..ed04559 100644
--- a/src/log4net/Repository/LoggerRepositorySkeleton.cs
+++ b/src/log4net/Repository/LoggerRepositorySkeleton.cs
@@ -24,6 +24,7 @@
using log4net.Util;
using log4net.Plugin;
using System.Threading;
+using log4net.Appender;
namespace log4net.Repository
{
@@ -41,25 +42,12 @@
/// </remarks>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
- public abstract class LoggerRepositorySkeleton : ILoggerRepository, Appender.IFlushable
+ public abstract class LoggerRepositorySkeleton : ILoggerRepository, IFlushable
{
- #region Member Variables
-
- private string m_name;
- private RendererMap m_rendererMap;
- private PluginMap m_pluginMap;
- private LevelMap m_levelMap;
- private Level m_threshold;
- private bool m_configured;
- private ICollection m_configurationMessages;
- private event LoggerRepositoryShutdownEventHandler m_shutdownEvent;
- private event LoggerRepositoryConfigurationResetEventHandler m_configurationResetEvent;
- private event LoggerRepositoryConfigurationChangedEventHandler m_configurationChangedEvent;
- private PropertiesDictionary m_properties;
-
- #endregion
-
- #region Constructors
+ private readonly RendererMap m_rendererMap = new();
+ private readonly LevelMap m_levelMap = new();
+ private Level m_threshold = Level.All; // Don't disable any levels by default.
+ private ICollection m_configurationMessages = EmptyCollection.Instance;
/// <summary>
/// Default Constructor
@@ -84,23 +72,11 @@
/// </remarks>
protected LoggerRepositorySkeleton(PropertiesDictionary properties)
{
- m_properties = properties;
- m_rendererMap = new RendererMap();
- m_pluginMap = new PluginMap(this);
- m_levelMap = new LevelMap();
- m_configurationMessages = EmptyCollection.Instance;
- m_configured = false;
-
+ Properties = properties;
+ PluginMap = new PluginMap(this);
AddBuiltinLevels();
-
- // Don't disable any levels by default.
- m_threshold = Level.All;
}
- #endregion
-
- #region Implementation of ILoggerRepository
-
/// <summary>
/// The name of the repository
/// </summary>
@@ -114,11 +90,7 @@
/// stored by the <see cref="IRepositorySelector"/>.
/// </para>
/// </remarks>
- public virtual string Name
- {
- get { return m_name; }
- set { m_name = value; }
- }
+ public virtual string? Name { get; set; }
/// <summary>
/// The threshold for all events in this repository
@@ -133,10 +105,10 @@
/// </remarks>
public virtual Level Threshold
{
- get { return m_threshold; }
+ get => m_threshold;
set
{
- if (value != null)
+ if (value is not null)
{
m_threshold = value;
}
@@ -164,10 +136,7 @@
/// <see cref="IObjectRenderer"/> objects.
/// </para>
/// </remarks>
- public virtual RendererMap RendererMap
- {
- get { return m_rendererMap; }
- }
+ public virtual RendererMap RendererMap => m_rendererMap;
/// <summary>
/// The plugin map for this repository.
@@ -181,10 +150,7 @@
/// that have been attached to this repository.
/// </para>
/// </remarks>
- public virtual PluginMap PluginMap
- {
- get { return m_pluginMap; }
- }
+ public virtual PluginMap PluginMap { get; }
/// <summary>
/// Get the level map for the Repository.
@@ -199,10 +165,7 @@
/// this repository.
/// </para>
/// </remarks>
- public virtual LevelMap LevelMap
- {
- get { return m_levelMap; }
- }
+ public virtual LevelMap LevelMap => m_levelMap;
/// <summary>
/// Test if logger exists
@@ -328,20 +291,16 @@
/// Flag indicates if this repository has been configured.
/// </para>
/// </remarks>
- public virtual bool Configured
- {
- get { return m_configured; }
- set { m_configured = value; }
- }
+ public virtual bool Configured { get; set; }
/// <summary>
- /// Contains a list of internal messages captures during the
+ /// Contains a list of internal messages captured during the
/// last configuration.
/// </summary>
public virtual ICollection ConfigurationMessages
{
- get { return m_configurationMessages; }
- set { m_configurationMessages = value; }
+ get => m_configurationMessages;
+ set => m_configurationMessages = value;
}
/// <summary>
@@ -355,11 +314,7 @@
/// Event raised when the repository has been shutdown.
/// </para>
/// </remarks>
- public event LoggerRepositoryShutdownEventHandler ShutdownEvent
- {
- add { m_shutdownEvent += value; }
- remove { m_shutdownEvent -= value; }
- }
+ public event LoggerRepositoryShutdownEventHandler? ShutdownEvent;
/// <summary>
/// Event to notify that the repository has had its configuration reset.
@@ -373,11 +328,7 @@
/// reset to default.
/// </para>
/// </remarks>
- public event LoggerRepositoryConfigurationResetEventHandler ConfigurationReset
- {
- add { m_configurationResetEvent += value; }
- remove { m_configurationResetEvent -= value; }
- }
+ public event LoggerRepositoryConfigurationResetEventHandler? ConfigurationReset;
/// <summary>
/// Event to notify that the repository has had its configuration changed.
@@ -390,11 +341,7 @@
/// Event raised when the repository's configuration has been changed.
/// </para>
/// </remarks>
- public event LoggerRepositoryConfigurationChangedEventHandler ConfigurationChanged
- {
- add { m_configurationChangedEvent += value; }
- remove { m_configurationChangedEvent -= value; }
- }
+ public event LoggerRepositoryConfigurationChangedEventHandler? ConfigurationChanged;
/// <summary>
/// Repository specific properties
@@ -405,10 +352,7 @@
/// <remarks>
/// These properties can be specified on a repository specific basis
/// </remarks>
- public PropertiesDictionary Properties
- {
- get { return m_properties; }
- }
+ public PropertiesDictionary Properties { get; }
/// <summary>
/// Returns all the Appenders that are configured as an Array.
@@ -419,11 +363,7 @@
/// Returns all the Appenders that are configured as an Array.
/// </para>
/// </remarks>
- public abstract log4net.Appender.IAppender[] GetAppenders();
-
- #endregion
-
- #region Private Static Fields
+ public abstract IAppender[] GetAppenders();
/// <summary>
/// The fully qualified type of the LoggerRepositorySkeleton class.
@@ -434,8 +374,6 @@
/// </remarks>
private static readonly Type declaringType = typeof(LoggerRepositorySkeleton);
- #endregion Private Static Fields
-
private void AddBuiltinLevels()
{
// Add the predefined levels to the map
@@ -481,11 +419,11 @@
{
if (typeToRender == null)
{
- throw new ArgumentNullException("typeToRender");
+ throw new ArgumentNullException(nameof(typeToRender));
}
if (rendererInstance == null)
{
- throw new ArgumentNullException("rendererInstance");
+ throw new ArgumentNullException(nameof(rendererInstance));
}
m_rendererMap.Put(typeToRender, rendererInstance);
@@ -500,18 +438,10 @@
/// Notify any listeners that this repository is shutting down.
/// </para>
/// </remarks>
- protected virtual void OnShutdown(EventArgs e)
+ protected virtual void OnShutdown(EventArgs? e)
{
- if (e == null)
- {
- e = EventArgs.Empty;
- }
-
- LoggerRepositoryShutdownEventHandler handler = m_shutdownEvent;
- if (handler != null)
- {
- handler(this, e);
- }
+ e ??= EventArgs.Empty;
+ ShutdownEvent?.Invoke(this, e);
}
/// <summary>
@@ -523,18 +453,10 @@
/// Notify any listeners that this repository's configuration has been reset.
/// </para>
/// </remarks>
- protected virtual void OnConfigurationReset(EventArgs e)
+ protected virtual void OnConfigurationReset(EventArgs? e)
{
- if (e == null)
- {
- e = EventArgs.Empty;
- }
-
- LoggerRepositoryConfigurationResetEventHandler handler = m_configurationResetEvent;
- if (handler != null)
- {
- handler(this, e);
- }
+ e ??= EventArgs.Empty;
+ ConfigurationReset?.Invoke(this, e);
}
/// <summary>
@@ -546,18 +468,10 @@
/// Notify any listeners that this repository's configuration has changed.
/// </para>
/// </remarks>
- protected virtual void OnConfigurationChanged(EventArgs e)
+ protected virtual void OnConfigurationChanged(EventArgs? e)
{
- if (e == null)
- {
- e = EventArgs.Empty;
- }
-
- LoggerRepositoryConfigurationChangedEventHandler handler = m_configurationChangedEvent;
- if (handler != null)
- {
- handler(this, e);
- }
+ e ??= EventArgs.Empty;
+ ConfigurationChanged?.Invoke(this, e);
}
/// <summary>
@@ -589,12 +503,12 @@
/// <summary>
/// Flushes all configured Appenders that implement <see cref="log4net.Appender.IFlushable"/>.
/// </summary>
- /// <param name="millisecondsTimeout">The maximum time in milliseconds to wait for logging events from asycnhronous appenders to be flushed,
+ /// <param name="millisecondsTimeout">The maximum time in milliseconds to wait for logging events from asynchronous appenders to be flushed,
/// or <see cref="Timeout.Infinite"/> to wait indefinitely.</param>
/// <returns><c>True</c> if all logging events were flushed successfully, else <c>false</c>.</returns>
public bool Flush(int millisecondsTimeout)
{
- if (millisecondsTimeout < -1) throw new ArgumentOutOfRangeException("millisecondsTimeout", "Timeout must be -1 (Timeout.Infinite) or non-negative");
+ if (millisecondsTimeout < -1) throw new ArgumentOutOfRangeException(nameof(millisecondsTimeout), "Timeout must be -1 (Timeout.Infinite) or non-negative");
// Assume success until one of the appenders fails
bool result = true;
@@ -603,11 +517,14 @@
DateTime startTimeUtc = DateTime.UtcNow;
// Do buffering appenders first. These may be forwarding to other appenders
- foreach (log4net.Appender.IAppender appender in GetAppenders())
+ foreach (IAppender appender in GetAppenders())
{
- log4net.Appender.IFlushable flushable = appender as log4net.Appender.IFlushable;
- if (flushable == null) continue;
- if (appender is Appender.BufferingAppenderSkeleton)
+ if (appender is not IFlushable flushable)
+ {
+ continue;
+ }
+
+ if (appender is BufferingAppenderSkeleton)
{
int timeout = GetWaitTime(startTimeUtc, millisecondsTimeout);
if (!flushable.Flush(timeout)) result = false;
@@ -615,11 +532,14 @@
}
// Do non-buffering appenders.
- foreach (log4net.Appender.IAppender appender in GetAppenders())
+ foreach (IAppender appender in GetAppenders())
{
- log4net.Appender.IFlushable flushable = appender as log4net.Appender.IFlushable;
- if (flushable == null) continue;
- if (!(appender is Appender.BufferingAppenderSkeleton))
+ if (appender is not IFlushable flushable)
+ {
+ continue;
+ }
+
+ if (appender is not BufferingAppenderSkeleton)
{
int timeout = GetWaitTime(startTimeUtc, millisecondsTimeout);
if (!flushable.Flush(timeout)) result = false;
diff --git a/src/log4net/ThreadContext.cs b/src/log4net/ThreadContext.cs
index e84dba5..6d17de1 100644
--- a/src/log4net/ThreadContext.cs
+++ b/src/log4net/ThreadContext.cs
@@ -17,9 +17,6 @@
//
#endregion
-using System;
-using System.Collections;
-
using log4net.Util;
namespace log4net
@@ -67,26 +64,8 @@
/// </example>
/// <threadsafety static="true" instance="true" />
/// <author>Nicko Cadell</author>
- public sealed class ThreadContext
+ public static class ThreadContext
{
- #region Private Instance Constructors
-
- /// <summary>
- /// Private Constructor.
- /// </summary>
- /// <remarks>
- /// <para>
- /// Uses a private access modifier to prevent instantiation of this class.
- /// </para>
- /// </remarks>
- private ThreadContext()
- {
- }
-
- #endregion Private Instance Constructors
-
- #region Public Static Properties
-
/// <summary>
/// The thread properties map
/// </summary>
@@ -99,10 +78,7 @@
/// properties with the same name.
/// </para>
/// </remarks>
- public static ThreadContextProperties Properties
- {
- get { return s_properties; }
- }
+ public static ThreadContextProperties Properties { get; } = new();
/// <summary>
/// The thread stacks
@@ -115,25 +91,6 @@
/// The thread local stacks.
/// </para>
/// </remarks>
- public static ThreadContextStacks Stacks
- {
- get { return s_stacks; }
- }
-
- #endregion Public Static Properties
-
- #region Private Static Fields
-
- /// <summary>
- /// The thread context properties instance
- /// </summary>
- private static readonly ThreadContextProperties s_properties = new ThreadContextProperties();
-
- /// <summary>
- /// The thread context stacks instance
- /// </summary>
- private static readonly ThreadContextStacks s_stacks = new ThreadContextStacks(s_properties);
-
- #endregion Private Static Fields
+ public static ThreadContextStacks Stacks { get; } = new(Properties);
}
}
diff --git a/src/log4net/Util/AppenderAttachedImpl.cs b/src/log4net/Util/AppenderAttachedImpl.cs
index f638f2b..c2ec9a0 100644
--- a/src/log4net/Util/AppenderAttachedImpl.cs
+++ b/src/log4net/Util/AppenderAttachedImpl.cs
@@ -114,11 +114,11 @@
{
if (loggingEvents == null)
{
- throw new ArgumentNullException("loggingEvents");
+ throw new ArgumentNullException(nameof(loggingEvents));
}
if (loggingEvents.Length == 0)
{
- throw new ArgumentException("loggingEvents array must not be empty", "loggingEvents");
+ throw new ArgumentException($"{nameof(loggingEvents)} array must not be empty", nameof(loggingEvents));
}
if (loggingEvents.Length == 1)
{
diff --git a/src/log4net/Util/CompositeProperties.cs b/src/log4net/Util/CompositeProperties.cs
index 66ac7b7..5e1350f 100644
--- a/src/log4net/Util/CompositeProperties.cs
+++ b/src/log4net/Util/CompositeProperties.cs
@@ -17,8 +17,7 @@
//
#endregion
-using System;
-using System.Collections;
+using System.Collections.Generic;
namespace log4net.Util
{
@@ -34,14 +33,8 @@
/// <author>Nicko Cadell</author>
public sealed class CompositeProperties
{
- #region Private Instance Fields
-
- private PropertiesDictionary m_flattened = null;
- private ArrayList m_nestedProperties = new ArrayList();
-
- #endregion Private Instance Fields
-
- #region Public Instance Constructors
+ private PropertiesDictionary? m_flattened;
+ private readonly List<ReadOnlyPropertiesDictionary> m_nestedProperties = new();
/// <summary>
/// Constructor
@@ -55,10 +48,6 @@
{
}
- #endregion Public Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
/// Gets the value of a property
/// </summary>
@@ -78,12 +67,12 @@
/// <c>null</c> is returned.
/// </para>
/// </remarks>
- public object this[string key]
+ public object? this[string key]
{
get
{
// Look in the flattened properties first
- if (m_flattened != null)
+ if (m_flattened is not null)
{
return m_flattened[key];
}
@@ -91,19 +80,15 @@
// Look for the key in all the nested properties
foreach (ReadOnlyPropertiesDictionary cur in m_nestedProperties)
{
- if (cur.Contains(key))
+ if (cur.TryGetValue(key, out object? val))
{
- return cur[key];
+ return val;
}
}
return null;
}
}
- #endregion Public Instance Properties
-
- #region Public Instance Methods
-
/// <summary>
/// Add a Properties Dictionary to this composite collection
/// </summary>
@@ -132,24 +117,22 @@
/// </remarks>
public PropertiesDictionary Flatten()
{
- if (m_flattened == null)
+ if (m_flattened is null)
{
m_flattened = new PropertiesDictionary();
for (int i = m_nestedProperties.Count; --i >= 0;)
{
- ReadOnlyPropertiesDictionary cur = (ReadOnlyPropertiesDictionary)m_nestedProperties[i];
+ ReadOnlyPropertiesDictionary cur = m_nestedProperties[i];
- foreach (DictionaryEntry entry in cur)
+ foreach (KeyValuePair<string, object?> entry in cur)
{
- m_flattened[(string)entry.Key] = entry.Value;
+ m_flattened[entry.Key] = entry.Value;
}
}
}
return m_flattened;
}
-
- #endregion Public Instance Methods
}
}
diff --git a/src/log4net/Util/ContextPropertiesBase.cs b/src/log4net/Util/ContextPropertiesBase.cs
index 4727461..b75b0d0 100644
--- a/src/log4net/Util/ContextPropertiesBase.cs
+++ b/src/log4net/Util/ContextPropertiesBase.cs
@@ -17,34 +17,19 @@
//
#endregion
-using System;
-using System.Collections;
+#nullable enable
namespace log4net.Util
{
/// <summary>
/// Base class for Context Properties implementations
/// </summary>
- /// <remarks>
- /// <para>
- /// This class defines a basic property get set accessor
- /// </para>
- /// </remarks>
/// <author>Nicko Cadell</author>
public abstract class ContextPropertiesBase
{
/// <summary>
- /// Gets or sets the value of a property
+ /// Gets or sets the value of a property.
/// </summary>
- /// <value>
- /// The value for the property with the specified key
- /// </value>
- /// <remarks>
- /// <para>
- /// Gets or sets the value of a property
- /// </para>
- /// </remarks>
- public abstract object this[string key] { get; set; }
+ public abstract object? this[string key] { get; set; }
}
}
-
diff --git a/src/log4net/Util/CountingQuietTextWriter.cs b/src/log4net/Util/CountingQuietTextWriter.cs
index 97bdaa4..86609b6 100644
--- a/src/log4net/Util/CountingQuietTextWriter.cs
+++ b/src/log4net/Util/CountingQuietTextWriter.cs
@@ -37,8 +37,6 @@
/// <author>Gert Driesen</author>
public class CountingQuietTextWriter : QuietTextWriter
{
- #region Public Instance Constructors
-
/// <summary>
/// Constructor
/// </summary>
@@ -52,13 +50,9 @@
/// </remarks>
public CountingQuietTextWriter(TextWriter writer, IErrorHandler errorHandler) : base(writer, errorHandler)
{
- m_countBytes = 0;
+ Count = 0;
}
- #endregion Public Instance Constructors
-
- #region Override implementation of QuietTextWriter
-
/// <summary>
/// Writes a character to the underlying writer and counts the number of bytes written.
/// </summary>
@@ -77,11 +71,11 @@
// get the number of bytes needed to represent the
// char using the supplied encoding.
- m_countBytes += this.Encoding.GetByteCount(new char[] { value });
+ Count += Encoding.GetByteCount(new[] { value });
}
catch (Exception e)
{
- this.ErrorHandler.Error("Failed to write [" + value + "].", e, ErrorCode.WriteFailure);
+ ErrorHandler.Error($"Failed to write [{value}].", e, ErrorCode.WriteFailure);
}
}
@@ -107,11 +101,11 @@
// get the number of bytes needed to represent the
// char array using the supplied encoding.
- m_countBytes += this.Encoding.GetByteCount(buffer, index, count);
+ Count += Encoding.GetByteCount(buffer, index, count);
}
catch (Exception e)
{
- this.ErrorHandler.Error("Failed to write buffer.", e, ErrorCode.WriteFailure);
+ ErrorHandler.Error("Failed to write buffer.", e, ErrorCode.WriteFailure);
}
}
}
@@ -126,9 +120,9 @@
/// the number of bytes written.
/// </para>
/// </remarks>
- public override void Write(string str)
+ public override void Write(string? str)
{
- if (str != null && str.Length > 0)
+ if (str is not null && str.Length > 0)
{
try
{
@@ -136,19 +130,15 @@
// get the number of bytes needed to represent the
// string using the supplied encoding.
- m_countBytes += this.Encoding.GetByteCount(str);
+ Count += Encoding.GetByteCount(str);
}
catch (Exception e)
{
- this.ErrorHandler.Error("Failed to write [" + str + "].", e, ErrorCode.WriteFailure);
+ ErrorHandler.Error($"Failed to write [{str}].", e, ErrorCode.WriteFailure);
}
}
}
- #endregion Override implementation of QuietTextWriter
-
- #region Public Instance Properties
-
/// <summary>
/// Gets or sets the total number of bytes written.
/// </summary>
@@ -160,21 +150,6 @@
/// Gets or sets the total number of bytes written.
/// </para>
/// </remarks>
- public long Count
- {
- get { return m_countBytes; }
- set { m_countBytes = value; }
- }
-
- #endregion Public Instance Properties
-
- #region Private Instance Fields
-
- /// <summary>
- /// Total number of bytes written.
- /// </summary>
- private long m_countBytes;
-
- #endregion Private Instance Fields
+ public long Count { get; set; }
}
}
diff --git a/src/log4net/Util/CyclicBuffer.cs b/src/log4net/Util/CyclicBuffer.cs
index f99fb48..fd8c9e9b2 100644
--- a/src/log4net/Util/CyclicBuffer.cs
+++ b/src/log4net/Util/CyclicBuffer.cs
@@ -21,6 +21,8 @@
using log4net.Core;
+#nullable enable
+
namespace log4net.Util
{
/// <summary>
@@ -35,8 +37,6 @@
/// <author>Gert Driesen</author>
public class CyclicBuffer
{
- #region Public Instance Constructors
-
/// <summary>
/// Constructor
/// </summary>
@@ -52,7 +52,7 @@
{
if (maxSize < 1)
{
- throw SystemInfo.CreateArgumentOutOfRangeException("maxSize", (object)maxSize, "Parameter: maxSize, Value: [" + maxSize + "] out of range. Non zero positive integer required");
+ throw SystemInfo.CreateArgumentOutOfRangeException(nameof(maxSize), maxSize, $"Parameter: {nameof(maxSize)}, Value: [{maxSize}] out of range. A positive integer is required.");
}
m_maxSize = maxSize;
@@ -62,10 +62,6 @@
m_numElems = 0;
}
- #endregion Public Instance Constructors
-
- #region Public Instance Methods
-
/// <summary>
/// Appends a <paramref name="loggingEvent"/> to the buffer.
/// </summary>
@@ -75,20 +71,20 @@
/// <para>
/// Append an event to the buffer. If the buffer still contains free space then
/// <c>null</c> is returned. If the buffer is full then an event will be dropped
- /// to make space for the new event, the event dropped is returned.
+ /// to make space for the new event, the dropped event is returned.
/// </para>
/// </remarks>
- public LoggingEvent Append(LoggingEvent loggingEvent)
+ public LoggingEvent? Append(LoggingEvent loggingEvent)
{
- if (loggingEvent == null)
+ if (loggingEvent is null)
{
- throw new ArgumentNullException("loggingEvent");
+ throw new ArgumentNullException(nameof(loggingEvent));
}
lock (this)
{
// save the discarded event
- LoggingEvent discardedLoggingEvent = m_events[m_last];
+ LoggingEvent? discardedLoggingEvent = m_events[m_last];
// overwrite the last event position
m_events[m_last] = loggingEvent;
@@ -129,11 +125,11 @@
/// from the buffer.
/// </para>
/// </remarks>
- public LoggingEvent PopOldest()
+ public LoggingEvent? PopOldest()
{
lock (this)
{
- LoggingEvent ret = null;
+ LoggingEvent? ret = null;
if (m_numElems > 0)
{
m_numElems--;
@@ -223,14 +219,14 @@
{
if (newSize < 0)
{
- throw log4net.Util.SystemInfo.CreateArgumentOutOfRangeException("newSize", (object)newSize, "Parameter: newSize, Value: [" + newSize + "] out of range. Non zero positive integer required");
+ throw SystemInfo.CreateArgumentOutOfRangeException(nameof(newSize), newSize, $"Parameter: {nameof(newSize)}, Value: [{newSize}] out of range. A positive integer is required.");
}
if (newSize == m_numElems)
{
return; // nothing to do
}
- LoggingEvent[] temp = new LoggingEvent[newSize];
+ LoggingEvent?[] temp = new LoggingEvent[newSize];
int loopLen = (newSize < m_numElems) ? newSize : m_numElems;
@@ -262,21 +258,16 @@
}
#endif
- #endregion Public Instance Methods
-
- #region Public Instance Properties
-
/// <summary>
/// Gets the <paramref name="i"/>th oldest event currently in the buffer.
/// </summary>
- /// <value>The <paramref name="i"/>th oldest event currently in the buffer.</value>
/// <remarks>
/// <para>
/// If <paramref name="i"/> is outside the range 0 to the number of events
/// currently in the buffer, then <c>null</c> is returned.
/// </para>
/// </remarks>
- public LoggingEvent this[int i]
+ public LoggingEvent? this[int i]
{
get
{
@@ -340,16 +331,10 @@
}
}
- #endregion Public Instance Properties
-
- #region Private Instance Fields
-
- private LoggingEvent[] m_events;
+ private readonly LoggingEvent?[] m_events;
private int m_first;
private int m_last;
private int m_numElems;
- private int m_maxSize;
-
- #endregion Private Instance Fields
+ private readonly int m_maxSize;
}
}
diff --git a/src/log4net/Util/EmptyCollection.cs b/src/log4net/Util/EmptyCollection.cs
index ab36d94..7dd9fad 100644
--- a/src/log4net/Util/EmptyCollection.cs
+++ b/src/log4net/Util/EmptyCollection.cs
@@ -33,9 +33,7 @@
/// </remarks>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
-#if !NETCF
[Serializable]
-#endif
public sealed class EmptyCollection : ICollection
{
#region Private Instance Constructors
diff --git a/src/log4net/Util/EmptyDictionary.cs b/src/log4net/Util/EmptyDictionary.cs
index a35d3f9..dbdce4d 100644
--- a/src/log4net/Util/EmptyDictionary.cs
+++ b/src/log4net/Util/EmptyDictionary.cs
@@ -33,9 +33,7 @@
/// </remarks>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
-#if !NETCF
[Serializable]
-#endif
public sealed class EmptyDictionary : IDictionary
{
#region Private Instance Constructors
@@ -336,4 +334,4 @@
#endregion Private Static Fields
}
-}
+}
\ No newline at end of file
diff --git a/src/log4net/Util/GlobalContextProperties.cs b/src/log4net/Util/GlobalContextProperties.cs
index cfebd22..9d5c1ce 100644
--- a/src/log4net/Util/GlobalContextProperties.cs
+++ b/src/log4net/Util/GlobalContextProperties.cs
@@ -17,9 +17,6 @@
//
#endregion
-using System;
-using System.Collections;
-
namespace log4net.Util
{
/// <summary>
@@ -38,8 +35,6 @@
/// <author>Nicko Cadell</author>
public sealed class GlobalContextProperties : ContextPropertiesBase
{
- #region Private Instance Fields
-
/// <summary>
/// The read only copy of the properties.
/// </summary>
@@ -49,20 +44,12 @@
/// reordering reads and writes of this thread performed on different threads.
/// </para>
/// </remarks>
-#if NETCF
- private ReadOnlyPropertiesDictionary m_readOnlyProperties = new ReadOnlyPropertiesDictionary();
-#else
- private volatile ReadOnlyPropertiesDictionary m_readOnlyProperties = new ReadOnlyPropertiesDictionary();
-#endif
+ private volatile ReadOnlyPropertiesDictionary m_readOnlyProperties = new();
/// <summary>
/// Lock object used to synchronize updates within this instance
/// </summary>
- private readonly object m_syncRoot = new object();
-
- #endregion Private Instance Fields
-
- #region Public Instance Constructors
+ private readonly object m_syncRoot = new();
/// <summary>
/// Constructor
@@ -76,10 +63,6 @@
{
}
- #endregion Public Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
/// Gets or sets the value of a property
/// </summary>
@@ -93,29 +76,22 @@
/// the properties is created.
/// </para>
/// </remarks>
- public override object this[string key]
+ public override object? this[string key]
{
- get
- {
- return m_readOnlyProperties[key];
- }
+ get => m_readOnlyProperties[key];
set
{
lock (m_syncRoot)
{
- PropertiesDictionary mutableProps = new PropertiesDictionary(m_readOnlyProperties);
-
- mutableProps[key] = value;
-
+ var mutableProps = new PropertiesDictionary(m_readOnlyProperties)
+ {
+ [key] = value
+ };
m_readOnlyProperties = new ReadOnlyPropertiesDictionary(mutableProps);
}
}
}
- #endregion Public Instance Properties
-
- #region Public Instance Methods
-
/// <summary>
/// Remove a property from the global context
/// </summary>
@@ -132,10 +108,8 @@
{
if (m_readOnlyProperties.Contains(key))
{
- PropertiesDictionary mutableProps = new PropertiesDictionary(m_readOnlyProperties);
-
+ var mutableProps = new PropertiesDictionary(m_readOnlyProperties);
mutableProps.Remove(key);
-
m_readOnlyProperties = new ReadOnlyPropertiesDictionary(mutableProps);
}
}
@@ -152,10 +126,6 @@
}
}
- #endregion Public Instance Methods
-
- #region Internal Instance Methods
-
/// <summary>
/// Get a readonly immutable copy of the properties
/// </summary>
@@ -170,8 +140,5 @@
{
return m_readOnlyProperties;
}
-
- #endregion Internal Instance Methods
}
}
-
diff --git a/src/log4net/Util/ILogExtensions.cs b/src/log4net/Util/ILogExtensions.cs
index 0d13e04..3cfbb96 100644
--- a/src/log4net/Util/ILogExtensions.cs
+++ b/src/log4net/Util/ILogExtensions.cs
@@ -17,8 +17,6 @@
//
#endregion
-#if NET_3_5 || NET_4_0 || MONO_3_5 || MONO_4_0 || NETSTANDARD
-
using System;
using log4net.Core;
@@ -1737,5 +1735,4 @@
#endregion
}
-}
-#endif
+}
\ No newline at end of file
diff --git a/src/log4net/Util/LevelMapping.cs b/src/log4net/Util/LevelMapping.cs
index 674ec3d..8b3eabf 100644
--- a/src/log4net/Util/LevelMapping.cs
+++ b/src/log4net/Util/LevelMapping.cs
@@ -18,42 +18,18 @@
#endregion
using System;
-using System.Collections;
-
+using System.Collections.Generic;
using log4net.Core;
namespace log4net.Util
{
/// <summary>
- /// Manages a mapping from levels to <see cref="LevelMappingEntry"/>
- /// </summary>
- /// <remarks>
- /// <para>
/// Manages an ordered mapping from <see cref="Level"/> instances
/// to <see cref="LevelMappingEntry"/> subclasses.
- /// </para>
- /// </remarks>
+ /// </summary>
/// <author>Nicko Cadell</author>
public sealed class LevelMapping : IOptionHandler
{
- #region Public Instance Constructors
-
- /// <summary>
- /// Default constructor
- /// </summary>
- /// <remarks>
- /// <para>
- /// Initialise a new instance of <see cref="LevelMapping"/>.
- /// </para>
- /// </remarks>
- public LevelMapping()
- {
- }
-
- #endregion // Public Instance Constructors
-
- #region Public Instance Methods
-
/// <summary>
/// Add a <see cref="LevelMappingEntry"/> to this mapping
/// </summary>
@@ -67,31 +43,19 @@
/// </remarks>
public void Add(LevelMappingEntry entry)
{
- if (m_entriesMap.ContainsKey(entry.Level))
- {
- m_entriesMap.Remove(entry.Level);
- }
- m_entriesMap.Add(entry.Level, entry);
+ m_entriesMap[entry.Level] = entry;
}
/// <summary>
- /// Lookup the mapping for the specified level
- /// </summary>
- /// <param name="level">the level to lookup</param>
- /// <returns>the <see cref="LevelMappingEntry"/> for the level or <c>null</c> if no mapping found</returns>
- /// <remarks>
- /// <para>
- /// Lookup the value for the specified level. Finds the nearest
+ /// Looks up the value for the specified level. Finds the nearest
/// mapping value for the level that is equal to or less than the
/// <paramref name="level"/> specified.
- /// </para>
- /// <para>
- /// If no mapping could be found then <c>null</c> is returned.
- /// </para>
- /// </remarks>
- public LevelMappingEntry Lookup(Level level)
+ /// </summary>
+ /// <param name="level">the level to look up.</param>
+ /// <returns>The <see cref="LevelMappingEntry"/> for the level or <c>null</c> if no mapping found</returns>
+ public LevelMappingEntry? Lookup(Level? level)
{
- if (m_entries != null)
+ if (m_entries is not null)
{
foreach (LevelMappingEntry entry in m_entries)
{
@@ -104,10 +68,6 @@
return null;
}
- #endregion // Public Instance Methods
-
- #region IOptionHandler Members
-
/// <summary>
/// Initialize options
/// </summary>
@@ -138,13 +98,7 @@
m_entries = sortValues;
}
- #endregion // IOptionHandler Members
-
- #region Private Instance Fields
-
- private Hashtable m_entriesMap = new Hashtable();
- private LevelMappingEntry[] m_entries = null;
-
- #endregion // Private Instance Fields
+ private readonly Dictionary<Level, LevelMappingEntry> m_entriesMap = new();
+ private LevelMappingEntry[]? m_entries;
}
}
diff --git a/src/log4net/Util/LogLog.cs b/src/log4net/Util/LogLog.cs
index a54f010..4ce84aa 100644
--- a/src/log4net/Util/LogLog.cs
+++ b/src/log4net/Util/LogLog.cs
@@ -19,6 +19,7 @@
using System;
using System.Collections;
+using System.Collections.Generic;
using System.Diagnostics;
namespace log4net.Util
@@ -28,7 +29,7 @@
/// </summary>
/// <param name="source"></param>
/// <param name="e"></param>
- public delegate void LogReceivedEventHandler(object source, LogReceivedEventArgs e);
+ public delegate void LogReceivedEventHandler(object? source, LogReceivedEventArgs e);
/// <summary>
/// Outputs log statements from within the log4net assembly.
@@ -52,37 +53,22 @@
/// <summary>
/// The event raised when an internal message has been received.
/// </summary>
- public static event LogReceivedEventHandler LogReceived;
-
- private readonly Type source;
- private readonly DateTime timeStampUtc;
- private readonly string prefix;
- private readonly string message;
- private readonly Exception exception;
+ public static event LogReceivedEventHandler? LogReceived;
/// <summary>
/// The Type that generated the internal message.
/// </summary>
- public Type Source
- {
- get { return source; }
- }
+ public Type Source { get; }
/// <summary>
/// The DateTime stamp of when the internal message was received.
/// </summary>
- public DateTime TimeStamp
- {
- get { return timeStampUtc.ToLocalTime(); }
- }
+ public DateTime TimeStamp => TimeStampUtc.ToLocalTime();
/// <summary>
/// The UTC DateTime stamp of when the internal message was received.
/// </summary>
- public DateTime TimeStampUtc
- {
- get { return timeStampUtc; }
- }
+ public DateTime TimeStampUtc { get; }
/// <summary>
/// A string indicating the severity of the internal message.
@@ -92,18 +78,12 @@
/// "log4net:ERROR ",
/// "log4net:WARN "
/// </remarks>
- public string Prefix
- {
- get { return prefix; }
- }
+ public string Prefix { get; }
/// <summary>
/// The internal log message.
/// </summary>
- public string Message
- {
- get { return message; }
- }
+ public string Message { get; }
/// <summary>
/// The Exception related to the message.
@@ -111,10 +91,7 @@
/// <remarks>
/// Optional. Will be null if no Exception was passed.
/// </remarks>
- public Exception Exception
- {
- get { return exception; }
- }
+ public Exception? Exception { get; }
/// <summary>
/// Formats Prefix, Source, and Message in the same format as the value
@@ -126,29 +103,19 @@
return Prefix + Source.Name + ": " + Message;
}
- #region Private Instance Constructors
-
/// <summary>
/// Initializes a new instance of the <see cref="LogLog" /> class.
/// </summary>
- /// <param name="source"></param>
- /// <param name="prefix"></param>
- /// <param name="message"></param>
- /// <param name="exception"></param>
- public LogLog(Type source, string prefix, string message, Exception exception)
+ public LogLog(Type source, string prefix, string message, Exception? exception)
{
- timeStampUtc = DateTime.UtcNow;
+ TimeStampUtc = DateTime.UtcNow;
- this.source = source;
- this.prefix = prefix;
- this.message = message;
- this.exception = exception;
+ Source = source;
+ Prefix = prefix;
+ Message = message;
+ Exception = exception;
}
- #endregion Private Instance Constructors
-
- #region Static Constructor
-
/// <summary>
/// Static constructor that initializes logging by reading
/// settings from the application configuration file.
@@ -168,7 +135,6 @@
/// </remarks>
static LogLog()
{
-#if !NETCF
try
{
InternalDebugging = OptionConverter.ToBoolean(SystemInfo.GetAppSetting("log4net.Internal.Debug"), false);
@@ -183,13 +149,8 @@
// We will leave debug OFF and print an Error message
Error(typeof(LogLog), "Exception while reading ConfigurationSettings. Check your .config file is well formed XML.", ex);
}
-#endif
}
- #endregion Static Constructor
-
- #region Public Static Properties
-
/// <summary>
/// Gets or sets a value indicating whether log4net internal logging
/// is enabled or disabled.
@@ -226,11 +187,7 @@
/// </configuration>
/// </code>
/// </example>
- public static bool InternalDebugging
- {
- get { return s_debugEnabled; }
- set { s_debugEnabled = value; }
- }
+ public static bool InternalDebugging { get; set; }
/// <summary>
/// Gets or sets a value indicating whether log4net should generate no output
@@ -266,24 +223,12 @@
/// </configuration>
/// </code>
/// </example>
- public static bool QuietMode
- {
- get { return s_quietMode; }
- set { s_quietMode = value; }
- }
+ public static bool QuietMode { get; set; }
/// <summary>
///
/// </summary>
- public static bool EmitInternalMessages
- {
- get { return s_emitInternalMessages; }
- set { s_emitInternalMessages = value; }
- }
-
- #endregion Public Static Properties
-
- #region Public Static Methods
+ public static bool EmitInternalMessages { get; set; } = true;
/// <summary>
/// Raises the LogReceived event when an internal messages is received.
@@ -292,12 +237,9 @@
/// <param name="prefix"></param>
/// <param name="message"></param>
/// <param name="exception"></param>
- public static void OnLogReceived(Type source, string prefix, string message, Exception exception)
+ public static void OnLogReceived(Type source, string prefix, string message, Exception? exception)
{
- if (LogReceived != null)
- {
- LogReceived(null, new LogReceivedEventArgs(new LogLog(source, prefix, message, exception)));
- }
+ LogReceived?.Invoke(null, new LogReceivedEventArgs(new LogLog(source, prefix, message, exception)));
}
/// <summary>
@@ -311,10 +253,7 @@
/// Test if LogLog.Debug is enabled for output.
/// </para>
/// </remarks>
- public static bool IsDebugEnabled
- {
- get { return s_debugEnabled && !s_quietMode; }
- }
+ public static bool IsDebugEnabled => InternalDebugging && !QuietMode;
/// <summary>
/// Writes log4net internal debug messages to the
@@ -354,7 +293,7 @@
/// the string "log4net: ".
/// </para>
/// </remarks>
- public static void Debug(Type source, string message, Exception exception)
+ public static void Debug(Type source, string message, Exception? exception)
{
if (IsDebugEnabled)
{
@@ -377,15 +316,7 @@
/// <value>
/// <c>true</c> if Warn is enabled
/// </value>
- /// <remarks>
- /// <para>
- /// Test if LogLog.Warn is enabled for output.
- /// </para>
- /// </remarks>
- public static bool IsWarnEnabled
- {
- get { return !s_quietMode; }
- }
+ public static bool IsWarnEnabled => !QuietMode;
/// <summary>
/// Writes log4net internal warning messages to the
@@ -425,7 +356,7 @@
/// the string "log4net:WARN ".
/// </para>
/// </remarks>
- public static void Warn(Type source, string message, Exception exception)
+ public static void Warn(Type source, string message, Exception? exception)
{
if (IsWarnEnabled)
{
@@ -453,10 +384,7 @@
/// Test if LogLog.Error is enabled for output.
/// </para>
/// </remarks>
- public static bool IsErrorEnabled
- {
- get { return !s_quietMode; }
- }
+ public static bool IsErrorEnabled => !QuietMode;
/// <summary>
/// Writes log4net internal error messages to the
@@ -496,7 +424,7 @@
/// the string "log4net:ERROR ".
/// </para>
/// </remarks>
- public static void Error(Type source, string message, Exception exception)
+ public static void Error(Type source, string message, Exception? exception)
{
if (IsErrorEnabled)
{
@@ -513,8 +441,6 @@
}
}
- #endregion Public Static Methods
-
/// <summary>
/// Writes output to the standard output stream.
/// </summary>
@@ -522,8 +448,6 @@
/// <remarks>
/// <para>
/// Writes to both Console.Out and System.Diagnostics.Trace.
- /// Note that the System.Diagnostics.Trace is not supported
- /// on the Compact Framework.
/// </para>
/// <para>
/// If the AppDomain is not configured with a config file then
@@ -535,13 +459,8 @@
{
try
{
-#if NETCF
- Console.WriteLine(message);
- //System.Diagnostics.Debug.WriteLine(message);
-#else
Console.Out.WriteLine(message);
Trace.WriteLine(message);
-#endif
}
catch
{
@@ -569,13 +488,8 @@
{
try
{
-#if NETCF
- Console.WriteLine(message);
- //System.Diagnostics.Debug.WriteLine(message);
-#else
Console.Error.WriteLine(message);
Trace.WriteLine(message);
-#endif
}
catch
{
@@ -583,67 +497,45 @@
}
}
- #region Private Static Fields
-
- /// <summary>
- /// Default debug level
- /// </summary>
- private static bool s_debugEnabled = false;
-
- /// <summary>
- /// In quietMode not even errors generate any output.
- /// </summary>
- private static bool s_quietMode = false;
-
- private static bool s_emitInternalMessages = true;
-
private const string PREFIX = "log4net: ";
private const string ERR_PREFIX = "log4net:ERROR ";
private const string WARN_PREFIX = "log4net:WARN ";
- #endregion Private Static Fields
-
/// <summary>
/// Subscribes to the LogLog.LogReceived event and stores messages
/// to the supplied IList instance.
/// </summary>
public class LogReceivedAdapter : IDisposable
{
- private readonly IList items;
- private readonly LogReceivedEventHandler handler;
+ private readonly LogReceivedEventHandler m_handler;
/// <summary>
///
/// </summary>
/// <param name="items"></param>
- public LogReceivedAdapter(IList items)
+ public LogReceivedAdapter(List<LogLog> items)
{
- this.items = items;
-
- handler = new LogReceivedEventHandler(LogLog_LogReceived);
-
- LogReceived += handler;
+ Items = items;
+ m_handler = LogLog_LogReceived;
+ LogReceived += m_handler;
}
void LogLog_LogReceived(object source, LogReceivedEventArgs e)
{
- items.Add(e.LogLog);
+ Items.Add(e.LogLog);
}
/// <summary>
///
/// </summary>
- public IList Items
- {
- get { return items; }
- }
+ public List<LogLog> Items { get; }
/// <summary>
///
/// </summary>
public void Dispose()
{
- LogReceived -= handler;
+ LogReceived -= m_handler;
}
}
}
@@ -653,23 +545,18 @@
/// </summary>
public class LogReceivedEventArgs : EventArgs
{
- private readonly LogLog loglog;
-
/// <summary>
///
/// </summary>
/// <param name="loglog"></param>
public LogReceivedEventArgs(LogLog loglog)
{
- this.loglog = loglog;
+ this.LogLog = loglog;
}
/// <summary>
///
/// </summary>
- public LogLog LogLog
- {
- get { return loglog; }
- }
+ public LogLog LogLog { get; }
}
}
diff --git a/src/log4net/Util/LogicalThreadContextProperties.cs b/src/log4net/Util/LogicalThreadContextProperties.cs
index 2104220..f42a6d2 100644
--- a/src/log4net/Util/LogicalThreadContextProperties.cs
+++ b/src/log4net/Util/LogicalThreadContextProperties.cs
@@ -17,17 +17,16 @@
//
#endregion
-// .NET Compact Framework 1.0 has no support for System.Runtime.Remoting.Messaging.CallContext
-#if !NETCF
-
using System;
-#if !NETSTANDARD
-using System.Runtime.Remoting.Messaging;
-#endif
using System.Security;
-#if NETSTANDARD
-using System.Threading;
+#if NET462_OR_GREATER
+using CallContext = System.Runtime.Remoting.Messaging.CallContext;
#endif
+#if NETSTANDARD2_0_OR_GREATER
+using CallContext = System.Threading.AsyncLocal<log4net.Util.PropertiesDictionary>;
+#endif
+
+#nullable enable
namespace log4net.Util
{
@@ -45,8 +44,7 @@
/// </para>
/// <para>
/// For .NET Standard 1.3 this class uses
- /// System.Threading.AsyncLocal rather than <see
- /// cref="System.Runtime.Remoting.Messaging.CallContext"/>.
+ /// System.Threading.AsyncLocal rather than <see cref="CallContext"/>.
/// </para>
/// <para>
/// The <see cref="CallContext"/> requires a link time
@@ -59,8 +57,8 @@
/// <author>Nicko Cadell</author>
public sealed class LogicalThreadContextProperties : ContextPropertiesBase
{
-#if NETSTANDARD
- private static readonly AsyncLocal<PropertiesDictionary> AsyncLocalDictionary = new AsyncLocal<PropertiesDictionary>();
+#if NETSTANDARD2_0_OR_GREATER
+ private static readonly CallContext AsyncLocalDictionary = new CallContext();
#else
private const string c_SlotName = "log4net.Util.LogicalThreadContextProperties";
#endif
@@ -68,9 +66,7 @@
/// <summary>
/// Flag used to disable this context if we don't have permission to access the CallContext.
/// </summary>
- private bool m_disabled = false;
-
- #region Public Instance Constructors
+ private bool m_disabled;
/// <summary>
/// Constructor
@@ -84,49 +80,27 @@
{
}
- #endregion Public Instance Constructors
-
- #region Public Instance Properties
-
- /// <summary>
- /// Gets or sets the value of a property
- /// </summary>
- /// <value>
- /// The value for the property with the specified key
- /// </value>
- /// <remarks>
- /// <para>
- /// Get or set the property value for the <paramref name="key"/> specified.
- /// </para>
- /// </remarks>
- public override object this[string key]
+ /// <inheritdoc/>
+ public override object? this[string key]
{
get
{
// Don't create the dictionary if it does not already exist
- PropertiesDictionary dictionary = GetProperties(false);
- if (dictionary != null)
- {
- return dictionary[key];
- }
- return null;
+ PropertiesDictionary? dictionary = GetProperties(false);
+ return dictionary?[key];
}
set
{
// Force the dictionary to be created
- PropertiesDictionary props = GetProperties(true);
+ PropertiesDictionary props = GetProperties(true)!;
// Reason for cloning the dictionary below: object instances set on the CallContext
// need to be immutable to correctly flow through async/await
- PropertiesDictionary immutableProps = new PropertiesDictionary(props);
+ var immutableProps = new PropertiesDictionary(props);
immutableProps[key] = value;
SetLogicalProperties(immutableProps);
}
}
- #endregion Public Instance Properties
-
- #region Public Instance Methods
-
/// <summary>
/// Remove a property
/// </summary>
@@ -138,7 +112,7 @@
/// </remarks>
public void Remove(string key)
{
- PropertiesDictionary dictionary = GetProperties(false);
+ PropertiesDictionary? dictionary = GetProperties(false);
if (dictionary != null)
{
PropertiesDictionary immutableProps = new PropertiesDictionary(dictionary);
@@ -157,22 +131,17 @@
/// </remarks>
public void Clear()
{
- PropertiesDictionary dictionary = GetProperties(false);
- if (dictionary != null)
+ PropertiesDictionary? dictionary = GetProperties(false);
+ if (dictionary is not null)
{
- PropertiesDictionary immutableProps = new PropertiesDictionary();
- SetLogicalProperties(immutableProps);
+ SetLogicalProperties(new PropertiesDictionary());
}
}
- #endregion Public Instance Methods
-
- #region Internal Instance Methods
-
/// <summary>
/// Get the PropertiesDictionary stored in the LocalDataStoreSlot for this thread.
/// </summary>
- /// <param name="create">create the dictionary if it does not exist, otherwise return null if is does not exist</param>
+ /// <param name="create">create the dictionary if it does not exist, otherwise return null if it does not exist</param>
/// <returns>the properties for this thread</returns>
/// <remarks>
/// <para>
@@ -181,13 +150,13 @@
/// caller must clone the collection before doings so.
/// </para>
/// </remarks>
- internal PropertiesDictionary GetProperties(bool create)
+ internal PropertiesDictionary? GetProperties(bool create)
{
if (!m_disabled)
{
try
{
- PropertiesDictionary properties = GetLogicalProperties();
+ PropertiesDictionary? properties = GetLogicalProperties();
if (properties == null && create)
{
properties = new PropertiesDictionary();
@@ -212,30 +181,21 @@
return null;
}
- #endregion Internal Instance Methods
-
- #region Private Static Methods
-
/// <summary>
/// Gets the call context get data.
/// </summary>
- /// <returns>The peroperties dictionary stored in the call context</returns>
+ /// <returns>The properties dictionary stored in the call context</returns>
/// <remarks>
- /// The <see cref="CallContext"/> method <see cref="CallContext.GetData"/> has a
- /// security link demand, therfore we must put the method call in a seperate method
- /// that we can wrap in an exception handler.
+ /// The <see cref="CallContext"/> method GetData security link demand, therefore we must
+ /// put the method call in a separate method that we can wrap in an exception handler.
/// </remarks>
-#if NET_4_0 || MONO_4_0 || NETSTANDARD
- [System.Security.SecuritySafeCritical]
-#endif
- private static PropertiesDictionary GetLogicalProperties()
+ [SecuritySafeCritical]
+ private static PropertiesDictionary? GetLogicalProperties()
{
-#if NETSTANDARD
- return AsyncLocalDictionary.Value;
-#elif NET_2_0 || MONO_2_0 || MONO_3_5 || MONO_4_0
- return CallContext.LogicalGetData(c_SlotName) as PropertiesDictionary;
+#if NETSTANDARD2_0_OR_GREATER
+ return AsyncLocalDictionary.Value;
#else
- return CallContext.GetData(c_SlotName) as PropertiesDictionary;
+ return CallContext.LogicalGetData(c_SlotName) as PropertiesDictionary;
#endif
}
@@ -244,28 +204,19 @@
/// </summary>
/// <param name="properties">The properties.</param>
/// <remarks>
- /// The <see cref="CallContext"/> method <see cref="CallContext.SetData"/> has a
- /// security link demand, therfore we must put the method call in a seperate method
- /// that we can wrap in an exception handler.
+ /// The <see cref="CallContext"/> method SetData has a security link demand, therefore we must
+ /// put the method call in a separate method that we can wrap in an exception handler.
/// </remarks>
-#if NET_4_0 || MONO_4_0 || NETSTANDARD
- [System.Security.SecuritySafeCritical]
-#endif
+ [SecuritySafeCritical]
private static void SetLogicalProperties(PropertiesDictionary properties)
{
-#if NETSTANDARD
+#if NETSTANDARD2_0_OR_GREATER
AsyncLocalDictionary.Value = properties;
-#elif NET_2_0 || MONO_2_0 || MONO_3_5 || MONO_4_0
- CallContext.LogicalSetData(c_SlotName, properties);
#else
- CallContext.SetData(c_SlotName, properties);
+ CallContext.LogicalSetData(c_SlotName, properties);
#endif
}
- #endregion
-
- #region Private Static Fields
-
/// <summary>
/// The fully qualified type of the LogicalThreadContextProperties class.
/// </summary>
@@ -274,9 +225,5 @@
/// log message.
/// </remarks>
private static readonly Type declaringType = typeof(LogicalThreadContextProperties);
-
- #endregion Private Static Fields
}
-}
-
-#endif
+}
\ No newline at end of file
diff --git a/src/log4net/Util/LogicalThreadContextStack.cs b/src/log4net/Util/LogicalThreadContextStack.cs
index bd7b0ab..fd407e3 100644
--- a/src/log4net/Util/LogicalThreadContextStack.cs
+++ b/src/log4net/Util/LogicalThreadContextStack.cs
@@ -17,61 +17,41 @@
//
#endregion
-#if !NETCF
using System;
-using System.Collections;
-
+using System.Collections.Generic;
using log4net.Core;
+#nullable enable
+
namespace log4net.Util
{
-
/// <summary>
/// Delegate type used for LogicalThreadContextStack's callbacks.
/// </summary>
-#if NET_2_0 || MONO_2_0 || NETSTANDARD
public delegate void TwoArgAction<T1, T2>(T1 t1, T2 t2);
-#else
- public delegate void TwoArgAction(string t1, LogicalThreadContextStack t2);
-#endif
/// <summary>
/// Implementation of Stack for the <see cref="log4net.LogicalThreadContext"/>
/// </summary>
- /// <remarks>
- /// <para>
- /// Implementation of Stack for the <see cref="log4net.LogicalThreadContext"/>
- /// </para>
- /// </remarks>
/// <author>Nicko Cadell</author>
public sealed class LogicalThreadContextStack : IFixingRequired
{
- #region Private Instance Fields
-
/// <summary>
/// The stack store.
/// </summary>
- private Stack m_stack = new Stack();
+ private Stack<StackFrame> m_stack = new();
/// <summary>
/// The name of this <see cref="log4net.Util.LogicalThreadContextStack"/> within the
/// <see cref="log4net.Util.LogicalThreadContextProperties"/>.
/// </summary>
- private string m_propertyKey;
+ private readonly string m_propertyKey;
/// <summary>
/// The callback used to let the <see cref="log4net.Util.LogicalThreadContextStacks"/> register a
/// new instance of a <see cref="log4net.Util.LogicalThreadContextStack"/>.
/// </summary>
-#if NET_2_0 || MONO_2_0 || NETSTANDARD
- private TwoArgAction<string, LogicalThreadContextStack> m_registerNew;
-#else
- private TwoArgAction m_registerNew;
-#endif
-
- #endregion Private Instance Fields
-
- #region Public Instance Constructors
+ private readonly TwoArgAction<string, LogicalThreadContextStack> m_registerNew;
/// <summary>
/// Internal constructor
@@ -81,26 +61,15 @@
/// Initializes a new instance of the <see cref="LogicalThreadContextStack" /> class.
/// </para>
/// </remarks>
-#if NET_2_0 || MONO_2_0 || NETSTANDARD
internal LogicalThreadContextStack(string propertyKey, TwoArgAction<string, LogicalThreadContextStack> registerNew)
-#else
- internal LogicalThreadContextStack(string propertyKey, TwoArgAction registerNew)
-#endif
{
m_propertyKey = propertyKey;
m_registerNew = registerNew;
}
- #endregion Public Instance Constructors
-
- #region Public Properties
-
/// <summary>
- /// The number of messages in the stack
+ /// Gets the number of messages in the stack.
/// </summary>
- /// <value>
- /// The current number of messages in the stack
- /// </value>
/// <remarks>
/// <para>
/// The current number of messages in the stack. That is
@@ -108,14 +77,7 @@
/// minus the number of times <see cref="Pop"/> has been called.
/// </para>
/// </remarks>
- public int Count
- {
- get { return m_stack.Count; }
- }
-
- #endregion // Public Properties
-
- #region Public Methods
+ public int Count => m_stack.Count;
/// <summary>
/// Clears all the contextual information held in this stack.
@@ -148,17 +110,16 @@
/// empty string (not <see langword="null"/>) is returned.
/// </para>
/// </remarks>
- public string Pop()
+ public string? Pop()
{
// copy current stack
- Stack stack = new Stack(new Stack(m_stack));
- string result = "";
+ var stack = new Stack<StackFrame>(new Stack<StackFrame>(m_stack));
+ string? result = string.Empty;
if (stack.Count > 0)
{
- result = ((StackFrame)(stack.Pop())).Message;
+ result = stack.Pop().Message;
}
- LogicalThreadContextStack ltcs = new LogicalThreadContextStack(m_propertyKey, m_registerNew);
- ltcs.m_stack = stack;
+ var ltcs = new LogicalThreadContextStack(m_propertyKey, m_registerNew) { m_stack = stack };
m_registerNew(m_propertyKey, ltcs);
return result;
}
@@ -186,11 +147,11 @@
/// }
/// </code>
/// </example>
- public IDisposable Push(string message)
+ public IDisposable Push(string? message)
{
// do modifications on a copy
- Stack stack = new Stack(new Stack(m_stack));
- stack.Push(new StackFrame(message, (stack.Count > 0) ? (StackFrame)stack.Peek() : null));
+ var stack = new Stack<StackFrame>(new Stack<StackFrame>(m_stack));
+ stack.Push(new StackFrame(message, (stack.Count > 0) ? stack.Peek() : null));
LogicalThreadContextStack contextStack = new LogicalThreadContextStack(m_propertyKey, m_registerNew);
contextStack.m_stack = stack;
@@ -208,54 +169,31 @@
/// empty string (not <see langword="null"/>) is returned.
/// </para>
/// </remarks>
- public string Peek()
+ public string? Peek()
{
- Stack stack = m_stack;
+ Stack<StackFrame> stack = m_stack;
if (stack.Count > 0)
{
- return ((StackFrame)stack.Peek()).Message;
+ return stack.Peek().Message;
}
- return "";
+ return string.Empty;
}
- #endregion Public Methods
-
- #region Internal Methods
-
/// <summary>
/// Gets the current context information for this stack.
/// </summary>
/// <returns>The current context information.</returns>
- internal string GetFullMessage()
+ internal string? GetFullMessage()
{
- Stack stack = m_stack;
+ Stack<StackFrame> stack = m_stack;
if (stack.Count > 0)
{
- return ((StackFrame)(stack.Peek())).FullMessage;
+ return stack.Peek().FullMessage;
}
return null;
}
/// <summary>
- /// Gets and sets the internal stack used by this <see cref="LogicalThreadContextStack"/>
- /// </summary>
- /// <value>The internal storage stack</value>
- /// <remarks>
- /// <para>
- /// This property is provided only to support backward compatability
- /// of the <see cref="NDC"/>. Tytpically the internal stack should not
- /// be modified.
- /// </para>
- /// </remarks>
- internal Stack InternalStack
- {
- get { return m_stack; }
- set { m_stack = value; }
- }
-
- #endregion Internal Methods
-
- /// <summary>
/// Gets the current context information for this stack.
/// </summary>
/// <returns>Gets the current context information</returns>
@@ -264,44 +202,23 @@
/// Gets the current context information for this stack.
/// </para>
/// </remarks>
- public override string ToString()
+ public override string? ToString()
{
return GetFullMessage();
}
/// <summary>
- /// Get a portable version of this object
+ /// Gets a cross-thread portable version of this object
/// </summary>
- /// <returns>the portable instance of this object</returns>
- /// <remarks>
- /// <para>
- /// Get a cross thread portable version of this object
- /// </para>
- /// </remarks>
- object IFixingRequired.GetFixedObject()
- {
- return GetFullMessage();
- }
+ object? IFixingRequired.GetFixedObject() => GetFullMessage();
/// <summary>
/// Inner class used to represent a single context frame in the stack.
/// </summary>
- /// <remarks>
- /// <para>
- /// Inner class used to represent a single context frame in the stack.
- /// </para>
- /// </remarks>
- private sealed class StackFrame
+ internal sealed class StackFrame
{
- #region Private Instance Fields
-
- private readonly string m_message;
- private readonly StackFrame m_parent;
- private string m_fullMessage = null;
-
- #endregion
-
- #region Internal Instance Constructors
+ private readonly StackFrame? m_parent;
+ private string? m_fullMessage;
/// <summary>
/// Constructor
@@ -314,9 +231,9 @@
/// with the specified message and parent context.
/// </para>
/// </remarks>
- internal StackFrame(string message, StackFrame parent)
+ internal StackFrame(string? message, StackFrame? parent)
{
- m_message = message;
+ Message = message;
m_parent = parent;
if (parent == null)
@@ -325,10 +242,6 @@
}
}
- #endregion Internal Instance Constructors
-
- #region Internal Instance Properties
-
/// <summary>
/// Get the message.
/// </summary>
@@ -338,10 +251,7 @@
/// Get the message.
/// </para>
/// </remarks>
- internal string Message
- {
- get { return m_message; }
- }
+ internal string? Message { get; }
/// <summary>
/// Gets the full text of the context down to the root level.
@@ -354,19 +264,18 @@
/// Gets the full text of the context down to the root level.
/// </para>
/// </remarks>
- internal string FullMessage
+ internal string? FullMessage
{
get
{
if (m_fullMessage == null && m_parent != null)
{
- m_fullMessage = string.Concat(m_parent.FullMessage, " ", m_message);
+ m_fullMessage = string.Concat(m_parent.FullMessage, " ", Message);
}
+
return m_fullMessage;
}
}
-
- #endregion Internal Instance Properties
}
/// <summary>
@@ -378,23 +287,17 @@
/// with the <see langword="using"/> pattern to remove the stack frame at the end of the scope.
/// </para>
/// </remarks>
- private struct AutoPopStackFrame : IDisposable
+ private readonly struct AutoPopStackFrame : IDisposable
{
- #region Private Instance Fields
-
/// <summary>
/// The depth to trim the stack to when this instance is disposed
/// </summary>
- private int m_frameDepth;
+ private readonly int m_frameDepth;
/// <summary>
/// The outer LogicalThreadContextStack.
/// </summary>
- private LogicalThreadContextStack m_logicalThreadContextStack;
-
- #endregion Private Instance Fields
-
- #region Internal Instance Constructors
+ private readonly LogicalThreadContextStack m_logicalThreadContextStack;
/// <summary>
/// Constructor
@@ -413,10 +316,6 @@
m_logicalThreadContextStack = logicalThreadContextStack;
}
- #endregion Internal Instance Constructors
-
- #region Implementation of IDisposable
-
/// <summary>
/// Returns the stack to the correct depth.
/// </summary>
@@ -427,23 +326,20 @@
/// </remarks>
public void Dispose()
{
- if (m_frameDepth >= 0 && m_logicalThreadContextStack.m_stack != null)
+ if (m_frameDepth >= 0)
{
- Stack stack = new Stack(new Stack(m_logicalThreadContextStack.m_stack));
+ var stack = new Stack<StackFrame>(new Stack<StackFrame>(m_logicalThreadContextStack.m_stack));
while (stack.Count > m_frameDepth)
{
stack.Pop();
}
- LogicalThreadContextStack ltcs = new LogicalThreadContextStack(m_logicalThreadContextStack.m_propertyKey, m_logicalThreadContextStack.m_registerNew);
- ltcs.m_stack = stack;
- m_logicalThreadContextStack.m_registerNew(m_logicalThreadContextStack.m_propertyKey,
- ltcs);
+ var ltcs = new LogicalThreadContextStack(m_logicalThreadContextStack.m_propertyKey, m_logicalThreadContextStack.m_registerNew)
+ {
+ m_stack = stack
+ };
+ m_logicalThreadContextStack.m_registerNew(m_logicalThreadContextStack.m_propertyKey, ltcs);
}
}
-
- #endregion Implementation of IDisposable
}
-
}
}
-#endif
\ No newline at end of file
diff --git a/src/log4net/Util/LogicalThreadContextStacks.cs b/src/log4net/Util/LogicalThreadContextStacks.cs
index 6ea5901..f797f48 100644
--- a/src/log4net/Util/LogicalThreadContextStacks.cs
+++ b/src/log4net/Util/LogicalThreadContextStacks.cs
@@ -17,7 +17,6 @@
//
#endregion
-#if !NETCF
using System;
namespace log4net.Util
@@ -25,18 +24,11 @@
/// <summary>
/// Implementation of Stacks collection for the <see cref="log4net.LogicalThreadContext"/>
/// </summary>
- /// <remarks>
- /// <para>
- /// Implementation of Stacks collection for the <see cref="log4net.LogicalThreadContext"/>
- /// </para>
- /// </remarks>
/// <author>Nicko Cadell</author>
public sealed class LogicalThreadContextStacks
{
private readonly LogicalThreadContextProperties m_properties;
- #region Public Instance Constructors
-
/// <summary>
/// Internal constructor
/// </summary>
@@ -50,10 +42,6 @@
m_properties = properties;
}
- #endregion Public Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
/// Gets the named thread context stack
/// </summary>
@@ -75,11 +63,7 @@
if (propertyValue == null)
{
// Stack does not exist, create
-#if NET_2_0 || MONO_2_0 || NETSTANDARD
- stack = new LogicalThreadContextStack(key, registerNew);
-#else
- stack = new LogicalThreadContextStack(key, new TwoArgAction(registerNew));
-#endif
+ stack = new LogicalThreadContextStack(key, RegisterNew);
m_properties[key] = stack;
}
else
@@ -101,11 +85,7 @@
LogLog.Error(declaringType, "ThreadContextStacks: Request for stack named [" + key + "] failed because a property with the same name exists which is a [" + propertyValue.GetType().Name + "] with value [" + propertyValueString + "]");
-#if NET_2_0 || MONO_2_0 || NETSTANDARD
- stack = new LogicalThreadContextStack(key, registerNew);
-#else
- stack = new LogicalThreadContextStack(key, new TwoArgAction(registerNew));
-#endif
+ stack = new LogicalThreadContextStack(key, RegisterNew);
}
}
@@ -113,19 +93,11 @@
}
}
- #endregion Public Instance Properties
-
- #region Private Instance Fields
-
- private void registerNew(string stackName, LogicalThreadContextStack stack)
+ private void RegisterNew(string stackName, LogicalThreadContextStack stack)
{
m_properties[stackName] = stack;
}
- #endregion Private Instance Fields
-
- #region Private Static Fields
-
/// <summary>
/// The fully qualified type of the ThreadContextStacks class.
/// </summary>
@@ -134,9 +106,5 @@
/// log message.
/// </remarks>
private static readonly Type declaringType = typeof(LogicalThreadContextStacks);
-
- #endregion Private Static Fields
}
-}
-
-#endif
+}
\ No newline at end of file
diff --git a/src/log4net/Util/NativeError.cs b/src/log4net/Util/NativeError.cs
index e93cef1..f7d3632 100644
--- a/src/log4net/Util/NativeError.cs
+++ b/src/log4net/Util/NativeError.cs
@@ -17,13 +17,6 @@
//
#endregion
-// MONO 1.0 has no support for Win32 Error APIs
-#if !MONO
-// SSCLI 1.0 has no support for Win32 Error APIs
-#if !SSCLI
-// We don't want framework or platform specific code in the CLI version of log4net
-#if !CLI_1_0
-
using System;
using System.Globalization;
using System.Runtime.InteropServices;
@@ -114,12 +107,8 @@
/// native Win32 <c>FormatMessage</c> function.
/// </para>
/// </remarks>
-#if NET_4_0 || MONO_4_0 || NETSTANDARD
- [System.Security.SecuritySafeCritical]
-#endif
-#if !NETCF && !NETSTANDARD1_3
+ [System.Security.SecuritySafeCritical]
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, UnmanagedCode = true)]
-#endif
public static NativeError GetLastError()
{
int number = Marshal.GetLastWin32Error();
@@ -158,12 +147,8 @@
/// using the native <c>FormatMessage</c> function.
/// </para>
/// </remarks>
-#if NET_4_0 || MONO_4_0 || NETSTANDARD
- [System.Security.SecuritySafeCritical]
-#endif
-#if !NETCF && !NETSTANDARD1_3
+ [System.Security.SecuritySafeCritical]
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, UnmanagedCode = true)]
-#endif
public static string GetErrorMessage(int messageId)
{
// Win32 constants
@@ -262,11 +247,7 @@
/// call <see cref="M:Marshal.GetLastWin32Error()" />.
/// </para>
/// </returns>
-#if NETCF || NETSTANDARD
- [DllImport("CoreDll.dll", SetLastError=true, CharSet=CharSet.Unicode)]
-#else
[DllImport("Kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
-#endif
private static extern int FormatMessage(
int dwFlags,
ref IntPtr lpSource,
@@ -285,8 +266,4 @@
#endregion
}
-}
-
-#endif // !CLI_1_0
-#endif // !SSCLI
-#endif // !MONO
+}
\ No newline at end of file
diff --git a/src/log4net/Util/OnlyOnceErrorHandler.cs b/src/log4net/Util/OnlyOnceErrorHandler.cs
index f593607..910b62a 100644
--- a/src/log4net/Util/OnlyOnceErrorHandler.cs
+++ b/src/log4net/Util/OnlyOnceErrorHandler.cs
@@ -42,8 +42,6 @@
/// <author>Ron Grabowski</author>
public class OnlyOnceErrorHandler : IErrorHandler
{
- #region Public Instance Constructors
-
/// <summary>
/// Default Constructor
/// </summary>
@@ -54,7 +52,7 @@
/// </remarks>
public OnlyOnceErrorHandler()
{
- m_prefix = "";
+ m_prefix = string.Empty;
}
/// <summary>
@@ -72,24 +70,18 @@
m_prefix = prefix;
}
- #endregion Public Instance Constructors
-
- #region Public Instance Methods
-
/// <summary>
/// Reset the error handler back to its initial disabled state.
/// </summary>
public void Reset()
{
- m_enabledDateUtc = DateTime.MinValue;
- m_errorCode = ErrorCode.GenericFailure;
- m_exception = null;
- m_message = null;
- m_firstTime = true;
+ EnabledDateUtc = DateTime.MinValue;
+ ErrorCode = ErrorCode.GenericFailure;
+ Exception = null;
+ ErrorMessage = null;
+ IsEnabled = true;
}
- #region Implementation of IErrorHandler
-
/// <summary>
/// Log an Error
/// </summary>
@@ -101,9 +93,9 @@
/// Invokes <see cref="FirstError"/> if and only if this is the first error or the first error after <see cref="Reset"/> has been called.
/// </para>
/// </remarks>
- public void Error(string message, Exception e, ErrorCode errorCode)
+ public void Error(string message, Exception? e, ErrorCode errorCode)
{
- if (m_firstTime)
+ if (IsEnabled)
{
FirstError(message, e, errorCode);
}
@@ -120,13 +112,13 @@
/// Sends the error information to <see cref="LogLog"/>'s Error method.
/// </para>
/// </remarks>
- public virtual void FirstError(string message, Exception e, ErrorCode errorCode)
+ public virtual void FirstError(string message, Exception? e, ErrorCode errorCode)
{
- m_enabledDateUtc = DateTime.UtcNow;
- m_errorCode = errorCode;
- m_exception = e;
- m_message = message;
- m_firstTime = false;
+ EnabledDateUtc = DateTime.UtcNow;
+ ErrorCode = errorCode;
+ Exception = e;
+ ErrorMessage = message;
+ IsEnabled = false;
if (LogLog.InternalDebugging && !LogLog.QuietMode)
{
@@ -163,114 +155,63 @@
Error(message, null, ErrorCode.GenericFailure);
}
- #endregion Implementation of IErrorHandler
-
- #endregion
-
- #region Public Instance Properties
-
/// <summary>
/// Is error logging enabled
/// </summary>
/// <remarks>
/// <para>
- /// Is error logging enabled. Logging is only enabled for the
- /// first error delivered to the <see cref="OnlyOnceErrorHandler"/>.
+ /// Logging is only enabled for the first error delivered to the <see cref="OnlyOnceErrorHandler"/>.
/// </para>
/// </remarks>
- public bool IsEnabled
- {
- get { return m_firstTime; }
- }
+ public bool IsEnabled { get; private set; } = true;
/// <summary>
- /// The date the first error that trigged this error handler occurred, or <see cref="DateTime.MinValue"/> if it has not been triggered.
+ /// The date the first error that triggered this error handler occurred, or <see cref="DateTime.MinValue"/> if it has not been triggered.
/// </summary>
public DateTime EnabledDate
{
get
{
- if (m_enabledDateUtc == DateTime.MinValue) return DateTime.MinValue;
- return m_enabledDateUtc.ToLocalTime();
+ if (EnabledDateUtc == DateTime.MinValue)
+ {
+ return DateTime.MinValue;
+ }
+
+ return EnabledDateUtc.ToLocalTime();
}
}
/// <summary>
- /// The UTC date the first error that trigged this error handler occured, or <see cref="DateTime.MinValue"/> if it has not been triggered.
+ /// The UTC date the first error that triggered this error handler occured, or <see cref="DateTime.MinValue"/> if it has not been triggered.
/// </summary>
- public DateTime EnabledDateUtc
- {
- get { return m_enabledDateUtc; }
- }
+ public DateTime EnabledDateUtc { get; private set; }
/// <summary>
- /// The message from the first error that trigged this error handler.
+ /// The message from the first error that triggered this error handler.
/// </summary>
- public string ErrorMessage
- {
- get { return m_message; }
- }
+ public string? ErrorMessage { get; private set; }
/// <summary>
- /// The exception from the first error that trigged this error handler.
+ /// The exception from the first error that triggered this error handler.
/// </summary>
/// <remarks>
/// May be <see langword="null" />.
/// </remarks>
- public Exception Exception
- {
- get { return m_exception; }
- }
+ public Exception? Exception { get; private set; }
/// <summary>
- /// The error code from the first error that trigged this error handler.
+ /// The error code from the first error that triggered this error handler.
/// </summary>
/// <remarks>
/// Defaults to <see cref="log4net.Core.ErrorCode.GenericFailure"/>
/// </remarks>
- public ErrorCode ErrorCode
- {
- get { return m_errorCode; }
- }
-
- #endregion
-
- #region Private Instance Fields
-
- /// <summary>
- /// The UTC date the error was recorded.
- /// </summary>
- private DateTime m_enabledDateUtc;
-
- /// <summary>
- /// Flag to indicate if it is the first error
- /// </summary>
- private bool m_firstTime = true;
-
- /// <summary>
- /// The message recorded during the first error.
- /// </summary>
- private string m_message = null;
-
- /// <summary>
- /// The exception recorded during the first error.
- /// </summary>
- private Exception m_exception = null;
-
- /// <summary>
- /// The error code recorded during the first error.
- /// </summary>
- private ErrorCode m_errorCode = ErrorCode.GenericFailure;
+ public ErrorCode ErrorCode { get; private set; } = ErrorCode.GenericFailure;
/// <summary>
/// String to prefix each message with
/// </summary>
private readonly string m_prefix;
- #endregion Private Instance Fields
-
- #region Private Static Fields
-
/// <summary>
/// The fully qualified type of the OnlyOnceErrorHandler class.
/// </summary>
@@ -279,7 +220,5 @@
/// log message.
/// </remarks>
private static readonly Type declaringType = typeof(OnlyOnceErrorHandler);
-
- #endregion
}
}
diff --git a/src/log4net/Util/OptionConverter.cs b/src/log4net/Util/OptionConverter.cs
index 8f4bcc7..8e5033e 100644
--- a/src/log4net/Util/OptionConverter.cs
+++ b/src/log4net/Util/OptionConverter.cs
@@ -25,6 +25,8 @@
using log4net.Core;
using log4net.Util.TypeConverters;
+#nullable enable
+
namespace log4net.Util
{
/// <summary>
@@ -37,26 +39,8 @@
/// </remarks>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
- public sealed class OptionConverter
+ public static class OptionConverter
{
- #region Private Instance Constructors
-
- /// <summary>
- /// Initializes a new instance of the <see cref="OptionConverter" /> class.
- /// </summary>
- /// <remarks>
- /// <para>
- /// Uses a private access modifier to prevent instantiation of this class.
- /// </para>
- /// </remarks>
- private OptionConverter()
- {
- }
-
- #endregion Private Instance Constructors
-
- #region Public Static Methods
-
/// <summary>
/// Converts a string to a <see cref="bool" /> value.
/// </summary>
@@ -70,9 +54,9 @@
/// Otherwise, <paramref name="defaultValue"/> is returned.
/// </para>
/// </remarks>
- public static bool ToBoolean(string argValue, bool defaultValue)
+ public static bool ToBoolean(string? argValue, bool defaultValue)
{
- if (argValue != null && argValue.Length > 0)
+ if (!string.IsNullOrEmpty(argValue))
{
try
{
@@ -80,7 +64,7 @@
}
catch (Exception e)
{
- LogLog.Error(declaringType, "[" + argValue + "] is not in proper bool form.", e);
+ LogLog.Error(declaringType, $"[{argValue}] is not in proper bool form.", e);
}
}
return defaultValue;
@@ -102,9 +86,9 @@
/// cannot be converted to a <see cref="long" /> value.
/// </para>
/// </remarks>
- public static long ToFileSize(string argValue, long defaultValue)
+ public static long ToFileSize(string? argValue, long defaultValue)
{
- if (argValue == null)
+ if (argValue is null)
{
return defaultValue;
}
@@ -113,35 +97,32 @@
long multiplier = 1;
int index;
- if ((index = s.IndexOf("KB")) != -1)
+ if ((index = s.IndexOf("KB", StringComparison.Ordinal)) != -1)
{
multiplier = 1024;
s = s.Substring(0, index);
}
- else if ((index = s.IndexOf("MB")) != -1)
+ else if ((index = s.IndexOf("MB", StringComparison.Ordinal)) != -1)
{
multiplier = 1024 * 1024;
s = s.Substring(0, index);
}
- else if ((index = s.IndexOf("GB")) != -1)
+ else if ((index = s.IndexOf("GB", StringComparison.Ordinal)) != -1)
{
multiplier = 1024 * 1024 * 1024;
s = s.Substring(0, index);
}
- if (s != null)
- {
- // Try again to remove whitespace between the number and the size specifier
- s = s.Trim();
- long longVal;
- if (SystemInfo.TryParse(s, out longVal))
- {
- return longVal * multiplier;
- }
- else
- {
- LogLog.Error(declaringType, "OptionConverter: [" + s + "] is not in the correct file size syntax.");
- }
+ // Try again to remove whitespace between the number and the size specifier
+ s = s.Trim();
+
+ if (SystemInfo.TryParse(s, out long longVal))
+ {
+ return longVal * multiplier;
+ }
+ else
+ {
+ LogLog.Error(declaringType, $"OptionConverter: [{s}] is not in the correct file size syntax.");
}
return defaultValue;
}
@@ -161,11 +142,11 @@
/// to convert the string value into the specified target type.
/// </para>
/// </remarks>
- public static object ConvertStringTo(Type target, string txt)
+ public static object? ConvertStringTo(Type target, string txt)
{
- if (target == null)
+ if (target is null)
{
- throw new ArgumentNullException("target");
+ throw new ArgumentNullException(nameof(target));
}
// If we want a string we already have the correct type
@@ -175,19 +156,15 @@
}
// First lets try to find a type converter
- IConvertFrom typeConverter = ConverterRegistry.GetConvertFrom(target);
- if (typeConverter != null && typeConverter.CanConvertFrom(typeof(string)))
+ IConvertFrom? typeConverter = ConverterRegistry.GetConvertFrom(target);
+ if (typeConverter is not null && typeConverter.CanConvertFrom(typeof(string)))
{
// Found appropriate converter
return typeConverter.ConvertFrom(txt);
}
else
{
-#if NETSTANDARD1_3
- if (target.GetTypeInfo().IsEnum)
-#else
if (target.IsEnum)
-#endif
{
// Target type is an enum.
@@ -200,15 +177,10 @@
// to an arbitrary type T there will be a static method defined on type T called Parse
// that will take an argument of type string. i.e. T.Parse(string)->T we call this
// method to convert the string to the type required by the property.
- System.Reflection.MethodInfo meth = target.GetMethod("Parse", new Type[] { typeof(string) });
- if (meth != null)
+ if (target.GetMethod("Parse", new[] { typeof(string) }) is MethodInfo meth)
{
// Call the Parse method
-#if NETSTANDARD1_3
- return meth.Invoke(target, new[] { txt });
-#else
return meth.Invoke(null, BindingFlags.InvokeMethod, null, new object[] { txt }, CultureInfo.InvariantCulture);
-#endif
}
else
{
@@ -219,21 +191,6 @@
return null;
}
- // /// <summary>
- // /// Looks up the <see cref="IConvertFrom"/> for the target type.
- // /// </summary>
- // /// <param name="target">The type to lookup the converter for.</param>
- // /// <returns>The converter for the specified type.</returns>
- // public static IConvertFrom GetTypeConverter(Type target)
- // {
- // IConvertFrom converter = ConverterRegistry.GetConverter(target);
- // if (converter == null)
- // {
- // throw new InvalidOperationException("No type converter defined for [" + target + "]");
- // }
- // return converter;
- // }
-
/// <summary>
/// Checks if there is an appropriate type conversion from the source type to the target type.
/// </summary>
@@ -245,9 +202,9 @@
/// <para>
/// </para>
/// </remarks>
- public static bool CanConvertTypeTo(Type sourceType, Type targetType)
+ public static bool CanConvertTypeTo(Type? sourceType, Type? targetType)
{
- if (sourceType == null || targetType == null)
+ if (sourceType is null || targetType is null)
{
return false;
}
@@ -259,8 +216,7 @@
}
// Look for a To converter
- IConvertTo tcSource = ConverterRegistry.GetConvertTo(sourceType, targetType);
- if (tcSource != null)
+ if (ConverterRegistry.GetConvertTo(sourceType, targetType) is IConvertTo tcSource)
{
if (tcSource.CanConvertTo(targetType))
{
@@ -269,8 +225,7 @@
}
// Look for a From converter
- IConvertFrom tcTarget = ConverterRegistry.GetConvertFrom(targetType);
- if (tcTarget != null)
+ if (ConverterRegistry.GetConvertFrom(targetType) is IConvertFrom tcTarget)
{
if (tcTarget.CanConvertFrom(sourceType))
{
@@ -303,8 +258,7 @@
}
// Look for a TO converter
- IConvertTo tcSource = ConverterRegistry.GetConvertTo(sourceType, targetType);
- if (tcSource != null)
+ if (ConverterRegistry.GetConvertTo(sourceType, targetType) is IConvertTo tcSource)
{
if (tcSource.CanConvertTo(targetType))
{
@@ -313,8 +267,7 @@
}
// Look for a FROM converter
- IConvertFrom tcTarget = ConverterRegistry.GetConvertFrom(targetType);
- if (tcTarget != null)
+ if (ConverterRegistry.GetConvertFrom(targetType) is IConvertFrom tcTarget)
{
if (tcTarget.CanConvertFrom(sourceType))
{
@@ -322,41 +275,9 @@
}
}
- throw new ArgumentException("Cannot convert source object [" + sourceInstance.ToString() + "] to target type [" + targetType.Name + "]", "sourceInstance");
+ throw new ArgumentException($"Cannot convert source object [{sourceInstance}] to target type [{targetType.Name}]", nameof(sourceInstance));
}
- // /// <summary>
- // /// Finds the value corresponding to <paramref name="key"/> in
- // /// <paramref name="props"/> and then perform variable substitution
- // /// on the found value.
- // /// </summary>
- // /// <param name="key">The key to lookup.</param>
- // /// <param name="props">The association to use for lookups.</param>
- // /// <returns>The substituted result.</returns>
- // public static string FindAndSubst(string key, System.Collections.IDictionary props)
- // {
- // if (props == null)
- // {
- // throw new ArgumentNullException("props");
- // }
- //
- // string v = props[key] as string;
- // if (v == null)
- // {
- // return null;
- // }
- //
- // try
- // {
- // return SubstituteVariables(v, props);
- // }
- // catch(Exception e)
- // {
- // LogLog.Error(declaringType, "OptionConverter: Bad option value [" + v + "].", e);
- // return v;
- // }
- // }
-
/// <summary>
/// Instantiates an object given a class name.
/// </summary>
@@ -374,27 +295,28 @@
/// not be instantiated, then <paramref name="defaultValue"/> is returned.
/// </para>
/// </remarks>
- public static object InstantiateByClassName(string className, Type superClass, object defaultValue)
+ public static object? InstantiateByClassName(string? className, Type superClass, object? defaultValue)
{
- if (className != null)
+ if (className is not null)
{
try
{
-#if NETSTANDARD1_3
- Type classObj = SystemInfo.GetTypeFromString(superClass.GetTypeInfo().Assembly, className, true, true);
-#else
- Type classObj = SystemInfo.GetTypeFromString(className, true, true);
-#endif
- if (!superClass.IsAssignableFrom(classObj))
+ Type? classObj = SystemInfo.GetTypeFromString(className, true, true);
+ if (classObj is not null)
{
- LogLog.Error(declaringType, "OptionConverter: A [" + className + "] object is not assignable to a [" + superClass.FullName + "] variable.");
- return defaultValue;
+ if (!superClass.IsAssignableFrom(classObj))
+ {
+ LogLog.Error(declaringType, $"OptionConverter: A [{className}] object is not assignable to a [{superClass.FullName}] variable.");
+ return defaultValue;
+ }
+ return Activator.CreateInstance(classObj);
}
- return Activator.CreateInstance(classObj);
+
+ LogLog.Error(declaringType, $"Could not find class [{className}].");
}
catch (Exception e)
{
- LogLog.Error(declaringType, "Could not instantiate class [" + className + "].", e);
+ LogLog.Error(declaringType, $"Could not instantiate class [{className}].", e);
}
}
return defaultValue;
@@ -452,7 +374,7 @@
while (true)
{
- j = value.IndexOf(DELIM_START, i);
+ j = value.IndexOf(DELIM_START, i, StringComparison.Ordinal);
if (j == -1)
{
if (i == 0)
@@ -478,9 +400,7 @@
j += DELIM_START_LEN;
string key = value.Substring(j, k - j);
- string replacement = props[key] as string;
-
- if (replacement != null)
+ if (props[key] is string replacement)
{
buf.Append(replacement);
}
@@ -490,10 +410,6 @@
}
}
- #endregion Public Static Methods
-
- #region Private Static Methods
-
/// <summary>
/// Converts the string representation of the name or numeric value of one or
/// more enumerated constants to an equivalent enumerated object.
@@ -502,53 +418,11 @@
/// <param name="value">The enum string value.</param>
/// <param name="ignoreCase">If <c>true</c>, ignore case; otherwise, regard case.</param>
/// <returns>An object of type <paramref name="enumType" /> whose value is represented by <paramref name="value" />.</returns>
- private static object ParseEnum(System.Type enumType, string value, bool ignoreCase)
+ private static object ParseEnum(Type enumType, string value, bool ignoreCase)
{
-#if !NETCF
return Enum.Parse(enumType, value, ignoreCase);
-#else
- FieldInfo[] fields = enumType.GetFields(BindingFlags.Public | BindingFlags.Static);
-
- string[] names = value.Split(new char[] {','});
- for (int i = 0; i < names.Length; ++i)
- {
- names[i] = names [i].Trim();
- }
-
- long retVal = 0;
-
- try
- {
- // Attempt to convert to numeric type
- return Enum.ToObject(enumType, Convert.ChangeType(value, typeof(long), CultureInfo.InvariantCulture));
- }
- catch {}
-
- foreach (string name in names)
- {
- bool found = false;
- foreach(FieldInfo field in fields)
- {
- if (String.Compare(name, field.Name, ignoreCase) == 0)
- {
- retVal |= ((IConvertible) field.GetValue(null)).ToInt64(CultureInfo.InvariantCulture);
- found = true;
- break;
- }
- }
- if (!found)
- {
- throw new ArgumentException("Failed to lookup member [" + name + "] from Enum type [" + enumType.Name + "]");
- }
- }
- return Enum.ToObject(enumType, retVal);
-#endif
}
- #endregion Private Static Methods
-
- #region Private Static Fields
-
/// <summary>
/// The fully qualified type of the OptionConverter class.
/// </summary>
@@ -562,7 +436,5 @@
private const char DELIM_STOP = '}';
private const int DELIM_START_LEN = 2;
private const int DELIM_STOP_LEN = 1;
-
- #endregion Private Static Fields
}
-}
+}
\ No newline at end of file
diff --git a/src/log4net/Util/PatternConverter.cs b/src/log4net/Util/PatternConverter.cs
index 8403ddd..d5b3a35 100644
--- a/src/log4net/Util/PatternConverter.cs
+++ b/src/log4net/Util/PatternConverter.cs
@@ -21,7 +21,6 @@
using System.IO;
using System.Collections;
-using log4net.Util;
using log4net.Repository;
namespace log4net.Util
@@ -41,8 +40,6 @@
/// <author>Gert Driesen</author>
public abstract class PatternConverter
{
- #region Protected Instance Constructors
-
/// <summary>
/// Protected constructor
/// </summary>
@@ -55,25 +52,10 @@
{
}
- #endregion Protected Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
- /// Get the next pattern converter in the chain
+ /// Gets the next pattern converter in the chain.
/// </summary>
- /// <value>
- /// the next pattern converter in the chain
- /// </value>
- /// <remarks>
- /// <para>
- /// Get the next pattern converter in the chain
- /// </para>
- /// </remarks>
- public virtual PatternConverter Next
- {
- get { return m_next; }
- }
+ public virtual PatternConverter? Next => m_next;
/// <summary>
/// Gets or sets the formatting info for this converter
@@ -108,15 +90,7 @@
/// Gets or sets the option value for this converter
/// </para>
/// </remarks>
- public virtual string Option
- {
- get { return m_option; }
- set { m_option = value; }
- }
-
- #endregion Public Instance Properties
-
- #region Protected Abstract Methods
+ public virtual string? Option { get; set; }
/// <summary>
/// Evaluate this pattern converter and write the output to a writer.
@@ -129,11 +103,7 @@
/// convert conversion specifiers in the appropriate way.
/// </para>
/// </remarks>
- protected abstract void Convert(TextWriter writer, object state);
-
- #endregion Protected Abstract Methods
-
- #region Public Instance Methods
+ public abstract void Convert(TextWriter writer, object state);
/// <summary>
/// Set the next pattern converter in the chains
@@ -142,7 +112,7 @@
/// <returns>the next converter</returns>
/// <remarks>
/// <para>
- /// The PatternConverter can merge with its neighbor during this method (or a sub class).
+ /// The PatternConverter can merge with its neighbor during this method (or a subclass).
/// Therefore the return value may or may not be the value of the argument passed in.
/// </para>
/// </remarks>
@@ -174,7 +144,7 @@
}
else
{
- string msg = null;
+ string? msg;
int len;
lock (m_formatWriter)
{
@@ -215,9 +185,17 @@
}
}
- private static readonly string[] SPACES = { " ", " ", " ", " ", // 1,2,4,8 spaces
- " ", // 16 spaces
- " " }; // 32 spaces
+ private static readonly string[] SPACES =
+ {
+ // 1,2,4,8 spaces
+ " ", " ", " ", " ",
+
+ // 16 spaces
+ " ",
+
+ // 32 spaces
+ " "
+ };
/// <summary>
/// Fast space padding method.
@@ -246,25 +224,12 @@
}
}
- #endregion Public Instance Methods
-
- #region Private Instance Fields
-
- private PatternConverter m_next;
+ private PatternConverter? m_next;
private int m_min = -1;
private int m_max = int.MaxValue;
- private bool m_leftAlign = false;
+ private bool m_leftAlign;
- /// <summary>
- /// The option string to the converter
- /// </summary>
- private string m_option = null;
-
- private ReusableStringWriter m_formatWriter = new ReusableStringWriter(System.Globalization.CultureInfo.InvariantCulture);
-
- #endregion Private Instance Fields
-
- #region Constants
+ private readonly ReusableStringWriter m_formatWriter = new(System.Globalization.CultureInfo.InvariantCulture);
/// <summary>
/// Initial buffer size
@@ -276,10 +241,6 @@
/// </summary>
private const int c_renderBufferMaxCapacity = 1024;
- #endregion
-
- #region Static Methods
-
/// <summary>
/// Write an dictionary to a <see cref="TextWriter"/>
/// </summary>
@@ -305,7 +266,7 @@
}
/// <summary>
- /// Write an dictionary to a <see cref="TextWriter"/>
+ /// Writes a dictionary to a <see cref="TextWriter"/>
/// </summary>
/// <param name="writer">the writer to write to</param>
/// <param name="repository">a <see cref="ILoggerRepository"/> to use for object conversion</param>
@@ -361,16 +322,16 @@
/// the object's ToString method is called.
/// </para>
/// </remarks>
- protected static void WriteObject(TextWriter writer, ILoggerRepository repository, object value)
+ protected static void WriteObject(TextWriter writer, ILoggerRepository? repository, object? value)
{
- if (repository != null)
+ if (repository is not null)
{
repository.RendererMap.FindAndRender(value, writer);
}
else
{
// Don't have a repository to render with so just have to rely on ToString
- if (value == null)
+ if (value is null)
{
writer.Write(SystemInfo.NullText);
}
@@ -381,17 +342,9 @@
}
}
- #endregion
-
- private PropertiesDictionary properties;
-
/// <summary>
///
/// </summary>
- public PropertiesDictionary Properties
- {
- get { return properties; }
- set { properties = value; }
- }
+ public PropertiesDictionary? Properties { get; set; }
}
}
diff --git a/src/log4net/Util/PatternString.cs b/src/log4net/Util/PatternString.cs
index d844b63..b256a54 100644
--- a/src/log4net/Util/PatternString.cs
+++ b/src/log4net/Util/PatternString.cs
@@ -294,12 +294,8 @@
s_globalRulesRegistry.Add("appdomain", typeof(AppDomainPatternConverter));
s_globalRulesRegistry.Add("date", typeof(DatePatternConverter));
-#if !NETCF
s_globalRulesRegistry.Add("env", typeof(EnvironmentPatternConverter));
-#if !NETSTANDARD1_3 // EnvironmentFolderPathPatternConverter not yet supported
s_globalRulesRegistry.Add("envFolderPath", typeof(EnvironmentFolderPathPatternConverter));
-#endif
-#endif
s_globalRulesRegistry.Add("identity", typeof(IdentityPatternConverter));
s_globalRulesRegistry.Add("literal", typeof(LiteralPatternConverter));
s_globalRulesRegistry.Add("newline", typeof(NewLinePatternConverter));
@@ -311,13 +307,11 @@
s_globalRulesRegistry.Add("utcdate", typeof(UtcDatePatternConverter));
s_globalRulesRegistry.Add("utcDate", typeof(UtcDatePatternConverter));
s_globalRulesRegistry.Add("UtcDate", typeof(UtcDatePatternConverter));
-#if !NETCF && !NETSTANDARD1_3
// TODO - have added common variants of casing like utcdate above.
// Wouldn't it be better to use a case-insensitive Hashtable?
s_globalRulesRegistry.Add("appsetting", typeof(AppSettingPatternConverter));
s_globalRulesRegistry.Add("appSetting", typeof(AppSettingPatternConverter));
s_globalRulesRegistry.Add("AppSetting", typeof(AppSettingPatternConverter));
-#endif
}
#endregion Static Constructor
diff --git a/src/log4net/Util/PatternStringConverters/AppDomainPatternConverter.cs b/src/log4net/Util/PatternStringConverters/AppDomainPatternConverter.cs
index 4168df1..8b592e4 100644
--- a/src/log4net/Util/PatternStringConverters/AppDomainPatternConverter.cs
+++ b/src/log4net/Util/PatternStringConverters/AppDomainPatternConverter.cs
@@ -17,12 +17,8 @@
//
#endregion
-using System;
-using System.Text;
using System.IO;
-using log4net.Util;
-
namespace log4net.Util.PatternStringConverters
{
/// <summary>
@@ -46,9 +42,7 @@
/// Writes name of the current AppDomain to the output <paramref name="writer"/>.
/// </para>
/// </remarks>
- protected override void Convert(TextWriter writer, object state)
- {
- writer.Write(SystemInfo.ApplicationFriendlyName);
- }
+ public override void Convert(TextWriter writer, object state)
+ => writer.Write(SystemInfo.ApplicationFriendlyName);
}
-}
+}
\ No newline at end of file
diff --git a/src/log4net/Util/PatternStringConverters/AppSettingPatternConverter.cs b/src/log4net/Util/PatternStringConverters/AppSettingPatternConverter.cs
index b3487ff..8f9339e 100644
--- a/src/log4net/Util/PatternStringConverters/AppSettingPatternConverter.cs
+++ b/src/log4net/Util/PatternStringConverters/AppSettingPatternConverter.cs
@@ -17,9 +17,6 @@
//
#endregion
-// .NET Compact Framework 1.0 has no support for application .config files
-#if !NETCF && (NET_2_0 || NETSTANDARD2_0)
-
using System.IO;
using System.Collections;
using System.Configuration;
@@ -89,20 +86,14 @@
/// then all the properties are written as key value pairs.
/// </para>
/// </remarks>
- protected override void Convert(TextWriter writer, object state)
+ public override void Convert(TextWriter writer, object state)
{
-
- if (Option != null)
- {
+ if (Option is not null)
// Write the value for the specified key
WriteObject(writer, null, ConfigurationManager.AppSettings[Option]);
- }
else
- {
// Write all the key value pairs
WriteDictionary(writer, null, AppSettingsDictionary);
- }
}
}
-}
-#endif // !NETCF && NET_2_0
+}
\ No newline at end of file
diff --git a/src/log4net/Util/PatternStringConverters/DatePatternConverter.cs b/src/log4net/Util/PatternStringConverters/DatePatternConverter.cs
index 8f77b5f..a36385c 100644
--- a/src/log4net/Util/PatternStringConverters/DatePatternConverter.cs
+++ b/src/log4net/Util/PatternStringConverters/DatePatternConverter.cs
@@ -161,7 +161,7 @@
/// The date and time passed is in the local time zone.
/// </para>
/// </remarks>
- protected override void Convert(TextWriter writer, object state)
+ public override void Convert(TextWriter writer, object state)
{
try
{
@@ -186,4 +186,4 @@
#endregion Private Static Fields
}
-}
+}
\ No newline at end of file
diff --git a/src/log4net/Util/PatternStringConverters/EnvironmentFolderPathPatternConverter.cs b/src/log4net/Util/PatternStringConverters/EnvironmentFolderPathPatternConverter.cs
index a66cdce..b59452a 100644
--- a/src/log4net/Util/PatternStringConverters/EnvironmentFolderPathPatternConverter.cs
+++ b/src/log4net/Util/PatternStringConverters/EnvironmentFolderPathPatternConverter.cs
@@ -17,8 +17,6 @@
//
#endregion
-#if !NETCF && (NET_2_0 || NETSTANDARD2_0)
-
using System;
using System.IO;
@@ -29,7 +27,6 @@
/// </summary>
/// <remarks>
/// <para>
- /// Write an special path environment folder path to the output writer.
/// The value of the <see cref="log4net.Util.PatternConverter.Option"/> determines
/// the name of the variable to output. <see cref="log4net.Util.PatternConverter.Option"/>
/// should be a value in the <see cref="System.Environment.SpecialFolder" /> enumeration.
@@ -39,7 +36,7 @@
internal sealed class EnvironmentFolderPathPatternConverter : PatternConverter
{
/// <summary>
- /// Write an special path environment folder path to the output
+ /// Writes a special path environment folder path to the output
/// </summary>
/// <param name="writer">the writer to write to</param>
/// <param name="state">null, state is not set</param>
@@ -51,20 +48,18 @@
/// property.
/// </para>
/// </remarks>
- protected override void Convert(TextWriter writer, object state)
+ public override void Convert(TextWriter writer, object state)
{
try
{
- if (Option != null && Option.Length > 0)
+ if (Option?.Length > 0)
{
Environment.SpecialFolder specialFolder =
(Environment.SpecialFolder)Enum.Parse(typeof(Environment.SpecialFolder), Option, true);
string envFolderPathValue = Environment.GetFolderPath(specialFolder);
- if (envFolderPathValue != null && envFolderPathValue.Length > 0)
- {
+ if (envFolderPathValue?.Length > 0)
writer.Write(envFolderPathValue);
- }
}
}
catch (System.Security.SecurityException secEx)
@@ -93,6 +88,4 @@
#endregion Private Static Fields
}
-}
-
-#endif // !NETCF && NET_2_0
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/src/log4net/Util/PatternStringConverters/EnvironmentPatternConverter.cs b/src/log4net/Util/PatternStringConverters/EnvironmentPatternConverter.cs
index 7efb2a2..98d77f0 100644
--- a/src/log4net/Util/PatternStringConverters/EnvironmentPatternConverter.cs
+++ b/src/log4net/Util/PatternStringConverters/EnvironmentPatternConverter.cs
@@ -17,9 +17,6 @@
//
#endregion
-// .NET Compact Framework 1.0 has no support for Environment.GetEnvironmentVariable()
-#if !NETCF
-
using System;
using System.IO;
@@ -36,7 +33,7 @@
/// </para>
/// </remarks>
/// <author>Nicko Cadell</author>
- internal sealed class EnvironmentPatternConverter : PatternConverter
+ public sealed class EnvironmentPatternConverter : PatternConverter
{
/// <summary>
/// Write an environment variable to the output
@@ -51,30 +48,22 @@
/// property.
/// </para>
/// </remarks>
- protected override void Convert(TextWriter writer, object state)
+ public override void Convert(TextWriter writer, object state)
{
try
{
- if (this.Option != null && this.Option.Length > 0)
+ if (Option?.Length > 0)
{
// Lookup the environment variable
- string envValue = Environment.GetEnvironmentVariable(this.Option);
+ string envValue = Environment.GetEnvironmentVariable(Option);
-#if NET_2_0 || NETSTANDARD2_0
// If we didn't see it for the process, try a user level variable.
- if (envValue == null)
- {
- envValue = Environment.GetEnvironmentVariable(this.Option, EnvironmentVariableTarget.User);
- }
+ envValue ??= Environment.GetEnvironmentVariable(Option, EnvironmentVariableTarget.User);
// If we still didn't find it, try a system level one.
- if (envValue == null)
- {
- envValue = Environment.GetEnvironmentVariable(this.Option, EnvironmentVariableTarget.Machine);
- }
-#endif
+ envValue ??= Environment.GetEnvironmentVariable(Option, EnvironmentVariableTarget.Machine);
- if (envValue != null && envValue.Length > 0)
+ if (envValue?.Length > 0)
{
writer.Write(envValue);
}
@@ -93,8 +82,6 @@
}
}
- #region Private Static Fields
-
/// <summary>
/// The fully qualified type of the EnvironmentPatternConverter class.
/// </summary>
@@ -103,9 +90,5 @@
/// log message.
/// </remarks>
private static readonly Type declaringType = typeof(EnvironmentPatternConverter);
-
- #endregion Private Static Fields
}
}
-
-#endif // !NETCF
diff --git a/src/log4net/Util/PatternStringConverters/IdentityPatternConverter.cs b/src/log4net/Util/PatternStringConverters/IdentityPatternConverter.cs
index 8f6b926..de55409 100644
--- a/src/log4net/Util/PatternStringConverters/IdentityPatternConverter.cs
+++ b/src/log4net/Util/PatternStringConverters/IdentityPatternConverter.cs
@@ -18,11 +18,8 @@
#endregion
using System;
-using System.Text;
using System.IO;
-using log4net.Util;
-
namespace log4net.Util.PatternStringConverters
{
/// <summary>
@@ -46,12 +43,8 @@
/// Writes the current thread identity to the output <paramref name="writer"/>.
/// </para>
/// </remarks>
- protected override void Convert(TextWriter writer, object state)
+ public override void Convert(TextWriter writer, object state)
{
-#if (NETCF || SSCLI || NETSTANDARD1_3)
- // On compact framework there's no notion of current thread principals
- writer.Write( SystemInfo.NotAvailableText );
-#else
try
{
if (System.Threading.Thread.CurrentPrincipal != null &&
@@ -69,7 +62,6 @@
writer.Write(SystemInfo.NotAvailableText);
}
-#endif
}
#region Private Static Fields
@@ -85,4 +77,4 @@
#endregion Private Static Fields
}
-}
+}
\ No newline at end of file
diff --git a/src/log4net/Util/PatternStringConverters/LiteralPatternConverter.cs b/src/log4net/Util/PatternStringConverters/LiteralPatternConverter.cs
index c1adfb9..17ebc23 100644
--- a/src/log4net/Util/PatternStringConverters/LiteralPatternConverter.cs
+++ b/src/log4net/Util/PatternStringConverters/LiteralPatternConverter.cs
@@ -18,11 +18,8 @@
#endregion
using System;
-using System.Text;
using System.IO;
-using log4net.Util;
-
namespace log4net.Util.PatternStringConverters
{
/// <summary>
@@ -56,12 +53,10 @@
/// </remarks>
public override PatternConverter SetNext(PatternConverter pc)
{
- LiteralPatternConverter literalPc = pc as LiteralPatternConverter;
- if (literalPc != null)
+ if (pc is LiteralPatternConverter literalPc)
{
// Combine the two adjacent literals together
Option = Option + literalPc.Option;
-
// We are the next converter now
return this;
}
@@ -85,9 +80,7 @@
/// </para>
/// </remarks>
public override void Format(TextWriter writer, object state)
- {
- writer.Write(Option);
- }
+ => writer.Write(Option);
/// <summary>
/// Convert this pattern into the rendered message
@@ -99,9 +92,7 @@
/// This method is not used.
/// </para>
/// </remarks>
- protected override void Convert(TextWriter writer, object state)
- {
- throw new InvalidOperationException("Should never get here because of the overridden Format method");
- }
+ public override void Convert(TextWriter writer, object state)
+ => throw new InvalidOperationException("Should never get here because of the overridden Format method");
}
-}
+}
\ No newline at end of file
diff --git a/src/log4net/Util/PatternStringConverters/ProcessIdPatternConverter.cs b/src/log4net/Util/PatternStringConverters/ProcessIdPatternConverter.cs
index 55dbeeb..b602932 100644
--- a/src/log4net/Util/PatternStringConverters/ProcessIdPatternConverter.cs
+++ b/src/log4net/Util/PatternStringConverters/ProcessIdPatternConverter.cs
@@ -43,15 +43,9 @@
/// Write the current process ID to the output <paramref name="writer"/>.
/// </para>
/// </remarks>
-#if NET_4_0 || MONO_4_0 || NETSTANDARD
- [System.Security.SecuritySafeCritical]
-#endif
- protected override void Convert(TextWriter writer, object state)
+ [System.Security.SecuritySafeCritical]
+ public override void Convert(TextWriter writer, object state)
{
-#if (NETCF || SSCLI)
- // On compact framework there is no System.Diagnostics.Process class
- writer.Write( SystemInfo.NotAvailableText );
-#else
try
{
writer.Write(System.Diagnostics.Process.GetCurrentProcess().Id);
@@ -64,7 +58,6 @@
writer.Write(SystemInfo.NotAvailableText);
}
-#endif
}
#region Private Static Fields
@@ -80,4 +73,4 @@
#endregion Private Static Fields
}
-}
+}
\ No newline at end of file
diff --git a/src/log4net/Util/PatternStringConverters/PropertyPatternConverter.cs b/src/log4net/Util/PatternStringConverters/PropertyPatternConverter.cs
index 9955116..e736c32 100644
--- a/src/log4net/Util/PatternStringConverters/PropertyPatternConverter.cs
+++ b/src/log4net/Util/PatternStringConverters/PropertyPatternConverter.cs
@@ -57,27 +57,19 @@
/// then all the properties are written as key value pairs.
/// </para>
/// </remarks>
- protected override void Convert(TextWriter writer, object state)
+ public override void Convert(TextWriter writer, object state)
{
- CompositeProperties compositeProperties = new CompositeProperties();
+ CompositeProperties compositeProperties = new();
-#if !NETCF
- PropertiesDictionary logicalThreadProperties = LogicalThreadContext.Properties.GetProperties(false);
- if (logicalThreadProperties != null)
- {
+ if (LogicalThreadContext.Properties.GetProperties(false) is PropertiesDictionary logicalThreadProperties)
compositeProperties.Add(logicalThreadProperties);
- }
-#endif
- PropertiesDictionary threadProperties = ThreadContext.Properties.GetProperties(false);
- if (threadProperties != null)
- {
- compositeProperties.Add(threadProperties);
- }
- // TODO: Add Repository Properties
+ if (ThreadContext.Properties.GetProperties(false) is PropertiesDictionary threadProperties)
+ compositeProperties.Add(threadProperties);
+
compositeProperties.Add(GlobalContext.Properties.GetReadOnlyProperties());
- if (Option != null)
+ if (Option is not null)
{
// Write the value for the specified key
WriteObject(writer, null, compositeProperties[Option]);
@@ -89,4 +81,4 @@
}
}
}
-}
+}
\ No newline at end of file
diff --git a/src/log4net/Util/PatternStringConverters/RandomStringPatternConverter.cs b/src/log4net/Util/PatternStringConverters/RandomStringPatternConverter.cs
index 0502dfc..178dd63 100644
--- a/src/log4net/Util/PatternStringConverters/RandomStringPatternConverter.cs
+++ b/src/log4net/Util/PatternStringConverters/RandomStringPatternConverter.cs
@@ -18,11 +18,8 @@
#endregion
using System;
-using System.Text;
using System.IO;
-using log4net.Util;
-using log4net.DateFormatter;
using log4net.Core;
namespace log4net.Util.PatternStringConverters
@@ -37,15 +34,14 @@
/// to the string value of the length required.
/// </para>
/// <para>
- /// The random characters in the string are limited to uppercase letters
- /// and numbers only.
+ /// The random characters in the string are limited to uppercase letters and numbers only.
/// </para>
/// <para>
/// The random number generator used by this class is not cryptographically secure.
/// </para>
/// </remarks>
/// <author>Nicko Cadell</author>
- internal sealed class RandomStringPatternConverter : PatternConverter, IOptionHandler
+ public sealed class RandomStringPatternConverter : PatternConverter, IOptionHandler
{
/// <summary>
/// Shared random number generator
@@ -104,7 +100,7 @@
/// Write a randoim string to the output <paramref name="writer"/>.
/// </para>
/// </remarks>
- protected override void Convert(TextWriter writer, object state)
+ public override void Convert(TextWriter writer, object state)
{
try
{
diff --git a/src/log4net/Util/PatternStringConverters/UserNamePatternConverter.cs b/src/log4net/Util/PatternStringConverters/UserNamePatternConverter.cs
index a0f4789..79e5393 100644
--- a/src/log4net/Util/PatternStringConverters/UserNamePatternConverter.cs
+++ b/src/log4net/Util/PatternStringConverters/UserNamePatternConverter.cs
@@ -43,20 +43,12 @@
/// Write the current threads username to the output <paramref name="writer"/>.
/// </para>
/// </remarks>
- protected override void Convert(TextWriter writer, object state)
+ public override void Convert(TextWriter writer, object state)
{
-#if (NETCF || SSCLI || NETSTANDARD1_3)
- // On compact framework there's no notion of current Windows user
- writer.Write( SystemInfo.NotAvailableText );
-#else
try
{
- System.Security.Principal.WindowsIdentity windowsIdentity = null;
- windowsIdentity = System.Security.Principal.WindowsIdentity.GetCurrent();
- if (windowsIdentity != null && windowsIdentity.Name != null)
- {
- writer.Write(windowsIdentity.Name);
- }
+ if (System.Security.Principal.WindowsIdentity.GetCurrent()?.Name is string name)
+ writer.Write(name);
}
catch (System.Security.SecurityException)
{
@@ -66,7 +58,6 @@
writer.Write(SystemInfo.NotAvailableText);
}
-#endif
}
#region Private Static Fields
@@ -82,4 +73,4 @@
#endregion Private Static Fields
}
-}
+}
\ No newline at end of file
diff --git a/src/log4net/Util/PatternStringConverters/UtcDatePatternConverter.cs b/src/log4net/Util/PatternStringConverters/UtcDatePatternConverter.cs
index 3a04450..e512797 100644
--- a/src/log4net/Util/PatternStringConverters/UtcDatePatternConverter.cs
+++ b/src/log4net/Util/PatternStringConverters/UtcDatePatternConverter.cs
@@ -18,11 +18,8 @@
#endregion
using System;
-using System.Text;
using System.IO;
-using log4net.Core;
-using log4net.Util;
using log4net.DateFormatter;
namespace log4net.Util.PatternStringConverters
@@ -58,7 +55,7 @@
/// </para>
/// </remarks>
/// <seealso cref="DatePatternConverter"/>
- protected override void Convert(TextWriter writer, object state)
+ public override void Convert(TextWriter writer, object state)
{
try
{
diff --git a/src/log4net/Util/PropertiesDictionary.cs b/src/log4net/Util/PropertiesDictionary.cs
index 6a37b60..ced2c72 100644
--- a/src/log4net/Util/PropertiesDictionary.cs
+++ b/src/log4net/Util/PropertiesDictionary.cs
@@ -19,8 +19,11 @@
using System;
using System.Collections;
+using System.Collections.Generic;
using System.Runtime.Serialization;
+#nullable enable
+
namespace log4net.Util
{
/// <summary>
@@ -28,22 +31,16 @@
/// </summary>
/// <remarks>
/// <para>
- /// While this collection is serializable only member
+ /// While this collection is serializable, only member
/// objects that are serializable will
/// be serialized along with this collection.
/// </para>
/// </remarks>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
-#if NETCF
- public sealed class PropertiesDictionary : ReadOnlyPropertiesDictionary, IDictionary
-#else
[Serializable]
public sealed class PropertiesDictionary : ReadOnlyPropertiesDictionary, ISerializable, IDictionary
-#endif
{
- #region Public Instance Constructors
-
/// <summary>
/// Constructor
/// </summary>
@@ -69,11 +66,6 @@
{
}
- #endregion Public Instance Constructors
-
- #region Private Instance Constructors
-
-#if !NETCF
/// <summary>
/// Initializes a new instance of the <see cref="PropertiesDictionary" /> class
/// with serialized data.
@@ -88,11 +80,6 @@
private PropertiesDictionary(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
-#endif
-
- #endregion Protected Instance Constructors
-
- #region Public Instance Properties
/// <summary>
/// Gets or sets the value of the property with the specified key.
@@ -108,15 +95,19 @@
/// a serialization operation is performed.
/// </para>
/// </remarks>
- public override object this[string key]
+ public override object? this[string key]
{
- get { return InnerHashtable[key]; }
- set { InnerHashtable[key] = value; }
+ get => base[key];
+ set => InnerHashtable[key] = value;
}
- #endregion Public Instance Properties
-
- #region Public Instance Methods
+ /// <summary>
+ /// See <see cref="IDictionary{TKey,TValue}.Add(TKey,TValue)"/>.
+ /// </summary>
+ public override void Add(string key, object? value)
+ {
+ InnerHashtable.Add(key, value);
+ }
/// <summary>
/// Remove the entry with the specified key from this dictionary
@@ -127,15 +118,11 @@
/// Remove the entry with the specified key from this dictionary
/// </para>
/// </remarks>
- public void Remove(string key)
+ public override bool Remove(string key)
{
- InnerHashtable.Remove(key);
+ return InnerHashtable.Remove(key);
}
- #endregion Public Instance Methods
-
- #region Implementation of IDictionary
-
/// <summary>
/// See <see cref="IDictionary.GetEnumerator"/>
/// </summary>
@@ -161,22 +148,12 @@
/// </remarks>
void IDictionary.Remove(object key)
{
- InnerHashtable.Remove(key);
- }
+ if (key is not string k)
+ {
+ throw new ArgumentException("key must be a string");
+ }
- /// <summary>
- /// See <see cref="IDictionary.Contains"/>
- /// </summary>
- /// <param name="key">the key to lookup in the collection</param>
- /// <returns><c>true</c> if the collection contains the specified key</returns>
- /// <remarks>
- /// <para>
- /// Test if this collection contains a specified key.
- /// </para>
- /// </remarks>
- bool IDictionary.Contains(object key)
- {
- return InnerHashtable.Contains(key);
+ InnerHashtable.Remove(k);
}
/// <summary>
@@ -205,11 +182,11 @@
/// <exception cref="ArgumentException">Thrown if the <paramref name="key"/> is not a string</exception>
void IDictionary.Add(object key, object value)
{
- if (!(key is string))
+ if (key is not string k)
{
- throw new ArgumentException("key must be a string", "key");
+ throw new ArgumentException("key must be a string", nameof(key));
}
- InnerHashtable.Add(key, value);
+ InnerHashtable.Add(k, value);
}
/// <summary>
@@ -224,10 +201,7 @@
/// returns <c>false</c>.
/// </para>
/// </remarks>
- bool IDictionary.IsReadOnly
- {
- get { return false; }
- }
+ bool IDictionary.IsReadOnly => false;
/// <summary>
/// See <see cref="IDictionary.this"/>
@@ -241,93 +215,25 @@
/// </para>
/// </remarks>
/// <exception cref="ArgumentException">Thrown if the <paramref name="key"/> is not a string</exception>
- object IDictionary.this[object key]
+ object? IDictionary.this[object key]
{
get
{
- if (!(key is string))
+ if (key is not string k)
{
- throw new ArgumentException("key must be a string", "key");
+ throw new ArgumentException("key must be a string", nameof(key));
}
- return InnerHashtable[key];
+ InnerHashtable.TryGetValue(k, out object? val);
+ return val;
}
set
{
- if (!(key is string))
+ if (key is not string k)
{
- throw new ArgumentException("key must be a string", "key");
+ throw new ArgumentException("key must be a string", nameof(key));
}
- InnerHashtable[key] = value;
+ InnerHashtable[k] = value;
}
}
-
- /// <summary>
- /// See <see cref="IDictionary.Values"/>
- /// </summary>
- ICollection IDictionary.Values
- {
- get { return InnerHashtable.Values; }
- }
-
- /// <summary>
- /// See <see cref="IDictionary.Keys"/>
- /// </summary>
- ICollection IDictionary.Keys
- {
- get { return InnerHashtable.Keys; }
- }
-
- /// <summary>
- /// See <see cref="IDictionary.IsFixedSize"/>
- /// </summary>
- bool IDictionary.IsFixedSize
- {
- get { return false; }
- }
-
- #endregion
-
- #region Implementation of ICollection
-
- /// <summary>
- /// See <see cref="ICollection.CopyTo"/>
- /// </summary>
- /// <param name="array"></param>
- /// <param name="index"></param>
- void ICollection.CopyTo(Array array, int index)
- {
- InnerHashtable.CopyTo(array, index);
- }
-
- /// <summary>
- /// See <see cref="ICollection.IsSynchronized"/>
- /// </summary>
- bool ICollection.IsSynchronized
- {
- get { return InnerHashtable.IsSynchronized; }
- }
-
- /// <summary>
- /// See <see cref="ICollection.SyncRoot"/>
- /// </summary>
- object ICollection.SyncRoot
- {
- get { return InnerHashtable.SyncRoot; }
- }
-
- #endregion
-
- #region Implementation of IEnumerable
-
- /// <summary>
- /// See <see cref="IEnumerable.GetEnumerator"/>
- /// </summary>
- IEnumerator IEnumerable.GetEnumerator()
- {
- return ((IEnumerable)InnerHashtable).GetEnumerator();
- }
-
- #endregion
}
}
-
diff --git a/src/log4net/Util/PropertyEntry.cs b/src/log4net/Util/PropertyEntry.cs
index 379a285..bac35c8 100644
--- a/src/log4net/Util/PropertyEntry.cs
+++ b/src/log4net/Util/PropertyEntry.cs
@@ -24,49 +24,17 @@
/// <summary>
/// A class to hold the key and data for a property set in the config file
/// </summary>
- /// <remarks>
- /// <para>
- /// A class to hold the key and data for a property set in the config file
- /// </para>
- /// </remarks>
public class PropertyEntry
{
- private string m_key = null;
- private object m_value = null;
-
/// <summary>
/// Property Key
/// </summary>
- /// <value>
- /// Property Key
- /// </value>
- /// <remarks>
- /// <para>
- /// Property Key.
- /// </para>
- /// </remarks>
- public string Key
- {
- get { return m_key; }
- set { m_key = value; }
- }
+ public string? Key { get; set; }
/// <summary>
/// Property Value
/// </summary>
- /// <value>
- /// Property Value
- /// </value>
- /// <remarks>
- /// <para>
- /// Property Value.
- /// </para>
- /// </remarks>
- public object Value
- {
- get { return m_value; }
- set { m_value = value; }
- }
+ public object? Value { get; set; }
/// <summary>
/// Override <c>Object.ToString</c> to return sensible debug info
@@ -74,7 +42,7 @@
/// <returns>string info about this object</returns>
public override string ToString()
{
- return "PropertyEntry(Key=" + m_key + ", Value=" + m_value + ")";
+ return $"PropertyEntry(Key={Key}, Value={Value})";
}
}
}
diff --git a/src/log4net/Util/QuietTextWriter.cs b/src/log4net/Util/QuietTextWriter.cs
index 884ce4b..9e100a0 100644
--- a/src/log4net/Util/QuietTextWriter.cs
+++ b/src/log4net/Util/QuietTextWriter.cs
@@ -37,8 +37,6 @@
/// <author>Gert Driesen</author>
public class QuietTextWriter : TextWriterAdapter
{
- #region Public Instance Constructors
-
/// <summary>
/// Constructor
/// </summary>
@@ -51,17 +49,13 @@
/// </remarks>
public QuietTextWriter(TextWriter writer, IErrorHandler errorHandler) : base(writer)
{
- if (errorHandler == null)
+ if (errorHandler is null)
{
- throw new ArgumentNullException("errorHandler");
+ throw new ArgumentNullException(nameof(errorHandler));
}
- ErrorHandler = errorHandler;
+ m_errorHandler = errorHandler;
}
- #endregion Public Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
/// Gets or sets the error handler that all errors are passed to.
/// </summary>
@@ -75,13 +69,13 @@
/// </remarks>
public IErrorHandler ErrorHandler
{
- get { return m_errorHandler; }
+ get => m_errorHandler;
set
{
- if (value == null)
+ if (value is null)
{
// This is a programming error on the part of the enclosing appender.
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
}
m_errorHandler = value;
}
@@ -98,14 +92,7 @@
/// Gets a value indicating whether this writer is closed.
/// </para>
/// </remarks>
- public bool Closed
- {
- get { return m_closed; }
- }
-
- #endregion Public Instance Properties
-
- #region Override Implementation of TextWriter
+ public bool Closed { get; private set; }
/// <summary>
/// Writes a character to the underlying writer
@@ -124,7 +111,7 @@
}
catch (Exception e)
{
- m_errorHandler.Error("Failed to write [" + value + "].", e, ErrorCode.WriteFailure);
+ m_errorHandler.Error($"Failed to write [{value}].", e, ErrorCode.WriteFailure);
}
}
@@ -155,11 +142,6 @@
/// Writes a string to the output.
/// </summary>
/// <param name="value">The string data to write to the output.</param>
- /// <remarks>
- /// <para>
- /// Writes a string to the output.
- /// </para>
- /// </remarks>
public override void Write(string value)
{
try
@@ -168,7 +150,7 @@
}
catch (Exception e)
{
- m_errorHandler.Error("Failed to write [" + value + "].", e, ErrorCode.WriteFailure);
+ m_errorHandler.Error($"Failed to write [{value}].", e, ErrorCode.WriteFailure);
}
}
@@ -182,24 +164,13 @@
/// </remarks>
public override void Close()
{
- m_closed = true;
+ Closed = true;
base.Close();
}
- #endregion Public Instance Methods
-
- #region Private Instance Fields
-
/// <summary>
/// The error handler instance to pass all errors to
/// </summary>
private IErrorHandler m_errorHandler;
-
- /// <summary>
- /// Flag to indicate if this writer is closed
- /// </summary>
- private bool m_closed = false;
-
- #endregion Private Instance Fields
}
}
diff --git a/src/log4net/Util/ReadOnlyPropertiesDictionary.cs b/src/log4net/Util/ReadOnlyPropertiesDictionary.cs
index c59be90..1da7256 100644
--- a/src/log4net/Util/ReadOnlyPropertiesDictionary.cs
+++ b/src/log4net/Util/ReadOnlyPropertiesDictionary.cs
@@ -19,12 +19,12 @@
using System;
using System.Collections;
-#if NETSTANDARD1_3
-using System.Reflection;
-#endif
+using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Xml;
+#nullable enable
+
namespace log4net.Util
{
/// <summary>
@@ -32,33 +32,20 @@
/// </summary>
/// <remarks>
/// <para>
- /// This collection is readonly and cannot be modified.
+ /// This collection is readonly and cannot be modified. It is not thread-safe.
/// </para>
/// <para>
- /// While this collection is serializable only member
+ /// While this collection is serializable, only member
/// objects that are serializable will
/// be serialized along with this collection.
/// </para>
/// </remarks>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
-#if NETCF
- public class ReadOnlyPropertiesDictionary : IDictionary
-#else
[Serializable]
- public class ReadOnlyPropertiesDictionary : ISerializable, IDictionary
-#endif
+ public class ReadOnlyPropertiesDictionary : ISerializable, IDictionary, IDictionary<string, object?>
{
- #region Private Instance Fields
-
- /// <summary>
- /// The Hashtable used to store the properties data
- /// </summary>
- private readonly Hashtable m_hashtable = new Hashtable();
-
- #endregion Private Instance Fields
-
- #region Public Instance Constructors
+ private const string ReadOnlyMessage = "This is a read-only dictionary and cannot be modified";
/// <summary>
/// Constructor
@@ -83,17 +70,12 @@
/// </remarks>
public ReadOnlyPropertiesDictionary(ReadOnlyPropertiesDictionary propertiesDictionary)
{
- foreach (DictionaryEntry entry in propertiesDictionary)
+ foreach (KeyValuePair<string, object?> entry in propertiesDictionary)
{
- InnerHashtable.Add(entry.Key, entry.Value);
+ InnerHashtable[entry.Key] = entry.Value;
}
}
- #endregion Public Instance Constructors
-
- #region Private Instance Constructors
-
-#if !NETCF
/// <summary>
/// Deserialization constructor
/// </summary>
@@ -110,14 +92,9 @@
foreach (var entry in info)
{
// The keys are stored as Xml encoded names
- InnerHashtable[XmlConvert.DecodeName(entry.Name)] = entry.Value;
+ InnerHashtable[XmlConvert.DecodeName(entry.Name) ?? string.Empty] = entry.Value;
}
}
-#endif
-
- #endregion Protected Instance Constructors
-
- #region Public Instance Properties
/// <summary>
/// Gets the key names.
@@ -136,10 +113,40 @@
}
/// <summary>
- /// Gets or sets the value of the property with the specified key.
+ /// See <see cref="IDictionary{TKey,TValue}.ContainsKey(TKey)"/>.
+ /// </summary>
+ public bool ContainsKey(string key) => InnerHashtable.ContainsKey(key);
+
+ /// <summary>
+ /// See <see cref="IDictionary{TKey,TValue}.Add(TKey,TValue)"/>.
+ /// </summary>
+ public virtual void Add(string key, object? value)
+ {
+ throw new NotSupportedException(ReadOnlyMessage);
+ }
+
+ /// <summary>
+ /// See <see cref="IDictionary{TKey,TValue}.Remove(TKey)"/>.
+ /// </summary>
+ public virtual bool Remove(string key)
+ {
+ throw new NotSupportedException(ReadOnlyMessage);
+ }
+
+ /// <summary>
+ /// See <see cref="IDictionary{TKey,TValue}.TryGetValue(TKey,out TValue)"/>.
+ /// </summary>
+ public bool TryGetValue(string key, out object? value)
+ {
+ return InnerHashtable.TryGetValue(key, out value);
+ }
+
+ /// <summary>
+ /// Gets or sets the value of the property with the specified key.
/// </summary>
/// <value>
- /// The value of the property with the specified key.
+ /// The value of the property with the specified key, or null if a property is not present in the dictionary.
+ /// Note this is the <see cref="IDictionary"/> semantic, not that of <see cref="IDictionary{TKey,TValue}"/>.
/// </value>
/// <param name="key">The key of the property to get or set.</param>
/// <remarks>
@@ -149,16 +156,16 @@
/// a serialization operation is performed.
/// </para>
/// </remarks>
- public virtual object this[string key]
+ public virtual object? this[string key]
{
- get { return InnerHashtable[key]; }
- set { throw new NotSupportedException("This is a Read Only Dictionary and can not be modified"); }
+ get
+ {
+ InnerHashtable.TryGetValue(key, out object? val);
+ return val;
+ }
+ set => throw new NotSupportedException(ReadOnlyMessage);
}
- #endregion Public Instance Properties
-
- #region Public Instance Methods
-
/// <summary>
/// Test if the dictionary contains a specified key
/// </summary>
@@ -171,11 +178,9 @@
/// </remarks>
public bool Contains(string key)
{
- return InnerHashtable.Contains(key);
+ return InnerHashtable.ContainsKey(key);
}
- #endregion
-
/// <summary>
/// The hashtable used to store the properties
/// </summary>
@@ -187,14 +192,8 @@
/// The hashtable used to store the properties
/// </para>
/// </remarks>
- protected Hashtable InnerHashtable
- {
- get { return m_hashtable; }
- }
+ protected Dictionary<string, object?> InnerHashtable { get; } = new(StringComparer.Ordinal);
- #region Implementation of ISerializable
-
-#if !NETCF
/// <summary>
/// Serializes this object into the <see cref="SerializationInfo" /> provided.
/// </summary>
@@ -205,51 +204,30 @@
/// Serializes this object into the <see cref="SerializationInfo" /> provided.
/// </para>
/// </remarks>
-#if NET_4_0 || MONO_4_0 || NETSTANDARD
- [System.Security.SecurityCritical]
-#endif
-#if !NETCF && !NETSTANDARD1_3
+ [System.Security.SecurityCritical]
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter = true)]
-#endif
public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
{
- foreach (DictionaryEntry entry in InnerHashtable.Clone() as IDictionary)
+ foreach (KeyValuePair<string, object?> entry in InnerHashtable)
{
- var entryKey = entry.Key as string;
- if (entryKey is null)
- {
- continue;
- }
-
- var entryValue = entry.Value;
-
// If value is serializable then we add it to the list
-#if NETSTANDARD1_3
- var isSerializable = entryValue?.GetType().GetTypeInfo().IsSerializable ?? false;
-#else
- var isSerializable = entryValue?.GetType().IsSerializable ?? false;
-#endif
+ var isSerializable = entry.Value?.GetType().IsSerializable ?? false;
if (!isSerializable)
{
continue;
}
- // Store the keys as an Xml encoded local name as it may contain colons (':')
+ // Store the keys as an XML encoded local name as it may contain colons (':')
// which are NOT escaped by the Xml Serialization framework.
// This must be a bug in the serialization framework as we cannot be expected
// to know the implementation details of all the possible transport layers.
- var localKeyName = XmlConvert.EncodeLocalName(entryKey);
+ var localKeyName = XmlConvert.EncodeLocalName(entry.Key);
if (localKeyName is not null)
{
- info.AddValue(localKeyName, entryValue);
+ info.AddValue(localKeyName, entry.Value);
}
}
}
-#endif
-
- #endregion Implementation of ISerializable
-
- #region Implementation of IDictionary
/// <summary>
/// See <see cref="IDictionary.GetEnumerator"/>
@@ -260,131 +238,161 @@
}
/// <summary>
+ /// See <see cref="IEnumerable{T}.GetEnumerator"/>
+ /// </summary>
+ IEnumerator<KeyValuePair<string, object?>> IEnumerable<KeyValuePair<string, object?>>.GetEnumerator()
+ {
+ return InnerHashtable.GetEnumerator();
+ }
+
+ /// <summary>
/// See <see cref="IDictionary.Remove"/>
/// </summary>
/// <param name="key"></param>
void IDictionary.Remove(object key)
{
- throw new NotSupportedException("This is a Read Only Dictionary and can not be modified");
+ throw new NotSupportedException(ReadOnlyMessage);
}
/// <summary>
/// See <see cref="IDictionary.Contains"/>
/// </summary>
- /// <param name="key"></param>
- /// <returns></returns>
bool IDictionary.Contains(object key)
{
- return InnerHashtable.Contains(key);
+ if (key is not string k)
+ {
+ throw new ArgumentException("key must be a string");
+ }
+ return InnerHashtable.ContainsKey(k);
}
/// <summary>
- /// Remove all properties from the properties collection
+ /// See <see cref="ICollection{T}.Add(T)"/>.
+ /// </summary>
+ public void Add(KeyValuePair<string, object?> item)
+ {
+ InnerHashtable.Add(item.Key, item.Value);
+ }
+
+ /// <summary>
+ /// Removes all properties from the properties collection
/// </summary>
public virtual void Clear()
{
- throw new NotSupportedException("This is a Read Only Dictionary and can not be modified");
+ throw new NotSupportedException(ReadOnlyMessage);
}
/// <summary>
- /// See <see cref="IDictionary.Add"/>
+ /// See <see cref="ICollection{T}.Contains(T)"/>.
/// </summary>
- /// <param name="key"></param>
- /// <param name="value"></param>
+ public bool Contains(KeyValuePair<string, object?> item)
+ {
+ return InnerHashtable.TryGetValue(item.Key, out object? v) && item.Value == v;
+ }
+
+ /// <summary>
+ /// See <see cref="ICollection{T}.CopyTo(T[],int)"/>.
+ /// </summary>
+ public void CopyTo(KeyValuePair<string, object?>[] array, int arrayIndex)
+ {
+ int i = arrayIndex;
+ foreach (var kvp in InnerHashtable)
+ {
+ array[i] = kvp;
+ i++;
+ }
+ }
+
+ /// <summary>
+ /// See <see cref="ICollection{T}.Remove(T)"/>.
+ /// </summary>
+ public bool Remove(KeyValuePair<string, object?> item)
+ {
+ return InnerHashtable.Remove(item.Key);
+ }
+
+ /// <summary>
+ /// See <see cref="IDictionary.Add"/>.
+ /// </summary>
void IDictionary.Add(object key, object value)
{
- throw new NotSupportedException("This is a Read Only Dictionary and can not be modified");
+ throw new NotSupportedException(ReadOnlyMessage);
}
/// <summary>
- /// See <see cref="IDictionary.IsReadOnly"/>
+ /// See <see cref="IDictionary.IsReadOnly"/>.
/// </summary>
- bool IDictionary.IsReadOnly
- {
- get { return true; }
- }
+ bool IDictionary.IsReadOnly => true;
/// <summary>
/// See <see cref="IDictionary.this[object]"/>
/// </summary>
- object IDictionary.this[object key]
+ object? IDictionary.this[object key]
{
get
{
- if (!(key is string)) throw new ArgumentException("key must be a string");
- return InnerHashtable[key];
+ if (key is not string k)
+ {
+ throw new ArgumentException("key must be a string", nameof(key));
+ }
+ InnerHashtable.TryGetValue(k, out object? val);
+ return val;
}
- set
- {
- throw new NotSupportedException("This is a Read Only Dictionary and can not be modified");
- }
+ set => throw new NotSupportedException(ReadOnlyMessage);
}
/// <summary>
+ /// See <see cref="IDictionary{TKey,TValue}.Keys"/>.
+ /// </summary>
+ public ICollection<string> Keys => InnerHashtable.Keys;
+
+ /// <summary>
+ /// See <see cref="IDictionary{TKey,TValue}.Values"/>.
+ /// </summary>
+ public ICollection<object?> Values => InnerHashtable.Values;
+
+ /// <summary>
/// See <see cref="IDictionary.Values"/>
/// </summary>
- ICollection IDictionary.Values
- {
- get { return InnerHashtable.Values; }
- }
+ ICollection IDictionary.Values => InnerHashtable.Values;
/// <summary>
/// See <see cref="IDictionary.Keys"/>
/// </summary>
- ICollection IDictionary.Keys
- {
- get { return InnerHashtable.Keys; }
- }
+ ICollection IDictionary.Keys => InnerHashtable.Keys;
/// <summary>
/// See <see cref="IDictionary.IsFixedSize"/>
/// </summary>
- bool IDictionary.IsFixedSize
- {
- get { return InnerHashtable.IsFixedSize; }
- }
-
- #endregion
-
- #region Implementation of ICollection
+ bool IDictionary.IsFixedSize => false;
/// <summary>
/// See <see cref="ICollection.CopyTo"/>
/// </summary>
- /// <param name="array"></param>
- /// <param name="index"></param>
void ICollection.CopyTo(Array array, int index)
{
- InnerHashtable.CopyTo(array, index);
+ ((ICollection)InnerHashtable).CopyTo(array, index);
}
/// <summary>
/// See <see cref="ICollection.IsSynchronized"/>
/// </summary>
- bool ICollection.IsSynchronized
- {
- get { return InnerHashtable.IsSynchronized; }
- }
+ bool ICollection.IsSynchronized => false;
/// <summary>
/// The number of properties in this collection
/// </summary>
- public int Count
- {
- get { return InnerHashtable.Count; }
- }
+ public int Count => InnerHashtable.Count;
+
+ /// <summary>
+ /// See <see cref="IDictionary.IsReadOnly"/>.
+ /// </summary>
+ public bool IsReadOnly => true;
/// <summary>
/// See <see cref="ICollection.SyncRoot"/>
/// </summary>
- object ICollection.SyncRoot
- {
- get { return InnerHashtable.SyncRoot; }
- }
-
- #endregion
-
- #region Implementation of IEnumerable
+ object ICollection.SyncRoot => InnerHashtable;
/// <summary>
/// See <see cref="IEnumerable.GetEnumerator"/>
@@ -393,8 +401,5 @@
{
return ((IEnumerable)InnerHashtable).GetEnumerator();
}
-
- #endregion
}
}
-
diff --git a/src/log4net/Util/ReaderWriterLock.cs b/src/log4net/Util/ReaderWriterLock.cs
index abac458..47ba22e 100644
--- a/src/log4net/Util/ReaderWriterLock.cs
+++ b/src/log4net/Util/ReaderWriterLock.cs
@@ -17,13 +17,6 @@
//
#endregion
-#if (!NETCF) && !NETSTANDARD1_3
-#define HAS_READERWRITERLOCK
-#endif
-#if NET_4_0 || MONO_4_0
-#define HAS_READERWRITERLOCKSLIM
-#endif
-
using System;
namespace log4net.Util
@@ -61,14 +54,7 @@
/// </remarks>
public ReaderWriterLock()
{
-
-#if HAS_READERWRITERLOCK
-#if HAS_READERWRITERLOCKSLIM
m_lock = new System.Threading.ReaderWriterLockSlim(System.Threading.LockRecursionPolicy.SupportsRecursion);
-#else
- m_lock = new System.Threading.ReaderWriterLock();
-#endif
-#endif
}
#endregion Private Instance Constructors
@@ -86,20 +72,12 @@
/// </remarks>
public void AcquireReaderLock()
{
-#if HAS_READERWRITERLOCK
-#if HAS_READERWRITERLOCKSLIM
- // prevent ThreadAbort while updating state, see https://issues.apache.org/jira/browse/LOG4NET-443
- try { }
- finally
- {
- m_lock.EnterReadLock();
- }
-#else
- m_lock.AcquireReaderLock(-1);
-#endif
-#else
- System.Threading.Monitor.Enter(this);
-#endif
+ // prevent ThreadAbort while updating state, see https://issues.apache.org/jira/browse/LOG4NET-443
+ try { }
+ finally
+ {
+ m_lock.EnterReadLock();
+ }
}
/// <summary>
@@ -113,16 +91,7 @@
/// </remarks>
public void ReleaseReaderLock()
{
-#if HAS_READERWRITERLOCK
-#if HAS_READERWRITERLOCKSLIM
m_lock.ExitReadLock();
-#else
- m_lock.ReleaseReaderLock();
-
-#endif
-#else
- System.Threading.Monitor.Exit(this);
-#endif
}
/// <summary>
@@ -135,20 +104,12 @@
/// </remarks>
public void AcquireWriterLock()
{
-#if HAS_READERWRITERLOCK
-#if HAS_READERWRITERLOCKSLIM
- // prevent ThreadAbort while updating state, see https://issues.apache.org/jira/browse/LOG4NET-443
- try { }
- finally
- {
- m_lock.EnterWriteLock();
- }
-#else
- m_lock.AcquireWriterLock(-1);
-#endif
-#else
- System.Threading.Monitor.Enter(this);
-#endif
+ // prevent ThreadAbort while updating state, see https://issues.apache.org/jira/browse/LOG4NET-443
+ try { }
+ finally
+ {
+ m_lock.EnterWriteLock();
+ }
}
/// <summary>
@@ -162,29 +123,14 @@
/// </remarks>
public void ReleaseWriterLock()
{
-#if HAS_READERWRITERLOCK
-#if HAS_READERWRITERLOCKSLIM
m_lock.ExitWriteLock();
-#else
- m_lock.ReleaseWriterLock();
-#endif
-#else
- System.Threading.Monitor.Exit(this);
-#endif
}
#endregion Public Methods
#region Private Members
-#if HAS_READERWRITERLOCK
-#if HAS_READERWRITERLOCKSLIM
private System.Threading.ReaderWriterLockSlim m_lock;
-#else
- private System.Threading.ReaderWriterLock m_lock;
-#endif
-
-#endif
#endregion
}
diff --git a/src/log4net/Util/SystemInfo.cs b/src/log4net/Util/SystemInfo.cs
index 5cf7980..2a021b4 100644
--- a/src/log4net/Util/SystemInfo.cs
+++ b/src/log4net/Util/SystemInfo.cs
@@ -18,55 +18,26 @@
#endregion
using System;
-#if NETSTANDARD1_3
-using System.Globalization;
-#else
using System.Configuration;
-#endif
using System.Reflection;
using System.IO;
using System.Collections;
+#nullable enable
+
namespace log4net.Util
{
/// <summary>
/// Utility class for system specific information.
/// </summary>
- /// <remarks>
- /// <para>
- /// Utility class of static methods for system specific information.
- /// </para>
- /// </remarks>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
/// <author>Alexey Solofnenko</author>
- public sealed class SystemInfo
+ public static class SystemInfo
{
- #region Private Constants
-
private const string DEFAULT_NULL_TEXT = "(null)";
private const string DEFAULT_NOT_AVAILABLE_TEXT = "NOT AVAILABLE";
- #endregion
-
- #region Private Instance Constructors
-
- /// <summary>
- /// Private constructor to prevent instances.
- /// </summary>
- /// <remarks>
- /// <para>
- /// Only static methods are exposed from this type.
- /// </para>
- /// </remarks>
- private SystemInfo()
- {
- }
-
- #endregion Private Instance Constructors
-
- #region Public Static Constructor
-
/// <summary>
/// Initialize default values for private static fields.
/// </summary>
@@ -80,91 +51,45 @@
string nullText = DEFAULT_NULL_TEXT;
string notAvailableText = DEFAULT_NOT_AVAILABLE_TEXT;
-#if !NETCF
// Look for log4net.NullText in AppSettings
- string nullTextAppSettingsKey = SystemInfo.GetAppSetting("log4net.NullText");
- if (nullTextAppSettingsKey != null && nullTextAppSettingsKey.Length > 0)
+ string? nullTextAppSettingsKey = GetAppSetting("log4net.NullText");
+ if (nullTextAppSettingsKey is not null && nullTextAppSettingsKey.Length > 0)
{
- LogLog.Debug(declaringType, "Initializing NullText value to [" + nullTextAppSettingsKey + "].");
+ LogLog.Debug(declaringType, $"Initializing NullText value to [{nullTextAppSettingsKey}].");
nullText = nullTextAppSettingsKey;
}
// Look for log4net.NotAvailableText in AppSettings
- string notAvailableTextAppSettingsKey = SystemInfo.GetAppSetting("log4net.NotAvailableText");
- if (notAvailableTextAppSettingsKey != null && notAvailableTextAppSettingsKey.Length > 0)
+ string? notAvailableTextAppSettingsKey = GetAppSetting("log4net.NotAvailableText");
+ if (notAvailableTextAppSettingsKey is not null && notAvailableTextAppSettingsKey.Length > 0)
{
- LogLog.Debug(declaringType, "Initializing NotAvailableText value to [" + notAvailableTextAppSettingsKey + "].");
+ LogLog.Debug(declaringType, $"Initializing NotAvailableText value to [{notAvailableTextAppSettingsKey}].");
notAvailableText = notAvailableTextAppSettingsKey;
}
-#endif
- s_notAvailableText = notAvailableText;
- s_nullText = nullText;
+ NotAvailableText = notAvailableText;
+ NullText = nullText;
}
- #endregion
-
- #region Public Static Properties
-
/// <summary>
/// Gets the system dependent line terminator.
/// </summary>
- /// <value>
- /// The system dependent line terminator.
- /// </value>
- /// <remarks>
- /// <para>
- /// Gets the system dependent line terminator.
- /// </para>
- /// </remarks>
- public static string NewLine
- {
- get
- {
-#if NETCF
- return "\r\n";
-#else
- return System.Environment.NewLine;
-#endif
- }
- }
+ public static string NewLine => Environment.NewLine;
/// <summary>
/// Gets the base directory for this <see cref="AppDomain"/>.
/// </summary>
- /// <value>The base directory path for the current <see cref="AppDomain"/>.</value>
/// <remarks>
/// <para>
- /// Gets the base directory for this <see cref="AppDomain"/>.
- /// </para>
- /// <para>
/// The value returned may be either a local file path or a URI.
/// </para>
/// </remarks>
- public static string ApplicationBaseDirectory
- {
- get
- {
-#if NETCF
-- return System.IO.Path.GetDirectoryName(SystemInfo.EntryAssemblyLocation) + System.IO.Path.DirectorySeparatorChar;
-#elif NETSTANDARD1_3
- return Directory.GetCurrentDirectory();
-#else
- return AppDomain.CurrentDomain.BaseDirectory;
-#endif
- }
- }
+ public static string ApplicationBaseDirectory => AppDomain.CurrentDomain.BaseDirectory;
/// <summary>
/// Gets the path to the configuration file for the current <see cref="AppDomain"/>.
/// </summary>
- /// <value>The path to the configuration file for the current <see cref="AppDomain"/>.</value>
/// <remarks>
/// <para>
- /// The .NET Compact Framework 1.0 does not have a concept of a configuration
- /// file. For this runtime, we use the entry assembly location as the root for
- /// the configuration file name.
- /// </para>
- /// <para>
/// The value returned may be either a local file path or a URI.
/// </para>
/// </remarks>
@@ -172,39 +97,29 @@
{
get
{
-#if NETCF || NETSTANDARD
- return SystemInfo.EntryAssemblyLocation+".config";
+#if NETSTANDARD2_0_OR_GREATER
+ return EntryAssemblyLocation + ".config";
#else
- return System.AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
+ return AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
#endif
}
}
- private static string entryAssemblyLocation;
+ private static string? entryAssemblyLocation;
/// <summary>
/// Gets the path to the file that first executed in the current <see cref="AppDomain"/>.
/// </summary>
- /// <value>The path to the entry assembly.</value>
- /// <remarks>
- /// <para>
- /// Gets the path to the file that first executed in the current <see cref="AppDomain"/>.
- /// </para>
- /// </remarks>
public static string EntryAssemblyLocation
{
get
{
- if (entryAssemblyLocation != null)
+ if (entryAssemblyLocation is not null)
+ {
return entryAssemblyLocation;
-#if NETCF
- return entryAssemblyLocation = SystemInfo.NativeEntryAssemblyLocation;
-#elif NETSTANDARD1_3 // TODO GetEntryAssembly is available for netstandard1.5
- return entryAssemblyLocation = AppContext.BaseDirectory;
-#else
+ }
return entryAssemblyLocation = Assembly.GetEntryAssembly()?.Location
?? throw new InvalidOperationException($"Unable to determine EntryAssembly location: EntryAssembly is null. Try explicitly setting {nameof(SystemInfo)}.{nameof(EntryAssemblyLocation)}");
-#endif
}
set => entryAssemblyLocation = value;
}
@@ -212,52 +127,15 @@
/// <summary>
/// Gets the ID of the current thread.
/// </summary>
- /// <value>The ID of the current thread.</value>
- /// <remarks>
- /// <para>
- /// On the .NET framework, the <c>AppDomain.GetCurrentThreadId</c> method
- /// is used to obtain the thread ID for the current thread. This is the
- /// operating system ID for the thread.
- /// </para>
- /// <para>
- /// On the .NET Compact Framework 1.0 it is not possible to get the
- /// operating system thread ID for the current thread. The native method
- /// <c>GetCurrentThreadId</c> is implemented inline in a header file
- /// and cannot be called.
- /// </para>
- /// <para>
- /// On the .NET Framework 2.0 the <c>Thread.ManagedThreadId</c> is used as this
- /// gives a stable id unrelated to the operating system thread ID which may
- /// change if the runtime is using fibers.
- /// </para>
- /// </remarks>
- public static int CurrentThreadId
- {
- get
- {
-#if NETCF_1_0
- return System.Threading.Thread.CurrentThread.GetHashCode();
-#elif NET_2_0 || NETCF_2_0 || MONO_2_0 || MONO_3_5 || MONO_4_0 || NETSTANDARD
- return System.Threading.Thread.CurrentThread.ManagedThreadId;
-#else
- return AppDomain.GetCurrentThreadId();
-#endif
- }
- }
+ public static int CurrentThreadId => System.Threading.Thread.CurrentThread.ManagedThreadId;
/// <summary>
- /// Get the host name or machine name for the current machine
+ /// Gets the host name or machine name for the current machine.
/// </summary>
- /// <value>
- /// The hostname or machine name
- /// </value>
/// <remarks>
/// <para>
- /// Get the host name or machine name for the current machine
- /// </para>
- /// <para>
/// The host name (<see cref="System.Net.Dns.GetHostName"/>) or
- /// the machine name (<c>Environment.MachineName</c>) for
+ /// the machine name (<see cref="Environment.MachineName"/>) for
/// the current machine, or if neither of these are available
/// then <c>NOT AVAILABLE</c> is returned.
/// </para>
@@ -266,9 +144,8 @@
{
get
{
- if (s_hostName == null)
+ if (s_hostName is null)
{
-
// Get the DNS host name of the current machine
try
{
@@ -291,15 +168,11 @@
}
// Get the NETBIOS machine name of the current machine
- if (s_hostName == null || s_hostName.Length == 0)
+ if (string.IsNullOrEmpty(s_hostName))
{
try
{
-#if NETSTANDARD1_3
- s_hostName = Environment.GetEnvironmentVariable("COMPUTERNAME");
-#elif (!SSCLI && !NETCF)
s_hostName = Environment.MachineName;
-#endif
}
catch (InvalidOperationException)
{
@@ -312,22 +185,19 @@
}
// Couldn't find a value
- if (s_hostName == null || s_hostName.Length == 0)
+ if (string.IsNullOrEmpty(s_hostName))
{
- s_hostName = s_notAvailableText;
+ s_hostName = NotAvailableText;
LogLog.Debug(declaringType, "Could not determine the hostname. Error Ignored. Empty host name will be used");
}
}
- return s_hostName;
+ return s_hostName!;
}
}
/// <summary>
- /// Get this application's friendly name
+ /// Gets this application's friendly name.
/// </summary>
- /// <value>
- /// The friendly name of this application as a string
- /// </value>
/// <remarks>
/// <para>
/// If available the name of the application is retrieved from
@@ -341,13 +211,11 @@
{
get
{
- if (s_appFriendlyName == null)
+ if (s_appFriendlyName is null)
{
try
{
-#if !NETCF && !NETSTANDARD1_3
s_appFriendlyName = AppDomain.CurrentDomain.FriendlyName;
-#endif
}
catch (System.Security.SecurityException)
{
@@ -356,12 +224,12 @@
LogLog.Debug(declaringType, "Security exception while trying to get current domain friendly name. Error Ignored.");
}
- if (s_appFriendlyName == null || s_appFriendlyName.Length == 0)
+ if (string.IsNullOrEmpty(s_appFriendlyName))
{
try
{
- string assemblyLocation = SystemInfo.EntryAssemblyLocation;
- s_appFriendlyName = System.IO.Path.GetFileName(assemblyLocation);
+ string assemblyLocation = EntryAssemblyLocation;
+ s_appFriendlyName = Path.GetFileName(assemblyLocation);
}
catch (System.Security.SecurityException)
{
@@ -369,12 +237,12 @@
}
}
- if (s_appFriendlyName == null || s_appFriendlyName.Length == 0)
+ if (string.IsNullOrEmpty(s_appFriendlyName))
{
- s_appFriendlyName = s_notAvailableText;
+ s_appFriendlyName = NotAvailableText;
}
}
- return s_appFriendlyName;
+ return s_appFriendlyName!;
}
}
@@ -399,10 +267,7 @@
/// </para>
/// </remarks>
[Obsolete("Use ProcessStartTimeUtc and convert to local time if needed.")]
- public static DateTime ProcessStartTime
- {
- get { return s_processStartTimeUtc.ToLocalTime(); }
- }
+ public static DateTime ProcessStartTime => s_processStartTimeUtc.ToLocalTime();
/// <summary>
/// Get the UTC start time for the current process.
@@ -424,10 +289,7 @@
/// will be set per AppDomain.
/// </para>
/// </remarks>
- public static DateTime ProcessStartTimeUtc
- {
- get { return s_processStartTimeUtc; }
- }
+ public static DateTime ProcessStartTimeUtc => s_processStartTimeUtc;
/// <summary>
/// Text to output when a <c>null</c> is encountered.
@@ -443,11 +305,7 @@
/// .config file.
/// </para>
/// </remarks>
- public static string NullText
- {
- get { return s_nullText; }
- set { s_nullText = value; }
- }
+ public static string NullText { get; set; }
/// <summary>
/// Text to output when an unsupported feature is requested.
@@ -462,15 +320,7 @@
/// .config file.
/// </para>
/// </remarks>
- public static string NotAvailableText
- {
- get { return s_notAvailableText; }
- set { s_notAvailableText = value; }
- }
-
- #endregion Public Static Properties
-
- #region Public Static Methods
+ public static string NotAvailableText { get; set; }
/// <summary>
/// Gets the assembly location path for the specified assembly.
@@ -486,11 +336,6 @@
/// </remarks>
public static string AssemblyLocationInfo(Assembly myAssembly)
{
-#if NETCF
- return "Not supported on Microsoft .NET Compact Framework";
-#elif NETSTANDARD1_3
- return "Not supported on .NET Core";
-#else
if (myAssembly.GlobalAssemblyCache)
{
return "Global Assembly Cache";
@@ -499,24 +344,15 @@
{
try
{
-#if NET_4_0 || MONO_4_0
if (myAssembly.IsDynamic)
{
return "Dynamic Assembly";
}
-#else
-#if !NETSTANDARD2_0
- if (myAssembly is System.Reflection.Emit.AssemblyBuilder)
- {
- return "Dynamic Assembly";
- }
-#endif
if (myAssembly.GetType().FullName == "System.Reflection.Emit.InternalAssemblyBuilder")
{
return "Dynamic Assembly";
}
-#endif
else
{
// This call requires FileIOPermission for access to the path
@@ -533,42 +369,17 @@
}
catch (TargetInvocationException ex)
{
- return "Location Detect Failed (" + ex.Message + ")";
+ return $"Location Detect Failed ({ex.Message})";
}
catch (ArgumentException ex)
{
- return "Location Detect Failed (" + ex.Message + ")";
+ return $"Location Detect Failed ({ex.Message})";
}
catch (System.Security.SecurityException)
{
return "Location Permission Denied";
}
}
-#endif
- }
-
- /// <summary>
- /// Gets the fully qualified name of the <see cref="Type" />, including
- /// the name of the assembly from which the <see cref="Type" /> was
- /// loaded.
- /// </summary>
- /// <param name="type">The <see cref="Type" /> to get the fully qualified name for.</param>
- /// <returns>The fully qualified name for the <see cref="Type" />.</returns>
- /// <remarks>
- /// <para>
- /// This is equivalent to the <c>Type.AssemblyQualifiedName</c> property,
- /// but this method works on the .NET Compact Framework 1.0 as well as
- /// the full .NET runtime.
- /// </para>
- /// </remarks>
- public static string AssemblyQualifiedName(Type type)
- {
- return type.FullName + ", "
-#if NETSTANDARD1_3
- + type.GetTypeInfo().Assembly.FullName;
-#else
- + type.Assembly.FullName;
-#endif
}
/// <summary>
@@ -583,10 +394,6 @@
/// assembly's file name without the extension.
/// </para>
/// <para>
- /// Use this rather than <c>Assembly.GetName().Name</c> because that
- /// is not available on the Compact Framework.
- /// </para>
- /// <para>
/// Because of a FileIOPermission security demand we cannot do
/// the obvious Assembly.GetName().Name. We are allowed to get
/// the <see cref="Assembly.FullName" /> of the assembly so we
@@ -620,27 +427,7 @@
/// </remarks>
public static string AssemblyFileName(Assembly myAssembly)
{
-#if NETCF || NETSTANDARD1_3 // TODO Assembly.Location is in netstandard1.5 System.Reflection
- // This is not very good because it assumes that only
- // the entry assembly can be an EXE. In fact multiple
- // EXEs can be loaded in to a process.
-
- string assemblyShortName = SystemInfo.AssemblyShortName(myAssembly);
- string entryAssemblyShortName = System.IO.Path.GetFileNameWithoutExtension(SystemInfo.EntryAssemblyLocation);
-
- if (string.Compare(assemblyShortName, entryAssemblyShortName, true) == 0)
- {
- // assembly is entry assembly
- return assemblyShortName + ".exe";
- }
- else
- {
- // assembly is not entry assembly
- return assemblyShortName + ".dll";
- }
-#else
- return System.IO.Path.GetFileName(myAssembly.Location);
-#endif
+ return Path.GetFileName(myAssembly.Location);
}
/// <summary>
@@ -663,16 +450,11 @@
/// then all the loaded assemblies will be searched for the type.
/// </para>
/// </remarks>
- public static Type GetTypeFromString(Type relativeType, string typeName, bool throwOnError, bool ignoreCase)
+ public static Type? GetTypeFromString(Type relativeType, string typeName, bool throwOnError, bool ignoreCase)
{
-#if NETSTANDARD1_3
- return GetTypeFromString(relativeType.GetTypeInfo().Assembly, typeName, throwOnError, ignoreCase);
-#else
return GetTypeFromString(relativeType.Assembly, typeName, throwOnError, ignoreCase);
-#endif
}
-#if !NETSTANDARD1_3
/// <summary>
/// Loads the type specified in the type string.
/// </summary>
@@ -692,11 +474,10 @@
/// in the assembly then all the loaded assemblies will be searched for the type.
/// </para>
/// </remarks>
- public static Type GetTypeFromString(string typeName, bool throwOnError, bool ignoreCase)
+ public static Type? GetTypeFromString(string typeName, bool throwOnError, bool ignoreCase)
{
return GetTypeFromString(Assembly.GetCallingAssembly(), typeName, throwOnError, ignoreCase);
}
-#endif
/// <summary>
/// Loads the type specified in the type string.
@@ -718,27 +499,18 @@
/// will be searched for the type.
/// </para>
/// </remarks>
- public static Type GetTypeFromString(Assembly relativeAssembly, string typeName, bool throwOnError, bool ignoreCase)
+ public static Type? GetTypeFromString(Assembly relativeAssembly, string typeName, bool throwOnError, bool ignoreCase)
{
// Check if the type name specifies the assembly name
if (typeName.IndexOf(',') == -1)
{
- //LogLog.Debug(declaringType, "SystemInfo: Loading type ["+typeName+"] from assembly ["+relativeAssembly.FullName+"]");
-#if NETSTANDARD1_3
- return relativeAssembly.GetType(typeName, throwOnError, ignoreCase);
-#elif NETCF
- return relativeAssembly.GetType(typeName, throwOnError);
-#else
- // Attempt to lookup the type from the relativeAssembly
- Type type = relativeAssembly.GetType(typeName, false, ignoreCase);
- if (type != null)
+ // Attempt to look up the type from the relativeAssembly
+ if (relativeAssembly.GetType(typeName, false, ignoreCase) is Type type)
{
- // Found type in relative assembly
- //LogLog.Debug(declaringType, "SystemInfo: Loaded type ["+typeName+"] from assembly ["+relativeAssembly.FullName+"]");
return type;
}
- Assembly[] loadedAssemblies = null;
+ Assembly[]? loadedAssemblies = null;
try
{
loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies();
@@ -748,17 +520,16 @@
// Insufficient permissions to get the list of loaded assemblies
}
- if (loadedAssemblies != null)
+ if (loadedAssemblies is not null)
{
- Type fallback = null;
+ Type? fallback = null;
// Search the loaded assemblies for the type
foreach (Assembly assembly in loadedAssemblies)
{
- Type t = assembly.GetType(typeName, false, ignoreCase);
- if (t != null)
+ if (assembly.GetType(typeName, false, ignoreCase) is Type t)
{
// Found type in loaded assembly
- LogLog.Debug(declaringType, "Loaded type [" + typeName + "] from assembly [" + assembly.FullName + "] by searching loaded assemblies.");
+ LogLog.Debug(declaringType, $"Loaded type [{typeName}] from assembly [{assembly.FullName}] by searching loaded assemblies.");
if (assembly.GlobalAssemblyCache)
{
fallback = t;
@@ -769,7 +540,7 @@
}
}
}
- if (fallback != null)
+ if (fallback is not null)
{
return fallback;
}
@@ -778,82 +549,46 @@
// Didn't find the type
if (throwOnError)
{
- throw new TypeLoadException("Could not load type [" + typeName + "]. Tried assembly [" + relativeAssembly.FullName + "] and all loaded assemblies");
+ throw new TypeLoadException($"Could not load type [{typeName}]. Tried assembly [{relativeAssembly.FullName}] and all loaded assemblies");
}
return null;
-#endif
}
- else
- {
- // Includes explicit assembly name
- //LogLog.Debug(declaringType, "SystemInfo: Loading type ["+typeName+"] from global Type");
-#if NETCF
- // In NETCF 2 and 3 arg versions seem to behave differently
- // https://issues.apache.org/jira/browse/LOG4NET-113
- return Type.GetType(typeName, throwOnError);
-#else
- return Type.GetType(typeName, throwOnError, ignoreCase);
-#endif
- }
- }
-
-
- /// <summary>
- /// Generate a new guid
- /// </summary>
- /// <returns>A new Guid</returns>
- /// <remarks>
- /// <para>
- /// Generate a new guid
- /// </para>
- /// </remarks>
- public static Guid NewGuid()
- {
-#if NETCF_1_0
- return PocketGuid.NewGuid();
-#else
- return Guid.NewGuid();
-#endif
+ // Includes explicit assembly name
+ return Type.GetType(typeName, throwOnError, ignoreCase);
}
/// <summary>
- /// Create an <see cref="ArgumentOutOfRangeException"/>
+ /// Creates an <see cref="ArgumentOutOfRangeException"/>
/// </summary>
/// <param name="parameterName">The name of the parameter that caused the exception</param>
/// <param name="actualValue">The value of the argument that causes this exception</param>
/// <param name="message">The message that describes the error</param>
- /// <returns>the ArgumentOutOfRangeException object</returns>
- /// <remarks>
- /// <para>
- /// Create a new instance of the <see cref="ArgumentOutOfRangeException"/> class
- /// with a specified error message, the parameter name, and the value
+ /// <returns>
+ /// A new instance of the <see cref="ArgumentOutOfRangeException"/> class
+ /// with the specified error message, parameter name, and value
/// of the argument.
- /// </para>
- /// <para>
- /// The Compact Framework does not support the 3 parameter constructor for the
- /// <see cref="ArgumentOutOfRangeException"/> type. This method provides an
- /// implementation that works for all platforms.
- /// </para>
- /// </remarks>
+ /// </returns>
public static ArgumentOutOfRangeException CreateArgumentOutOfRangeException(string parameterName, object actualValue, string message)
{
-#if NETCF_1_0
- return new ArgumentOutOfRangeException(message + " [param=" + parameterName + "] [value=" + actualValue + "]");
-#elif NETCF_2_0
- return new ArgumentOutOfRangeException(parameterName, message + " [value=" + actualValue + "]");
-#else
return new ArgumentOutOfRangeException(parameterName, actualValue, message);
-#endif
}
+ /// <summary>
+ /// Creates a <see cref="NotSupportedException"/> for read-only collection modification calls.
+ /// </summary>
+ /// <returns>The NotSupportedException object</returns>
+ public static NotSupportedException CreateReadOnlyCollectionNotModifiableException()
+ {
+ return new NotSupportedException("This is a Read Only Collection and can not be modified");
+ }
/// <summary>
/// Parse a string into an <see cref="Int32"/> value
/// </summary>
/// <param name="s">the string to parse</param>
/// <param name="val">out param where the parsed value is placed</param>
- /// <returns><c>true</c> if the string was able to be parsed into an integer</returns>
+ /// <returns><c>true</c> if the string was parsed into an integer</returns>
/// <remarks>
/// <para>
/// Attempts to parse the string into an integer. If the string cannot
@@ -862,26 +597,12 @@
/// </remarks>
public static bool TryParse(string s, out int val)
{
-#if NETCF
- val = 0;
- try
- {
- val = int.Parse(s, System.Globalization.NumberStyles.Integer, System.Globalization.CultureInfo.InvariantCulture);
- return true;
- }
- catch
- {
- }
-
- return false;
-#else
// Initialise out param
val = 0;
try
{
- double doubleVal;
- if (Double.TryParse(s, System.Globalization.NumberStyles.Integer, System.Globalization.CultureInfo.InvariantCulture, out doubleVal))
+ if (double.TryParse(s, System.Globalization.NumberStyles.Integer, System.Globalization.CultureInfo.InvariantCulture, out double doubleVal))
{
val = Convert.ToInt32(doubleVal);
return true;
@@ -893,7 +614,6 @@
}
return false;
-#endif
}
/// <summary>
@@ -901,7 +621,7 @@
/// </summary>
/// <param name="s">the string to parse</param>
/// <param name="val">out param where the parsed value is placed</param>
- /// <returns><c>true</c> if the string was able to be parsed into an integer</returns>
+ /// <returns><c>true</c> if the string was parsed into an integer</returns>
/// <remarks>
/// <para>
/// Attempts to parse the string into an integer. If the string cannot
@@ -910,26 +630,12 @@
/// </remarks>
public static bool TryParse(string s, out long val)
{
-#if NETCF
- val = 0;
- try
- {
- val = long.Parse(s, System.Globalization.NumberStyles.Integer, System.Globalization.CultureInfo.InvariantCulture);
- return true;
- }
- catch
- {
- }
-
- return false;
-#else
// Initialise out param
val = 0;
try
{
- double doubleVal;
- if (Double.TryParse(s, System.Globalization.NumberStyles.Integer, System.Globalization.CultureInfo.InvariantCulture, out doubleVal))
+ if (double.TryParse(s, System.Globalization.NumberStyles.Integer, System.Globalization.CultureInfo.InvariantCulture, out double doubleVal))
{
val = Convert.ToInt64(doubleVal);
return true;
@@ -941,7 +647,6 @@
}
return false;
-#endif
}
/// <summary>
@@ -949,7 +654,7 @@
/// </summary>
/// <param name="s">the string to parse</param>
/// <param name="val">out param where the parsed value is placed</param>
- /// <returns><c>true</c> if the string was able to be parsed into an integer</returns>
+ /// <returns><c>true</c> if the string was parsed into an integer</returns>
/// <remarks>
/// <para>
/// Attempts to parse the string into an integer. If the string cannot
@@ -958,26 +663,12 @@
/// </remarks>
public static bool TryParse(string s, out short val)
{
-#if NETCF
- val = 0;
- try
- {
- val = short.Parse(s, System.Globalization.NumberStyles.Integer, System.Globalization.CultureInfo.InvariantCulture);
- return true;
- }
- catch
- {
- }
-
- return false;
-#else
// Initialise out param
val = 0;
try
{
- double doubleVal;
- if (Double.TryParse(s, System.Globalization.NumberStyles.Integer, System.Globalization.CultureInfo.InvariantCulture, out doubleVal))
+ if (double.TryParse(s, System.Globalization.NumberStyles.Integer, System.Globalization.CultureInfo.InvariantCulture, out double doubleVal))
{
val = Convert.ToInt16(doubleVal);
return true;
@@ -989,7 +680,6 @@
}
return false;
-#endif
}
/// <summary>
@@ -997,22 +687,11 @@
/// </summary>
/// <param name="key">the application settings key to lookup</param>
/// <returns>the value for the key, or <c>null</c></returns>
- /// <remarks>
- /// <para>
- /// Configuration APIs are not supported under the Compact Framework
- /// </para>
- /// </remarks>
- public static string GetAppSetting(string key)
+ public static string? GetAppSetting(string key)
{
try
{
-#if NETCF || NETSTANDARD1_3
- // Configuration APIs are not suported under the Compact Framework
-#elif NET_2_0 || NETSTANDARD2_0
return ConfigurationManager.AppSettings[key];
-#else
- return ConfigurationSettings.AppSettings[key];
-#endif
}
catch (Exception ex)
{
@@ -1040,23 +719,21 @@
/// </remarks>
public static string ConvertToFullPath(string path)
{
- if (path == null)
+ if (path is null)
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
- string baseDirectory = "";
+ string baseDirectory = string.Empty;
try
{
- string applicationBaseDirectory = SystemInfo.ApplicationBaseDirectory;
- if (applicationBaseDirectory != null)
+ string applicationBaseDirectory = ApplicationBaseDirectory;
+
+ // applicationBaseDirectory may be a URI not a local file path
+ Uri applicationBaseDirectoryUri = new Uri(applicationBaseDirectory);
+ if (applicationBaseDirectoryUri.IsFile)
{
- // applicationBaseDirectory may be a URI not a local file path
- Uri applicationBaseDirectoryUri = new Uri(applicationBaseDirectory);
- if (applicationBaseDirectoryUri.IsFile)
- {
- baseDirectory = applicationBaseDirectoryUri.LocalPath;
- }
+ baseDirectory = applicationBaseDirectoryUri.LocalPath;
}
}
catch
@@ -1064,7 +741,7 @@
// Ignore URI exceptions & SecurityExceptions from SystemInfo.ApplicationBaseDirectory
}
- if (baseDirectory != null && baseDirectory.Length > 0)
+ if (!string.IsNullOrEmpty(baseDirectory))
{
// Note that Path.Combine will return the second path if it is rooted
return Path.GetFullPath(Path.Combine(baseDirectory, path));
@@ -1083,13 +760,7 @@
/// </remarks>
public static Hashtable CreateCaseInsensitiveHashtable()
{
-#if NETCF_1_0
- return new Hashtable(CaseInsensitiveHashCodeProvider.Default, CaseInsensitiveComparer.Default);
-#elif NETCF_2_0 || NET_2_0 || MONO_2_0 || MONO_3_5 || MONO_4_0
return new Hashtable(StringComparer.OrdinalIgnoreCase);
-#else
- return System.Collections.Specialized.CollectionsUtil.CreateCaseInsensitiveHashtable();
-#endif
}
/// <summary>
@@ -1104,77 +775,11 @@
/// <param name="a">The one string.</param>
/// <param name="b">The other string.</param>
/// <returns><c>true</c> if the strings are equal, <c>false</c> otherwise.</returns>
- public static Boolean EqualsIgnoringCase(String a, String b)
+ public static bool EqualsIgnoringCase(string a, string b)
{
-#if NET_1_0 || NET_1_1 || NETCF_1_0
- return string.Compare(a, b, true, System.Globalization.CultureInfo.InvariantCulture) == 0
-#elif NETSTANDARD1_3
- return CultureInfo.InvariantCulture.CompareInfo.Compare(a, b, CompareOptions.IgnoreCase) == 0;
-#else // >= .NET-2.0
- return String.Equals(a, b, StringComparison.OrdinalIgnoreCase);
-#endif
+ return string.Equals(a, b, StringComparison.OrdinalIgnoreCase);
}
- #endregion Public Static Methods
-
- #region Private Static Methods
-
-#if NETCF
- private static string NativeEntryAssemblyLocation
- {
- get
- {
- StringBuilder moduleName = null;
-
- IntPtr moduleHandle = GetModuleHandle(IntPtr.Zero);
-
- if (moduleHandle != IntPtr.Zero)
- {
- moduleName = new StringBuilder(255);
- if (GetModuleFileName(moduleHandle, moduleName, moduleName.Capacity) == 0)
- {
- throw new NotSupportedException(NativeError.GetLastError().ToString());
- }
- }
- else
- {
- throw new NotSupportedException(NativeError.GetLastError().ToString());
- }
-
- return moduleName.ToString();
- }
- }
-
- [DllImport("CoreDll.dll", SetLastError=true, CharSet=CharSet.Unicode)]
- private static extern IntPtr GetModuleHandle(IntPtr ModuleName);
-
- [DllImport("CoreDll.dll", SetLastError=true, CharSet=CharSet.Unicode)]
- private static extern Int32 GetModuleFileName(
- IntPtr hModule,
- StringBuilder ModuleName,
- Int32 cch);
-
-#endif
-
- #endregion Private Static Methods
-
- #region Public Static Fields
-
- /// <summary>
- /// Gets an empty array of types.
- /// </summary>
- /// <remarks>
- /// <para>
- /// The <c>Type.EmptyTypes</c> field is not available on
- /// the .NET Compact Framework 1.0.
- /// </para>
- /// </remarks>
- public static readonly Type[] EmptyTypes = new Type[0];
-
- #endregion Public Static Fields
-
- #region Private Static Fields
-
/// <summary>
/// The fully qualified type of the SystemInfo class.
/// </summary>
@@ -1187,149 +792,16 @@
/// <summary>
/// Cache the host name for the current machine
/// </summary>
- private static string s_hostName;
+ private static string? s_hostName;
/// <summary>
/// Cache the application friendly name
/// </summary>
- private static string s_appFriendlyName;
-
- /// <summary>
- /// Text to output when a <c>null</c> is encountered.
- /// </summary>
- private static string s_nullText;
-
- /// <summary>
- /// Text to output when an unsupported feature is requested.
- /// </summary>
- private static string s_notAvailableText;
+ private static string? s_appFriendlyName;
/// <summary>
/// Start time for the current process.
/// </summary>
private static DateTime s_processStartTimeUtc = DateTime.UtcNow;
-
- #endregion
-
- #region Compact Framework Helper Classes
-#if NETCF_1_0
- /// <summary>
- /// Generate GUIDs on the .NET Compact Framework.
- /// </summary>
- public class PocketGuid
- {
- // guid variant types
- private enum GuidVariant
- {
- ReservedNCS = 0x00,
- Standard = 0x02,
- ReservedMicrosoft = 0x06,
- ReservedFuture = 0x07
- }
-
- // guid version types
- private enum GuidVersion
- {
- TimeBased = 0x01,
- Reserved = 0x02,
- NameBased = 0x03,
- Random = 0x04
- }
-
- // constants that are used in the class
- private class Const
- {
- // number of bytes in guid
- public const int ByteArraySize = 16;
-
- // multiplex variant info
- public const int VariantByte = 8;
- public const int VariantByteMask = 0x3f;
- public const int VariantByteShift = 6;
-
- // multiplex version info
- public const int VersionByte = 7;
- public const int VersionByteMask = 0x0f;
- public const int VersionByteShift = 4;
- }
-
- // imports for the crypto api functions
- private class WinApi
- {
- public const uint PROV_RSA_FULL = 1;
- public const uint CRYPT_VERIFYCONTEXT = 0xf0000000;
-
- [DllImport("CoreDll.dll")]
- public static extern bool CryptAcquireContext(
- ref IntPtr phProv, string pszContainer, string pszProvider,
- uint dwProvType, uint dwFlags);
-
- [DllImport("CoreDll.dll")]
- public static extern bool CryptReleaseContext(
- IntPtr hProv, uint dwFlags);
-
- [DllImport("CoreDll.dll")]
- public static extern bool CryptGenRandom(
- IntPtr hProv, int dwLen, byte[] pbBuffer);
- }
-
- // all static methods
- private PocketGuid()
- {
- }
-
- /// <summary>
- /// Return a new System.Guid object.
- /// </summary>
- public static Guid NewGuid()
- {
- IntPtr hCryptProv = IntPtr.Zero;
- Guid guid = Guid.Empty;
-
- try
- {
- // holds random bits for guid
- byte[] bits = new byte[Const.ByteArraySize];
-
- // get crypto provider handle
- if (!WinApi.CryptAcquireContext(ref hCryptProv, null, null,
- WinApi.PROV_RSA_FULL, WinApi.CRYPT_VERIFYCONTEXT))
- {
- throw new SystemException(
- "Failed to acquire cryptography handle.");
- }
-
- // generate a 128 bit (16 byte) cryptographically random number
- if (!WinApi.CryptGenRandom(hCryptProv, bits.Length, bits))
- {
- throw new SystemException(
- "Failed to generate cryptography random bytes.");
- }
-
- // set the variant
- bits[Const.VariantByte] &= Const.VariantByteMask;
- bits[Const.VariantByte] |=
- ((int)GuidVariant.Standard << Const.VariantByteShift);
-
- // set the version
- bits[Const.VersionByte] &= Const.VersionByteMask;
- bits[Const.VersionByte] |=
- ((int)GuidVersion.Random << Const.VersionByteShift);
-
- // create the new System.Guid object
- guid = new Guid(bits);
- }
- finally
- {
- // release the crypto provider handle
- if (hCryptProv != IntPtr.Zero)
- WinApi.CryptReleaseContext(hCryptProv, 0);
- }
-
- return guid;
- }
- }
-#endif
- #endregion Compact Framework Helper Classes
}
-}
+}
\ No newline at end of file
diff --git a/src/log4net/Util/SystemStringFormat.cs b/src/log4net/Util/SystemStringFormat.cs
index 0d75e89..65d7bc6 100644
--- a/src/log4net/Util/SystemStringFormat.cs
+++ b/src/log4net/Util/SystemStringFormat.cs
@@ -19,23 +19,16 @@
using System;
using System.Text;
-using System.Xml;
-using System.Text.RegularExpressions;
namespace log4net.Util
{
/// <summary>
/// Utility class that represents a format string.
/// </summary>
- /// <remarks>
- /// <para>
- /// Utility class that represents a format string.
- /// </para>
- /// </remarks>
/// <author>Nicko Cadell</author>
public sealed class SystemStringFormat
{
- private readonly IFormatProvider m_provider;
+ private readonly IFormatProvider? m_provider;
/// <summary>
/// Format
@@ -47,34 +40,28 @@
/// </summary>
public object[] Args { get; set; }
- #region Constructor
-
/// <summary>
/// Initialise the <see cref="SystemStringFormat"/>
/// </summary>
/// <param name="provider">An <see cref="System.IFormatProvider"/> that supplies culture-specific formatting information.</param>
/// <param name="format">A <see cref="System.String"/> containing zero or more format items.</param>
/// <param name="args">An <see cref="System.Object"/> array containing zero or more objects to format.</param>
- public SystemStringFormat(IFormatProvider provider, string format, params object[] args)
+ public SystemStringFormat(IFormatProvider? provider, string format, params object[] args)
{
m_provider = provider;
Format = format;
Args = args;
}
- #endregion Constructor
-
/// <summary>
/// Format the string and arguments
/// </summary>
/// <returns>the formatted string</returns>
- public override string ToString()
+ public override string? ToString()
{
return StringFormat(m_provider, Format, Args);
}
- #region StringFormat
-
/// <summary>
/// Replaces the format item in a specified <see cref="System.String"/> with the text equivalent
/// of the value of a corresponding <see cref="System.Object"/> instance in a specified array.
@@ -93,49 +80,42 @@
/// exception and arguments are returned in the result string.
/// </para>
/// </remarks>
- private static string StringFormat(IFormatProvider provider, string format, params object[] args)
+ private static string? StringFormat(IFormatProvider? provider, string? format, params object[]? args)
{
try
{
// The format is missing, log null value
- if (format == null)
+ if (format is null)
{
return null;
}
// The args are missing - should not happen unless we are called explicitly with a null array
- if (args == null)
+ if (args is null)
{
return format;
}
// Try to format the string
- return String.Format(provider, format, args);
+ return string.Format(provider, format, args);
}
catch (Exception ex)
{
- log4net.Util.LogLog.Warn(declaringType, "Exception while rendering format [" + format + "]", ex);
+ LogLog.Warn(declaringType, $"Exception while rendering format [{format}]", ex);
return StringFormatError(ex, format, args);
}
-#if !NET_2_0 && !MONO_2_0 && !MONO_3_5 && !MONO_4_0 && !NETSTANDARD
- catch
- {
- log4net.Util.LogLog.Warn(declaringType, "Exception while rendering format ["+format+"]");
- return StringFormatError(null, format, args);
- }
-#endif
}
/// <summary>
/// Process an error during StringFormat
/// </summary>
- private static string StringFormatError(Exception formatException, string format, object[] args)
+ private static string StringFormatError(Exception? formatException, string? format, object[]? args)
{
try
{
- StringBuilder buf = new StringBuilder("<log4net.Error>");
+ var buf = new StringBuilder("<log4net.Error>", 100);
- if (formatException != null)
+ if (formatException is not null)
{
buf.Append("Exception during StringFormat: ").Append(formatException.Message);
}
@@ -153,24 +133,17 @@
}
catch (Exception ex)
{
- log4net.Util.LogLog.Error(declaringType, "INTERNAL ERROR during StringFormat error handling", ex);
+ LogLog.Error(declaringType, "INTERNAL ERROR during StringFormat error handling", ex);
return "<log4net.Error>Exception during StringFormat. See Internal Log.</log4net.Error>";
}
-#if !NET_2_0 && !MONO_2_0 && !MONO_3_5 && !MONO_4_0 && !NETSTANDARD
- catch
- {
- log4net.Util.LogLog.Error(declaringType, "INTERNAL ERROR during StringFormat error handling");
- return "<log4net.Error>Exception during StringFormat. See Internal Log.</log4net.Error>";
- }
-#endif
}
/// <summary>
/// Dump the contents of an array into a string builder
/// </summary>
- private static void RenderArray(Array array, StringBuilder buffer)
+ private static void RenderArray(Array? array, StringBuilder buffer)
{
- if (array == null)
+ if (array is null)
{
buffer.Append(SystemInfo.NullText);
}
@@ -178,7 +151,7 @@
{
if (array.Rank != 1)
{
- buffer.Append(array.ToString());
+ buffer.Append(array);
}
else
{
@@ -202,9 +175,9 @@
/// <summary>
/// Dump an object to a string
/// </summary>
- private static void RenderObject(Object obj, StringBuilder buffer)
+ private static void RenderObject(object? obj, StringBuilder buffer)
{
- if (obj == null)
+ if (obj is null)
{
buffer.Append(SystemInfo.NullText);
}
@@ -218,19 +191,9 @@
{
buffer.Append("<Exception: ").Append(ex.Message).Append(">");
}
-#if !NET_2_0 && !MONO_2_0 && !MONO_3_5 && !MONO_4_0 && !NETSTANDARD
- catch
- {
- buffer.Append("<Exception>");
- }
-#endif
}
}
- #endregion StringFormat
-
- #region Private Static Fields
-
/// <summary>
/// The fully qualified type of the SystemStringFormat class.
/// </summary>
@@ -239,7 +202,5 @@
/// log message.
/// </remarks>
private static readonly Type declaringType = typeof(SystemStringFormat);
-
- #endregion Private Static Fields
}
}
diff --git a/src/log4net/Util/TextWriterAdapter.cs b/src/log4net/Util/TextWriterAdapter.cs
index 24304f0..393fdf8 100644
--- a/src/log4net/Util/TextWriterAdapter.cs
+++ b/src/log4net/Util/TextWriterAdapter.cs
@@ -149,12 +149,7 @@
/// <para>
/// </para>
/// </remarks>
-#if !NETSTANDARD1_3
- override
-#else
- virtual
-#endif
- public void Close()
+ override public void Close()
{
m_writer.Close();
}
diff --git a/src/log4net/Util/ThreadContextProperties.cs b/src/log4net/Util/ThreadContextProperties.cs
index 0fbeef6..939f8f7 100644
--- a/src/log4net/Util/ThreadContextProperties.cs
+++ b/src/log4net/Util/ThreadContextProperties.cs
@@ -18,9 +18,8 @@
#endregion
using System;
-#if NETCF
-using System.Collections;
-#endif
+
+#nullable enable
namespace log4net.Util
{
@@ -36,24 +35,11 @@
/// <author>Nicko Cadell</author>
public sealed class ThreadContextProperties : ContextPropertiesBase
{
- #region Private Instance Fields
-
-#if NETCF
- /// <summary>
- /// The thread local data slot to use to store a PropertiesDictionary.
- /// </summary>
- private readonly static LocalDataStoreSlot s_threadLocalSlot = System.Threading.Thread.AllocateDataSlot();
-#else
/// <summary>
/// Each thread will automatically have its instance.
/// </summary>
[ThreadStatic]
- private static PropertiesDictionary _dictionary;
-#endif
-
- #endregion Private Instance Fields
-
- #region Public Instance Constructors
+ private static PropertiesDictionary? _dictionary;
/// <summary>
/// Internal constructor
@@ -67,10 +53,6 @@
{
}
- #endregion Public Instance Constructors
-
- #region Public Instance Properties
-
/// <summary>
/// Gets or sets the value of a property
/// </summary>
@@ -82,29 +64,12 @@
/// Gets or sets the value of a property
/// </para>
/// </remarks>
- public override object this[string key]
+ public override object? this[string key]
{
- get
- {
-#if NETCF
- PropertiesDictionary _dictionary = GetProperties(false);
-#endif
- if (_dictionary != null)
- {
- return _dictionary[key];
- }
- return null;
- }
- set
- {
- GetProperties(true)[key] = value;
- }
+ get => _dictionary?[key];
+ set => GetProperties(true)![key] = value;
}
- #endregion Public Instance Properties
-
- #region Public Instance Methods
-
/// <summary>
/// Remove a property
/// </summary>
@@ -114,16 +79,7 @@
/// Remove a property
/// </para>
/// </remarks>
- public void Remove(string key)
- {
-#if NETCF
- PropertiesDictionary _dictionary = GetProperties(false);
-#endif
- if (_dictionary != null)
- {
- _dictionary.Remove(key);
- }
- }
+ public void Remove(string key) => _dictionary?.Remove(key);
/// <summary>
/// Get the keys stored in the properties.
@@ -132,17 +88,7 @@
/// Gets the keys stored in the properties.
/// </para>
/// <returns>a set of the defined keys</returns>
- public string[] GetKeys()
- {
-#if NETCF
- PropertiesDictionary _dictionary = GetProperties(false);
-#endif
- if (_dictionary != null)
- {
- return _dictionary.GetKeys();
- }
- return null;
- }
+ public string[]? GetKeys() => _dictionary?.GetKeys();
/// <summary>
/// Clear all properties
@@ -152,25 +98,12 @@
/// Clear all properties
/// </para>
/// </remarks>
- public void Clear()
- {
-#if NETCF
- PropertiesDictionary _dictionary = GetProperties(false);
-#endif
- if (_dictionary != null)
- {
- _dictionary.Clear();
- }
- }
-
- #endregion Public Instance Methods
-
- #region Internal Instance Methods
+ public void Clear() => _dictionary?.Clear();
/// <summary>
/// Get the <c>PropertiesDictionary</c> for this thread.
/// </summary>
- /// <param name="create">create the dictionary if it does not exist, otherwise return null if does not exist</param>
+ /// <param name="create">create the dictionary if it does not exist, otherwise return null if it does not exist</param>
/// <returns>the properties for this thread</returns>
/// <remarks>
/// <para>
@@ -179,22 +112,13 @@
/// caller must clone the collection before doing so.
/// </para>
/// </remarks>
- internal PropertiesDictionary GetProperties(bool create)
+ internal PropertiesDictionary? GetProperties(bool create)
{
-#if NETCF
- PropertiesDictionary _dictionary = (PropertiesDictionary)System.Threading.Thread.GetData(s_threadLocalSlot);
-#endif
- if (_dictionary == null && create)
+ if (_dictionary is null && create)
{
_dictionary = new PropertiesDictionary();
-#if NETCF
- System.Threading.Thread.SetData(s_threadLocalSlot, _dictionary);
-#endif
}
return _dictionary;
}
-
- #endregion Internal Instance Methods
}
-}
-
+}
\ No newline at end of file
diff --git a/src/log4net/Util/ThreadContextStack.cs b/src/log4net/Util/ThreadContextStack.cs
index 37ed907..ff72943 100644
--- a/src/log4net/Util/ThreadContextStack.cs
+++ b/src/log4net/Util/ThreadContextStack.cs
@@ -18,10 +18,8 @@
#endregion
using System;
-
-#if !NETCF_1_0
using System.Collections;
-#endif
+using System.Collections.Generic;
using log4net.Core;
@@ -38,16 +36,10 @@
/// <author>Nicko Cadell</author>
public sealed class ThreadContextStack : IFixingRequired
{
- #region Private Static Fields
-
/// <summary>
/// The stack store.
/// </summary>
- private Stack m_stack = new Stack();
-
- #endregion Private Static Fields
-
- #region Public Instance Constructors
+ private readonly Stack<StackFrame> m_stack = new();
/// <summary>
/// Internal constructor
@@ -61,10 +53,6 @@
{
}
- #endregion Public Instance Constructors
-
- #region Public Properties
-
/// <summary>
/// The number of messages in the stack
/// </summary>
@@ -78,14 +66,7 @@
/// minus the number of times <see cref="Pop"/> has been called.
/// </para>
/// </remarks>
- public int Count
- {
- get { return m_stack.Count; }
- }
-
- #endregion // Public Properties
-
- #region Public Methods
+ public int Count => m_stack.Count;
/// <summary>
/// Clears all the contextual information held in this stack.
@@ -102,10 +83,7 @@
/// syntax.
/// </para>
/// </remarks>
- public void Clear()
- {
- m_stack.Clear();
- }
+ public void Clear() => m_stack.Clear();
/// <summary>
/// Removes the top context from this stack.
@@ -118,14 +96,14 @@
/// empty string (not <see langword="null"/>) is returned.
/// </para>
/// </remarks>
- public string Pop()
+ public string? Pop()
{
- Stack stack = m_stack;
+ Stack<StackFrame> stack = m_stack;
if (stack.Count > 0)
{
- return ((StackFrame)(stack.Pop())).Message;
+ return stack.Pop().Message;
}
- return "";
+ return string.Empty;
}
/// <summary>
@@ -151,10 +129,10 @@
/// }
/// </code>
/// </example>
- public IDisposable Push(string message)
+ public IDisposable Push(string? message)
{
- Stack stack = m_stack;
- stack.Push(new StackFrame(message, (stack.Count > 0) ? (StackFrame)stack.Peek() : null));
+ Stack<StackFrame> stack = m_stack;
+ stack.Push(new StackFrame(message, (stack.Count > 0) ? stack.Peek() : null));
return new AutoPopStackFrame(stack, stack.Count - 1);
}
@@ -169,30 +147,26 @@
/// empty string (not <see langword="null"/>) is returned.
/// </para>
/// </remarks>
- public string Peek()
+ public string? Peek()
{
- Stack stack = m_stack;
+ Stack<StackFrame> stack = m_stack;
if (stack.Count > 0)
{
- return ((StackFrame)stack.Peek()).Message;
+ return stack.Peek().Message;
}
return "";
}
- #endregion Public Methods
-
- #region Internal Methods
-
/// <summary>
/// Gets the current context information for this stack.
/// </summary>
/// <returns>The current context information.</returns>
- internal string GetFullMessage()
+ internal string? GetFullMessage()
{
- Stack stack = m_stack;
+ Stack<StackFrame> stack = m_stack;
if (stack.Count > 0)
{
- return ((StackFrame)(stack.Peek())).FullMessage;
+ return stack.Peek().FullMessage;
}
return null;
}
@@ -203,46 +177,34 @@
/// <value>The internal storage stack</value>
/// <remarks>
/// <para>
- /// This property is provided only to support backward compatability
- /// of the <see cref="NDC"/>. Tytpically the internal stack should not
+ /// This property is provided only to support backward compatibility
+ /// of the <see cref="NDC"/>. Typically the internal stack should not
/// be modified.
/// </para>
/// </remarks>
internal Stack InternalStack
{
- get { return m_stack; }
- set { m_stack = value; }
+ get => new Stack(new Stack(m_stack));
+ set
+ {
+ m_stack.Clear();
+ var frames = (StackFrame[])value.ToArray();
+ for (int i = frames.Length - 1; i >= 0; i--)
+ {
+ m_stack.Push(frames[i]);
+ }
+ }
}
- #endregion Internal Methods
-
/// <summary>
/// Gets the current context information for this stack.
/// </summary>
- /// <returns>Gets the current context information</returns>
- /// <remarks>
- /// <para>
- /// Gets the current context information for this stack.
- /// </para>
- /// </remarks>
- public override string ToString()
- {
- return GetFullMessage();
- }
+ public override string? ToString() => GetFullMessage();
/// <summary>
/// Get a portable version of this object
/// </summary>
- /// <returns>the portable instance of this object</returns>
- /// <remarks>
- /// <para>
- /// Get a cross thread portable version of this object
- /// </para>
- /// </remarks>
- object IFixingRequired.GetFixedObject()
- {
- return GetFullMessage();
- }
+ object? IFixingRequired.GetFixedObject() => GetFullMessage();
/// <summary>
/// Inner class used to represent a single context frame in the stack.
@@ -252,17 +214,10 @@
/// Inner class used to represent a single context frame in the stack.
/// </para>
/// </remarks>
- private sealed class StackFrame
+ internal sealed class StackFrame
{
- #region Private Instance Fields
-
- private readonly string m_message;
- private readonly StackFrame m_parent;
- private string m_fullMessage = null;
-
- #endregion
-
- #region Internal Instance Constructors
+ private readonly StackFrame? m_parent;
+ private string? m_fullMessage;
/// <summary>
/// Constructor
@@ -275,21 +230,17 @@
/// with the specified message and parent context.
/// </para>
/// </remarks>
- internal StackFrame(string message, StackFrame parent)
+ internal StackFrame(string? message, StackFrame? parent)
{
- m_message = message;
+ Message = message;
m_parent = parent;
- if (parent == null)
+ if (parent is null)
{
m_fullMessage = message;
}
}
- #endregion Internal Instance Constructors
-
- #region Internal Instance Properties
-
/// <summary>
/// Get the message.
/// </summary>
@@ -299,10 +250,7 @@
/// Get the message.
/// </para>
/// </remarks>
- internal string Message
- {
- get { return m_message; }
- }
+ internal string? Message { get; }
/// <summary>
/// Gets the full text of the context down to the root level.
@@ -315,19 +263,17 @@
/// Gets the full text of the context down to the root level.
/// </para>
/// </remarks>
- internal string FullMessage
+ internal string? FullMessage
{
get
{
- if (m_fullMessage == null && m_parent != null)
+ if (m_fullMessage is null && m_parent is not null)
{
- m_fullMessage = string.Concat(m_parent.FullMessage, " ", m_message);
+ m_fullMessage = string.Concat(m_parent.FullMessage, " ", Message);
}
return m_fullMessage;
}
}
-
- #endregion Internal Instance Properties
}
/// <summary>
@@ -339,56 +285,36 @@
/// with the <see langword="using"/> pattern to remove the stack frame at the end of the scope.
/// </para>
/// </remarks>
- private struct AutoPopStackFrame : IDisposable
+ private readonly struct AutoPopStackFrame : IDisposable
{
- #region Private Instance Fields
-
/// <summary>
/// The ThreadContextStack internal stack
/// </summary>
- private Stack m_frameStack;
+ private readonly Stack<StackFrame> m_frameStack;
/// <summary>
/// The depth to trim the stack to when this instance is disposed
/// </summary>
- private int m_frameDepth;
-
- #endregion Private Instance Fields
-
- #region Internal Instance Constructors
+ private readonly int m_frameDepth;
/// <summary>
- /// Constructor
+ /// Initializes a new instance of the <see cref="AutoPopStackFrame" /> class with
+ /// the specified stack and return depth.
/// </summary>
/// <param name="frameStack">The internal stack used by the ThreadContextStack.</param>
/// <param name="frameDepth">The depth to return the stack to when this object is disposed.</param>
- /// <remarks>
- /// <para>
- /// Initializes a new instance of the <see cref="AutoPopStackFrame" /> class with
- /// the specified stack and return depth.
- /// </para>
- /// </remarks>
- internal AutoPopStackFrame(Stack frameStack, int frameDepth)
+ internal AutoPopStackFrame(Stack<StackFrame> frameStack, int frameDepth)
{
m_frameStack = frameStack;
m_frameDepth = frameDepth;
}
- #endregion Internal Instance Constructors
-
- #region Implementation of IDisposable
-
/// <summary>
/// Returns the stack to the correct depth.
/// </summary>
- /// <remarks>
- /// <para>
- /// Returns the stack to the correct depth.
- /// </para>
- /// </remarks>
public void Dispose()
{
- if (m_frameDepth >= 0 && m_frameStack != null)
+ if (m_frameDepth >= 0)
{
while (m_frameStack.Count > m_frameDepth)
{
@@ -396,60 +322,6 @@
}
}
}
-
- #endregion Implementation of IDisposable
}
-
-#if NETCF_1_0
- /// <summary>
- /// Subclass of <see cref="System.Collections.Stack"/> to
- /// provide missing methods.
- /// </summary>
- /// <remarks>
- /// <para>
- /// The Compact Framework version of the <see cref="System.Collections.Stack"/>
- /// class is missing the <c>Clear</c> and <c>Clone</c> methods.
- /// This subclass adds implementations of those missing methods.
- /// </para>
- /// </remarks>
- public class Stack : System.Collections.Stack
- {
- /// <summary>
- /// Clears the stack of all elements.
- /// </summary>
- /// <remarks>
- /// <para>
- /// Clears the stack of all elements.
- /// </para>
- /// </remarks>
- public void Clear()
- {
- while(Count > 0)
- {
- Pop();
- }
- }
-
- /// <summary>
- /// Makes a shallow copy of the stack's elements.
- /// </summary>
- /// <returns>A new stack that has a shallow copy of the stack's elements.</returns>
- /// <remarks>
- /// <para>
- /// Makes a shallow copy of the stack's elements.
- /// </para>
- /// </remarks>
- public Stack Clone()
- {
- Stack res = new Stack();
- object[] items = ToArray();
- foreach(object item in items)
- {
- res.Push(item);
- }
- return res;
- }
- }
-#endif
}
}
diff --git a/src/log4net/Util/ThreadContextStacks.cs b/src/log4net/Util/ThreadContextStacks.cs
index 6997636..3938b7b 100644
--- a/src/log4net/Util/ThreadContextStacks.cs
+++ b/src/log4net/Util/ThreadContextStacks.cs
@@ -18,7 +18,6 @@
#endregion
using System;
-using System.Collections;
namespace log4net.Util
{
@@ -120,5 +119,4 @@
#endregion Private Static Fields
}
-}
-
+}
\ No newline at end of file
diff --git a/src/log4net/Util/TypeConverters/ConversionNotSupportedException.cs b/src/log4net/Util/TypeConverters/ConversionNotSupportedException.cs
index 61bd750..d7c3782 100644
--- a/src/log4net/Util/TypeConverters/ConversionNotSupportedException.cs
+++ b/src/log4net/Util/TypeConverters/ConversionNotSupportedException.cs
@@ -18,9 +18,7 @@
#endregion
using System;
-#if !NETCF && !NETSTANDARD1_3
using System.Runtime.Serialization;
-#endif
namespace log4net.Util.TypeConverters
{
@@ -36,14 +34,8 @@
/// </remarks>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
-#if !NETCF
[Serializable]
-#endif
-#if NETSTANDARD1_3
- public class ConversionNotSupportedException : Exception
-#else
public class ConversionNotSupportedException : ApplicationException
-#endif
{
#region Public Instance Constructors
@@ -92,7 +84,6 @@
#region Protected Instance Constructors
-#if !NETCF && !NETSTANDARD1_3
/// <summary>
/// Serialization constructor
/// </summary>
@@ -107,7 +98,6 @@
protected ConversionNotSupportedException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
-#endif
#endregion Protected Instance Constructors
@@ -155,4 +145,4 @@
#endregion Public Static Methods
}
-}
+}
\ No newline at end of file
diff --git a/src/log4net/Util/TypeConverters/ConverterRegistry.cs b/src/log4net/Util/TypeConverters/ConverterRegistry.cs
index ec3e59b..fb0b4ca 100644
--- a/src/log4net/Util/TypeConverters/ConverterRegistry.cs
+++ b/src/log4net/Util/TypeConverters/ConverterRegistry.cs
@@ -18,10 +18,7 @@
#endregion
using System;
-using System.Collections;
-#if NETSTANDARD1_3
-using System.Reflection;
-#endif
+using System.Collections.Concurrent;
namespace log4net.Util.TypeConverters
{
@@ -44,24 +41,8 @@
/// <seealso cref="IConvertTo"/>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
- public sealed class ConverterRegistry
+ public static class ConverterRegistry
{
- #region Private Constructors
-
- /// <summary>
- /// Private constructor
- /// </summary>
- /// <remarks>
- /// Initializes a new instance of the <see cref="ConverterRegistry" /> class.
- /// </remarks>
- private ConverterRegistry()
- {
- }
-
- #endregion Private Constructors
-
- #region Static Constructor
-
/// <summary>
/// Static constructor.
/// </summary>
@@ -75,16 +56,12 @@
// Add predefined converters here
AddConverter(typeof(bool), typeof(BooleanConverter));
AddConverter(typeof(System.Text.Encoding), typeof(EncodingConverter));
- AddConverter(typeof(System.Type), typeof(TypeConverter));
- AddConverter(typeof(log4net.Layout.PatternLayout), typeof(PatternLayoutConverter));
- AddConverter(typeof(log4net.Util.PatternString), typeof(PatternStringConverter));
+ AddConverter(typeof(Type), typeof(TypeConverter));
+ AddConverter(typeof(Layout.PatternLayout), typeof(PatternLayoutConverter));
+ AddConverter(typeof(PatternString), typeof(PatternStringConverter));
AddConverter(typeof(System.Net.IPAddress), typeof(IPAddressConverter));
}
- #endregion Static Constructor
-
- #region Public Static Methods
-
/// <summary>
/// Adds a converter for a specific type.
/// </summary>
@@ -95,13 +72,17 @@
/// Adds a converter instance for a specific type.
/// </para>
/// </remarks>
- public static void AddConverter(Type destinationType, object converter)
+ public static void AddConverter(Type? destinationType, object? converter)
{
- if (destinationType != null && converter != null)
+ if (destinationType is not null && converter is not null)
{
- lock (s_type2converter)
+ if (converter is IConvertTo convertTo)
{
- s_type2converter[destinationType] = converter;
+ s_type2ConvertTo[destinationType] = convertTo;
+ }
+ else if (converter is IConvertFrom convertFrom)
+ {
+ s_type2ConvertFrom[destinationType] = convertFrom;
}
}
}
@@ -135,32 +116,26 @@
/// Gets the type converter to use to convert values to the destination type.
/// </para>
/// </remarks>
- public static IConvertTo GetConvertTo(Type sourceType, Type destinationType)
+ public static IConvertTo? GetConvertTo(Type sourceType, Type destinationType)
{
// TODO: Support inheriting type converters.
// i.e. getting a type converter for a base of sourceType
// TODO: Is destinationType required? We don't use it for anything.
- lock (s_type2converter)
+ // Look up in the static registry
+ if (!s_type2ConvertTo.TryGetValue(sourceType, out IConvertTo? converter))
{
- // Lookup in the static registry
- IConvertTo converter = s_type2converter[sourceType] as IConvertTo;
-
- if (converter == null)
+ // Look up using attributes
+ converter = GetConverterFromAttribute(sourceType) as IConvertTo;
+ if (converter is not null)
{
- // Lookup using attributes
- converter = GetConverterFromAttribute(sourceType) as IConvertTo;
-
- if (converter != null)
- {
- // Store in registry
- s_type2converter[sourceType] = converter;
- }
+ // Store in registry
+ s_type2ConvertTo[sourceType] = converter;
}
-
- return converter;
}
+
+ return converter;
}
/// <summary>
@@ -176,30 +151,24 @@
/// Gets the type converter to use to convert values to the destination type.
/// </para>
/// </remarks>
- public static IConvertFrom GetConvertFrom(Type destinationType)
+ public static IConvertFrom? GetConvertFrom(Type destinationType)
{
// TODO: Support inheriting type converters.
// i.e. getting a type converter for a base of destinationType
- lock (s_type2converter)
+ // Lookup in the static registry
+ if (!s_type2ConvertFrom.TryGetValue(destinationType, out IConvertFrom? converter))
{
- // Lookup in the static registry
- IConvertFrom converter = s_type2converter[destinationType] as IConvertFrom;
-
- if (converter == null)
+ // Look up using attributes
+ converter = GetConverterFromAttribute(destinationType) as IConvertFrom;
+ if (converter is not null)
{
- // Lookup using attributes
- converter = GetConverterFromAttribute(destinationType) as IConvertFrom;
-
- if (converter != null)
- {
- // Store in registry
- s_type2converter[destinationType] = converter;
- }
+ // Store in registry
+ s_type2ConvertFrom[destinationType] = converter;
}
-
- return converter;
}
+
+ return converter;
}
/// <summary>
@@ -211,27 +180,18 @@
/// The type converter instance to use for type conversions or <c>null</c>
/// if no type converter is found.
/// </returns>
- private static object GetConverterFromAttribute(Type destinationType)
+ private static object? GetConverterFromAttribute(Type destinationType)
{
// Look for an attribute on the destination type
- var attributes = destinationType
-#if NETSTANDARD1_3
- .GetTypeInfo()
-#endif
- .GetCustomAttributes(typeof(TypeConverterAttribute), true);
- if (attributes is null)
- {
- // I assume the original null check is perhaps for CF or older .NET versions -- please leave in place
- return null;
- }
-
+ object[] attributes = destinationType.GetCustomAttributes(typeof(TypeConverterAttribute), true);
foreach (var attribute in attributes)
{
- var tcAttr = attribute as TypeConverterAttribute;
- if (tcAttr != null)
+ if (attribute is TypeConverterAttribute tcAttr)
{
- var converterType = SystemInfo.GetTypeFromString(destinationType, tcAttr.ConverterTypeName, false, true);
- return CreateConverterInstance(converterType);
+ if (SystemInfo.GetTypeFromString(destinationType, tcAttr.ConverterTypeName, false, true) is Type converterType)
+ {
+ return CreateConverterInstance(converterType);
+ }
}
}
@@ -254,13 +214,8 @@
/// and must have a public default (no argument) constructor.
/// </para>
/// </remarks>
- private static object CreateConverterInstance(Type converterType)
+ private static object? CreateConverterInstance(Type converterType)
{
- if (converterType == null)
- {
- throw new ArgumentNullException("converterType", "CreateConverterInstance cannot create instance, converterType is null");
- }
-
// Check type is a converter
if (typeof(IConvertFrom).IsAssignableFrom(converterType) || typeof(IConvertTo).IsAssignableFrom(converterType))
{
@@ -271,20 +226,16 @@
}
catch (Exception ex)
{
- LogLog.Error(declaringType, "Cannot CreateConverterInstance of type [" + converterType.FullName + "], Exception in call to Activator.CreateInstance", ex);
+ LogLog.Error(declaringType, $"Cannot CreateConverterInstance of type [{converterType.FullName}], exception in call to Activator.CreateInstance", ex);
}
}
else
{
- LogLog.Error(declaringType, "Cannot CreateConverterInstance of type [" + converterType.FullName + "], type does not implement IConvertFrom or IConvertTo");
+ LogLog.Error(declaringType, $"Cannot CreateConverterInstance of type [{converterType.FullName}], type does not implement IConvertFrom or IConvertTo");
}
return null;
}
- #endregion Public Static Methods
-
- #region Private Static Fields
-
/// <summary>
/// The fully qualified type of the ConverterRegistry class.
/// </summary>
@@ -294,11 +245,7 @@
/// </remarks>
private static readonly Type declaringType = typeof(ConverterRegistry);
- /// <summary>
- /// Mapping from <see cref="Type" /> to type converter.
- /// </summary>
- private static Hashtable s_type2converter = new Hashtable();
-
- #endregion
+ private static readonly ConcurrentDictionary<Type, IConvertTo> s_type2ConvertTo = new();
+ private static readonly ConcurrentDictionary<Type, IConvertFrom> s_type2ConvertFrom = new();
}
}
diff --git a/src/log4net/Util/TypeConverters/IPAddressConverter.cs b/src/log4net/Util/TypeConverters/IPAddressConverter.cs
index 60c7bf6..f954468 100644
--- a/src/log4net/Util/TypeConverters/IPAddressConverter.cs
+++ b/src/log4net/Util/TypeConverters/IPAddressConverter.cs
@@ -77,16 +77,12 @@
{
try
{
-#if NET_2_0 || NETCF_2_0
-
-#if !NETCF_2_0
// Try an explicit parse of string representation of an IPAddress (v4 or v6)
IPAddress result;
if (IPAddress.TryParse(str, out result))
{
return result;
}
-#endif
// Try to resolve via DNS. This is a blocking call.
// GetHostEntry works with either an IPAddress string or a host name
@@ -98,37 +94,6 @@
{
return host.AddressList[0];
}
-#else
- // Before .NET 2 we need to try to parse the IPAddress from the string first
-
- // Check if the string only contains IP address valid chars
- if (str.Trim(validIpAddressChars).Length == 0)
- {
- try
- {
- // try to parse the string as an IP address
- return IPAddress.Parse(str);
- }
- catch(FormatException)
- {
- // Ignore a FormatException, try to resolve via DNS
- }
- }
-
- // Try to resolve via DNS. This is a blocking call.
-#if NETSTANDARD
- IPHostEntry host = Dns.GetHostEntryAsync(str).GetAwaiter().GetResult();
-#else
- IPHostEntry host = Dns.GetHostByName(str);
-#endif
- if (host != null &&
- host.AddressList != null &&
- host.AddressList.Length > 0 &&
- host.AddressList[0] != null)
- {
- return host.AddressList[0];
- }
-#endif
}
catch (Exception ex)
{
@@ -145,4 +110,4 @@
/// </summary>
private static readonly char[] validIpAddressChars = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'A', 'B', 'C', 'D', 'E', 'F', 'x', 'X', '.', ':', '%' };
}
-}
+}
\ No newline at end of file
diff --git a/src/log4net/Util/TypeConverters/TypeConverter.cs b/src/log4net/Util/TypeConverters/TypeConverter.cs
index c5136e4..d48a923 100644
--- a/src/log4net/Util/TypeConverters/TypeConverter.cs
+++ b/src/log4net/Util/TypeConverters/TypeConverter.cs
@@ -18,9 +18,6 @@
#endregion
using System;
-#if NETSTANDARD1_3
-using System.Reflection;
-#endif
namespace log4net.Util.TypeConverters
{
@@ -79,15 +76,11 @@
string str = source as string;
if (str != null)
{
-#if NETSTANDARD1_3 // TODO can we use ComponentModel here?
- return SystemInfo.GetTypeFromString(GetType().GetTypeInfo().Assembly, str, true, true);
-#else
return SystemInfo.GetTypeFromString(str, true, true);
-#endif
}
throw ConversionNotSupportedException.Create(typeof(Type), source);
}
#endregion
}
-}
+}
\ No newline at end of file
diff --git a/src/log4net/Util/TypeConverters/TypeConverterAttribute.cs b/src/log4net/Util/TypeConverters/TypeConverterAttribute.cs
index 137336a..1b34192 100644
--- a/src/log4net/Util/TypeConverters/TypeConverterAttribute.cs
+++ b/src/log4net/Util/TypeConverters/TypeConverterAttribute.cs
@@ -79,7 +79,7 @@
}
/// <summary>
- /// Create a new type converter attribute for the specified type
+ /// Creates a new type converter attribute for the specified type
/// </summary>
/// <param name="converterType">The type of the type converter</param>
/// <remarks>
@@ -90,7 +90,7 @@
/// </remarks>
public TypeConverterAttribute(Type converterType)
{
- m_typeName = log4net.Util.SystemInfo.AssemblyQualifiedName(converterType);
+ m_typeName = converterType.AssemblyQualifiedName!;
}
#endregion
diff --git a/src/log4net/Util/WindowsSecurityContext.cs b/src/log4net/Util/WindowsSecurityContext.cs
index bed14bc..21cadfc 100644
--- a/src/log4net/Util/WindowsSecurityContext.cs
+++ b/src/log4net/Util/WindowsSecurityContext.cs
@@ -17,16 +17,7 @@
//
#endregion
-#if NET_2_0
-// .NET Compact Framework 1.0 has no support for WindowsIdentity
-#if !NETCF
-// MONO 1.0 has no support for Win32 Logon APIs
-#if !MONO
-// SSCLI 1.0 has no support for Win32 Logon APIs
-#if !SSCLI
-// We don't want framework or platform specific code in the CLI version of log4net
-#if !CLI_1_0
-
+#if NET462_OR_GREATER
using System;
using System.Runtime.InteropServices;
using System.Security.Principal;
@@ -276,9 +267,7 @@
/// token is used to initialize the WindowsIdentity.
/// </para>
/// </remarks>
-#if NET_4_0 || MONO_4_0
- [System.Security.SecuritySafeCritical]
-#endif
+ [System.Security.SecuritySafeCritical]
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, UnmanagedCode = true)]
private static WindowsIdentity LogonUser(string userName, string domainName, string password)
{
@@ -380,10 +369,4 @@
#endregion
}
}
-
-#endif // !CLI_1_0
-#endif // !SSCLI
-#endif // !MONO
-#endif // !NETCF
-#endif // NET_2_0
-
+#endif // NET462_OR_GREATER
\ No newline at end of file
diff --git a/src/log4net/log4net.csproj b/src/log4net/log4net.csproj
index 380fba9..bab37dc 100644
--- a/src/log4net/log4net.csproj
+++ b/src/log4net/log4net.csproj
@@ -1,209 +1,118 @@
-<Project Sdk="Microsoft.NET.Sdk">
- <PropertyGroup>
- <PackageId>log4net</PackageId>
- <Version>2.0.17</Version>
- <PackageVersion>$(Version)</PackageVersion>
- <Title>Apache log4net</Title>
- <Product>Apache log4net</Product>
- <Description>
- log4net is a tool to help the programmer output log statements to a variety of output targets.
- In case of problems with an application, it is helpful to enable logging so that the problem
- can be located. With log4net it is possible to enable logging at runtime without modifying the
- application binary. The log4net package is designed so that log statements can remain in
- shipped code without incurring a high performance cost. It follows that the speed of logging
- (or rather not logging) is crucial.
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <PackageId>log4net</PackageId>
+ <Version>3.0.0</Version>
+ <PackageVersion>$(Version)</PackageVersion>
+ <Title>Apache log4net</Title>
+ <Product>Apache log4net</Product>
+ <Description>
+ log4net is a tool to help the programmer output log statements to a variety of output targets.
+ In case of problems with an application, it is helpful to enable logging so that the problem
+ can be located. With log4net it is possible to enable logging at runtime without modifying the
+ application binary. The log4net package is designed so that log statements can remain in
+ shipped code without incurring a high performance cost. It follows that the speed of logging
+ (or rather not logging) is crucial.
- At the same time, log output can be so voluminous that it quickly becomes overwhelming.
- One of the distinctive features of log4net is the notion of hierarchical loggers.
- Using these loggers it is possible to selectively control which log statements are output
- at arbitrary granularity.
+ At the same time, log output can be so voluminous that it quickly becomes overwhelming.
+ One of the distinctive features of log4net is the notion of hierarchical loggers.
+ Using these loggers it is possible to selectively control which log statements are output
+ at arbitrary granularity.
- log4net is designed with two distinct goals in mind: speed and flexibility
- </Description>
- <Authors>The Apache Software Foundation</Authors>
- <Owners>Apache Logging Project, Jiří Činčura</Owners>
- <PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
- <PackageProjectUrl>https://logging.apache.org/log4net/</PackageProjectUrl>
- <PackageIcon>package-icon.png</PackageIcon>
- <Copyright>Copyright 2004-2024 The Apache Software Foundation</Copyright>
- <PackageTags>logging log tracing logfiles</PackageTags>
- <RepositoryType>git</RepositoryType>
- <RepositoryUrl>https://github.com/apache/logging-log4net</RepositoryUrl>
- <GeneratePackageOnBuild>false</GeneratePackageOnBuild>
- <Platforms>AnyCPU</Platforms>
- <TargetFrameworks>net20;net35;net40;net40-client;net45;netstandard1.3;netstandard2.0</TargetFrameworks>
- <Configurations>Debug;Release</Configurations>
- <LangVersion>latest</LangVersion>
- <RootNamespace>log4net</RootNamespace>
- <AssemblyName>log4net</AssemblyName>
- <ProjectType>Local</ProjectType>
- <DefaultClientScript>JScript</DefaultClientScript>
- <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
- <DefaultTargetSchema>IE50</DefaultTargetSchema>
- <DelaySign>false</DelaySign>
- <OutputType>Library</OutputType>
- <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>
- <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
- <SignAssembly>true</SignAssembly>
- <AssemblyOriginatorKeyFile>..\..\log4net.snk</AssemblyOriginatorKeyFile>
- <GenerateDocumentationFile>true</GenerateDocumentationFile>
- <OutputPath>..\..\build\$(Configuration)</OutputPath>
- <PackageOutputPath>..\..\build\artifacts</PackageOutputPath>
- <DocumentationFile>..\..\build\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
- <AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
- </PropertyGroup>
- <PropertyGroup>
- <BaseAddress>285212672</BaseAddress>
- <FileAlignment>4096</FileAlignment>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <Deterministic>true</Deterministic>
- </PropertyGroup>
- <PropertyGroup Condition="'$(TargetFramework)'=='net40-client'">
- <TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <TargetFrameworkProfile>Client</TargetFrameworkProfile>
- <OutDir>..\..\build\$(Configuration)\net40-client</OutDir>
- <DefineConstants>$(DefineConstants);NET_2_0;NET_4_0;CLIENT_PROFILE</DefineConstants>
- </PropertyGroup>
- <PropertyGroup Condition="'$(TargetFramework)'=='netstandard1.3'">
- <DefineConstants>$(DefineConstants);NETSTANDARD;NETSTANDARD1_3</DefineConstants>
- <NoWarn>1574</NoWarn>
- </PropertyGroup>
- <PropertyGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
- <DefineConstants>$(DefineConstants);NETSTANDARD;NETSTANDARD2_0</DefineConstants>
- <NoWarn>1574</NoWarn>
- </PropertyGroup>
- <PropertyGroup Condition="'$(TargetFramework)'=='net20'">
- <DefineConstants>$(DefineConstants);NET_2_0</DefineConstants>
- </PropertyGroup>
- <PropertyGroup Condition="'$(TargetFramework)'=='net35'">
- <DefineConstants>$(DefineConstants);NET_2_0;NET_3_5</DefineConstants>
- </PropertyGroup>
- <PropertyGroup Condition="'$(TargetFramework)'=='net40'">
- <DefineConstants>$(DefineConstants);NET_2_0;NET_4_0</DefineConstants>
- </PropertyGroup>
- <PropertyGroup Condition="'$(TargetFramework)'=='net45'">
- <DefineConstants>$(DefineConstants);NET_2_0;NET_4_0;NET_4_5</DefineConstants>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)'=='Debug' ">
- <DefineConstants>TRACE;DEBUG;$(DefineConstants)</DefineConstants>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)'=='Release' ">
- <DefineConstants>TRACE;STRONG;$(DefineConstants)</DefineConstants>
- <DebugType>none</DebugType>
- <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
- </PropertyGroup>
- <ItemGroup>
- <Reference Update="System">
- <Name>System</Name>
- </Reference>
- <Reference Include="System.Configuration" Condition="$(DefineConstants.Contains(NET_2_0))" />
- <Reference Update="System.Data">
- <Name>System.Data</Name>
- </Reference>
- <Reference Include="System.Web" Condition="$(DefineConstants.Contains(NET_2_0)) and !$(DefineConstants.Contains(CLIENT_PROFILE))">
- <Name>System.Web</Name>
- </Reference>
- <Reference Update="System.Xml">
- <Name>System.XML</Name>
- </Reference>
- </ItemGroup>
- <ItemGroup Condition="'$(TargetFramework)'=='netstandard1.3'">
- <PackageReference Include="System.AppContext" Version="4.3.0" />
- <PackageReference Include="System.Collections.NonGeneric" Version="4.0.1" />
- <PackageReference Include="System.Console" Version="4.3.0" />
- <PackageReference Include="System.Data.Common" Version="4.1.0" />
- <PackageReference Include="System.Diagnostics.Debug" Version="4.3.0" />
- <PackageReference Include="System.Diagnostics.Process" Version="4.1.0" />
- <PackageReference Include="System.Diagnostics.StackTrace" Version="4.0.1" />
- <PackageReference Include="System.Diagnostics.TraceSource" Version="4.0.0" />
- <PackageReference Include="System.IO.FileSystem" Version="4.3.0" />
- <PackageReference Include="System.IO.FileSystem.Watcher" Version="4.0.0" />
- <PackageReference Include="System.Linq" Version="4.3.0" />
- <PackageReference Include="System.Net.NameResolution" Version="4.0.0" />
- <PackageReference Include="System.Net.Requests" Version="4.0.11" />
- <PackageReference Include="System.Net.Sockets" Version="4.3.0" />
- <PackageReference Include="System.Reflection" Version="4.3.0" />
- <PackageReference Include="System.Reflection.Extensions" Version="4.3.0" />
- <PackageReference Include="System.Reflection.TypeExtensions" Version="4.1.0" />
- <PackageReference Include="System.Runtime.Extensions" Version="4.3.1" />
- <PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
- <PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
- <PackageReference Include="System.Runtime.Serialization.Formatters" Version="4.3.0" />
- <PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
- <PackageReference Include="System.Text.Encoding" Version="4.3.0" />
- <PackageReference Include="System.Threading" Version="4.3.0" />
- <PackageReference Include="System.Threading.Thread" Version="4.0.0" />
- <PackageReference Include="System.Threading.Timer" Version="4.3.0" />
- <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" />
- <PackageReference Include="System.Xml.XmlDocument" Version="4.0.1" />
- </ItemGroup>
- <ItemGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
- <PackageReference Include="System.Configuration.ConfigurationManager" Version="4.5.0" />
- </ItemGroup>
- <ItemGroup>
- <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
- <Visible>False</Visible>
- <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
- <Install>false</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
- <Visible>False</Visible>
- <ProductName>.NET Framework 3.5 SP1</ProductName>
- <Install>true</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
- <Visible>False</Visible>
- <ProductName>Windows Installer 3.1</ProductName>
- <Install>true</Install>
- </BootstrapperPackage>
- </ItemGroup>
- <ItemGroup>
- <Compile Remove="Log4netAssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <None Include="..\..\log4net.snk">
- <Link>log4net.snk</Link>
- </None>
- </ItemGroup>
- <ItemGroup Label="Packaging">
- <Content Include="..\..\package-icon.png" PackagePath="package-icon.png">
- <Link>package-icon.png</Link>
- </Content>
- </ItemGroup>
- <ItemGroup>
- <PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="4.0.1">
- <PrivateAssets>all</PrivateAssets>
- <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
- </PackageReference>
- <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net35" Version="1.0.3">
- <PrivateAssets>all</PrivateAssets>
- <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
- </PackageReference>
- </ItemGroup>
- <PropertyGroup />
- <Import Project="../MonoForFramework.targets" />
- <Target Name="_ResolveCopyLocalNuGetPackagePdbsAndXml" Condition="$(CopyLocalLockFileAssemblies) == true" AfterTargets="ResolveReferences">
- <!-- "Workaround" for missing '.pdb'-Files from NuGet Packages -->
- <!-- https://github.com/dotnet/sdk/issues/1458#issuecomment-420456386 -->
- <ItemGroup>
- <ReferenceCopyLocalPaths Include="@(ReferenceCopyLocalPaths->'%(RootDir)%(Directory)%(Filename).pdb')" Condition="'%(ReferenceCopyLocalPaths.NuGetPackageId)' != '' and Exists('%(RootDir)%(Directory)%(Filename).pdb')"/>
- <ReferenceCopyLocalPaths Include="@(ReferenceCopyLocalPaths->'%(RootDir)%(Directory)%(Filename).xml')" Condition="'%(ReferenceCopyLocalPaths.NuGetPackageId)' != '' and Exists('%(RootDir)%(Directory)%(Filename).xml')"/>
+ log4net is designed with two distinct goals in mind: speed and flexibility
+ </Description>
+ <Platforms>AnyCPU</Platforms>
+ <TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
+ <Configurations>Debug;Release</Configurations>
+ <RootNamespace>log4net</RootNamespace>
+ <AssemblyName>log4net</AssemblyName>
+ <ProjectType>Local</ProjectType>
+ <OutputType>Library</OutputType>
+ <MapFileExtensions>true</MapFileExtensions>
+ <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+ <SignAssembly>true</SignAssembly>
+ <AssemblyOriginatorKeyFile>..\..\log4net.snk</AssemblyOriginatorKeyFile>
+ <GenerateDocumentationFile>true</GenerateDocumentationFile>
+ <OutputPath>..\..\build\$(Configuration)</OutputPath>
+ <PackageOutputPath>..\..\build\artifacts</PackageOutputPath>
+ <DocumentationFile>..\..\build\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
+ <AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
+ </PropertyGroup>
+ <PropertyGroup Label="NuGet generation">
+ <Authors>The Apache Software Foundation</Authors>
+ <Copyright>Copyright 2004-2024 The Apache Software Foundation</Copyright>
+ <DevelopmentDependency>false</DevelopmentDependency>
+ <GeneratePackageOnBuild>false</GeneratePackageOnBuild>
+ <PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
+ <PackageProjectUrl>https://logging.apache.org/log4net/</PackageProjectUrl>
+ <PackageIcon>package-icon.png</PackageIcon>
+ <PackageTags>logging log tracing logfiles</PackageTags>
+ <RepositoryType>git</RepositoryType>
+ <RepositoryUrl>https://github.com/apache/logging-log4net</RepositoryUrl>
+ <Owners>Apache Logging Project</Owners>
+ <PackageVersion>$(Version)</PackageVersion>
+ </PropertyGroup>
+ <PropertyGroup>
+ <BaseAddress>285212672</BaseAddress>
+ <DebugType>portable</DebugType>
+ <Deterministic>true</Deterministic>
+ <FileAlignment>4096</FileAlignment>
+ <PackageReadmeFile>README.md</PackageReadmeFile>
+ <RegisterForComInterop>false</RegisterForComInterop>
+ <RemoveIntegerChecks>false</RemoveIntegerChecks>
+ <RepositoryType>git</RepositoryType>
+ <RepositoryUrl>https://github.com/apache/logging-log4net</RepositoryUrl>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)'=='Debug' ">
+ <DefineConstants>TRACE;DEBUG;$(DefineConstants)</DefineConstants>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)'=='Release' ">
+ <DefineConstants>TRACE;STRONG;$(DefineConstants)</DefineConstants>
+ <DebugType>none</DebugType>
+ <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
+ </PropertyGroup>
+ <PropertyGroup />
+ <ItemGroup Condition="'$(TargetFramework)'=='net462'">
+ <Reference Update="System">
+ <Name>System</Name>
+ </Reference>
+ <Reference Include="System.Configuration" />
+ <Reference Include="System.Web">
+ <Name>System.Web</Name>
+ </Reference>
+ <Reference Update="System.Data">
+ <Name>System.Data</Name>
+ </Reference>
+ <Reference Update="System.Xml">
+ <Name>System.XML</Name>
+ </Reference>
</ItemGroup>
- </Target>
-</Project>
+ <ItemGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
+ <PackageReference Include="System.Configuration.ConfigurationManager" Version="4.5.0" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\log4net.snk">
+ <Link>log4net.snk</Link>
+ </None>
+ <None Include="..\..\README.md" Pack="true" PackagePath="\" />
+ </ItemGroup>
+ <ItemGroup Label="Packaging">
+ <Content Include="..\..\package-icon.png" PackagePath="package-icon.png">
+ <Link>package-icon.png</Link>
+ </Content>
+ </ItemGroup>
+ <ItemGroup>
+ <PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="4.0.1">
+ <PrivateAssets>all</PrivateAssets>
+ <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+ </PackageReference>
+ </ItemGroup>
+ <Import Project="../MonoForFramework.targets" />
+ <Target Name="_ResolveCopyLocalNuGetPackagePdbsAndXml" Condition="$(CopyLocalLockFileAssemblies) == true" AfterTargets="ResolveReferences">
+ <!-- "Workaround" for missing '.pdb'-Files from NuGet Packages -->
+ <!-- https://github.com/dotnet/sdk/issues/1458#issuecomment-420456386 -->
+ <ItemGroup>
+ <ReferenceCopyLocalPaths Include="@(ReferenceCopyLocalPaths->'%(RootDir)%(Directory)%(Filename).pdb')" Condition="'%(ReferenceCopyLocalPaths.NuGetPackageId)' != '' and Exists('%(RootDir)%(Directory)%(Filename).pdb')" />
+ <ReferenceCopyLocalPaths Include="@(ReferenceCopyLocalPaths->'%(RootDir)%(Directory)%(Filename).xml')" Condition="'%(ReferenceCopyLocalPaths.NuGetPackageId)' != '' and Exists('%(RootDir)%(Directory)%(Filename).xml')" />
+ </ItemGroup>
+ </Target>
+</Project>
\ No newline at end of file
diff --git a/src/site/xdoc/download_log4net.xml b/src/site/xdoc/download_log4net.xml
index 45fcd91..804ceee 100644
--- a/src/site/xdoc/download_log4net.xml
+++ b/src/site/xdoc/download_log4net.xml
@@ -16,78 +16,78 @@
limitations under the License.
-->
<document>
- <properties>
- <title>Download Apache log4net</title>
- </properties>
+ <properties>
+ <title>Download Apache log4net</title>
+ </properties>
- <body>
- <section name="Download Apache log4net™">
+ <body>
+ <section name="Download Apache log4net™">
- <p>Apache log4net is distributed under the <a href="http://www.apache.org/licenses/LICENSE-2.0.html">Apache License, version 2.0</a>.</p>
+ <p>Apache log4net is distributed under the <a href="http://www.apache.org/licenses/LICENSE-2.0.html">Apache License, version 2.0</a>.</p>
- <p>Starting with log4net 1.2.11 log4net is available as source only or binary only release.</p>
+ <p>Starting with log4net 1.2.11 log4net is available as source only or binary only release.</p>
- <p>Users who download the ZIP files to Windows may need to unblock the archive (right click on the ZIP and press the "Unblock" button) before extracting it.</p>
+ <p>Users who download the ZIP files to Windows may need to unblock the archive (right click on the ZIP and press the "Unblock" button) before extracting it.</p>
+ </section>
+
+ <section name="log4net 3.0.0">
+
+ <subsection name="Source">
+ <table>
+ <tr>
+ <td><a href="https://downloads.apache.org/logging/log4net/source/apache-log4net-source-3.0.0.zip">apache-log4net-source-3.0.0.zip</a></td>
+ <td><a href="https://downloads.apache.org/logging/log4net/source/apache-log4net-source-3.0.0.zip.sha512">sha512</a></td>
+ <td><a href="https://downloads.apache.org/logging/log4net/source/apache-log4net-source-3.0.0.zip.asc">pgp</a></td>
+ </tr>
+ </table>
+ </subsection>
+
+ <subsection name="Binaries">
+ <p>Binaries are available in a zip file or nupkg, which is also available from <a href="https://www.nuget.org/packages/log4net/">nuget.org</a></p>
+ <table>
+ <tr>
+ <td><a href="https://downloads.apache.org/logging/log4net/binaries/apache-log4net-binaries-3.0.0.zip">log4net-binaries-3.0.0.zip</a></td>
+ <td><a href="https://downloads.apache.org/logging/log4net/binaries/apache-log4net-binaries-3.0.0.zip.sha512">sha512</a></td>
+ <td><a href="https://downloads.apache.org/logging/log4net/binaries/apache-log4net-binaries-3.0.0.zip.asc">pgp</a></td>
+ </tr>
+ <tr>
+ <td><a href="https://downloads.apache.org/logging/log4net/binaries/apache-log4net.3.0.0.nupkg">log4net-3.0.0.nupkg</a></td>
+ <td><a href="https://downloads.apache.org/logging/log4net/binaries/apache-log4net.3.0.0.nupkg.sha512">sha512</a></td>
+ <td><a href="https://downloads.apache.org/logging/log4net/binaries/apache-log4net.3.0.0.nupkg.asc">pgp</a></td>
+ </tr>
+ </table>
+ </subsection>
+
+ </section>
+
+ <section name="Keys">
+ <p>The <a href="http://www.apache.org/dist/logging/log4net/KEYS">KEYS</a> link links to the code signing keys used to sign the product.
+ The <code>PGP</code> link downloads the OpenPGP compatible signature from our main site.</p>
+ </section>
+
+ <section name="Archives">
+ <p>Release 1.2.11 and all more recent releases are available
+ from the Apache Software Foundation's <a
+ href="http://archive.apache.org/dist/logging/log4net/">distribution
+ archive</a>.</p>
+
+ <p>The 1.2.10 and 1.2.9 releases have been created while log4net
+ was still undergoing incubation and those releases are available
+ from the <a href="http://archive.apache.org/dist/incubator/log4net/">distribution archive</a>
+ for the Incubator project.</p>
+
+ <p>Previous releases of log4net are available from the
+ <a href="http://sourceforge.net/project/showfiles.php?group_id=31983&release_id=171808">SourceForge Project Site</a>.</p>
+ </section>
+ </body>
+
+ <section name="Verify Releases">
+
+ <p>It is essential that you verify the integrity of the downloaded files using the GPG signature.</p>
+
+ <p>Please read <a
+ href="http://httpd.apache.org/dev/verification.html">Verifying Apache HTTP Server Releases</a> for more information on why you should verify our releases.
+ The PGP keys used to sign our distributions are part of the <a href="http://www.apache.org/dist/logging/log4net/KEYS">KEYS file</a>.</p>
</section>
-
- <section name="log4net 2.0.17">
-
- <subsection name="Source">
- <table>
- <tr>
- <td><a href="https://downloads.apache.org/logging/log4net/source/apache-log4net-source-2.0.17.zip">apache-log4net-source-2.0.17.zip</a></td>
- <td><a href="https://downloads.apache.org/logging/log4net/source/apache-log4net-source-2.0.17.zip.sha512">sha512</a></td>
- <td><a href="https://downloads.apache.org/logging/log4net/source/apache-log4net-source-2.0.17.zip.asc">pgp</a></td>
- </tr>
- </table>
- </subsection>
-
- <subsection name="Binaries">
- <p>Binaries are available in a zip file or nupkg, which is also available from <a href="https://www.nuget.org/packages/log4net/">nuget.org</a></p>
- <table>
- <tr>
- <td><a href="https://downloads.apache.org/logging/log4net/binaries/apache-log4net-binaries-2.0.17.zip">log4net-binaries-2.0.17.zip</a></td>
- <td><a href="https://downloads.apache.org/logging/log4net/binaries/apache-log4net-binaries-2.0.17.zip.sha512">sha512</a></td>
- <td><a href="https://downloads.apache.org/logging/log4net/binaries/apache-log4net-binaries-2.0.17.zip.asc">pgp</a></td>
- </tr>
- <tr>
- <td><a href="https://downloads.apache.org/logging/log4net/binaries/apache-log4net.2.0.17.nupkg">log4net-2.0.17.nupkg</a></td>
- <td><a href="https://downloads.apache.org/logging/log4net/binaries/apache-log4net.2.0.17.nupkg.sha512">sha512</a></td>
- <td><a href="https://downloads.apache.org/logging/log4net/binaries/apache-log4net.2.0.17.nupkg.asc">pgp</a></td>
- </tr>
- </table>
- </subsection>
-
- </section>
-
- <section name="Keys">
- <p>The <a href="http://www.apache.org/dist/logging/log4net/KEYS">KEYS</a> link links to the code signing keys used to sign the product.
- The <code>PGP</code> link downloads the OpenPGP compatible signature from our main site.</p>
- </section>
-
- <section name="Archives">
- <p>Release 1.2.11 and all more recent releases are available
- from the Apache Software Foundation's <a
- href="http://archive.apache.org/dist/logging/log4net/">distribution
- archive</a>.</p>
-
- <p>The 1.2.10 and 1.2.9 releases have been created while log4net
- was still undergoing incubation and those releases are available
- from the <a href="http://archive.apache.org/dist/incubator/log4net/">distribution archive</a>
- for the Incubator project.</p>
-
- <p>Previous releases of log4net are available from the
- <a href="http://sourceforge.net/project/showfiles.php?group_id=31983&release_id=171808">SourceForge Project Site</a>.</p>
- </section>
- </body>
-
- <section name="Verify Releases">
-
- <p>It is essential that you verify the integrity of the downloaded files using the GPG signature.</p>
-
- <p>Please read <a
- href="http://httpd.apache.org/dev/verification.html">Verifying Apache HTTP Server Releases</a> for more information on why you should verify our releases.
- The PGP keys used to sign our distributions are part of the <a href="http://www.apache.org/dist/logging/log4net/KEYS">KEYS file</a>.</p>
- </section>
-</document>
+</document>
\ No newline at end of file
diff --git a/src/site/xdoc/release/building.xml b/src/site/xdoc/release/building.xml
index f4c21a2..5b9e3a4 100644
--- a/src/site/xdoc/release/building.xml
+++ b/src/site/xdoc/release/building.xml
@@ -17,18 +17,18 @@
-->
<document>
- <properties>
- <author email="nicko at apache dot org">Nicko Cadell</author>
- <title>Apache log4net: Building log4net</title>
- </properties>
+ <properties>
+ <author email="nicko at apache dot org">Nicko Cadell</author>
+ <title>Apache log4net: Building log4net</title>
+ </properties>
- <meta name="keywords" content="building log4net, log4net" />
+ <meta name="keywords" content="building log4net, log4net" />
- <body>
- <section id="main" name="Building Apache log4net™">
- <p>
- see <a href="https://github.com/apache/logging-log4net/blob/master/doc/BUILDING.md">BUILDING.md</a>
- </p>
- </section>
- </body>
-</document>
+ <body>
+ <section id="main" name="Building Apache log4net™">
+ <p>
+ see <a href="https://github.com/apache/logging-log4net/blob/master/doc/BUILDING.md">BUILDING.md</a>
+ </p>
+ </section>
+ </body>
+</document>
\ No newline at end of file
diff --git a/src/site/xdoc/release/example-apps.xml b/src/site/xdoc/release/example-apps.xml
index 73329a8..4a883e3 100644
--- a/src/site/xdoc/release/example-apps.xml
+++ b/src/site/xdoc/release/example-apps.xml
@@ -16,18 +16,18 @@
limitations under the License.
-->
<document>
- <properties>
- <author email="nicko at apache dot org">Nicko Cadell</author>
- <title>Apache log4net: Examples</title>
- </properties>
+ <properties>
+ <author email="nicko at apache dot org">Nicko Cadell</author>
+ <title>Apache log4net: Examples</title>
+ </properties>
- <meta name="keywords" content="log4net examples, log4net" />
-
- <body>
- <section id="main" name="Apache log4net™ Examples">
- <p>
- The examples can be found at <a href="https://github.com/apache/logging-log4net/tree/master/examples">examples</a>
- </p>
- </section>
- </body>
+ <meta name="keywords" content="log4net examples, log4net" />
+
+ <body>
+ <section id="main" name="Apache log4net™ Examples">
+ <p>
+ The examples can be found at <a href="https://github.com/apache/logging-log4net/tree/master/examples">examples</a>
+ </p>
+ </section>
+ </body>
</document>
\ No newline at end of file
diff --git a/src/site/xdoc/release/faq.xml b/src/site/xdoc/release/faq.xml
index c23931e..25d36fd 100644
--- a/src/site/xdoc/release/faq.xml
+++ b/src/site/xdoc/release/faq.xml
@@ -17,151 +17,176 @@
-->
<document>
- <properties>
- <author email="nicko at apache dot org">Nicko Cadell</author>
- <title>Apache log4net: Frequently Asked Questions</title>
- </properties>
+ <properties>
+ <author email="nicko at apache dot org">Nicko Cadell</author>
+ <title>Apache log4net: Frequently Asked Questions</title>
+ </properties>
- <meta name="keywords" content="log4net frequently asked questions, log4net faq, log4net" />
+ <meta name="keywords" content="log4net frequently asked questions, log4net faq, log4net" />
- <body>
- <a name="top">
- </a>
- <section id="main" name="Apache log4net™ Frequently Asked Questions">
- <section id="information" name="Information">
-
- <section id="what-is-log4net" name="What is log4net?">
- <p>
- log4net is a tool to help the programmer output log statements to a variety of
- output targets.
- </p>
- <p>
- In case of problems with an application, it is helpful to enable logging so
- that the problem can be located. With log4net it is possible to enable logging at
- runtime without modifying the application binary. The log4net package is designed
- so that log statements can remain in <i>production</i> code without incurring a
- high performance cost. It follows that the speed of logging (or rather not
- logging) is crucial.
- </p>
- <p>
- At the same time, log output can be so voluminous that it quickly becomes
- overwhelming. One of the distinctive features of log4net (and common to all of
- the log4x libraries) is the notion of <i>hierarchical
- loggers</i>. Using these loggers it is possible to selectively control
- which log statements are output at arbitrary granularity.
- </p>
- <p>
- log4net is designed with two distinct goals in mind: speed and flexibility. There
- is a tight balance between these two requirements.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
+ <body>
+ <a name="top">
+ </a>
+ <section id="main" name="Apache log4net™ Frequently Asked Questions">
+ <section id="information" name="Information">
+
+ <section id="what-is-log4net" name="What is log4net?">
+ <p>
+ log4net is a tool to help the programmer output log statements to a variety of
+ output targets.
+ </p>
+ <p>
+ In case of problems with an application, it is helpful to enable logging so
+ that the problem can be located. With log4net it is possible to enable logging at
+ runtime without modifying the application binary. The log4net package is designed
+ so that log statements can remain in <i>production</i> code without incurring a
+ high performance cost. It follows that the speed of logging (or rather not
+ logging) is crucial.
+ </p>
+ <p>
+ At the same time, log output can be so voluminous that it quickly becomes
+ overwhelming. One of the distinctive features of log4net (and common to all of
+ the log4x libraries) is the notion of <i>
+ hierarchical
+ loggers
+ </i>. Using these loggers it is possible to selectively control
+ which log statements are output at arbitrary granularity.
+ </p>
+ <p>
+ log4net is designed with two distinct goals in mind: speed and flexibility. There
+ is a tight balance between these two requirements.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
- <section id="reliability" name="Is log4net a reliable logging system?">
- <p>
- No. log4net is not reliable. It is a best-effort and <em>fail-stop</em> logging system.
- </p>
- <p>
- By fail-stop, we mean that log4net will not throw unexpected exceptions at
- run-time potentially causing your application to crash. <b>If for any reason, log4net
- throws an uncaught exception</b> (except for <span class="code">ArgumentException</span> and
- <span class="code">ArgumentNullException</span> which may be thrown), <b>please send an email
- to the <a href="mailto:log4net-user@logging.apache.org">
- log4net-user@logging.apache.org</a> mailing list</b>. Uncaught exceptions
- are handled as serious bugs requiring immediate attention.
- </p>
- <p>
- Moreover, log4net will not revert to <span class="code">System.Console.Out</span>
- or <span class="code">System.Console.Error</span> when its designated
- output stream is not opened, is not writable or becomes full. This avoids
- corrupting an otherwise working program by flooding the user's terminal because
- logging fails. However, log4net will output a single message to
- <span class="code">System.Console.Error</span> and <span>System.Diagnostics.Trace</span>
- indicating that logging can not be performed.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
+ <section id="reliability" name="Is log4net a reliable logging system?">
+ <p>
+ No. log4net is not reliable. It is a best-effort and <em>fail-stop</em> logging system.
+ </p>
+ <p>
+ By fail-stop, we mean that log4net will not throw unexpected exceptions at
+ run-time potentially causing your application to crash. <b>
+ If for any reason, log4net
+ throws an uncaught exception
+ </b> (except for <span class="code">ArgumentException</span> and
+ <span class="code">ArgumentNullException</span> which may be thrown), <b>
+ please send an email
+ to the <a href="mailto:log4net-user@logging.apache.org">
+ log4net-user@logging.apache.org
+ </a> mailing list
+ </b>. Uncaught exceptions
+ are handled as serious bugs requiring immediate attention.
+ </p>
+ <p>
+ Moreover, log4net will not revert to <span class="code">System.Console.Out</span>
+ or <span class="code">System.Console.Error</span> when its designated
+ output stream is not opened, is not writable or becomes full. This avoids
+ corrupting an otherwise working program by flooding the user's terminal because
+ logging fails. However, log4net will output a single message to
+ <span class="code">System.Console.Error</span> and <span>System.Diagnostics.Trace</span>
+ indicating that logging can not be performed.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
- <section id="prerequisites" name="What are the prerequisites for log4net?">
- <p>
- log4net runs on many different frameworks and each framework has its own requirements.
- As a rule of thumb you will need an ECMA-335 compliant CLI runtime, for example,
- the Microsoft® .NET runtime 1.0 (1.0.3705) or 1.1 (1.1.4322).
- </p>
- <p>
- Not all frameworks are created equal and some features have been excluded from
- some of the builds. See the <a href="framework-support.html">Framework Support</a>
- document for more information.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
+ <section id="prerequisites" name="What are the prerequisites for log4net?">
+ <p>
+ log4net runs on net462 or higher and any framework supporting netstandard2.0.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
- <section id="examples" name="Is there example code for using log4net?">
- <p>
- There is a directory containing examples in <span class="code">log4net\examples</span>.
- The examples are broken down by framework.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
+ <section id="examples" name="Is there example code for using log4net?">
+ <p>
+ There is a directory containing examples in <span class="code">log4net\examples</span>.
+ The examples are broken down by framework.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
- <section id="features" name="What are the features of log4net?">
- <ul>
- <li>
- log4net is optimized for speed.</li>
- <li>
- log4net is based on a named logger hierarchy.</li>
- <li>
- log4net is fail-stop but not reliable.</li>
- <li>
- log4net is thread-safe.</li>
- <li>
- log4net is not restricted to a predefined set of facilities.</li>
- <li>
- Logging behavior can be set at runtime using a configuration file.
- Configuration files are in XML format.</li>
- <li>
- log4net is designed to handle exceptions from the start.</li>
- <li>
- log4net can direct its output to many sinks including: a file, the console, the NT EventLog or even e-mail.</li>
- <li>
- log4net categorizes logging into levels: DEBUG, INFO, WARN, ERROR and FATAL.</li>
- <li>
- The format of the log output can be easily changed by implementing a new layout class.</li>
- <li>
- The target of the log output as well as the writing strategy can be altered by
- writing a new appender class.</li>
- <li>
- log4net supports multiple output appenders per logger.</li>
- </ul>
- <p>
- See the <a href="features.html">features</a> overview document for more information on the features of log4net.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
+ <section id="features" name="What are the features of log4net?">
+ <ul>
+ <li>
+ log4net is optimized for speed.
+ </li>
+ <li>
+ log4net is based on a named logger hierarchy.
+ </li>
+ <li>
+ log4net is fail-stop but not reliable.
+ </li>
+ <li>
+ log4net is thread-safe.
+ </li>
+ <li>
+ log4net is not restricted to a predefined set of facilities.
+ </li>
+ <li>
+ Logging behavior can be set at runtime using a configuration file.
+ Configuration files are in XML format.
+ </li>
+ <li>
+ log4net is designed to handle exceptions from the start.
+ </li>
+ <li>
+ log4net can direct its output to many sinks including: a file, the console, the NT EventLog or even e-mail.
+ </li>
+ <li>
+ log4net categorizes logging into levels: DEBUG, INFO, WARN, ERROR and FATAL.
+ </li>
+ <li>
+ The format of the log output can be easily changed by implementing a new layout class.
+ </li>
+ <li>
+ The target of the log output as well as the writing strategy can be altered by
+ writing a new appender class.
+ </li>
+ <li>
+ log4net supports multiple output appenders per logger.
+ </li>
+ </ul>
+ <p>
+ See the <a href="features.html">features</a> overview document for more information on the features of log4net.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
- <section id="thread-safe" name="Is log4net thread-safe?">
- <p>
- Yes, log4net is thread-safe.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
+ <section id="thread-safe" name="Is log4net thread-safe?">
+ <p>
+ Yes, log4net is thread-safe.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
- <section id="output" name="What does log output look like?">
- <p>
- The log output can be customized in many ways. Moreover, one can completely
- override the output format by implementing one's own <span class="code">ILayout</span>
- </p>
- <p>
- Here is an example output using <span class="code">PatternLayout</span> with the conversion
- pattern <span class="code">%timestamp [%thread] %-5level %logger{2} %ndc - %message%newline</span>
- </p>
- <source language="text"><![CDATA[
+ <section id="output" name="What does log output look like?">
+ <p>
+ The log output can be customized in many ways. Moreover, one can completely
+ override the output format by implementing one's own <span class="code">ILayout</span>
+ </p>
+ <p>
+ Here is an example output using <span class="code">PatternLayout</span> with the conversion
+ pattern <span class="code">%timestamp [%thread] %-5level %logger{2} %ndc - %message%newline</span>
+ </p>
+ <source language="text">
+ <![CDATA[
176 [main] INFO examples.Sort - Populating an array of 2 elements in reverse order.
225 [main] INFO examples.SortAlgo - Entered the sort method.
262 [main] DEBUG SortAlgo.OUTER i=1 - Outer loop.
@@ -172,502 +197,495 @@
331 [main] INFO SortAlgo.DUMP - Element [1] = 1
343 [main] INFO examples.Sort - The next log statement should be an error message.
346 [main] ERROR SortAlgo.DUMP - Tried to dump an uninitialized array.
-467 [main] INFO examples.Sort - Exiting main method.]]></source>
- <p>
- The first field is the number of milliseconds elapsed since the start of the
- program. The second field is the thread outputting the log statement. The third
- field is the level of the log statement. The fourth field is the rightmost
- two components of the name of the logger making the log request. The fifth field (just
- before the '-') is the <em>nested diagnostic context</em> (<span class="code">NDC</span>). Note the
- nested diagnostic context may be empty as in the first two statements. The text
- after the '-' is the message of the statement.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
+467 [main] INFO examples.Sort - Exiting main method.]]>
+ </source>
+ <p>
+ The first field is the number of milliseconds elapsed since the start of the
+ program. The second field is the thread outputting the log statement. The third
+ field is the level of the log statement. The fourth field is the rightmost
+ two components of the name of the logger making the log request. The fifth field (just
+ before the '-') is the <em>nested diagnostic context</em> (<span class="code">NDC</span>). Note the
+ nested diagnostic context may be empty as in the first two statements. The text
+ after the '-' is the message of the statement.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
- <section id="loggers" name="What are Loggers?">
- <p>
- The logger concept lies at the heart of log4net's configuration. Loggers are organized into a
- hierarchy and give the programmer <em>run-time</em> control on which logging statements
- are printed or not.
- </p>
- <p>
- Loggers are assigned levels through the configuration of log4net. A log statement is
- routed through to the appender depending on its level <em>and</em> its logger.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
-
-
- <section id="contributing" name="Why should I donate my extensions to log4net back to the project?">
- <p>
- Contrary to the GNU Public License (GPL) the Apache Software License does not
- make any claims over your extensions. By extensions, we mean totally new code
- that invokes existing log4net code. <em>You are free to do whatever you wish with
- your proprietary log4net extensions.</em> In particular, you may choose to
- never release your extensions to the wider public. For details see the
- <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.
- </p>
- <p>
- We are very careful not to unnecessarily change the log4net client API so that newer log4net
- releases are backward compatible with previous versions. We are a lot less
- scrupulous with the internal log4net API. Thus, if your extension is designed to
- work with the internals of a specific log4net version, then when the next release
- of log4net comes out, you will probably need to adapt your proprietary extensions to the
- new release. Thus, you will be forced to spend precious resources in order to
- keep up with log4net changes. This is commonly referred to as the "stupid-tax".
- By donating the code and making it part of the standard distribution, you save
- yourself the unnecessary maintenance work.
- </p>
- <p>
- If your extensions are useful then someone will eventually write an extension
- providing the same or very similar functionality. Your development effort will
- be wasted.
- </p>
- <p>
- Unless the proprietary log4net extension is business critical, there is little
- reason for not donating your extensions back to the project.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
+ <section id="loggers" name="What are Loggers?">
+ <p>
+ The logger concept lies at the heart of log4net's configuration. Loggers are organized into a
+ hierarchy and give the programmer <em>run-time</em> control on which logging statements
+ are printed or not.
+ </p>
+ <p>
+ Loggers are assigned levels through the configuration of log4net. A log statement is
+ routed through to the appender depending on its level <em>and</em> its logger.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
- <section id="contributing-guidelines" name="What should I keep in mind when contributing code?">
- <ol>
- <li>
- Stick to the existing indentation style even if you hate it.
- <p>
- Alternating between indentation styles makes it hard to understand the source
- code. Make it hard on yourself but easier on others.
- </p>
- </li>
- <li>
- <b>Thoroughly test your code.</b>
- <p>
- There is nothing more irritating than finding the bugs in debugging (i.e. logging) code.
- </p>
- </li>
- <li>
- Keep it simple, small and fast.
- <p>
- It's all about the application not about logging.
- </p>
- </li>
- <li>
- Did I mention sticking with the indentation style?</li>
- </ol>
- </section>
- <p><a href="#top">Back to Top</a></p>
-
-
- <section id="history" name="What is the history of log4net?">
- <p>
- log4net is a port of the popular <a href="http://logging.apache.org/log4j/">Apache log4j™</a> logging library.
- The initial port was done in June 2001, since then we have tried to remain in the
- spirit of the original log4j. See the log4net <a href="../history.html">history</a> page for more details.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
-
-
- <section id="download" name="Where can I find the latest distribution of log4net?">
- <p>
- The log4net <a href="http://logging.apache.org/log4net/">home page</a> is a good place to start.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
-
- <section id="two-snks"
- name="Why are there two different strong name keys?">
- <p>
- Starting with log4net 1.2.11 there are two
- different binary distributions,
- <code>oldkey</code> and <code>newkey</code>.
- </p>
-
- <p>
- The <code>oldkey</code> distribution contains
- assemblies signed with the same strong name key
- that was used to sign the assemblies of log4net
- 1.2.10 and earlier. This strong name key is only
- available to log4net developers.
- </p>
-
- <p>
- The <code>newkey</code> distribution contains
- assemblies signed with the strong name key
- available from <a
- href="https://svn.apache.org/repos/asf/logging/log4net/trunk/log4net.snk">log4net's
- svn area</a> or inside the source distribution.
- Everybody can create assemblies that have the same
- strong name.
- </p>
-
- <p>
- For open source projects it is important that you
- can create your own patched version of a product
- and use it instead of the official release. This
- is something that is now possible if the
- <code>newkey</code> is used throughout.
- </p>
-
- <p>
- The <code>oldkey</code> distribution is mostly
- only for people who work with third-party
- dependencies that require one of the earlier
- releases of log4net and can't be recompiled to use
- the new strong name. If you start a new project
- or can recompile all your dependencies we strongly
- recommend you use the <code>newkey</code>
- assemblies.
- </p>
-
- <p>
- If you are creating an assembly that is likely to
- be combined with other assemblies that depend on
- the old strong name, then it is better you use the
- oldkey assemblies as well.
- </p>
-
- <p>
- We currently plan to distribute the new-key
- assembly under a different name while providing
- old and newkey <code>log4net.dll</code> assemblies
- holding type forwards to the new assembly. This
- may create a cleaner migration path for projects
- that have dependencies using both versions.
- At the moment such projects will either need to
- use the GAC or create sub-directories inside the
- application directory and configure assembly
- probing with a <code>privatePath</code>.
- </p>
-
- <p>
- Note that the "new" strong name no longer provides
- any kind of authenticity. If you want to be sure
- you have the "real" Apache log4net, download the binary
- release from one of the mirrors and verify the PGP
- signature.
- </p>
-
- </section>
- <p><a href="#top">Back to Top</a></p>
-
- </section>
-
- <section id="configuration" name="Configuration">
-
- <section id="dynamic" name="How can I change log behavior at runtime?">
- <p>
- Logging behavior can be set using configuration files which are parsed at runtime.
- Using configuration files the programmer can define loggers and set their
- levels.
- </p>
- <p>
- Configuration files are specified in XML. See <span class="code">log4net.Config.XmlConfigurator</span>
- for more details.
- </p>
- <p>
- See the various <span class="code">log4net.Layout</span> and <span class="code">log4net.Appender</span>
- components for specific configuration options.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
+ <section id="contributing" name="Why should I donate my extensions to log4net back to the project?">
+ <p>
+ Contrary to the GNU Public License (GPL) the Apache Software License does not
+ make any claims over your extensions. By extensions, we mean totally new code
+ that invokes existing log4net code. <em>
+ You are free to do whatever you wish with
+ your proprietary log4net extensions.
+ </em> In particular, you may choose to
+ never release your extensions to the wider public. For details see the
+ <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.
+ </p>
+ <p>
+ We are very careful not to unnecessarily change the log4net client API so that newer log4net
+ releases are backward compatible with previous versions. We are a lot less
+ scrupulous with the internal log4net API. Thus, if your extension is designed to
+ work with the internals of a specific log4net version, then when the next release
+ of log4net comes out, you will probably need to adapt your proprietary extensions to the
+ new release. Thus, you will be forced to spend precious resources in order to
+ keep up with log4net changes. This is commonly referred to as the "stupid-tax".
+ By donating the code and making it part of the standard distribution, you save
+ yourself the unnecessary maintenance work.
+ </p>
+ <p>
+ If your extensions are useful then someone will eventually write an extension
+ providing the same or very similar functionality. Your development effort will
+ be wasted.
+ </p>
+ <p>
+ Unless the proprietary log4net extension is business critical, there is little
+ reason for not donating your extensions back to the project.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
- <section id="runtime-disable" name="How do I completely disable all logging at runtime?">
- <p>
- Setting the <span class="code">Threshold</span> on the Hierarchy to Level OFF will disable all
- logging from that Hierarchy. This can be done in the log4net configuration file
- by setting the "threshold" attribute on the log4net configuration element to "OFF".
- For example:
- </p>
- <source language="xml"><![CDATA[
-<log4net threshold="OFF" />]]></source>
- </section>
- <p><a href="#top">Back to Top</a></p>
-
- <section id="appender-options" name="What are the configurable options for an appender?">
- <p>
- log4net uses public properties to configure components such as
- Appenders, Layouts, Loggers etc.
- </p>
- <p>
- Thus, any writable public property in on the appender corresponds to a
- configurable option. For example, in <span class="code">RollingFileAppender</span> the
- <span class="code">public int MaxSizeRollBackups { set; }</span> property corresponds to
- the <span class="code">MaxSizeRollBackups</span> option.
- </p>
- <p>
- Layouts options are also defined by their writable properties. Same goes for most
- other log4net components.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
-
-
- <section id="appender-level" name="Is it possible to direct log output to different appenders by level?">
- <p>
- Yes it is. Setting the <span class="code">Threshold</span> option of any appender extending
- <span class="code">AppenderSkeleton</span>, (most log4net appenders extend
- <span class="code">AppenderSkeleton</span>) will filter out all log events
- with a <em>lower</em> level than the value of the threshold option.
- </p>
- <p>
- For example, setting the threshold of an appender to DEBUG will also allow INFO,
- WARN, ERROR and FATAL messages to log along with DEBUG messages. (DEBUG is the
- lowest level). This is usually acceptable as there is little use for DEBUG
- messages without the surrounding INFO, WARN, ERROR and FATAL messages.
- Similarly, setting the threshold of an appender to ERROR will filter out DEBUG,
- INFO and WARN messages but not ERROR or FATAL messages.
- </p>
- <p>
- This policy usually best encapsulates what the user actually wants to do, as
- opposed to her mind-projected solution.
- </p>
- <p>
- If you must filter events by exact level match, then you can attach a
- <span class="code">LevelMatchFilter</span> to any appender to filter out logging
- events by exact level match.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
-
-
- <section id="config-reload" name="Is there a way to get log4net to automatically reload a configuration file if it changes?">
- <p>
- Yes. The <span class="code">XmlConfigurator</span> supports automatic
- reloading through the <span class="code">ConfigureAndWatch</span> APIs. See the API
- documentation for more details.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
+ <section id="contributing-guidelines" name="What should I keep in mind when contributing code?">
+ <ol>
+ <li>
+ Stick to the existing indentation style even if you hate it.
+ <p>
+ Alternating between indentation styles makes it hard to understand the source
+ code. Make it hard on yourself but easier on others.
+ </p>
+ </li>
+ <li>
+ <b>Thoroughly test your code.</b>
+ <p>
+ There is nothing more irritating than finding the bugs in debugging (i.e. logging) code.
+ </p>
+ </li>
+ <li>
+ Keep it simple, small and fast.
+ <p>
+ It's all about the application not about logging.
+ </p>
+ </li>
+ <li>
+ Did I mention sticking with the indentation style?
+ </li>
+ </ol>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
- <section id="appender-assembly" name="Can I load an appender from another assembly?">
- <p>
- Yes. When specifying the type in the configuration file you can give the assembly
- qualified name of the type. For example:
- </p>
- <source language="xml"><![CDATA[
-<appender name="..." type="MyNamespace.MyAppender, MyAssembly">]]></source>
- <p>
- The .NET runtime will try to locate the assembly called <i>MyAssembly</i>.
- How .NET locates assemblies is beyond the scope of this FAQ.
- </p>
- <p>
- When loading an assembly from the GAC the fully qualified assembly name,
- including the version, culture and public key must be specified. This is
- in the standard syntax supported by <span class="code">System.Type.GetType</span>.
- See the next FAQ on how to get the version and public key for an assembly.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
+ <section id="history" name="What is the history of log4net?">
+ <p>
+ log4net is a port of the popular <a href="http://logging.apache.org/log4j/">Apache log4j™</a> logging library.
+ The initial port was done in June 2001, since then we have tried to remain in the
+ spirit of the original log4j. See the log4net <a href="../history.html">history</a> page for more details.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
-
- <section id="assembly-public-key" name="How do I get the Public Key for an assembly?">
- <p>
- The fully qualified name for an assembly includes the version, culture and
- public key. The public key is derived from the strong name used to identify
- the publisher. When referencing an assembly from the GAC the fully qualified
- name must be used. To get the version, culture and public key you can use a
- tool like the excellent .NET Reflector from Lutz Roeder available from
- <a href="http://www.aisto.com/roeder/dotnet">http://www.aisto.com/roeder/dotnet</a>.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
-
-
- <section id="layout-header-xml-newlines" name="How do I insert newlines into the layout header?">
- <p>
- Newlines in the config file need to be escaped using an XML numeric character reference.
- The sequence that represents a CR LF is &#13; &#10;. The following example adds
- a header and footer to the output each followed by a newline.
- </p>
- <source language="xml"><![CDATA[
+
+ <section id="download" name="Where can I find the latest distribution of log4net?">
+ <p>
+ The log4net <a href="http://logging.apache.org/log4net/">home page</a> is a good place to start.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
+
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
+
+ </section>
+
+ <section id="configuration" name="Configuration">
+
+ <section id="dynamic" name="How can I change log behavior at runtime?">
+ <p>
+ Logging behavior can be set using configuration files which are parsed at runtime.
+ Using configuration files the programmer can define loggers and set their
+ levels.
+ </p>
+ <p>
+ Configuration files are specified in XML. See <span class="code">log4net.Config.XmlConfigurator</span>
+ for more details.
+ </p>
+ <p>
+ See the various <span class="code">log4net.Layout</span> and <span class="code">log4net.Appender</span>
+ components for specific configuration options.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
+
+
+ <section id="runtime-disable" name="How do I completely disable all logging at runtime?">
+ <p>
+ Setting the <span class="code">Threshold</span> on the Hierarchy to Level OFF will disable all
+ logging from that Hierarchy. This can be done in the log4net configuration file
+ by setting the "threshold" attribute on the log4net configuration element to "OFF".
+ For example:
+ </p>
+ <source language="xml">
+ <![CDATA[
+<log4net threshold="OFF" />]]>
+ </source>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
+
+ <section id="appender-options" name="What are the configurable options for an appender?">
+ <p>
+ log4net uses public properties to configure components such as
+ Appenders, Layouts, Loggers etc.
+ </p>
+ <p>
+ Thus, any writable public property in on the appender corresponds to a
+ configurable option. For example, in <span class="code">RollingFileAppender</span> the
+ <span class="code">public int MaxSizeRollBackups { set; }</span> property corresponds to
+ the <span class="code">MaxSizeRollBackups</span> option.
+ </p>
+ <p>
+ Layouts options are also defined by their writable properties. Same goes for most
+ other log4net components.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
+
+
+ <section id="appender-level" name="Is it possible to direct log output to different appenders by level?">
+ <p>
+ Yes it is. Setting the <span class="code">Threshold</span> option of any appender extending
+ <span class="code">AppenderSkeleton</span>, (most log4net appenders extend
+ <span class="code">AppenderSkeleton</span>) will filter out all log events
+ with a <em>lower</em> level than the value of the threshold option.
+ </p>
+ <p>
+ For example, setting the threshold of an appender to DEBUG will also allow INFO,
+ WARN, ERROR and FATAL messages to log along with DEBUG messages. (DEBUG is the
+ lowest level). This is usually acceptable as there is little use for DEBUG
+ messages without the surrounding INFO, WARN, ERROR and FATAL messages.
+ Similarly, setting the threshold of an appender to ERROR will filter out DEBUG,
+ INFO and WARN messages but not ERROR or FATAL messages.
+ </p>
+ <p>
+ This policy usually best encapsulates what the user actually wants to do, as
+ opposed to her mind-projected solution.
+ </p>
+ <p>
+ If you must filter events by exact level match, then you can attach a
+ <span class="code">LevelMatchFilter</span> to any appender to filter out logging
+ events by exact level match.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
+
+
+ <section id="config-reload" name="Is there a way to get log4net to automatically reload a configuration file if it changes?">
+ <p>
+ Yes. The <span class="code">XmlConfigurator</span> supports automatic
+ reloading through the <span class="code">ConfigureAndWatch</span> APIs. See the API
+ documentation for more details.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
+
+
+ <section id="appender-assembly" name="Can I load an appender from another assembly?">
+ <p>
+ Yes. When specifying the type in the configuration file you can give the assembly
+ qualified name of the type. For example:
+ </p>
+ <source language="xml">
+ <![CDATA[
+<appender name="..." type="MyNamespace.MyAppender, MyAssembly">]]>
+ </source>
+ <p>
+ The .NET runtime will try to locate the assembly called <i>MyAssembly</i>.
+ How .NET locates assemblies is beyond the scope of this FAQ.
+ </p>
+ <p>
+ When loading an assembly from the GAC the fully qualified assembly name,
+ including the version, culture and public key must be specified. This is
+ in the standard syntax supported by <span class="code">System.Type.GetType</span>.
+ See the next FAQ on how to get the version and public key for an assembly.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
+
+
+ <section id="assembly-public-key" name="How do I get the Public Key for an assembly?">
+ <p>
+ The fully qualified name for an assembly includes the version, culture and
+ public key. The public key is derived from the strong name used to identify
+ the publisher. When referencing an assembly from the GAC the fully qualified
+ name must be used. To get the version, culture and public key you can use a
+ tool like the excellent .NET Reflector from Lutz Roeder available from
+ <a href="http://www.aisto.com/roeder/dotnet">http://www.aisto.com/roeder/dotnet</a>.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
+
+
+ <section id="layout-header-xml-newlines" name="How do I insert newlines into the layout header?">
+ <p>
+ Newlines in the config file need to be escaped using an XML numeric character reference.
+ The sequence that represents a CR LF is &#13; &#10;. The following example adds
+ a header and footer to the output each followed by a newline.
+ </p>
+ <source language="xml">
+ <![CDATA[
<layout type="log4net.Layout.PatternLayout">
<header value="[Header] " />
<footer value="[Footer] " />
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
-</layout>]]></source>
- </section>
- <p><a href="#top">Back to Top</a></p>
-
-
- <section id="pattern-string" name="How do I use a pattern to set the value of a string property?">
- <p>
- Log4net supports a pattern syntax for setting string properties similar to the
- <span class="code">PatternLayout</span> used to format the output messages.
- This pattern syntax can be used by specifying <span class="code">type="log4net.Util.PatternString"</span>
- on the string property in the config file. This tells the config parser to pass the
- value to the <span class="code">PatternString</span> type before converting the result
- to a string. For details on the patterns supported see the <a href="sdk/html/T_log4net_Util_PatternString.htm">
- PatternString SDK Reference</a>.
- </p>
- <p>
- The following example sets the file name for a <span class="code">FileAppender</span> to include the
- current process id by specifying the <span class="code">%processid</span> pattern in the
- <span class="code">File</span> property.
- </p>
- <source language="xml"><![CDATA[
+</layout>]]>
+ </source>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
+
+
+ <section id="pattern-string" name="How do I use a pattern to set the value of a string property?">
+ <p>
+ Log4net supports a pattern syntax for setting string properties similar to the
+ <span class="code">PatternLayout</span> used to format the output messages.
+ This pattern syntax can be used by specifying <span class="code">type="log4net.Util.PatternString"</span>
+ on the string property in the config file. This tells the config parser to pass the
+ value to the <span class="code">PatternString</span> type before converting the result
+ to a string. For details on the patterns supported see the <a href="sdk/html/T_log4net_Util_PatternString.htm">
+ PatternString SDK Reference
+ </a>.
+ </p>
+ <p>
+ The following example sets the file name for a <span class="code">FileAppender</span> to include the
+ current process id by specifying the <span class="code">%processid</span> pattern in the
+ <span class="code">File</span> property.
+ </p>
+ <source language="xml">
+ <![CDATA[
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
<file type="log4net.Util.PatternString" value="log-file-[%processid].txt" />
<layout type="log4net.Layout.PatternLayout" value="%date [%thread] %-5level %logger - %message%newline" />
-</appender>]]></source>
- </section>
- <p><a href="#top">Back to Top</a></p>
-
-
- </section>
+</appender>]]>
+ </source>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
- <section id="implementing" name="Implementing Logging">
-
- <section id="naming" name="Are there any suggested ways for naming loggers?">
- <p>
- Yes, there are.
- </p>
- <p>
- You can name logging loggers by <strong>locality</strong>. It turns out that
- instantiating a logger in each class, with the logger name equal to the
- fully-qualified name of the class, is a useful and straightforward approach of
- defining loggers. This approach has many benefits:
- </p>
- <ul>
- <li>
- It is very simple to implement.</li>
- <li>
- It is very simple to explain to new developers.</li>
- <li>
- It automatically mirrors your application's own modular design.</li>
- <li>
- It can be further refined at will.</li>
- <li>
- Printing the logger automatically gives information on the locality of the
- log statement.</li>
- </ul>
- <p>
- However, this is not the only way for naming loggers. A common alternative
- is to name loggers by <strong>functional areas</strong>. For example, the
- "database" logger, "remoting" logger, "security" logger, or the "XML"
- logger.
- </p>
- <p>
- You may choose to name loggers by functionality and subcategorize by
- locality, as in "DATABASE.MyApp.MyClass" or
- "DATABASE.MyApp.MyModule.MyOtherClass".
- </p>
- <p>
- <em>You are totally free in choosing the names of your loggers.</em> The
- log4net package merely allows you to manage your names in a hierarchy. However,
- it is your responsibility to define this hierarchy.
- </p>
- <p>
- <b>Note:</b> by naming loggers by locality one tends to name things by
- functionality, since in most cases the locality relates closely to
- functionality.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
-
- <section id="static-class-name" name="How do I get the fully-qualified name of a class in a static block?">
- <p>
- You can easily retrieve the fully-qualified name of a class in a static block
- for class <span class="code">X</span>, with the statement <span class="code">typeof(X).Name</span>.
- Note that <span class="code">X</span> is the class name and span an instance.
- However because the <span class="code">LogManager.GetLogger</span> method is overloaded
- to take an instance of <span class="code">Type</span> as well as <span class="code">string</span>
- usually only the type of the class is required.
- </p>
- <p>
- Here is the suggested usage template:
- </p>
- <source language="C#"><![CDATA[
+ </section>
+
+ <section id="implementing" name="Implementing Logging">
+
+ <section id="naming" name="Are there any suggested ways for naming loggers?">
+ <p>
+ Yes, there are.
+ </p>
+ <p>
+ You can name logging loggers by <strong>locality</strong>. It turns out that
+ instantiating a logger in each class, with the logger name equal to the
+ fully-qualified name of the class, is a useful and straightforward approach of
+ defining loggers. This approach has many benefits:
+ </p>
+ <ul>
+ <li>
+ It is very simple to implement.
+ </li>
+ <li>
+ It is very simple to explain to new developers.
+ </li>
+ <li>
+ It automatically mirrors your application's own modular design.
+ </li>
+ <li>
+ It can be further refined at will.
+ </li>
+ <li>
+ Printing the logger automatically gives information on the locality of the
+ log statement.
+ </li>
+ </ul>
+ <p>
+ However, this is not the only way for naming loggers. A common alternative
+ is to name loggers by <strong>functional areas</strong>. For example, the
+ "database" logger, "remoting" logger, "security" logger, or the "XML"
+ logger.
+ </p>
+ <p>
+ You may choose to name loggers by functionality and subcategorize by
+ locality, as in "DATABASE.MyApp.MyClass" or
+ "DATABASE.MyApp.MyModule.MyOtherClass".
+ </p>
+ <p>
+ <em>You are totally free in choosing the names of your loggers.</em> The
+ log4net package merely allows you to manage your names in a hierarchy. However,
+ it is your responsibility to define this hierarchy.
+ </p>
+ <p>
+ <b>Note:</b> by naming loggers by locality one tends to name things by
+ functionality, since in most cases the locality relates closely to
+ functionality.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
+
+
+ <section id="static-class-name" name="How do I get the fully-qualified name of a class in a static block?">
+ <p>
+ You can easily retrieve the fully-qualified name of a class in a static block
+ for class <span class="code">X</span>, with the statement <span class="code">typeof(X).Name</span>.
+ Note that <span class="code">X</span> is the class name and span an instance.
+ However because the <span class="code">LogManager.GetLogger</span> method is overloaded
+ to take an instance of <span class="code">Type</span> as well as <span class="code">string</span>
+ usually only the type of the class is required.
+ </p>
+ <p>
+ Here is the suggested usage template:
+ </p>
+ <source language="C#">
+ <![CDATA[
public class Foo
{
private static readonly ILog log = LogManager.GetLogger(typeof(Foo));
... other code
-}]]></source>
- <p>
- An equivalent and more portable solution, though slightly longer, is to use the declaring type
- of the static constructor.
- </p>
- <source language="C#"><![CDATA[
+}]]>
+ </source>
+ <p>
+ An equivalent and more portable solution, though slightly longer, is to use the declaring type
+ of the static constructor.
+ </p>
+ <source language="C#">
+ <![CDATA[
public class Foo
{
private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
... other code
-}]]></source>
- <p>
- <b>Note:</b> the .NET Compact Framework 1.0 does not support <span class="code">System.Reflection.MethodBase.GetCurrentMethod()</span>.
- </p>
+}]]>
+ </source>
+ <p>
+ <b>Note:</b> the .NET Compact Framework 1.0 does not support <span class="code">System.Reflection.MethodBase.GetCurrentMethod()</span>.
+ </p>
- <p>
- <b>Note:</b> the two forms are only equivalent
- if <span class="code">Foo</span> is not a
- generic class. For a generic class <span
+ <p>
+ <b>Note:</b> the two forms are only equivalent
+ if <span class="code">Foo</span> is not a
+ generic class. For a generic class <span
class="code">Foo<T></span> the variant
- using <span class="code">typeof</span> generates
- a different logger for each different type
- parameter <span class="code">T</span> while the
- variant using reflection generates the same
- logger for all <span class="code">T</span>s.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
+ using <span class="code">typeof</span> generates
+ a different logger for each different type
+ parameter <span class="code">T</span> while the
+ variant using reflection generates the same
+ logger for all <span class="code">T</span>s.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
- <section id="perf-not-logging" name="What is the fastest way of (not) logging?">
- <p>
- For some logger <span class="code">log</span>, writing,
- </p>
- <source language="C#"><![CDATA[
-log.Debug("Entry number: " + i + " is " + entry[i]);]]></source>
- <p>
- incurs the cost of constructing the message parameter, that is converting both
- integer <span class="code">i</span> and <span class="code">entry[i]</span> to
- a string, and concatenating intermediate strings. This, regardless of whether
- the message will be logged or not.
- </p>
- <p>
- If you are worried about speed, then write
- </p>
- <source language="C#"><![CDATA[
+ <section id="perf-not-logging" name="What is the fastest way of (not) logging?">
+ <p>
+ For some logger <span class="code">log</span>, writing,
+ </p>
+ <source language="C#">
+ <![CDATA[
+log.Debug("Entry number: " + i + " is " + entry[i]);]]>
+ </source>
+ <p>
+ incurs the cost of constructing the message parameter, that is converting both
+ integer <span class="code">i</span> and <span class="code">entry[i]</span> to
+ a string, and concatenating intermediate strings. This, regardless of whether
+ the message will be logged or not.
+ </p>
+ <p>
+ If you are worried about speed, then write
+ </p>
+ <source language="C#">
+ <![CDATA[
if(log.IsDebugEnabled)
{
log.Debug("Entry number: " + i + " is " + entry[i]);
-}]]></source>
- <p>
- This way you will not incur the cost of parameter construction if debugging is
- disabled for logger <span class="code">log</span>. On the other hand, if the logger is
- debug enabled, you will incur the cost of evaluating whether the logger is
- enabled or not, twice: once in <span class="code">IsDebugEnabled</span> and once in <span class="code">Debug</span>.
- This is an insignificant overhead since evaluating a logger takes less than
- 1% of the time it takes to actually log a statement.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
+}]]>
+ </source>
+ <p>
+ This way you will not incur the cost of parameter construction if debugging is
+ disabled for logger <span class="code">log</span>. On the other hand, if the logger is
+ debug enabled, you will incur the cost of evaluating whether the logger is
+ enabled or not, twice: once in <span class="code">IsDebugEnabled</span> and once in <span class="code">Debug</span>.
+ This is an insignificant overhead since evaluating a logger takes less than
+ 1% of the time it takes to actually log a statement.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
- <section id="perf-not-logging2" name="What is REALLY the FASTEST way of (not) logging?">
- <p>
- So you don't think that the previous FAQ is really the fastest way
- of not logging? Well there is a faster way but it does have some
- drawbacks. Starting from:
- </p>
- <source language="C#"><![CDATA[
+ <section id="perf-not-logging2" name="What is REALLY the FASTEST way of (not) logging?">
+ <p>
+ So you don't think that the previous FAQ is really the fastest way
+ of not logging? Well there is a faster way but it does have some
+ drawbacks. Starting from:
+ </p>
+ <source language="C#">
+ <![CDATA[
if(log.IsDebugEnabled)
{
log.Debug("Entry number: " + i + " is " + entry[i]);
-}]]></source>
- <p>
- It is possible to further eliminate the calls to <span class="code">IsDebugEnabled</span>
- so that the call is only made once per logger. If you are using one logger
- for each class then you can store the enabled state for the logger in a static
- variable in the class and then test against this variable:
- </p>
- <source language="C#"><![CDATA[
+}]]>
+ </source>
+ <p>
+ It is possible to further eliminate the calls to <span class="code">IsDebugEnabled</span>
+ so that the call is only made once per logger. If you are using one logger
+ for each class then you can store the enabled state for the logger in a static
+ variable in the class and then test against this variable:
+ </p>
+ <source language="C#">
+ <![CDATA[
public class FastLogger
{
private static readonly ILog log = LogManager.GetLogger(typeof(FastLogger));
@@ -680,566 +698,624 @@
log.Debug("Entry number: " + i + " is " + entry[i]);
}
}
-}]]></source>
- <p>
- So why exactly is this faster? Well to start with the <span class="code">IsDebugEnabled</span>
- is not called for each log statement, it is called once per logger. Furthermore as the
- <span class="code">isDebugEnabled</span> variable is <span class="code">private static readonly</span>
- the JIT compiler can at <em>run-time</em> optimize out the <span class="code">if</span> test altogether.
- This means that at runtime the JIT compiler won't even compile the logging statements into native code, i.e.
- all the logging just disappears.
- </p>
- <p>
- So what is the downside to using this? Well one of the clever features of log4net is that
- you can change the logging configuration while your program is running. If you need to
- investigate an issue in your application, you don't have to stop the application, setup the
- logging and restart the application, you can change the logging configuration and the
- log4net will reload it (see <span class="code">XmlConfigurator.ConfigureAndWatch</span> APIs for more
- information). However if the JIT has compiled out all of the logging statements
- then they are gone and you can't get them back by reloading the configuration file. Effectively
- this means that the logging configuration can only be set when the application loads and
- it cannot be changed at runtime. It is up to you to decide if you need ultimate speed or need
- to be able to reload the logging configuration while the application is running.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
+}]]>
+ </source>
+ <p>
+ So why exactly is this faster? Well to start with the <span class="code">IsDebugEnabled</span>
+ is not called for each log statement, it is called once per logger. Furthermore as the
+ <span class="code">isDebugEnabled</span> variable is <span class="code">private static readonly</span>
+ the JIT compiler can at <em>run-time</em> optimize out the <span class="code">if</span> test altogether.
+ This means that at runtime the JIT compiler won't even compile the logging statements into native code, i.e.
+ all the logging just disappears.
+ </p>
+ <p>
+ So what is the downside to using this? Well one of the clever features of log4net is that
+ you can change the logging configuration while your program is running. If you need to
+ investigate an issue in your application, you don't have to stop the application, setup the
+ logging and restart the application, you can change the logging configuration and the
+ log4net will reload it (see <span class="code">XmlConfigurator.ConfigureAndWatch</span> APIs for more
+ information). However if the JIT has compiled out all of the logging statements
+ then they are gone and you can't get them back by reloading the configuration file. Effectively
+ this means that the logging configuration can only be set when the application loads and
+ it cannot be changed at runtime. It is up to you to decide if you need ultimate speed or need
+ to be able to reload the logging configuration while the application is running.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
- <section id="multiple-files" name="Can the outputs of multiple client request go to different log files?">
- <p>
- Many developers are confronted with the problem of distinguishing the log
- output originating from the same class but different client requests. They come
- up with ingenious mechanisms to fan out the log output to different files. In
- most cases, this is not the right approach.
- </p>
- <p>
- It is simpler to use a context property or stack (<span class="code">ThreadContext</span>).
- Typically, one would <span class="code">ThreadContext.Properties["ID"] = "XXX"</span>
- client specific information, such as the client's hostname, ID or any other
- distinguishing information when starting to handle the client's request.
- Thereafter, log output will automatically include the context data
- so that you can distinguish logs from different client requests even if they
- are output to the same file.
- </p>
- <p>
- See the <span class="code">ThreadContext</span> and the <span class="code">PatternLayout</span> classes for more
- information.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
+ <section id="multiple-files" name="Can the outputs of multiple client request go to different log files?">
+ <p>
+ Many developers are confronted with the problem of distinguishing the log
+ output originating from the same class but different client requests. They come
+ up with ingenious mechanisms to fan out the log output to different files. In
+ most cases, this is not the right approach.
+ </p>
+ <p>
+ It is simpler to use a context property or stack (<span class="code">ThreadContext</span>).
+ Typically, one would <span class="code">ThreadContext.Properties["ID"] = "XXX"</span>
+ client specific information, such as the client's hostname, ID or any other
+ distinguishing information when starting to handle the client's request.
+ Thereafter, log output will automatically include the context data
+ so that you can distinguish logs from different client requests even if they
+ are output to the same file.
+ </p>
+ <p>
+ See the <span class="code">ThreadContext</span> and the <span class="code">PatternLayout</span> classes for more
+ information.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
- <section id="remove-logger" name="Logger instances seem to be create only. Why isn't there a method to remove logger instances?">
- <p>
- It is quite nontrivial to define the semantics of a "removed" logger which is
- still referenced by the user.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
+ <section id="remove-logger" name="Logger instances seem to be create only. Why isn't there a method to remove logger instances?">
+ <p>
+ It is quite nontrivial to define the semantics of a "removed" logger which is
+ still referenced by the user.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
- <section id="single-file" name="How do I get multiple process to log to the same file?">
- <p>
- Before you even start trying any of the
- alternatives provided, ask yourself whether you
- really need to have multiple processes log to the
- same file, then don't do it ;-).
- </p>
+ <section id="single-file" name="How do I get multiple process to log to the same file?">
+ <p>
+ Before you even start trying any of the
+ alternatives provided, ask yourself whether you
+ really need to have multiple processes log to the
+ same file, then don't do it ;-).
+ </p>
- <p>
- FileAppender offers pluggable locking models for
- this usecase but all existing implementations have
- issues and drawbacks.
- </p>
+ <p>
+ FileAppender offers pluggable locking models for
+ this usecase but all existing implementations have
+ issues and drawbacks.
+ </p>
- <p>
- By default the <span
+ <p>
+ By default the <span
class="code">FileAppender</span> holds an
- exclusive write lock on the log file while it
- is logging. This prevents other processes from
- writing to the file. This model is known to
- break down with (at least on some versions of)
- Mono on Linux and log files may get corrupted
- as soon as another process tries to access the
- log file.
- </p>
+ exclusive write lock on the log file while it
+ is logging. This prevents other processes from
+ writing to the file. This model is known to
+ break down with (at least on some versions of)
+ Mono on Linux and log files may get corrupted
+ as soon as another process tries to access the
+ log file.
+ </p>
- <p>
- <span class="code">MinimalLock</span> only
- acquires the write lock while a log is being
- written. This allows multiple processes to
- interleave writes to the same file, albeit with
- a considerable loss in performance.
- </p>
- <p>
- <span class="code">InterProcessLock</span>
- doesn't lock the file at all but synchronizes
- using a system wide Mutex. This will only work
- if all processes cooperate (and use the same
- locking model). The acquisition and release of a
- Mutex for every log entry to be written will
- result in a loss of performance, but the Mutex
- is preferable to the use of MinimalLock.
- </p>
- <p>
- If you use <span
- class="code">RollingFileAppender</span> things
- become even worse as several process may try to
- start rolling the log file concurrently. <span
+ <p>
+ <span class="code">MinimalLock</span> only
+ acquires the write lock while a log is being
+ written. This allows multiple processes to
+ interleave writes to the same file, albeit with
+ a considerable loss in performance.
+ </p>
+ <p>
+ <span class="code">InterProcessLock</span>
+ doesn't lock the file at all but synchronizes
+ using a system wide Mutex. This will only work
+ if all processes cooperate (and use the same
+ locking model). The acquisition and release of a
+ Mutex for every log entry to be written will
+ result in a loss of performance, but the Mutex
+ is preferable to the use of MinimalLock.
+ </p>
+ <p>
+ If you use <span
+ class="code">RollingFileAppender</span> things
+ become even worse as several process may try to
+ start rolling the log file concurrently. <span
class="code">RollingFileAppender</span>
- completely ignores the locking model when
- rolling files, rolling files is simply not
- compatible with this scenario.
- </p>
- <p>
- A better alternative is to have your processes
- log to <span
- class="code">RemotingAppenders</span>. Using
- the <span
- class="code">RemoteLoggingServerPlugin</span>
- (or <span
- class="code">IRemoteLoggingSink</span>) a
- process can receive all the events and log
- them to a single log file. One of the
- examples shows how to use the <span
+ completely ignores the locking model when
+ rolling files, rolling files is simply not
+ compatible with this scenario.
+ </p>
+ <p>
+ A better alternative is to have your processes
+ log to <span
+ class="code">RemotingAppenders</span>. Using
+ the <span
+ class="code">RemoteLoggingServerPlugin</span>
+ (or <span
+ class="code">IRemoteLoggingSink</span>) a
+ process can receive all the events and log
+ them to a single log file. One of the
+ examples shows how to use the <span
class="code">RemoteLoggingServerPlugin</span>.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
-
-
- <section id="distributed" name="If I have many processes across multiple hosts (possibly across multiple time zones) logging to the same file using the RemotingAppender, what happens to timestamps?">
- <p>
- The timestamp is created when the logging event is created. That is so say,
- when the <span class="code">Debug</span>, <span class="code">Info</span>,
- <span class="code">Warn</span>, <span class="code">Error</span>
- or <span class="code">Fatal</span> method is invoked. This is unaffected by the time at
- which they may arrive at a remote server. Since the timestamps are
- transmitted in UTC format by the <span class="code">RemotingAppender</span>,
- they all appear in the same time zone as
- the host creating the logfile. Since the clocks of various machines may not be
- synchronized, this may account for time interval inconsistencies between events
- generated on different hosts.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
-
-
- <section id="first-log" name="When should I log my first message?">
- <p>
- The simple answer is as soon as possible. The long answer is more complex.
- </p>
- <p>
- If you are configuring log4net programmatically, i.e. by calling the
- <span class="code">XmlConfigurator.Configure</span> method then you should do so
- before you begin logging and it is reasonable to do this very soon after application
- start.
- </p>
- <p>
- If you are configuring log4net by specifying assembly level attributes on
- your assembly then the configuration will be loaded once the first call to
- the <span class="code">LogManager.GetLogger</span> is made. It is necessary
- that the first call to <span class="code">LogManager.GetLogger</span> made
- during the process (or AppDomain) is made from the assembly that has the
- configuration attributes. Log4net will look only once and only on the first
- calling assembly for the configuration attributes.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
-
-
- </section>
-
- <section id="customization" name="Customization">
-
- <section id="custom-output" name="Can the log output format be customized?">
- <p>
- Yes. You can implement the <span class="code">log4net.Layout.ILayout</span>
- interface to create you own customized log format, or you can extend the
- <span class="code">LayoutSkeleton</span> class which provides a default
- implementation of the <span class="code">ILayout</span> interface.
- Appenders can be parameterized to use the layout of your choice.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
-
-
- <section id="custom-appender" name="Can I write a custom appender?">
- <p>
- Yes. You can implement the <span class="code">log4net.Appender.IAppender</span>
- interface to create you own customized appender. We recommend that you extend the
- <span class="code">log4net.Appender.AppenderSkeleton</span> class rather than
- starting from scratch. You should implement your custom code in a assembly
- separate from the log4net assembly. To get started it is worth looking at the
- source of the <span class="code">log4net.Appender.TraceAppender</span> as an
- example of the minimum amount of code required to get an appender working.
- </p>
- <p>
- To configure log4net to use your custom appender you need to specify the
- assembly qualified name of the appender type in the config file. For
- example:
- </p>
- <source language="xml"><![CDATA[
-<appender name="..." type="MyNamespace.MyAppender, MyAssembly">]]></source>
- <p>
- The .NET runtime will try to locate the assembly called <i>MyAssembly</i>.
- How .NET locates assemblies is beyond the scope of this FAQ.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
-
- </section>
-
- <section id="troubleshooting" name="Troubleshooting">
-
- <section id="internalDebug" name="How do I enable log4net internal debugging?">
- <p>
- There are 2 different ways to enable internal debugging in log4net.
- These are listed below. The preferred method is to specify
- the <span class="code">log4net.Internal.Debug</span> option in the application's
- config file.
- </p>
- <ul>
- <li>
- <p>
- Internal debugging can also be enabled by setting a value in the application's
- configuration file (not the log4net configuration file, unless the log4net config
- data is embedded in the application's config file). The <span class="code">log4net.Internal.Debug</span>
- application setting must be set to the value <span class="code">true</span>.
- For example:
- </p>
- <div class="syntax"><pre class="code">
-<?xml version="1.0" encoding="utf-8" ?>
-<configuration>
- <appSettings>
- <add key="log4net.Internal.Debug" value="true"/>
- </appSettings>
-</configuration></pre></div>
- <p>
- This setting is read immediately on startup an will cause all internal
- debugging messages to be emitted.
- </p>
- </li>
- <li>
- <p>
- To enable log4net's internal debug programmatically you need
- to set the <span class="code">log4net.Util.LogLog.InternalDebugging</span>
- property to <span class="code">true</span>. Obviously the sooner this
- is set the more debug will be produced.
- </p>
- </li>
- </ul>
- <p>
- Internal debugging messages are written to the console and to the
- <span class="code">System.Diagnostics.Trace</span>
- system. If the application does not have a console the messages logged
- there will be lost. Note that an application can redirect the console
- stream by setting the <span class="code">System.Console.Out</span>. The
- Trace system will by default send the message to an attached debugger
- (where the messages will appear in the output window). If the process
- does not have a debugger attached then the messages are sent to the
- system debugger. A utility like DebugView from
- <a href="http://www.sysinternals.com">http://www.sysinternals.com</a>
- may be used to capture these messages.
- </p>
- <p>
- As log4net internal debug messages are written to the <span class="code">System.Diagnostics.Trace</span>
- system it is possible to redirect those messages to a local file. You can define
- a trace listener by adding the following to your application's .config file:
- </p>
- <div class="syntax"><pre class="code">
-<configuration>
- ...
-
- <system.diagnostics>
- <trace autoflush="true">
- <listeners>
- <add
- name="textWriterTraceListener"
- type="System.Diagnostics.TextWriterTraceListener"
- initializeData="C:\tmp\log4net.txt" />
- </listeners>
- </trace>
- </system.diagnostics>
-
- ...
-</configuration></pre></div>
- <p>
- Make sure that the process running your application has permission
- to write to this file.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
-
- <section id="trouble-evaluate-configurationerrors-at-runtime" name="How can I evaluate configuration errors at runtime?">
- <p>
- To prevent silent failure of log4net as reported as <a href="http://issues.apache.org/jira/browse/LOG4NET-342">LOG4NET-342</a>,
- log4net supports a way to evaluate if it was configured and also to evaluate messages generated on startup since 1.2.11. To
- check if log4net was started and configured properly one can check the property
- <span class="code">log4net.Repository.ILoggerRepository.Configured</span> and enumerate the configuration messages as follows:
- </p>
- <div class="syntax">
- <pre class="code">
-if(!log4net.LogManager.GetRepository().Configured)
-{
- // log4net not configured
- foreach(log4net.Util.LogLog message in log4net.LogManager.GetRepository().ConfigurationMessages.Cast<log4net.Util.LogLog&bg;())
- {
- // evaluate configuration message
- }
-}
- </pre>
- </div>
- </section>
- <p><a href="#top">Back to Top</a></p>
-
- <section id="trouble-EventLog" name="Why doesn't the EventLogAppender work?">
- <p>
- If you are not getting events delivered to the event log this usually indicates
- a permissions problem. Basically if the event log does not exist the EventLogAppender
- tries to create it, but you need local administrator permissions to create event logs
- (just to write into the right bit of the registry). You don't need administrator
- permissions to log to an existing event log, but it must exist. If you are using the
- event log from a web application or service using the event log can be a little tricky.
- </p>
- <p>
- A web application will run as the user account ASPNET. This account deliberately has
- few permissions to reduce the chances of someone hacking into the web server. While the
- account has permission to write to the event log it does not have permission to create
- event sources (registry create and write access), which are needed to write to the event log.
- </p>
- <p>
- There are a couple of solutions:
- </p>
- <ol>
- <li>
- <p>
- Make the ASPNET user a member of the Administrators group. This will work because the
- user will then have the required permissions. This is <strong>not recommended</strong>
- for production use.
- </p>
- </li>
- <li>
- <p>
- As the event source only needs to be created once for the machine, create an installer
- and configure it to create the event source.
- The installer will need to be run as Administrator (don't they all). See
- <span class="code">System.Diagnostics.EventLogInstaller</span> in the Microsoft .NET
- Framework SDK for an example of how to create a simple event log installer.
- </p>
- </li>
- </ol>
- <p>
- There is a Microsoft Knowledge Base article that covers this issue and how to resolve
- it. <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;329291">
- PRB: "Requested Registry Access Is Not Allowed" Error Message When ASP.NET
- Application Tries to Write New EventSource in the EventLog</a>.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
- <section id="trouble-file-perm" name="Why can't I log to a FileAppender from a web application?">
- <p>
- The web application runs as a special user account on the web server
- called ASPNET. This account has restricted permissions to protect the
- web server from attacks. By default this account may not have permission
- to write to the file system. Make sure that the ASPNET account has
- permission to create and write to files in the directory chosen for
- logging.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
+ <section id="distributed" name="If I have many processes across multiple hosts (possibly across multiple time zones) logging to the same file using the RemotingAppender, what happens to timestamps?">
+ <p>
+ The timestamp is created when the logging event is created. That is so say,
+ when the <span class="code">Debug</span>, <span class="code">Info</span>,
+ <span class="code">Warn</span>, <span class="code">Error</span>
+ or <span class="code">Fatal</span> method is invoked. This is unaffected by the time at
+ which they may arrive at a remote server. Since the timestamps are
+ transmitted in UTC format by the <span class="code">RemotingAppender</span>,
+ they all appear in the same time zone as
+ the host creating the logfile. Since the clocks of various machines may not be
+ synchronized, this may account for time interval inconsistencies between events
+ generated on different hosts.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
- <section id="trouble-service" name="Why doesn't the logging in my service work?">
- <p>
- A windows service runs as a user account specified in the services
- control panel. This account may have restricted permissions, make
- sure that the account has permission to create and write to files
- in the directory chosen for logging.
- </p>
- <p>
- A windows service is launched by windows. The current directory in
- a service is set to the windows system directory (e.g.
- <span class="code">C:\Windows\System32</span>). If you are loading
- the configuration file from the current directory then be aware
- that this path will not be the location of your assemblies.
- The best way to get the path to your assemblies is to use
- <span class="code">AppDomain.BaseDirectory</span>.
- Note that the log4net internals never use the current directory.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
-
-
- <section id="trouble-webapp-stops-logging" name="Why does my ASP.NET web application stop logging when deployed on an IIS?">
- <p>
- This problem has been reported by several people as issue
- <a href="https://issues.apache.org/jira/browse/LOG4NET-178">LOG4NET-178</a>.
- The issue seems to be caused by a broken LOG4NET configuration
- or a timing problem caused by an application shutdown event that
- floats in late after an application start event and thus LOG4NET
- stops logging immediately after it has been started.
- </p>
- <p>
- The first thing step to troubleshoot problems is enabling
- the log4net internal debugging features as described
- <a href="http://logging.apache.org/log4net/release/faq.html#internalDebug">here</a>
- and fix all errors that pop up. If the problem still persists,
- <a href="https://issues.apache.org/jira/browse/LOG4NET-178?focusedCommentId=13504094&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13504094">this comment</a>
- suggests to move the LOG4NET configuration out of the
- <span class="code">web.config</span> into a separate file
- like <span class="code">log4net.config</span>. Finally,
- if both previous steps did not help and the problem still
- occurs, you can try to work around the event timing problem
- by invoking the configuration call from the class constructor as described in
- <a href="https://issues.apache.org/jira/browse/LOG4NET-178?focusedCommentId=13504485&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13504485">this comment</a>.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
-
-
- <section id="trouble-db" name="I am having trouble using the AdoNetAppender to connect to my database?">
- <p>
- For details on the different ways in which ADO.NET can connect to a database see:
- <a href="http://msdn.microsoft.com/library/en-us/cpguide/html/cpconadonetconnections.asp">Connecting to a Data Source Using ADO.NET</a>.
- </p>
- <p>
- If you need to use ODBC to connect to your database then please note that the
- ADO.NET ODBC drivers are not included in the standard .NET framework redistributable.
- You can download the drivers from microsoft download at:
- <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=6ccd8427-1017-4f33-a062-d165078e32b1">ODBC .NET Data Provider</a>.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
+ <section id="first-log" name="When should I log my first message?">
+ <p>
+ The simple answer is as soon as possible. The long answer is more complex.
+ </p>
+ <p>
+ If you are configuring log4net programmatically, i.e. by calling the
+ <span class="code">XmlConfigurator.Configure</span> method then you should do so
+ before you begin logging and it is reasonable to do this very soon after application
+ start.
+ </p>
+ <p>
+ If you are configuring log4net by specifying assembly level attributes on
+ your assembly then the configuration will be loaded once the first call to
+ the <span class="code">LogManager.GetLogger</span> is made. It is necessary
+ that the first call to <span class="code">LogManager.GetLogger</span> made
+ during the process (or AppDomain) is made from the assembly that has the
+ configuration attributes. Log4net will look only once and only on the first
+ calling assembly for the configuration attributes.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
- <section id="report-bugs" name="How do I report bugs?">
- <p>
- First make sure it really is a bug and not a
- usage error. When in doubt, ask on the <a
- href="../mail-lists.html">log4net-user mailing
- list</a> first.
- </p>
- <p>
- If you have identified a bug, please report it
- via our <a href="../issue-tracking.html">Issue
- Tracker</a>. You may want to check it hasn't
- been reported before by searching the existing
- issues.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
+ </section>
- <section id="log-early"
- name="log4net doesn't log when built in RELEASE mode">
- <p>
- If you use attributes to configure log4net then
- the order by which assemblies are loaded may
- determine whether you attributes are used or
- not. Assembly load order may be different in
- DEBUG and RELEASE mode.
- </p>
+ <section id="customization" name="Customization">
- <p>
- As stated in <a
- href="manual/configuration.html#attributes">the
- manual</a> the attribute will only be read for
- the first assembly that tries to use log4net.
- So it is important that you obtain your
- <code>ILog</code> instance as early as possible.
- </p>
+ <section id="custom-output" name="Can the log output format be customized?">
+ <p>
+ Yes. You can implement the <span class="code">log4net.Layout.ILayout</span>
+ interface to create you own customized log format, or you can extend the
+ <span class="code">LayoutSkeleton</span> class which provides a default
+ implementation of the <span class="code">ILayout</span> interface.
+ Appenders can be parameterized to use the layout of your choice.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
- <p>
- For a command line application "as early as
- possible" probably is the class holding the
- <code>Main</code> method, for a Web-Application
- it would be your <code>Global.asax</code> class
- and for a Windows Service it would be the class
- deriving from <code>ServiceBase</code>.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
- <section id="no-explicit-configuration"
- name="log4net doesn't log at all">
- <p>
- You may have overlooked initialization code for
- log4net in your application. log4net can be
- initialized explicitly by calling one of the
- configurators
- (e.g. <code>BasicConfigurator</code> or
- <code>XmlConfigurator</code> in the
- <code>log4net.Config</code> namespace, or
- implicitly by including the
- <code>[XmlConfiguratorAttribute]</code> in the
- assembly where log4net is first used.
- </p>
+ <section id="custom-appender" name="Can I write a custom appender?">
+ <p>
+ Yes. You can implement the <span class="code">log4net.Appender.IAppender</span>
+ interface to create you own customized appender. We recommend that you extend the
+ <span class="code">log4net.Appender.AppenderSkeleton</span> class rather than
+ starting from scratch. You should implement your custom code in a assembly
+ separate from the log4net assembly. To get started it is worth looking at the
+ source of the <span class="code">log4net.Appender.TraceAppender</span> as an
+ example of the minimum amount of code required to get an appender working.
+ </p>
+ <p>
+ To configure log4net to use your custom appender you need to specify the
+ assembly qualified name of the appender type in the config file. For
+ example:
+ </p>
+ <source language="xml">
+ <![CDATA[
+<appender name="..." type="MyNamespace.MyAppender, MyAssembly">]]>
+ </source>
+ <p>
+ The .NET runtime will try to locate the assembly called <i>MyAssembly</i>.
+ How .NET locates assemblies is beyond the scope of this FAQ.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
- <p>
- See <a href="manual/configuration.html">the
- manual</a> for more information. If you use
- attributes to configure log4net then the order
- by which assemblies are loaded may determine
- whether you attributes are used or not.
- Assembly load order may be different in DEBUG
- and RELEASE mode. See also <a
- href="#log-early">log4net doesn't log when built
- in RELEASE mode</a>.
- </p>
+ </section>
- </section>
- <p><a href="#top">Back to Top</a></p>
+ <section id="troubleshooting" name="Troubleshooting">
- <section id="adonet-doesnt-reconnect"
- name="The ADO.NET Appender doesn't reconnect
+ <section id="internalDebug" name="How do I enable log4net internal debugging?">
+ <p>
+ There are 2 different ways to enable internal debugging in log4net.
+ These are listed below. The preferred method is to specify
+ the <span class="code">log4net.Internal.Debug</span> option in the application's
+ config file.
+ </p>
+ <ul>
+ <li>
+ <p>
+ Internal debugging can also be enabled by setting a value in the application's
+ configuration file (not the log4net configuration file, unless the log4net config
+ data is embedded in the application's config file). The <span class="code">log4net.Internal.Debug</span>
+ application setting must be set to the value <span class="code">true</span>.
+ For example:
+ </p>
+ <div class="syntax">
+ <pre class="code">
+ <?xml version="1.0" encoding="utf-8" ?>
+ <configuration>
+ <appSettings>
+ <add key="log4net.Internal.Debug" value="true"/>
+ </appSettings>
+ </configuration>
+ </pre>
+ </div>
+ <p>
+ This setting is read immediately on startup an will cause all internal
+ debugging messages to be emitted.
+ </p>
+ </li>
+ <li>
+ <p>
+ To enable log4net's internal debug programmatically you need
+ to set the <span class="code">log4net.Util.LogLog.InternalDebugging</span>
+ property to <span class="code">true</span>. Obviously the sooner this
+ is set the more debug will be produced.
+ </p>
+ </li>
+ </ul>
+ <p>
+ Internal debugging messages are written to the console and to the
+ <span class="code">System.Diagnostics.Trace</span>
+ system. If the application does not have a console the messages logged
+ there will be lost. Note that an application can redirect the console
+ stream by setting the <span class="code">System.Console.Out</span>. The
+ Trace system will by default send the message to an attached debugger
+ (where the messages will appear in the output window). If the process
+ does not have a debugger attached then the messages are sent to the
+ system debugger. A utility like DebugView from
+ <a href="http://www.sysinternals.com">http://www.sysinternals.com</a>
+ may be used to capture these messages.
+ </p>
+ <p>
+ As log4net internal debug messages are written to the <span class="code">System.Diagnostics.Trace</span>
+ system it is possible to redirect those messages to a local file. You can define
+ a trace listener by adding the following to your application's .config file:
+ </p>
+ <div class="syntax">
+ <pre class="code">
+ <configuration>
+ ...
+
+ <system.diagnostics>
+ <trace autoflush="true">
+ <listeners>
+ <add
+ name="textWriterTraceListener"
+ type="System.Diagnostics.TextWriterTraceListener"
+ initializeData="C:\tmp\log4net.txt" />
+ </listeners>
+ </trace>
+ </system.diagnostics>
+
+ ...
+ </configuration>
+ </pre>
+ </div>
+ <p>
+ Make sure that the process running your application has permission
+ to write to this file.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
+
+ <section id="trouble-evaluate-configurationerrors-at-runtime" name="How can I evaluate configuration errors at runtime?">
+ <p>
+ To prevent silent failure of log4net as reported as <a href="http://issues.apache.org/jira/browse/LOG4NET-342">LOG4NET-342</a>,
+ log4net supports a way to evaluate if it was configured and also to evaluate messages generated on startup since 1.2.11. To
+ check if log4net was started and configured properly one can check the property
+ <span class="code">log4net.Repository.ILoggerRepository.Configured</span> and enumerate the configuration messages as follows:
+ </p>
+ <div class="syntax">
+ <pre class="code">
+ if(!log4net.LogManager.GetRepository().Configured)
+ {
+ // log4net not configured
+ foreach(log4net.Util.LogLog message in log4net.LogManager.GetRepository().ConfigurationMessages.Cast<log4net.Util.LogLog&bg;())
+ {
+ // evaluate configuration message
+ }
+ }
+ </pre>
+ </div>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
+
+ <section id="trouble-EventLog" name="Why doesn't the EventLogAppender work?">
+ <p>
+ If you are not getting events delivered to the event log this usually indicates
+ a permissions problem. Basically if the event log does not exist the EventLogAppender
+ tries to create it, but you need local administrator permissions to create event logs
+ (just to write into the right bit of the registry). You don't need administrator
+ permissions to log to an existing event log, but it must exist. If you are using the
+ event log from a web application or service using the event log can be a little tricky.
+ </p>
+ <p>
+ A web application will run as the user account ASPNET. This account deliberately has
+ few permissions to reduce the chances of someone hacking into the web server. While the
+ account has permission to write to the event log it does not have permission to create
+ event sources (registry create and write access), which are needed to write to the event log.
+ </p>
+ <p>
+ There are a couple of solutions:
+ </p>
+ <ol>
+ <li>
+ <p>
+ Make the ASPNET user a member of the Administrators group. This will work because the
+ user will then have the required permissions. This is <strong>not recommended</strong>
+ for production use.
+ </p>
+ </li>
+ <li>
+ <p>
+ As the event source only needs to be created once for the machine, create an installer
+ and configure it to create the event source.
+ The installer will need to be run as Administrator (don't they all). See
+ <span class="code">System.Diagnostics.EventLogInstaller</span> in the Microsoft .NET
+ Framework SDK for an example of how to create a simple event log installer.
+ </p>
+ </li>
+ </ol>
+ <p>
+ There is a Microsoft Knowledge Base article that covers this issue and how to resolve
+ it. <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;329291">
+ PRB: "Requested Registry Access Is Not Allowed" Error Message When ASP.NET
+ Application Tries to Write New EventSource in the EventLog
+ </a>.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
+
+
+ <section id="trouble-file-perm" name="Why can't I log to a FileAppender from a web application?">
+ <p>
+ The web application runs as a special user account on the web server
+ called ASPNET. This account has restricted permissions to protect the
+ web server from attacks. By default this account may not have permission
+ to write to the file system. Make sure that the ASPNET account has
+ permission to create and write to files in the directory chosen for
+ logging.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
+
+
+ <section id="trouble-service" name="Why doesn't the logging in my service work?">
+ <p>
+ A windows service runs as a user account specified in the services
+ control panel. This account may have restricted permissions, make
+ sure that the account has permission to create and write to files
+ in the directory chosen for logging.
+ </p>
+ <p>
+ A windows service is launched by windows. The current directory in
+ a service is set to the windows system directory (e.g.
+ <span class="code">C:\Windows\System32</span>). If you are loading
+ the configuration file from the current directory then be aware
+ that this path will not be the location of your assemblies.
+ The best way to get the path to your assemblies is to use
+ <span class="code">AppDomain.BaseDirectory</span>.
+ Note that the log4net internals never use the current directory.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
+
+
+ <section id="trouble-webapp-stops-logging" name="Why does my ASP.NET web application stop logging when deployed on an IIS?">
+ <p>
+ This problem has been reported by several people as issue
+ <a href="https://issues.apache.org/jira/browse/LOG4NET-178">LOG4NET-178</a>.
+ The issue seems to be caused by a broken LOG4NET configuration
+ or a timing problem caused by an application shutdown event that
+ floats in late after an application start event and thus LOG4NET
+ stops logging immediately after it has been started.
+ </p>
+ <p>
+ The first thing step to troubleshoot problems is enabling
+ the log4net internal debugging features as described
+ <a href="http://logging.apache.org/log4net/release/faq.html#internalDebug">here</a>
+ and fix all errors that pop up. If the problem still persists,
+ <a href="https://issues.apache.org/jira/browse/LOG4NET-178?focusedCommentId=13504094&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13504094">this comment</a>
+ suggests to move the LOG4NET configuration out of the
+ <span class="code">web.config</span> into a separate file
+ like <span class="code">log4net.config</span>. Finally,
+ if both previous steps did not help and the problem still
+ occurs, you can try to work around the event timing problem
+ by invoking the configuration call from the class constructor as described in
+ <a href="https://issues.apache.org/jira/browse/LOG4NET-178?focusedCommentId=13504485&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13504485">this comment</a>.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
+
+
+ <section id="trouble-db" name="I am having trouble using the AdoNetAppender to connect to my database?">
+ <p>
+ For details on the different ways in which ADO.NET can connect to a database see:
+ <a href="http://msdn.microsoft.com/library/en-us/cpguide/html/cpconadonetconnections.asp">Connecting to a Data Source Using ADO.NET</a>.
+ </p>
+ <p>
+ If you need to use ODBC to connect to your database then please note that the
+ ADO.NET ODBC drivers are not included in the standard .NET framework redistributable.
+ You can download the drivers from microsoft download at:
+ <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=6ccd8427-1017-4f33-a062-d165078e32b1">ODBC .NET Data Provider</a>.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
+
+
+ <section id="report-bugs" name="How do I report bugs?">
+ <p>
+ First make sure it really is a bug and not a
+ usage error. When in doubt, ask on the <a
+ href="../mail-lists.html">
+ log4net-user mailing
+ list
+ </a> first.
+ </p>
+ <p>
+ If you have identified a bug, please report it
+ via our <a href="../issue-tracking.html">
+ Issue
+ Tracker
+ </a>. You may want to check it hasn't
+ been reported before by searching the existing
+ issues.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
+
+ <section id="log-early"
+ name="log4net doesn't log when built in RELEASE mode">
+ <p>
+ If you use attributes to configure log4net then
+ the order by which assemblies are loaded may
+ determine whether you attributes are used or
+ not. Assembly load order may be different in
+ DEBUG and RELEASE mode.
+ </p>
+
+ <p>
+ As stated in <a
+ href="manual/configuration.html#attributes">
+ the
+ manual
+ </a> the attribute will only be read for
+ the first assembly that tries to use log4net.
+ So it is important that you obtain your
+ <code>ILog</code> instance as early as possible.
+ </p>
+
+ <p>
+ For a command line application "as early as
+ possible" probably is the class holding the
+ <code>Main</code> method, for a Web-Application
+ it would be your <code>Global.asax</code> class
+ and for a Windows Service it would be the class
+ deriving from <code>ServiceBase</code>.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
+
+ <section id="no-explicit-configuration"
+ name="log4net doesn't log at all">
+ <p>
+ You may have overlooked initialization code for
+ log4net in your application. log4net can be
+ initialized explicitly by calling one of the
+ configurators
+ (e.g. <code>BasicConfigurator</code> or
+ <code>XmlConfigurator</code> in the
+ <code>log4net.Config</code> namespace, or
+ implicitly by including the
+ <code>[XmlConfiguratorAttribute]</code> in the
+ assembly where log4net is first used.
+ </p>
+
+ <p>
+ See <a href="manual/configuration.html">
+ the
+ manual
+ </a> for more information. If you use
+ attributes to configure log4net then the order
+ by which assemblies are loaded may determine
+ whether you attributes are used or not.
+ Assembly load order may be different in DEBUG
+ and RELEASE mode. See also <a
+ href="#log-early">
+ log4net doesn't log when built
+ in RELEASE mode
+ </a>.
+ </p>
+
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
+
+ <section id="adonet-doesnt-reconnect"
+ name="The ADO.NET Appender doesn't reconnect
after a DB failure on .NET 4.5.1">
- <p>
- Starting with .NET 4.5.1 ADO.NET has added
- connection resiliency which is supposed to
- re-establish the connection as part if the
- framework. As a result log4net doesn't know the
- connection is broken and will never attempt to
- re-establish the connection.
- </p>
- <p>
- Unfortunately re-connecting doesn't seem to be
- working reliably. A workaround may be to add
- <code>ConnectRetryCount=0</code> to your
- connection string.
- </p>
- <p>
- For details see <a
+ <p>
+ Starting with .NET 4.5.1 ADO.NET has added
+ connection resiliency which is supposed to
+ re-establish the connection as part if the
+ framework. As a result log4net doesn't know the
+ connection is broken and will never attempt to
+ re-establish the connection.
+ </p>
+ <p>
+ Unfortunately re-connecting doesn't seem to be
+ working reliably. A workaround may be to add
+ <code>ConnectRetryCount=0</code> to your
+ connection string.
+ </p>
+ <p>
+ For details see <a
href="https://issues.apache.org/jira/browse/LOG4NET-442">LOG4NET-442</a>
- </p>
- </section>
- </section>
-
- <section id="misc" name="Miscellaneous">
-
- <section id="vsnet-add-reference" name="How do I make log4net appear in the Visual Studio Add References dialog?">
- <p>
- There is a good discussion of this topic on Robert McLaws blog:
- <a href="http://weblogs.asp.net/rmclaws/archive/2003/11/15/37743.aspx">Building a Better Server Control Experience, Part 2</a>.
- </p>
- </section>
-
- <section id="nuget" name="Do you provide a Nuget package?">
- <p>
- Starting with version 2.0.6 we provide <a
- href="https://www.nuget.org/packages/log4net/"
- rel="nofollow">Nuget packages</a>. For earlier
- versions <a href="http://blog.cincura.net/"
- rel="nofollow">Jiří Činčura</a> has kindly created
- Nuget packages.
- </p>
- </section>
- <p><a href="#top">Back to Top</a></p>
-
- </section>
-
+ </p>
+ </section>
+ </section>
+
+ <section id="misc" name="Miscellaneous">
+
+ <section id="vsnet-add-reference" name="How do I make log4net appear in the Visual Studio Add References dialog?">
+ <p>
+ There is a good discussion of this topic on Robert McLaws blog:
+ <a href="http://weblogs.asp.net/rmclaws/archive/2003/11/15/37743.aspx">Building a Better Server Control Experience, Part 2</a>.
+ </p>
</section>
- </body>
+ <section id="nuget" name="Do you provide a Nuget package?">
+ <p>
+ Starting with version 2.0.6 we provide <a
+ href="https://www.nuget.org/packages/log4net/"
+ rel="nofollow">Nuget packages</a>. For earlier
+ versions <a href="http://blog.cincura.net/"
+ rel="nofollow">Jiří Činčura</a> has kindly created
+ Nuget packages.
+ </p>
+ </section>
+ <p>
+ <a href="#top">Back to Top</a>
+ </p>
+
+ </section>
+
+ </section>
+
+ </body>
</document>
diff --git a/src/site/xdoc/release/features.xml b/src/site/xdoc/release/features.xml
index eb7b09a..2375c18 100644
--- a/src/site/xdoc/release/features.xml
+++ b/src/site/xdoc/release/features.xml
@@ -26,29 +26,29 @@
<body>
<section id="main" name="Apache log4net™ Features">
-
+
<section id="overview" name="Overview">
<p>
- log4net is a tool to help the programmer output log statements to a
- variety of output targets. In case of problems with an application,
- it is helpful to enable logging so that the problem can be located.
- With log4net it is possible to enable logging at runtime without
- modifying the application binary. The log4net package is designed so
- that log statements can remain in shipped code without incurring a
- high performance cost. It follows that the speed of logging (or
+ log4net is a tool to help the programmer output log statements to a
+ variety of output targets. In case of problems with an application,
+ it is helpful to enable logging so that the problem can be located.
+ With log4net it is possible to enable logging at runtime without
+ modifying the application binary. The log4net package is designed so
+ that log statements can remain in shipped code without incurring a
+ high performance cost. It follows that the speed of logging (or
rather not logging) is crucial.
</p>
<p>
- At the same time, log output can be so voluminous that it quickly becomes
- overwhelming. One of the distinctive features of log4net is the notion of
- hierarchical loggers. Using these loggers it is possible to selectively
- control which log statements are output at arbitrary granularity.
+ At the same time, log output can be so voluminous that it quickly becomes
+ overwhelming. One of the distinctive features of log4net is the notion of
+ hierarchical loggers. Using these loggers it is possible to selectively
+ control which log statements are output at arbitrary granularity.
</p>
<p>
log4net is designed with two distinct goals in mind: speed and flexibility
</p>
</section>
-
+
<section id="features" name="Features">
<ul>
<li>Support for multiple frameworks</li>
@@ -88,7 +88,7 @@
<tr>
<td>log4net.Appender.AdoNetAppender</td>
<td>
- Writes logging events to a database using either prepared statements or stored
+ Writes logging events to a database using either prepared statements or stored
procedures.
</td>
</tr>
@@ -101,7 +101,7 @@
<tr>
<td>log4net.Appender.AspNetTraceAppender</td>
<td>
- Writes logging events to the ASP trace context. These can then be rendered at
+ Writes logging events to the ASP trace context. These can then be rendered at
the end of the ASP page or on the ASP trace page.
</td>
</tr>
@@ -114,7 +114,7 @@
<tr>
<td>log4net.Appender.ConsoleAppender</td>
<td>
- Writes logging events to the application's Console. The events may go to either
+ Writes logging events to the application's Console. The events may go to either
the standard our stream or the standard error stream.
</td>
</tr>
@@ -151,15 +151,15 @@
<tr>
<td>log4net.Appender.NetSendAppender</td>
<td>
- Writes logging events to the Windows Messenger service. These messages are
+ Writes logging events to the Windows Messenger service. These messages are
displayed in a dialog on a users terminal.
</td>
</tr>
<tr>
<td>log4net.Appender.OutputDebugStringAppender</td>
<td>
- Writes logging events to the debugger. If the application has no
- debugger, the system debugger displays the string. If the application has no
+ Writes logging events to the debugger. If the application has no
+ debugger, the system debugger displays the string. If the application has no
debugger and the system debugger is not active, the message is ignored.
</td>
</tr>
@@ -178,8 +178,8 @@
<tr>
<td>log4net.Appender.RollingFileAppender</td>
<td>
- Writes logging events to a file in the file system. The RollingFileAppender can
- be configured to log to multiple files based upon date or file size
+ Writes logging events to a file in the file system. The RollingFileAppender can
+ be configured to log to multiple files based upon date or file size
constraints.
</td>
</tr>
@@ -213,34 +213,34 @@
<tr>
<td>log4net.Appender.UdpAppender</td>
<td>
- Sends logging events as connectionless UDP datagrams to a remote host or a
+ Sends logging events as connectionless UDP datagrams to a remote host or a
multicast group using a UdpClient.
</td>
</tr>
</table>
</div>
<p>A special log4net.Appender.ForwardingAppender can
- be used to wrap another appender, for example to
- attach additional filters.</p>
+ be used to wrap another appender, for example to
+ attach additional filters.</p>
</section>
<section id="hierarchy" name="Hierarchical logging architecture">
<p>
- Hierarchical logging is an ideal fit with component based development.
- Each component has its own of logger. When individually tested, the
- properties of these loggers may be set as the developer requires.
- When combined with other components, the loggers inherit the properties
- determined by the integrator of the components. One can selectively elevate
- logging priorities on one component without affecting the other components.
- This is useful when you need a detailed trace from just a single component
- without crowding the trace file with messages from other components. All
- this can be done through configuration files; no code changes are required.
+ Hierarchical logging is an ideal fit with component based development.
+ Each component has its own of logger. When individually tested, the
+ properties of these loggers may be set as the developer requires.
+ When combined with other components, the loggers inherit the properties
+ determined by the integrator of the components. One can selectively elevate
+ logging priorities on one component without affecting the other components.
+ This is useful when you need a detailed trace from just a single component
+ without crowding the trace file with messages from other components. All
+ this can be done through configuration files; no code changes are required.
</p>
</section>
<section id="xml-config" name="XML Configuration">
<p>
- log4net is configured using an XML configuration file. The configuration
+ log4net is configured using an XML configuration file. The configuration
information can be embedded within other XML configuration files
(such as the application's .config file) or in a separate file. The
configuration is easily readable and updateable while retaining the
@@ -254,9 +254,9 @@
<section id="dynamic-config" name="Dynamic Configuration">
<p>
log4net can monitor its configuration file for changes and dynamically
- apply changes made by the configurator. The logging levels, appenders,
- layouts, and just about everything else can be adjusted at runtime.
- In many cases it is possible to diagnose application issues without
+ apply changes made by the configurator. The logging levels, appenders,
+ layouts, and just about everything else can be adjusted at runtime.
+ In many cases it is possible to diagnose application issues without
terminating the process in question. This can a very valuable tool in
investigating issues with deployed applications.
</p>
@@ -264,12 +264,12 @@
<section id="context" name="Logging Context">
<p>
- log4net can be used to collect logging context data in a way that is transparent
- to the developer at the point of logging. The GlobalContext and the
+ log4net can be used to collect logging context data in a way that is transparent
+ to the developer at the point of logging. The GlobalContext and the
ThreadContext allow the application to store contextual data that is
- attached to logging messages. For instance, in a web service,
- once the caller is authenticated the username of the caller could be
- stored in a ThreadContext property. This property would then be automatically
+ attached to logging messages. For instance, in a web service,
+ once the caller is authenticated the username of the caller could be
+ stored in a ThreadContext property. This property would then be automatically
logged as part of each subsequent logging message made from the same thread.
</p>
</section>
@@ -277,11 +277,11 @@
<section id="history" name="Proven architecture">
<p>
log4net is based on the highly successful Apache log4j™ logging library,
- in development since 1996. This popular and proven architecture has
+ in development since 1996. This popular and proven architecture has
so far been ported to 12 languages.
</p>
</section>
-
+
</section>
</body>
</document>
\ No newline at end of file
diff --git a/src/site/xdoc/release/framework-support.xml b/src/site/xdoc/release/framework-support.xml
index c19be03..505e2e6 100644
--- a/src/site/xdoc/release/framework-support.xml
+++ b/src/site/xdoc/release/framework-support.xml
@@ -17,52 +17,181 @@
-->
<document>
- <properties>
- <author email="nicko at apache dot org">Nicko Cadell</author>
- <title>Apache log4net: Supported Frameworks</title>
- </properties>
+ <properties>
+ <author email="nicko at apache dot org">Nicko Cadell</author>
+ <title>Apache log4net: Supported Frameworks</title>
+ </properties>
- <meta name="keywords" content="log4net supported frameworks, mono, sscli, .net, log4net" />
+ <meta name="keywords" content="log4net supported frameworks, netstandard, .net, log4net" />
- <body>
- <section id="main" name="Apache log4net™ Supported Frameworks">
-
- <section id="summary" name="Summary of .NET frameworks supported by log4net">
- <p>
- log4net is built on a number of different frameworks. Each new version of the frameworks add
- new features. To take advantage of these new features we must build log4net using the
- appropriate framework. We also maintain builds compatible with older versions of the frameworks.
- </p>
- <p>
- It is important to remember that the .NET frameworks support backward compatibility, that is
- a new version of the framework will run binary assemblies that were targeted to previous versions
- of the framework.
- </p>
- <p>
- log4net is regularly built by its developers on the following frameworks:
- </p>
+ <body>
+ <section id="main" name="Apache log4net™ Supported Frameworks">
- <div class="table">
- <table>
- <colgroup>
- <col style="text-align: left; white-space: nowrap" />
- <col style="text-align: left;" />
- </colgroup>
- <tr>
- <th>Framework</th>
- <th>Website</th>
- </tr>
- <tr style="vertical-align: top;">
- <td>.NET Core 6 or higher providing .NET Standard 2.0</td>
- <td><a href="https://dotnet.github.io/">https://dotnet.github.io/</a></td>
- </tr>
- <tr style="vertical-align: top;">
- <td>Microsoft .NET Framework 4.6.2</td>
- <td><a href="https://dotnet.microsoft.com/en-us/download/dotnet-framework/net462">https://dotnet.microsoft.com/en-us/download/dotnet-framework/net462</a></td>
- </tr>
- </table>
- </div>
- </section>
- </section>
- </body>
+ <section id="summary" name="Summary of .NET frameworks supported by log4net">
+ <p>
+ log4net is regularly built by its developers on the following frameworks:
+ </p>
+
+ <div class="table">
+ <table>
+ <colgroup>
+ <col style="text-align: left; white-space: nowrap" />
+ <col style="text-align: left;" />
+ </colgroup>
+ <tr>
+ <th>Framework</th>
+ <th>Website</th>
+ </tr>
+ <tr style="vertical-align: top;">
+ <td>Microsoft .NET 8 providing .NET Standard 2.0</td>
+ <td>
+ <a href="https://dotnet.microsoft.com/en-us/download/dotnet/8.0">https://dotnet.microsoft.com/en-us/download/dotnet/8.0</a>
+ </td>
+ </tr>
+ <tr style="vertical-align: top;">
+ <td>Microsoft .NET Framework 4.6.2</td>
+ <td>
+ <a href="http://msdn.microsoft.com/en-us/netframework/">http://msdn.microsoft.com/en-us/netframework/</a>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </section>
+
+ <section id="appenders" name="Appenders">
+ <p>
+ The following appenders are supported as specified:
+ </p>
+ <div class="table">
+ <table>
+ <colgroup>
+ <col style="text-align: left;" />
+ <col style="text-align: center;" />
+ <col style="text-align: center;" />
+ </colgroup>
+ <tr>
+ <th>Appender</th>
+ <th>.NET Framework 4.6.2</th>
+ <th>.NET Standard 2.0</th>
+ </tr>
+ <tr>
+ <td>AdoNetAppender</td>
+ <td>x</td>
+ <td>x</td>
+ </tr>
+ <tr>
+ <td>AnsiColorTerminalAppender</td>
+ <td>x</td>
+ <td>x</td>
+ </tr>
+ <tr>
+ <td>AspNetTraceAppender</td>
+ <td>x</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>BufferingForwardingAppender</td>
+ <td>x</td>
+ <td>x</td>
+ </tr>
+ <tr>
+ <td>ColoredConsoleAppender</td>
+ <td>x</td>
+ <td>x</td>
+ </tr>
+ <tr>
+ <td>ConsoleAppender</td>
+ <td>x</td>
+ <td>x</td>
+ </tr>
+ <tr>
+ <td>DebugAppender</td>
+ <td>x</td>
+ <td>x</td>
+ </tr>
+ <tr>
+ <td>EventLogAppender</td>
+ <td>x</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>FileAppender</td>
+ <td>x</td>
+ <td>x</td>
+ </tr>
+ <tr>
+ <td>ForwardingAppender</td>
+ <td>x</td>
+ <td>x</td>
+ </tr>
+ <tr>
+ <td>LocalSyslogAppender</td>
+ <td>x</td>
+ <td>x</td>
+ </tr>
+ <tr>
+ <td>ManagedColoredConsoleAppender</td>
+ <td>x</td>
+ <td>x</td>
+ </tr>
+ <tr>
+ <td>MemoryAppender</td>
+ <td>x</td>
+ <td>x</td>
+ </tr>
+ <tr>
+ <td>NetSendAppender</td>
+ <td>x</td>
+ <td>x</td>
+ </tr>
+ <tr>
+ <td>OutputDebugStringAppender</td>
+ <td>x</td>
+ <td>x</td>
+ </tr>
+ <tr>
+ <td>RemoteSyslogAppender</td>
+ <td>x</td>
+ <td>x</td>
+ </tr>
+ <tr>
+ <td>RemotingAppender</td>
+ <td>x</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>RollingFileAppender</td>
+ <td>x</td>
+ <td>x</td>
+ </tr>
+ <tr>
+ <td>SmtpAppender</td>
+ <td>x</td>
+ <td>x</td>
+ </tr>
+ <tr>
+ <td>SmtpPickupDirAppender</td>
+ <td>x</td>
+ <td>x</td>
+ </tr>
+ <tr>
+ <td>TelnetAppender</td>
+ <td>x</td>
+ <td>x</td>
+ </tr>
+ <tr>
+ <td>TraceAppender</td>
+ <td>x</td>
+ <td>x</td>
+ </tr>
+ <tr>
+ <td>UdpAppender</td>
+ <td>x</td>
+ <td>x</td>
+ </tr>
+ </table>
+ </div>
+ </section>
+ </section>
+ </body>
</document>
diff --git a/src/site/xdoc/release/release-notes.xml b/src/site/xdoc/release/release-notes.xml
index 1c4948c..f598651 100644
--- a/src/site/xdoc/release/release-notes.xml
+++ b/src/site/xdoc/release/release-notes.xml
@@ -17,2210 +17,2245 @@
-->
<document>
- <properties>
- <author email="nicko at apache dot org">Nicko Cadell</author>
- <title>Apache log4net: Release Notes</title>
- </properties>
+ <properties>
+ <author email="nicko at apache dot org">Nicko Cadell</author>
+ <title>Apache log4net: Release Notes</title>
+ </properties>
- <meta name="keywords" content="log4net release notes, log4net"/>
+ <meta name="keywords" content="log4net release notes, log4net"/>
- <body>
+ <body>
- <section id="main" name="Apache log4net™ Release Notes">
- <section id="a2.0.17" name="2.0.17">
- Apache log4net 2.0.16 addresses reported issues:
- <section id="a2.0.17-bug" name="Bug fixes">
- <ul>
- <li>
- <a href="https://github.com/apache/logging-log4net/issues/118">NullRefException from shutdown in 2.0.16</a> fixed in <a href="https://github.com/apache/logging-log4net/pull/120">Fast fix for NullRefException from FileAppender"</a> by (by @erikmav)"</li>
- </ul>
- </section>
- </section>
- <section id="a2.0.16" name="2.0.16">
- Apache log4net 2.0.16 addresses reported issues:
- <section id="a2.0.16-bug" name="Bug fixes">
- <ul>
- <li>
- <a href="https://github.com/apache/logging-log4net/pull/103">Support converting '.NET TP Worker' to the numeric thread ID on .NET 8+</a> (by @erikmav)
- </li>
- <li>
- <a href="https://github.com/apache/logging-log4net/pull/94">Fix typo in RemotingServer App.Config</a> (by @craigdfrench)
- </li>
- <li>
- <a href="https://github.com/apache/logging-log4net/pull/105">Fix CodeQL Password in configuration file Rule False Positives</a> (by @justinmichaels)
- </li>
- </ul>
- </section>
- <section id="a2.0.16-enhancements" name="Enhancements">
- <ul>
- <li>
- <a href="https://github.com/apache/logging-log4net/pull/89">adding extension points for revising logged content</a> (by @freeandnil)
- </li>
- <li>
- <a href="https://github.com/apache/logging-log4net/pull/91">SystemInfo.EntryAssemblyLocation writable to adjust location for config-files in unit test projects</a> (by @freeandnil)
- </li>
- <li>
- <a href="https://github.com/apache/logging-log4net/pull/92">New locking model for single log file in native applications with managed parts</a> (by @freeandnil)
- </li>
- <li>
- <a href="https://github.com/apache/logging-log4net/pull/93">Extension point for handling new lines in RemoteSysLogAppender added</a> (by @freeandnil)
- </li>
- <li>
- <a href="https://github.com/apache/logging-log4net/pull/95">Defer creation of locking model to ActivateOptions()</a> (by @freeandnil)
- </li>
- <li>
- <a href="https://github.com/apache/logging-log4net/pull/101">Add Peek() method to ThreadContextStack and LogicalThreadContextStack</a> (by @andreycha)
- </li>
- </ul>
- </section>
- </section>
- <section id="a2.0.15" name="2.0.15">
- Attention: .NET 3.5 Client Profile is <i>no longer supported</i>. I'm really sorry, I've tried
- to keep as many of the legacy targets available as possible, but after spending another 4 or so
- hours trying to get net35-client to build on any machine, I've given up - as far as I'm aware,
- this should only affect Windows XP clients. I'm afraid 2.0.14 was the end of the road for you.
+ <section id="main" name="Apache log4net™ Release Notes">
+ <section id="3.0.0" name="3.0.0">
+ <section id="3.0.0-breaking" name="Breaking Changes">
+ <p>
+ Attention: Starting with 3.0.0 we only support the following target frameworks
+ <ul>
+ <li>net462</li>
+ <li>netstandard2.0</li>
+ </ul>
+ The reasoning for this change can be found in <a href="https://github.com/apache/logging-log4net/issues/111">Dropping support for older runtimes</a>
+ </p>
+ <p>
+ log4net.Util.ReadOnlyPropertiesDictionary.InnerHashtable is now Dictionary<string, object?> (instead of System.Collections.Hashtable before)
+ The reason is an optimization as part of <a href="https://github.com/apache/logging-log4net/issues/124">Add support for nullable annotations</a>
+ </p>
+ </section>
- Apache log4net 2.0.15 addresses reported issues:
- <section id="a2.0.15-bug" name="Bug fixes">
- <ul>
- <li>
- Improper usage of xml namespacing for netfx targets after a netstandard update (
- <a href="https://issues.apache.org/jira/projects/LOG4NET/issues/LOG4NET-685">LOG4NET-685</a>,
- related <a href="https://issues.apache.org/jira/projects/LOG4NET/issues/LOG4NET-683">LOG4NET-683</a>)
- </li>
- <li>
- Locking hashtables during write in RenderMap calls to make them thread-safe (
- <a href="https://issues.apache.org/jira/projects/LOG4NET/issues/LOG4NET-646">LOG4NET-646</a>)
- </li>
- <li>
- An issue where RollingFilAppender would sometimes overwrite files instead of rolling them (
- <a href="https://issues.apache.org/jira/projects/LOG4NET/issues/LOG4NET-672">LOG4NET-672</a>)
- </li>
- </ul>
- </section>
- <section id="a2.0.15-enhancements" name="Enhancements">
- <ul>
- <li>
- <a href="https://github.com/apache/logging-log4net/pull/81">Enforce TLS1.2 in the ps1 scripts provided for dev use</a>
- </li>
- <li>
- <a href="https://github.com/apache/logging-log4net/pull/80">Corrected links in README</a>
- </li>
- <li>
- <a href="https://github.com/apache/logging-log4net/pull/89">Open up the internals of LogEvent a bit for extension purposes</a>
- </li>
- <li>Add information about FixFlags and performance to the BufferingAppender (and derivative) documentation</li>
- </ul>
- </section>
- </section>
- <section id="a2.0.14" name="2.0.14">
- Apache log4net 2.0.14 is a minor release to address some reported issues
- and accept a pull request provided by a community member:
- <section id="a2.0.14-bug" name="Bug fixes">
- <ul>
- <li>
- <a href="https://github.com/apache/logging-log4net/pull/77">Pull request</a> by @NicholasNoise to address issues with logging via ado appender to PostgreSQL
- </li>
- <li>Community request to correctly handle null data in ReadOnlyPropertiesDictionary</li>
- <li>
- <a href="https://github.com/apache/logging-log4net/pull/78">Pull request</a> by @erikma to use the numeric thread id for .net worker pool threads
- (<a href="https://issues.apache.org/jira/projects/LOG4NET/issues/LOG4NET-680">LOG4NET-680</a>)
- </li>
- <li>
- <a href="https://github.com/apache/logging-log4net/pull/79">Pull request</a> by @erikma to dispose of WindowsIdentity retrieved in TryGetCurrentUserName()
- (<a href="https://issues.apache.org/jira/projects/LOG4NET/issues/LOG4NET-671">LOG4NET-671</a>)
- </li>
- </ul>
- </section>
- </section>
- <section id="a2.0.13" name="2.0.13">
- Apache log4net 2.0.13 is a minor release to address some reported issues
- and accept some pull requests provided by community members:
- <section id="a2.0.13-bug" name="Bug fixes">
- <ul>
- <li>
- Addresses issue [<a href="https://issues.apache.org/jira/browse/LOG4NET-583">LOG4NET-583</a>] with proposed solution by Emmo Emminghaus,
- namely to provide an unique mutex identifier for the file rolling logic.
- </li>
- <li>
- Accepts pull request <a href="https://github.com/apache/logging-log4net/pull/76">76</a> by @dschwartzni
- to allow the netstandard2.0 library to be used within net472 web services
- </li>
- <li>
- Accepts pull request <a href=" https://github.com/apache/logging-log4net/pull/18">18</a> by @dmarlow
- to update the xml layout mimicking log4j
- </li>
- </ul>
- </section>
- </section>
- <section id="a2.0.12" name="2.0.12">
- <p>
- Apache log4net 2.0.12 is a minor fix release to address reported issues on
- non-windows platforms.
- </p>
- <section id="a2.0.12-bug" name="Bug Fixes">
- <ul>
- <li>
- Addresses the issues reported in
- [<a href="https://issues.apache.org/jira/browse/LOG4NET-652">LOG4NET-652</a>]
- and [<a href="https://issues.apache.org/jira/browse/LOG4NET-652">LOG4NET-653</a>] whereby
- logging could throw a PlatformNotSupported exception when the username
- is required within logs on non-Windows platforms. The implemented
- behavior is to fall back, where possible, on Environment.UserName
- or provide text that the facility is not supported.
- </li>
- </ul>
- </section>
- </section>
- <section id="a2.0.11" name="2.0.11">
- Apache log4net 2.0.11 fixes incorrect version strings within the released
- binaries and contains some minor fixes to correctly dispose of StreamWriters
- used during log flushing, thanks to community member @NicholasNoise
- </section>
- <section id="a2.0.10" name="2.0.10">
- <p>
- Apache log4net 2.0.10 improves <code>netstandard2.0</code> support
- thanks to community member @NicholasNoise.
- </p>
- <section id="a2.0.10-bug" name="Bug Fixes">
- <ul>
- <li>
- [<a href="https://issues.apache.org/jira/browse/LOG4NET-575">LOG4NET-575</a>]
- Addresses CVE-2018-1285 by cherry-picking the fix from
- Dominik Psenner, reported by Karthik Balasundaram, as it already
- existed in the the develop branch
- </li>
- </ul>
- </section>
- </section>
+ Apache log4net 3.0.0 addresses reported issues:
+ <section id="3.0.0-bug" name="Bug fixes">
+ <ul>
+ </ul>
+ </section>
+ <section id="3.0.0-enhancements" name="Enhancements">
+ <ul>
+ <li>
+ <a href="https://github.com/apache/logging-log4net/issues/111">Dropping support for older runtimes</a> (by @fluffynuts and @freeandnil)
+ </li>
+ <li>
+ <a href="https://github.com/apache/logging-log4net/issues/124">Add support for nullable annotations</a> (by @erikmav)
+ </li>
+ <li>
+ <a href="https://github.com/apache/logging-log4net/issues/127">Enable building log4net with docker container</a> (by @freeandnil)
+ </li>
+ </ul>
+ </section>
+ </section>
+ <section id="a2.0.17" name="2.0.17">
+ Apache log4net 2.0.16 addresses reported issues:
+ <section id="a2.0.17-bug" name="Bug fixes">
+ <ul>
+ <li>
+ <a href="https://github.com/apache/logging-log4net/issues/118">NullRefException from shutdown in 2.0.16</a> fixed in <a href="https://github.com/apache/logging-log4net/pull/120">Fast fix for NullRefException from FileAppender"</a> by (by @erikmav)"</li>
+ </ul>
+ </section>
+ </section>
+ <section id="a2.0.16" name="2.0.16">
+ Apache log4net 2.0.16 addresses reported issues:
+ <section id="a2.0.16-bug" name="Bug fixes">
+ <ul>
+ <li>
+ <a href="https://github.com/apache/logging-log4net/pull/103">Support converting '.NET TP Worker' to the numeric thread ID on .NET 8+</a> (by @erikmav)
+ </li>
+ <li>
+ <a href="https://github.com/apache/logging-log4net/pull/94">Fix typo in RemotingServer App.Config</a> (by @craigdfrench)
+ </li>
+ <li>
+ <a href="https://github.com/apache/logging-log4net/pull/105">Fix CodeQL Password in configuration file Rule False Positives</a> (by @justinmichaels)
+ </li>
+ </ul>
+ </section>
+ <section id="a2.0.16-enhancements" name="Enhancements">
+ <ul>
+ <li>
+ <a href="https://github.com/apache/logging-log4net/pull/89">adding extension points for revising logged content</a> (by @freeandnil)
+ </li>
+ <li>
+ <a href="https://github.com/apache/logging-log4net/pull/91">SystemInfo.EntryAssemblyLocation writable to adjust location for config-files in unit test projects</a> (by @freeandnil)
+ </li>
+ <li>
+ <a href="https://github.com/apache/logging-log4net/pull/92">New locking model for single log file in native applications with managed parts</a> (by @freeandnil)
+ </li>
+ <li>
+ <a href="https://github.com/apache/logging-log4net/pull/93">Extension point for handling new lines in RemoteSysLogAppender added</a> (by @freeandnil)
+ </li>
+ <li>
+ <a href="https://github.com/apache/logging-log4net/pull/95">Defer creation of locking model to ActivateOptions()</a> (by @freeandnil)
+ </li>
+ <li>
+ <a href="https://github.com/apache/logging-log4net/pull/101">Add Peek() method to ThreadContextStack and LogicalThreadContextStack</a> (by @andreycha)
+ </li>
+ </ul>
+ </section>
+ </section>
+ <section id="a2.0.15" name="2.0.15">
+ Attention: .NET 3.5 Client Profile is <i>no longer supported</i>. I'm really sorry, I've tried
+ to keep as many of the legacy targets available as possible, but after spending another 4 or so
+ hours trying to get net35-client to build on any machine, I've given up - as far as I'm aware,
+ this should only affect Windows XP clients. I'm afraid 2.0.14 was the end of the road for you.
- <section id="a2.0.9" name="2.0.9">
- <p>
- Apache log4net 2.0.9 adds <code>netstandard2.0</code> support
- and restructures the project to enable easier build as well as build
- at AppVeyer. Project files have been updated to the modern Sdk format.
- </p>
- <section id="a2.0.9-bug" name="Bug Fixes">
- <ul>
- <li>
- [<a href="https://issues.apache.org/jira/browse/LOG4NET-559">LOG4NET-559</a>] Add null
- checkes to avoid issues thrown by custom appenders
- </li>
- <li>
- [<a href="https://issues.apache.org/jira/browse/LOG4NET-563">LOG4NET-563</a>] Site styling
- copied from log4j
- </li>
- </ul>
- </section>
- </section>
- <section id="a2.0.8" name="2.0.8">
- <p>
- Apache log4net 2.0.8 fixes a
- <code>LockRecursionException</code>
- that could happen
- inside the <code>FileAppender</code> under certain
- circumstances. It also adds support for
- <code>LogicalThreadContext</code>
- to the .NET Standard
- build based on <code>AsyncLocal</code> rather than
- <code>CallContext</code>.
- </p>
+ Apache log4net 2.0.15 addresses reported issues:
+ <section id="a2.0.15-bug" name="Bug fixes">
+ <ul>
+ <li>
+ Improper usage of xml namespacing for netfx targets after a netstandard update (
+ <a href="https://issues.apache.org/jira/projects/LOG4NET/issues/LOG4NET-685">LOG4NET-685</a>,
+ related <a href="https://issues.apache.org/jira/projects/LOG4NET/issues/LOG4NET-683">LOG4NET-683</a>)
+ </li>
+ <li>
+ Locking hashtables during write in RenderMap calls to make them thread-safe (
+ <a href="https://issues.apache.org/jira/projects/LOG4NET/issues/LOG4NET-646">LOG4NET-646</a>)
+ </li>
+ <li>
+ An issue where RollingFilAppender would sometimes overwrite files instead of rolling them (
+ <a href="https://issues.apache.org/jira/projects/LOG4NET/issues/LOG4NET-672">LOG4NET-672</a>)
+ </li>
+ </ul>
+ </section>
+ <section id="a2.0.15-enhancements" name="Enhancements">
+ <ul>
+ <li>
+ <a href="https://github.com/apache/logging-log4net/pull/81">Enforce TLS1.2 in the ps1 scripts provided for dev use</a>
+ </li>
+ <li>
+ <a href="https://github.com/apache/logging-log4net/pull/80">Corrected links in README</a>
+ </li>
+ <li>
+ <a href="https://github.com/apache/logging-log4net/pull/89">Open up the internals of LogEvent a bit for extension purposes</a>
+ </li>
+ <li>Add information about FixFlags and performance to the BufferingAppender (and derivative) documentation</li>
+ </ul>
+ </section>
+ </section>
+ <section id="a2.0.14" name="2.0.14">
+ Apache log4net 2.0.14 is a minor release to address some reported issues
+ and accept a pull request provided by a community member:
+ <section id="a2.0.14-bug" name="Bug fixes">
+ <ul>
+ <li>
+ <a href="https://github.com/apache/logging-log4net/pull/77">Pull request</a> by @NicholasNoise to address issues with logging via ado appender to PostgreSQL
+ </li>
+ <li>Community request to correctly handle null data in ReadOnlyPropertiesDictionary</li>
+ <li>
+ <a href="https://github.com/apache/logging-log4net/pull/78">Pull request</a> by @erikma to use the numeric thread id for .net worker pool threads
+ (<a href="https://issues.apache.org/jira/projects/LOG4NET/issues/LOG4NET-680">LOG4NET-680</a>)
+ </li>
+ <li>
+ <a href="https://github.com/apache/logging-log4net/pull/79">Pull request</a> by @erikma to dispose of WindowsIdentity retrieved in TryGetCurrentUserName()
+ (<a href="https://issues.apache.org/jira/projects/LOG4NET/issues/LOG4NET-671">LOG4NET-671</a>)
+ </li>
+ </ul>
+ </section>
+ </section>
+ <section id="a2.0.13" name="2.0.13">
+ Apache log4net 2.0.13 is a minor release to address some reported issues
+ and accept some pull requests provided by community members:
+ <section id="a2.0.13-bug" name="Bug fixes">
+ <ul>
+ <li>
+ Addresses issue [<a href="https://issues.apache.org/jira/browse/LOG4NET-583">LOG4NET-583</a>] with proposed solution by Emmo Emminghaus,
+ namely to provide an unique mutex identifier for the file rolling logic.
+ </li>
+ <li>
+ Accepts pull request <a href="https://github.com/apache/logging-log4net/pull/76">76</a> by @dschwartzni
+ to allow the netstandard2.0 library to be used within net472 web services
+ </li>
+ <li>
+ Accepts pull request <a href=" https://github.com/apache/logging-log4net/pull/18">18</a> by @dmarlow
+ to update the xml layout mimicking log4j
+ </li>
+ </ul>
+ </section>
+ </section>
+ <section id="a2.0.12" name="2.0.12">
+ <p>
+ Apache log4net 2.0.12 is a minor fix release to address reported issues on
+ non-windows platforms.
+ </p>
+ <section id="a2.0.12-bug" name="Bug Fixes">
+ <ul>
+ <li>
+ Addresses the issues reported in
+ [<a href="https://issues.apache.org/jira/browse/LOG4NET-652">LOG4NET-652</a>]
+ and [<a href="https://issues.apache.org/jira/browse/LOG4NET-652">LOG4NET-653</a>] whereby
+ logging could throw a PlatformNotSupported exception when the username
+ is required within logs on non-Windows platforms. The implemented
+ behavior is to fall back, where possible, on Environment.UserName
+ or provide text that the facility is not supported.
+ </li>
+ </ul>
+ </section>
+ </section>
+ <section id="a2.0.11" name="2.0.11">
+ Apache log4net 2.0.11 fixes incorrect version strings within the released
+ binaries and contains some minor fixes to correctly dispose of StreamWriters
+ used during log flushing, thanks to community member @NicholasNoise
+ </section>
+ <section id="a2.0.10" name="2.0.10">
+ <p>
+ Apache log4net 2.0.10 improves <code>netstandard2.0</code> support
+ thanks to community member @NicholasNoise.
+ </p>
+ <section id="a2.0.10-bug" name="Bug Fixes">
+ <ul>
+ <li>
+ [<a href="https://issues.apache.org/jira/browse/LOG4NET-575">LOG4NET-575</a>]
+ Addresses CVE-2018-1285 by cherry-picking the fix from
+ Dominik Psenner, reported by Karthik Balasundaram, as it already
+ existed in the the develop branch
+ </li>
+ </ul>
+ </section>
+ </section>
- <section id="a2.0.8-bug" name="Bug Fixes">
- <ul>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-466'>LOG4NET-466</a>] - "LockRecursionException:
- A read lock may not be acquired with the write lock held in this mode." exception
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-550'>LOG4NET-550</a>] - Logging
- recursively from an Appender not supported for NET_4_0 and MONO_4_0
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-551'>LOG4NET-551</a>] -
- LockRecursionException when using File Appenders
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-554'>LOG4NET-554</a>] -
- LogicalThreadContext was removed in .NETStandard
- </li>
- </ul>
- </section>
+ <section id="a2.0.9" name="2.0.9">
+ <p>
+ Apache log4net 2.0.9 adds <code>netstandard2.0</code> support
+ and restructures the project to enable easier build as well as build
+ at AppVeyer. Project files have been updated to the modern Sdk format.
+ </p>
+ <section id="a2.0.9-bug" name="Bug Fixes">
+ <ul>
+ <li>
+ [<a href="https://issues.apache.org/jira/browse/LOG4NET-559">LOG4NET-559</a>] Add null
+ checkes to avoid issues thrown by custom appenders
+ </li>
+ <li>
+ [<a href="https://issues.apache.org/jira/browse/LOG4NET-563">LOG4NET-563</a>] Site styling
+ copied from log4j
+ </li>
+ </ul>
+ </section>
+ </section>
+ <section id="a2.0.8" name="2.0.8">
+ <p>
+ Apache log4net 2.0.8 fixes a
+ <code>LockRecursionException</code>
+ that could happen
+ inside the <code>FileAppender</code> under certain
+ circumstances. It also adds support for
+ <code>LogicalThreadContext</code>
+ to the .NET Standard
+ build based on <code>AsyncLocal</code> rather than
+ <code>CallContext</code>.
+ </p>
- <section id="a2.0.8-new" name="New Features">
- <ul>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-553'>LOG4NET-553</a>] -
- DebugAppender
- configuration should give the possibility to disable outputting loggerName as category
- </li>
- </ul>
- </section>
- </section>
+ <section id="a2.0.8-bug" name="Bug Fixes">
+ <ul>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-466'>LOG4NET-466</a>] - "LockRecursionException:
+ A read lock may not be acquired with the write lock held in this mode." exception
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-550'>LOG4NET-550</a>] - Logging
+ recursively from an Appender not supported for NET_4_0 and MONO_4_0
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-551'>LOG4NET-551</a>] -
+ LockRecursionException when using File Appenders
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-554'>LOG4NET-554</a>] -
+ LogicalThreadContext was removed in .NETStandard
+ </li>
+ </ul>
+ </section>
- <section id="a2.0.7" name="2.0.7">
- <p>
- Apache log4net 2.0.7 fixes a glitch in nuget packaging and
- is otherwise identical to 2.0.6 (apart from the copyright
- year and assembly version). If you are not using the nuget
- package there is no reason to upgrade.
- </p>
+ <section id="a2.0.8-new" name="New Features">
+ <ul>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-553'>LOG4NET-553</a>] -
+ DebugAppender
+ configuration should give the possibility to disable outputting loggerName as category
+ </li>
+ </ul>
+ </section>
+ </section>
- <section id="a2.0.7-bug" name="Bug Fixes">
- <ul>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-540'>LOG4NET-540</a>] - nuget
- dependencies for .NET Standard leak into net46
- </li>
- </ul>
- </section>
- </section>
+ <section id="a2.0.7" name="2.0.7">
+ <p>
+ Apache log4net 2.0.7 fixes a glitch in nuget packaging and
+ is otherwise identical to 2.0.6 (apart from the copyright
+ year and assembly version). If you are not using the nuget
+ package there is no reason to upgrade.
+ </p>
- <section id="a2.0.6" name="2.0.6">
+ <section id="a2.0.7-bug" name="Bug Fixes">
+ <ul>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-540'>LOG4NET-540</a>] - nuget
+ dependencies for .NET Standard leak into net46
+ </li>
+ </ul>
+ </section>
+ </section>
- <p>
- The Apache log4net team is now responsible for the nuget
- package, we've changed the version number of this release
- to align the version numbers. Release 2.0.6 is supposed to
- be compatible with 1.2.15.
- </p>
+ <section id="a2.0.6" name="2.0.6">
- <p>
- The binary distributions no longer contain assemblies
- built for the .NET Framework 1.x or Mono 1.x - you can
- build those yourself using the source distribution.
- </p>
+ <p>
+ The Apache log4net team is now responsible for the nuget
+ package, we've changed the version number of this release
+ to align the version numbers. Release 2.0.6 is supposed to
+ be compatible with 1.2.15.
+ </p>
- <p>
- Starting with 2.0.6 .NET Core - or more precisely
- .NET Standard 1.3 - has become a supported platform. Please
- note that several features of log4net are not available
- when using the .NET Core version, see <a
+ <p>
+ The binary distributions no longer contain assemblies
+ built for the .NET Framework 1.x or Mono 1.x - you can
+ build those yourself using the source distribution.
+ </p>
+
+ <p>
+ Starting with 2.0.6 .NET Core - or more precisely
+ .NET Standard 1.3 - has become a supported platform. Please
+ note that several features of log4net are not available
+ when using the .NET Core version, see <a
href="framework-support.html#netstandard-1.3">
- framework
- support
- </a> for details.
- </p>
+ framework
+ support
+ </a> for details.
+ </p>
- <section id="a2.0.6-bug" name="Bug Fixes">
- <ul>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-508'>LOG4NET-508</a>] - NAnt release
- build is not optimized
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-512'>LOG4NET-512</a>] - Thread
- safety
- issue in Hierarchy.cs
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-527'>LOG4NET-527</a>] - broken link
- on
- config-examples.html
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-529'>LOG4NET-529</a>] - Possible
- thread-safety bug in LoggingEvent
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-536'>LOG4NET-536</a>] - Can't
- build
- for NETCF-2.0
- </li>
- </ul>
- </section>
- <section id="a2.0.6-enh" name="Improvements">
- <ul>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-530'>LOG4NET-530</a>] - Use UTC
- internally to avoid ambiguous timestamps
- </li>
- </ul>
- </section>
+ <section id="a2.0.6-bug" name="Bug Fixes">
+ <ul>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-508'>LOG4NET-508</a>] - NAnt release
+ build is not optimized
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-512'>LOG4NET-512</a>] - Thread
+ safety
+ issue in Hierarchy.cs
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-527'>LOG4NET-527</a>] - broken link
+ on
+ config-examples.html
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-529'>LOG4NET-529</a>] - Possible
+ thread-safety bug in LoggingEvent
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-536'>LOG4NET-536</a>] - Can't
+ build
+ for NETCF-2.0
+ </li>
+ </ul>
+ </section>
+ <section id="a2.0.6-enh" name="Improvements">
+ <ul>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-530'>LOG4NET-530</a>] - Use UTC
+ internally to avoid ambiguous timestamps
+ </li>
+ </ul>
+ </section>
- <section id="a2.0.6-new" name="New Features">
- <ul>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-467'>LOG4NET-467</a>] - Is .NET
- Core,
- will be supported in the near future, or not
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-511'>LOG4NET-511</a>] - API to flush
- appenders
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-526'>LOG4NET-526</a>] - Add
- appSetting
- conversion pattern to PatternString
- </li>
- </ul>
- </section>
- </section>
+ <section id="a2.0.6-new" name="New Features">
+ <ul>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-467'>LOG4NET-467</a>] - Is .NET
+ Core,
+ will be supported in the near future, or not
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-511'>LOG4NET-511</a>] - API to flush
+ appenders
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-526'>LOG4NET-526</a>] - Add
+ appSetting
+ conversion pattern to PatternString
+ </li>
+ </ul>
+ </section>
+ </section>
- <section id="a1.2.15" name="1.2.15">
- <section id="a1.2.15-bug" name="Bug Fixes">
- <ul>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-462'>LOG4NET-462</a>] -
- ReadOnlyPropertiesDictionary not thread safe
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-488'>LOG4NET-488</a>] - Fix tests
- build
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-489'>LOG4NET-489</a>] -
- AdoNetAppender
- fails after upgrade to 2.0.4
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-490'>LOG4NET-490</a>] -
- InterProcessLock
- Tests fail
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-493'>LOG4NET-493</a>] - Log4net
- 1.2.14/ADO.NET appender throws exception when starting (1.2.13 with same config works fine)
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-494'>LOG4NET-494</a>] -
- ArgumentOutOfRange with SQLite
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-495'>LOG4NET-495</a>] - Error when
- BufferSize is >1, parameter already defined
- </li>
- </ul>
- </section>
- </section>
+ <section id="a1.2.15" name="1.2.15">
+ <section id="a1.2.15-bug" name="Bug Fixes">
+ <ul>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-462'>LOG4NET-462</a>] -
+ ReadOnlyPropertiesDictionary not thread safe
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-488'>LOG4NET-488</a>] - Fix tests
+ build
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-489'>LOG4NET-489</a>] -
+ AdoNetAppender
+ fails after upgrade to 2.0.4
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-490'>LOG4NET-490</a>] -
+ InterProcessLock
+ Tests fail
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-493'>LOG4NET-493</a>] - Log4net
+ 1.2.14/ADO.NET appender throws exception when starting (1.2.13 with same config works fine)
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-494'>LOG4NET-494</a>] -
+ ArgumentOutOfRange with SQLite
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-495'>LOG4NET-495</a>] - Error when
+ BufferSize is >1, parameter already defined
+ </li>
+ </ul>
+ </section>
+ </section>
- <section id="a1.2.14" name="1.2.14">
- <section id="a1.2.14-bug" name="Bug Fixes">
- <ul>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-408'>LOG4NET-408</a>] - Correction
- on
- InterProcessLock
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-443'>LOG4NET-443</a>] -
- Logger.CallAppenders
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-447'>LOG4NET-447</a>] -
- MemoryAppender
- class is not thread safe
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-455'>LOG4NET-455</a>] -
- LogicalThreadContext does not flow correctly through async/await
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-479'>LOG4NET-479</a>] - Cannot
- compile
- log4net.vs2008
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-484'>LOG4NET-484</a>] -
- System.ObjectDisposedException with FileAppender+InterProcessLock
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-485'>LOG4NET-485</a>] -
- RollingFileAppender cannot be used by multiple process
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-486'>LOG4NET-486</a>] - Rolling File
- Appender with 'maxSizeRollBackups' and 'datePattern' does not detect
- existing
- logs initially
- </li>
- </ul>
- </section>
+ <section id="a1.2.14" name="1.2.14">
+ <section id="a1.2.14-bug" name="Bug Fixes">
+ <ul>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-408'>LOG4NET-408</a>] - Correction
+ on
+ InterProcessLock
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-443'>LOG4NET-443</a>] -
+ Logger.CallAppenders
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-447'>LOG4NET-447</a>] -
+ MemoryAppender
+ class is not thread safe
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-455'>LOG4NET-455</a>] -
+ LogicalThreadContext does not flow correctly through async/await
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-479'>LOG4NET-479</a>] - Cannot
+ compile
+ log4net.vs2008
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-484'>LOG4NET-484</a>] -
+ System.ObjectDisposedException with FileAppender+InterProcessLock
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-485'>LOG4NET-485</a>] -
+ RollingFileAppender cannot be used by multiple process
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-486'>LOG4NET-486</a>] - Rolling File
+ Appender with 'maxSizeRollBackups' and 'datePattern' does not detect
+ existing
+ logs initially
+ </li>
+ </ul>
+ </section>
- <section id="a1.2.14-enh" name="Improvements">
- <ul>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-456'>LOG4NET-456</a>] - Include
- debug
- symbol files in release packages
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-457'>LOG4NET-457</a>] - SMTP
- Appender
- should trim leading and trailing separators from address fields
- </li>
- </ul>
- </section>
+ <section id="a1.2.14-enh" name="Improvements">
+ <ul>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-456'>LOG4NET-456</a>] - Include
+ debug
+ symbol files in release packages
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-457'>LOG4NET-457</a>] - SMTP
+ Appender
+ should trim leading and trailing separators from address fields
+ </li>
+ </ul>
+ </section>
- <section id="a1.2.14-new" name="New Features">
- <ul>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-473'>LOG4NET-473</a>] - Option for
- file
- extension in SmtpPickupDirAppender
- </li>
- </ul>
- </section>
- </section>
+ <section id="a1.2.14-new" name="New Features">
+ <ul>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-473'>LOG4NET-473</a>] - Option for
+ file
+ extension in SmtpPickupDirAppender
+ </li>
+ </ul>
+ </section>
+ </section>
- <section id="a1.2.13" name="1.2.13">
+ <section id="a1.2.13" name="1.2.13">
- <section id="a1.2.13-bug" name="Bug Fixes">
- <ul>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-132'>LOG4NET-132</a>] - Environment
- variables are mistakenly case sensitive on windows
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-376'>LOG4NET-376</a>] - Race
- condition
- in AbsoluteTimeDateFormatter
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-393'>LOG4NET-393</a>] - Using
- dynamic
- methods with log4net causes NullReferenceException in StackFrameItem
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-399'>LOG4NET-399</a>] - Does not
- build
- for Compact Framework 2.0
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-404'>LOG4NET-404</a>] - assemblies
- for
- .NET 3.5 are missing ILogExtensions
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-405'>LOG4NET-405</a>] - SmtpAppender
- encoding changes
- </li>
- </ul>
+ <section id="a1.2.13-bug" name="Bug Fixes">
+ <ul>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-132'>LOG4NET-132</a>] - Environment
+ variables are mistakenly case sensitive on windows
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-376'>LOG4NET-376</a>] - Race
+ condition
+ in AbsoluteTimeDateFormatter
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-393'>LOG4NET-393</a>] - Using
+ dynamic
+ methods with log4net causes NullReferenceException in StackFrameItem
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-399'>LOG4NET-399</a>] - Does not
+ build
+ for Compact Framework 2.0
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-404'>LOG4NET-404</a>] - assemblies
+ for
+ .NET 3.5 are missing ILogExtensions
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-405'>LOG4NET-405</a>] - SmtpAppender
+ encoding changes
+ </li>
+ </ul>
- </section>
+ </section>
- <section id="a1.2.13-enh" name="Improvements">
+ <section id="a1.2.13-enh" name="Improvements">
- <ul>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-394'>LOG4NET-394</a>] - Lambda-based
- ILog-Extensions should catch errors
- </li>
- </ul>
+ <ul>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-394'>LOG4NET-394</a>] - Lambda-based
+ ILog-Extensions should catch errors
+ </li>
+ </ul>
- </section>
- </section>
+ </section>
+ </section>
- <section id="a1.2.12" name="1.2.12">
+ <section id="a1.2.12" name="1.2.12">
- <p>
- The binary distributions no longer contain assemblies
- built for the Compact Framework 2.0 - you can build
- those yourself using the source distribution.
- </p>
+ <p>
+ The binary distributions no longer contain assemblies
+ built for the Compact Framework 2.0 - you can build
+ those yourself using the source distribution.
+ </p>
- <section id="a1.2.12-bug" name="Bug Fixes">
- <ul>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-148'>LOG4NET-148</a>] -
- ThreadContext
- uses LocalDataStore to store ThreadSpecific data instead should be using [ThreadStatic]
- variables.
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-178'>LOG4NET-178</a>] - Log4Net
- stops
- logging after appdomain recycle of ASP.NET2.0 application
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-202'>LOG4NET-202</a>] -
- AdoNetAppenderParameter.Size Property is not optional
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-218'>LOG4NET-218</a>] - Test
- StringFormatTest.TestFormatString fails
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-220'>LOG4NET-220</a>] - multiple
- users
- overwrite existing log file when RollingFileAppender is rolling over date and minimal
- locking is
- used
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-228'>LOG4NET-228</a>] -
- log4net.Util.HostName may throw System.Configuration.ConfigurationErrorsException in
- System.Net.Dns.GetHostName(). The exception should be ignored.
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-266'>LOG4NET-266</a>] -
- AdoNetAppender
- does not work on a IIS 7 website using Windows authentication
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-277'>LOG4NET-277</a>] - Registering
- a
- custom Object Renderer in configuration file
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-284'>LOG4NET-284</a>] - In a
- multithreaded application, duplicate messages are output.
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-294'>LOG4NET-294</a>] - Exception
- rendering object type [System.OutOfMemoryException]
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-317'>LOG4NET-317</a>] -
- LogicalThreadContext sometimes doesn't follow CallContext's logical thread
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-322'>LOG4NET-322</a>] - Conditional
- compilation symbols for .net4 Release
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-323'>LOG4NET-323</a>] -
- AbsoluteTimeDateFormatter caches string representation of now too aggressively
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-331'>LOG4NET-331</a>] -
- AdoNetAppender
- errors when writing Asp.net item when Request object is null
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-335'>LOG4NET-335</a>] - Lost the
- ability
- to monitor changes to logger config files when you call ConfigureAndWatch multiple times
- with
- different Config File Names - worked fine on 1.2.10.0
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-341'>LOG4NET-341</a>] -
- RemotingAppender
- Error
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-343'>LOG4NET-343</a>] -
- ArgumentOutOfRangeException in log4net hierarchy on "." logger name
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-347'>LOG4NET-347</a>] - Log4net not
- working in an ASP.Net environment with medium trust
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-348'>LOG4NET-348</a>] -
- System.IndexOutOfRangeException when StackFrameLevel is greater then StackFrames length
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-352'>LOG4NET-352</a>] - CS0419
- during
- build with Mono >2.6
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-360'>LOG4NET-360</a>] -
- EventLogAppender
- can corrupt the event log on Windows Vista and higher if the string is longer than 31839
- bytes
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-361'>LOG4NET-361</a>] -
- RollingLogFileAppender does not correctly initialize the backup index when style is date or
- composite
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-369'>LOG4NET-369</a>] -
- preserveLogFileNameExtension is not considered when rolling over time after an application
- restart
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-370'>LOG4NET-370</a>] -
- RemoteSyslogAppender doesn't properly handle newline in log message
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-371'>LOG4NET-371</a>] - Log with
- formatting doesn't call custom renderers (IObjectRenderer)
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-375'>LOG4NET-375</a>] - typo /
- misspelling in log message
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-378'>LOG4NET-378</a>] - Rolling log
- file
- is overwritten when application is restarted
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-379'>LOG4NET-379</a>] -
- NullReferenceException in FileAppender when file is not filled.
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-382'>LOG4NET-382</a>] -
- TargetInvocationException occurs because MESSAGE_SIZE fields in EventLogAppender are
- initialized
- in wrong order
- </li>
- </ul>
- </section>
+ <section id="a1.2.12-bug" name="Bug Fixes">
+ <ul>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-148'>LOG4NET-148</a>] -
+ ThreadContext
+ uses LocalDataStore to store ThreadSpecific data instead should be using [ThreadStatic]
+ variables.
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-178'>LOG4NET-178</a>] - Log4Net
+ stops
+ logging after appdomain recycle of ASP.NET2.0 application
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-202'>LOG4NET-202</a>] -
+ AdoNetAppenderParameter.Size Property is not optional
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-218'>LOG4NET-218</a>] - Test
+ StringFormatTest.TestFormatString fails
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-220'>LOG4NET-220</a>] - multiple
+ users
+ overwrite existing log file when RollingFileAppender is rolling over date and minimal
+ locking is
+ used
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-228'>LOG4NET-228</a>] -
+ log4net.Util.HostName may throw System.Configuration.ConfigurationErrorsException in
+ System.Net.Dns.GetHostName(). The exception should be ignored.
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-266'>LOG4NET-266</a>] -
+ AdoNetAppender
+ does not work on a IIS 7 website using Windows authentication
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-277'>LOG4NET-277</a>] - Registering
+ a
+ custom Object Renderer in configuration file
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-284'>LOG4NET-284</a>] - In a
+ multithreaded application, duplicate messages are output.
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-294'>LOG4NET-294</a>] - Exception
+ rendering object type [System.OutOfMemoryException]
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-317'>LOG4NET-317</a>] -
+ LogicalThreadContext sometimes doesn't follow CallContext's logical thread
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-322'>LOG4NET-322</a>] - Conditional
+ compilation symbols for .net4 Release
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-323'>LOG4NET-323</a>] -
+ AbsoluteTimeDateFormatter caches string representation of now too aggressively
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-331'>LOG4NET-331</a>] -
+ AdoNetAppender
+ errors when writing Asp.net item when Request object is null
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-335'>LOG4NET-335</a>] - Lost the
+ ability
+ to monitor changes to logger config files when you call ConfigureAndWatch multiple times
+ with
+ different Config File Names - worked fine on 1.2.10.0
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-341'>LOG4NET-341</a>] -
+ RemotingAppender
+ Error
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-343'>LOG4NET-343</a>] -
+ ArgumentOutOfRangeException in log4net hierarchy on "." logger name
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-347'>LOG4NET-347</a>] - Log4net not
+ working in an ASP.Net environment with medium trust
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-348'>LOG4NET-348</a>] -
+ System.IndexOutOfRangeException when StackFrameLevel is greater then StackFrames length
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-352'>LOG4NET-352</a>] - CS0419
+ during
+ build with Mono >2.6
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-360'>LOG4NET-360</a>] -
+ EventLogAppender
+ can corrupt the event log on Windows Vista and higher if the string is longer than 31839
+ bytes
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-361'>LOG4NET-361</a>] -
+ RollingLogFileAppender does not correctly initialize the backup index when style is date or
+ composite
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-369'>LOG4NET-369</a>] -
+ preserveLogFileNameExtension is not considered when rolling over time after an application
+ restart
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-370'>LOG4NET-370</a>] -
+ RemoteSyslogAppender doesn't properly handle newline in log message
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-371'>LOG4NET-371</a>] - Log with
+ formatting doesn't call custom renderers (IObjectRenderer)
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-375'>LOG4NET-375</a>] - typo /
+ misspelling in log message
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-378'>LOG4NET-378</a>] - Rolling log
+ file
+ is overwritten when application is restarted
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-379'>LOG4NET-379</a>] -
+ NullReferenceException in FileAppender when file is not filled.
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-382'>LOG4NET-382</a>] -
+ TargetInvocationException occurs because MESSAGE_SIZE fields in EventLogAppender are
+ initialized
+ in wrong order
+ </li>
+ </ul>
+ </section>
- <section id="a1.2.12-enh" name="Improvements">
- <ul>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-222'>LOG4NET-222</a>] - [PATCH]
- Improve
- AnsiColorTerminalAppender to support marking colors as Light
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-223'>LOG4NET-223</a>] - [PATCH]
- Improve
- AnsiColorTerminalAppender to support marking colors as Light
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-232'>LOG4NET-232</a>] - Use
- ReaderWriterLockSlim instead of ReaderWriterLock.
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-259'>LOG4NET-259</a>] - Log4Net does
- not
- create a new tab in Chainsaw
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-283'>LOG4NET-283</a>] -
- OnlyOnceErrorHandler is not subclass-friendly
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-292'>LOG4NET-292</a>] - Managed
- ColoredConsoleAppender for .NET2/Mono.
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-315'>LOG4NET-315</a>] - SmtpAppender
- -
- Add support for ignoring certificate errors
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-316'>LOG4NET-316</a>] - Provide a
- Layout
- Pattern that is re-evaluated on each use
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-318'>LOG4NET-318</a>] - log4net
- doesn't
- pass verification
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-334'>LOG4NET-334</a>] - Appender
- Faill
- over
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-354'>LOG4NET-354</a>] - E-mail
- encoding
- configuration setting for SmtpAppender
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-362'>LOG4NET-362</a>] - [PATCH]
- SystemInfo.AssemblyLocationInfo throws unhandled ArgumentException "Absolute path
- required"
- when exe is started via UNC path
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-386'>LOG4NET-386</a>] - Can't
- access
- ThreadContext properties
- </li>
- </ul>
- </section>
+ <section id="a1.2.12-enh" name="Improvements">
+ <ul>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-222'>LOG4NET-222</a>] - [PATCH]
+ Improve
+ AnsiColorTerminalAppender to support marking colors as Light
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-223'>LOG4NET-223</a>] - [PATCH]
+ Improve
+ AnsiColorTerminalAppender to support marking colors as Light
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-232'>LOG4NET-232</a>] - Use
+ ReaderWriterLockSlim instead of ReaderWriterLock.
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-259'>LOG4NET-259</a>] - Log4Net does
+ not
+ create a new tab in Chainsaw
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-283'>LOG4NET-283</a>] -
+ OnlyOnceErrorHandler is not subclass-friendly
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-292'>LOG4NET-292</a>] - Managed
+ ColoredConsoleAppender for .NET2/Mono.
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-315'>LOG4NET-315</a>] - SmtpAppender
+ -
+ Add support for ignoring certificate errors
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-316'>LOG4NET-316</a>] - Provide a
+ Layout
+ Pattern that is re-evaluated on each use
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-318'>LOG4NET-318</a>] - log4net
+ doesn't
+ pass verification
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-334'>LOG4NET-334</a>] - Appender
+ Faill
+ over
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-354'>LOG4NET-354</a>] - E-mail
+ encoding
+ configuration setting for SmtpAppender
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-362'>LOG4NET-362</a>] - [PATCH]
+ SystemInfo.AssemblyLocationInfo throws unhandled ArgumentException "Absolute path
+ required"
+ when exe is started via UNC path
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-386'>LOG4NET-386</a>] - Can't
+ access
+ ThreadContext properties
+ </li>
+ </ul>
+ </section>
- <section id="a1.2.12-new" name="New Features">
- <ul>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-290'>LOG4NET-290</a>] - Add
- Lambda-based
- ILog-Extensions (embedded log.IsEnabled)
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-342'>LOG4NET-342</a>] - Add a way to
- prevent silent failure
- </li>
- </ul>
- </section>
- </section>
+ <section id="a1.2.12-new" name="New Features">
+ <ul>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-290'>LOG4NET-290</a>] - Add
+ Lambda-based
+ ILog-Extensions (embedded log.IsEnabled)
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-342'>LOG4NET-342</a>] - Add a way to
+ prevent silent failure
+ </li>
+ </ul>
+ </section>
+ </section>
- <section id="a1.2.11" name="1.2.11">
- <p>
- log4net 1.2.11 is not only a bugfix release, it also
- adds support for Microsoft® .NET 4.0 as well as the client profiles
- of .NET 3.5 and .NET 4.0.
- </p>
+ <section id="a1.2.11" name="1.2.11">
+ <p>
+ log4net 1.2.11 is not only a bugfix release, it also
+ adds support for Microsoft® .NET 4.0 as well as the client profiles
+ of .NET 3.5 and .NET 4.0.
+ </p>
- <p>
- Starting with this release log4net uses a new strong
- name key but we also provide a binary distribution using
- the "old" strong name key of log4net 1.2.10 and earlier.
- See <a href="faq.html#two-snks">the FAQ</a> for details.
- </p>
+ <p>
+ Starting with this release log4net uses a new strong
+ name key but we also provide a binary distribution using
+ the "old" strong name key of log4net 1.2.10 and earlier.
+ See <a href="faq.html#two-snks">the FAQ</a> for details.
+ </p>
- <p>
- The binary distributions no longer contain assemblies
- built for the Compact Framework 1.0 or the Shared Source
- CLI - you can build those yourself using the source
- distribution.
- </p>
+ <p>
+ The binary distributions no longer contain assemblies
+ built for the Compact Framework 1.0 or the Shared Source
+ CLI - you can build those yourself using the source
+ distribution.
+ </p>
- <section id="a1.2.11-breaking" name="Breaking Changes">
- <p>
- The signature of
- <code>ILoggerFactory.CreateLogger</code>
- has changed.
- </p>
- </section>
+ <section id="a1.2.11-breaking" name="Breaking Changes">
+ <p>
+ The signature of
+ <code>ILoggerFactory.CreateLogger</code>
+ has changed.
+ </p>
+ </section>
- <section id="a1.2.11-bug" name="Bug Fixes">
- <ul>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-76'>LOG4NET-76</a>] -
- TextWriterAdapter
- is not thread safe
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-79'>LOG4NET-79</a>] -
- SecurityException
- thrown in LogicalThreadContextProperties GetProperties
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-81'>LOG4NET-81</a>] -
- LoggerRepositorySkeleton's OnConfigurationChanged method always raises its event with
- EventArgs.Empty instead of passing through its EventArgs parameter.
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-93'>LOG4NET-93</a>] - Typos for node
- name in tutorial, excess quote, invalid XML
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-94'>LOG4NET-94</a>] - Incorrect
- config
- file for ..\examples\net\1.0\Tutorials\ConsoleApp
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-95'>LOG4NET-95</a>] -
- Level.CompareTo()
- may result a wrong Value -> sorting of Levels does not work
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-113'>LOG4NET-113</a>] -
- SystemInfo.GetTypeFromString() raises NotSupportedException
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-123'>LOG4NET-123</a>] -
- EnvironmentPatternConverter does not expand User or System level environment variables under
- Windows
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-126'>LOG4NET-126</a>] - Links on the
- log4net Examples page do not work, including the overview link explaining why the other
- links do
- not work
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-128'>LOG4NET-128</a>] - Either
- documentation is incorrect or a bug in SmtpAppender
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-129'>LOG4NET-129</a>] -
- EventLogAppender
- EventID parsing does not handle Active Properties properly
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-135'>LOG4NET-135</a>] - Bad example
- code
- in documentation
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-137'>LOG4NET-137</a>] -
- log4net.Filter.LevelMatchFilter does not work anymore
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-143'>LOG4NET-143</a>] - Invalid
- Repository Config Uri composition from "log4net.Config" application setting
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-146'>LOG4NET-146</a>] -
- System.NullReferenceException on FindAndRender object
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-158'>LOG4NET-158</a>] -
- XMLConfigurator.ConfigureAndWatch() leaks resources if called multiple times
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-167'>LOG4NET-167</a>] -
- ArrayOutOfBounds
- Exception in MemoryAppender.getEvents()
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-212'>LOG4NET-212</a>] - Threading
- bug in
- the PatternConverter.cs
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-214'>LOG4NET-214</a>] -
- EventLogAppender
- should also use config file to set EventId
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-215'>LOG4NET-215</a>] - Exception on
- Convert for return %class{1} name
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-229'>LOG4NET-229</a>] - Japanese
- characters get garbled with log4net.Layout.XmlLayoutSchemaLog4j
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-241'>LOG4NET-241</a>] - Issue
- tracking
- page does not link to project
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-242'>LOG4NET-242</a>] - Download
- page
- does not have link to KEYS file
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-243'>LOG4NET-243</a>] - broken link
- on
- http://logging.apache.org/log4net/release/example-apps.html
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-244'>LOG4NET-244</a>] -
- SmtpAppender.To
- Property has incorrect delimiter
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-257'>LOG4NET-257</a>] - Visual
- Studio
- 2010 .NET 4.0 Application does not copy log4net lib to bin directory
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-265'>LOG4NET-265</a>] -
- RemoteFileAppender Tests fail on Windows 7
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-274'>LOG4NET-274</a>] - log4net
- doesn't
- log when running a .Net 4.0 Windows application built in Release mode
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-297'>LOG4NET-297</a>] -
- AppenderSkeleton.RequiresLayout docs and implementation don't match
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-300'>LOG4NET-300</a>] - FilterTest
- doesn't
- compile for .Net 2.0
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-301'>LOG4NET-301</a>] - Unit tests
- fail
- on a clean checkout on .NET 2.0 using NAnt
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-310'>LOG4NET-310</a>] -
- EventLogAppender's
- ActivateOptions throws SecurityException on Vista/Win2k3 and later when not run as
- administrator
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-311'>LOG4NET-311</a>] - MinimalLock
- and
- AppendToFile=false don't work together in trunk's FileAppender
- </li>
- </ul>
- </section>
+ <section id="a1.2.11-bug" name="Bug Fixes">
+ <ul>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-76'>LOG4NET-76</a>] -
+ TextWriterAdapter
+ is not thread safe
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-79'>LOG4NET-79</a>] -
+ SecurityException
+ thrown in LogicalThreadContextProperties GetProperties
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-81'>LOG4NET-81</a>] -
+ LoggerRepositorySkeleton's OnConfigurationChanged method always raises its event with
+ EventArgs.Empty instead of passing through its EventArgs parameter.
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-93'>LOG4NET-93</a>] - Typos for node
+ name in tutorial, excess quote, invalid XML
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-94'>LOG4NET-94</a>] - Incorrect
+ config
+ file for ..\examples\net\1.0\Tutorials\ConsoleApp
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-95'>LOG4NET-95</a>] -
+ Level.CompareTo()
+ may result a wrong Value -> sorting of Levels does not work
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-113'>LOG4NET-113</a>] -
+ SystemInfo.GetTypeFromString() raises NotSupportedException
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-123'>LOG4NET-123</a>] -
+ EnvironmentPatternConverter does not expand User or System level environment variables under
+ Windows
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-126'>LOG4NET-126</a>] - Links on the
+ log4net Examples page do not work, including the overview link explaining why the other
+ links do
+ not work
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-128'>LOG4NET-128</a>] - Either
+ documentation is incorrect or a bug in SmtpAppender
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-129'>LOG4NET-129</a>] -
+ EventLogAppender
+ EventID parsing does not handle Active Properties properly
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-135'>LOG4NET-135</a>] - Bad example
+ code
+ in documentation
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-137'>LOG4NET-137</a>] -
+ log4net.Filter.LevelMatchFilter does not work anymore
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-143'>LOG4NET-143</a>] - Invalid
+ Repository Config Uri composition from "log4net.Config" application setting
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-146'>LOG4NET-146</a>] -
+ System.NullReferenceException on FindAndRender object
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-158'>LOG4NET-158</a>] -
+ XMLConfigurator.ConfigureAndWatch() leaks resources if called multiple times
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-167'>LOG4NET-167</a>] -
+ ArrayOutOfBounds
+ Exception in MemoryAppender.getEvents()
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-212'>LOG4NET-212</a>] - Threading
+ bug in
+ the PatternConverter.cs
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-214'>LOG4NET-214</a>] -
+ EventLogAppender
+ should also use config file to set EventId
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-215'>LOG4NET-215</a>] - Exception on
+ Convert for return %class{1} name
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-229'>LOG4NET-229</a>] - Japanese
+ characters get garbled with log4net.Layout.XmlLayoutSchemaLog4j
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-241'>LOG4NET-241</a>] - Issue
+ tracking
+ page does not link to project
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-242'>LOG4NET-242</a>] - Download
+ page
+ does not have link to KEYS file
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-243'>LOG4NET-243</a>] - broken link
+ on
+ http://logging.apache.org/log4net/release/example-apps.html
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-244'>LOG4NET-244</a>] -
+ SmtpAppender.To
+ Property has incorrect delimiter
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-257'>LOG4NET-257</a>] - Visual
+ Studio
+ 2010 .NET 4.0 Application does not copy log4net lib to bin directory
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-265'>LOG4NET-265</a>] -
+ RemoteFileAppender Tests fail on Windows 7
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-274'>LOG4NET-274</a>] - log4net
+ doesn't
+ log when running a .Net 4.0 Windows application built in Release mode
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-297'>LOG4NET-297</a>] -
+ AppenderSkeleton.RequiresLayout docs and implementation don't match
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-300'>LOG4NET-300</a>] - FilterTest
+ doesn't
+ compile for .Net 2.0
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-301'>LOG4NET-301</a>] - Unit tests
+ fail
+ on a clean checkout on .NET 2.0 using NAnt
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-310'>LOG4NET-310</a>] -
+ EventLogAppender's
+ ActivateOptions throws SecurityException on Vista/Win2k3 and later when not run as
+ administrator
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-311'>LOG4NET-311</a>] - MinimalLock
+ and
+ AppendToFile=false don't work together in trunk's FileAppender
+ </li>
+ </ul>
+ </section>
- <section id="a1.2.11-enh" name="Improvements">
- <ul>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-31'>LOG4NET-31</a>] - Allow user to
- pass
- in additional parameters to <converter> node via some kind of <property> tag
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-38'>LOG4NET-38</a>] -
- EventLogAppender:
- Add support for setting the Category on Event Log messages.
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-66'>LOG4NET-66</a>] -
- PreserveFileExtension with StaticFileName
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-77'>LOG4NET-77</a>] - A small
- improvement of log4net.Layout.Pattern.ExceptionPatternConverter - added 'Option'
- propery
- support
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-88'>LOG4NET-88</a>] - support .NET
- 2.0
- connectionStrings configuration section
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-96'>LOG4NET-96</a>] - Expose the
- Message, Exception, and ErrorCode properties of OnlyOnceErrorHandler.
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-97'>LOG4NET-97</a>] - Make Hierarchy's
- ILoggerFactory aware of the repository's LevelMap
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-98'>LOG4NET-98</a>] - Update header
- comment in files to be compliant with new Apache header requirements:
- http://www.apache.org/legal/src-headers.html for 11/1/2006 deadline
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-100'>LOG4NET-100</a>] -
- IPAddressConverter improvement for .NET 2 or .NET 3
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-106'>LOG4NET-106</a>] -
- TraceAppender :
- Add switch to disable using logger name as trace category
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-112'>LOG4NET-112</a>] - Add support
- to
- the UdpAppender for IP v6 remote addresses
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-131'>LOG4NET-131</a>] - Add Cc and
- Bcc
- support to SmtpAppender
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-141'>LOG4NET-141</a>] - Add
- CreateConnection method to AdoNetAppender to allow subclasses to have control of
- IDbConnection.
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-153'>LOG4NET-153</a>] - Make it
- easier
- to configure multiple appenders in code using BasicConfigurator
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-157'>LOG4NET-157</a>] - FAQ for
- getting
- the fully-qualified name of a class
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-164'>LOG4NET-164</a>] - using a
- named
- mutex for file appenders
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-170'>LOG4NET-170</a>] -
- Documentation
- improvement re: fixing and active properties
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-246'>LOG4NET-246</a>] - Make it
- possible
- to choose whether or not to watch configuration files specified using the "log4net.Config"
- appsetting key
- </li>
- </ul>
+ <section id="a1.2.11-enh" name="Improvements">
+ <ul>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-31'>LOG4NET-31</a>] - Allow user to
+ pass
+ in additional parameters to <converter> node via some kind of <property> tag
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-38'>LOG4NET-38</a>] -
+ EventLogAppender:
+ Add support for setting the Category on Event Log messages.
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-66'>LOG4NET-66</a>] -
+ PreserveFileExtension with StaticFileName
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-77'>LOG4NET-77</a>] - A small
+ improvement of log4net.Layout.Pattern.ExceptionPatternConverter - added 'Option'
+ propery
+ support
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-88'>LOG4NET-88</a>] - support .NET
+ 2.0
+ connectionStrings configuration section
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-96'>LOG4NET-96</a>] - Expose the
+ Message, Exception, and ErrorCode properties of OnlyOnceErrorHandler.
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-97'>LOG4NET-97</a>] - Make Hierarchy's
+ ILoggerFactory aware of the repository's LevelMap
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-98'>LOG4NET-98</a>] - Update header
+ comment in files to be compliant with new Apache header requirements:
+ http://www.apache.org/legal/src-headers.html for 11/1/2006 deadline
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-100'>LOG4NET-100</a>] -
+ IPAddressConverter improvement for .NET 2 or .NET 3
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-106'>LOG4NET-106</a>] -
+ TraceAppender :
+ Add switch to disable using logger name as trace category
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-112'>LOG4NET-112</a>] - Add support
+ to
+ the UdpAppender for IP v6 remote addresses
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-131'>LOG4NET-131</a>] - Add Cc and
+ Bcc
+ support to SmtpAppender
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-141'>LOG4NET-141</a>] - Add
+ CreateConnection method to AdoNetAppender to allow subclasses to have control of
+ IDbConnection.
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-153'>LOG4NET-153</a>] - Make it
+ easier
+ to configure multiple appenders in code using BasicConfigurator
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-157'>LOG4NET-157</a>] - FAQ for
+ getting
+ the fully-qualified name of a class
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-164'>LOG4NET-164</a>] - using a
+ named
+ mutex for file appenders
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-170'>LOG4NET-170</a>] -
+ Documentation
+ improvement re: fixing and active properties
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-246'>LOG4NET-246</a>] - Make it
+ possible
+ to choose whether or not to watch configuration files specified using the "log4net.Config"
+ appsetting key
+ </li>
+ </ul>
- </section>
- <section id="a1.2.11-new" name="New Features">
- <ul>
- <li>
- The various static <code>Configure</code> methods of the <code>Configurator</code> classes
- now
- return collections of configuration messages rather than <code>void</code>.
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-59'>LOG4NET-59</a>] - add the
- ability to
- roll files based on universal time (UTC).
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-64'>LOG4NET-64</a>] - add the
- ability to
- preserve the log file name extension when rolling the log file.
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-87'>LOG4NET-87</a>] - Support
- ASP.Net
- related PatternConverters to allow items from the HttpContext.Current.Session, Cache,
- Request,
- etc. to be captured.
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-92'>LOG4NET-92</a>] - Build for
- Compact Framework 2.0
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-107'>LOG4NET-107</a>] - Added
- ExceptionEvaluator
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-115'>LOG4NET-115</a>] - Expand
- UserAppDataPath in filename
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-116'>LOG4NET-116</a>] - allow
- smtp
- to ssl authenticate and with certificates.
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-154'>LOG4NET-154</a>] - Add a
- StackTracePatternConverter to display method calls leading up to log message
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-155'>LOG4NET-155</a>] - Add
- TimeEvaluator
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-168'>LOG4NET-168</a>] - New
- property
- ReplyTo address for the SmtpAppender required
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-176'>LOG4NET-176</a>] -
- Buildable
- with VS 2008 and .NET FW 3.5
- </li>
- <li>
- [<a href='https://issues.apache.org/jira/browse/LOG4NET-233'>LOG4NET-233</a>] - Support
- .NET
- 4.0 including Client Profile
- </li>
- </li>
- </ul>
- </section>
+ </section>
+ <section id="a1.2.11-new" name="New Features">
+ <ul>
+ <li>
+ The various static <code>Configure</code> methods of the <code>Configurator</code> classes
+ now
+ return collections of configuration messages rather than <code>void</code>.
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-59'>LOG4NET-59</a>] - add the
+ ability to
+ roll files based on universal time (UTC).
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-64'>LOG4NET-64</a>] - add the
+ ability to
+ preserve the log file name extension when rolling the log file.
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-87'>LOG4NET-87</a>] - Support
+ ASP.Net
+ related PatternConverters to allow items from the HttpContext.Current.Session, Cache,
+ Request,
+ etc. to be captured.
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-92'>LOG4NET-92</a>] - Build for
+ Compact Framework 2.0
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-107'>LOG4NET-107</a>] - Added
+ ExceptionEvaluator
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-115'>LOG4NET-115</a>] - Expand
+ UserAppDataPath in filename
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-116'>LOG4NET-116</a>] - allow
+ smtp
+ to ssl authenticate and with certificates.
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-154'>LOG4NET-154</a>] - Add a
+ StackTracePatternConverter to display method calls leading up to log message
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-155'>LOG4NET-155</a>] - Add
+ TimeEvaluator
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-168'>LOG4NET-168</a>] - New
+ property
+ ReplyTo address for the SmtpAppender required
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-176'>LOG4NET-176</a>] -
+ Buildable
+ with VS 2008 and .NET FW 3.5
+ </li>
+ <li>
+ [<a href='https://issues.apache.org/jira/browse/LOG4NET-233'>LOG4NET-233</a>] - Support
+ .NET
+ 4.0 including Client Profile
+ </li>
+ </li>
+ </ul>
+ </section>
- </section>
+ </section>
- <section id="a1.2.10" name="1.2.10">
+ <section id="a1.2.10" name="1.2.10">
- <section id="a1.2.10-bug" name="Bug Fixes">
- <ul>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-21'>LOG4NET-21</a>] -
- RemotingAppender
- fails once NDC becomes empty
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-22'>LOG4NET-22</a>] - XmlLayout
- allows
- output of invalid control characters
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-23'>LOG4NET-23</a>] -
- example-apps.html
- links are off by one folder level
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-25'>LOG4NET-25</a>] -
- RollingFileAppender
- can fail if RollOverIfDateBoundaryCrossing required
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-28'>LOG4NET-28</a>] - AdoNetAppender
- does
- not support inserting NULL into columns
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-29'>LOG4NET-29</a>] -
- LevelMatchFilter
- should return Neutral when no match is found
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-32'>LOG4NET-32</a>] - AdoNetAppender
- losing first entry
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-35'>LOG4NET-35</a>] - Exception
- rendering
- ThreadContextStack if null value pushed into stack
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-36'>LOG4NET-36</a>] -
- System.Diagnostics.Trace may throw exception if AppDomain does not have config file
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-40'>LOG4NET-40</a>] -
- RollingFileAppender
- does not limit files to MaxSizeRollBackups when CountDirection is 1
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-41'>LOG4NET-41</a>] -
- RollingFileAppender
- roll over date fail
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-42'>LOG4NET-42</a>] - Serialised
- LoggingEvent does not preserve the Fix flags
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-43'>LOG4NET-43</a>] - Specifying an
- empty
- string as a property in the config file results in an error
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-44'>LOG4NET-44</a>] - XmlLayout emits
- all
- properties under a node named global-properties, rather than just properties.
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-49'>LOG4NET-49</a>] -
- CountingQuietTextWriter does not count strings written with WriteLine
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-50'>LOG4NET-50</a>] -
- Process.StartTime
- hangs on some systems
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-60'>LOG4NET-60</a>] - Bug in
- RollingFileAppender.cs causing failure to timely roll files on monthly interval
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-63'>LOG4NET-63</a>] - 1.2.9.0
- Documentation typos
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-65'>LOG4NET-65</a>] - Unhandled
- SecurityException exception for FileIOPermission while loading configuration file
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-67'>LOG4NET-67</a>] - CVE-2006-0743
- Security vulnerability in LocalSyslogAppender
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-69'>LOG4NET-69</a>] - Exception
- thrown
- when *Format methods are given a malformed format string
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-70'>LOG4NET-70</a>] - CoreDll.dll
- referenced with different capitalisation
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-73'>LOG4NET-73</a>] -
- ADONetAppender.ActivateOptions() leaks database connection when called multiple times
- </li>
- </ul>
- </section>
+ <section id="a1.2.10-bug" name="Bug Fixes">
+ <ul>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-21'>LOG4NET-21</a>] -
+ RemotingAppender
+ fails once NDC becomes empty
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-22'>LOG4NET-22</a>] - XmlLayout
+ allows
+ output of invalid control characters
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-23'>LOG4NET-23</a>] -
+ example-apps.html
+ links are off by one folder level
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-25'>LOG4NET-25</a>] -
+ RollingFileAppender
+ can fail if RollOverIfDateBoundaryCrossing required
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-28'>LOG4NET-28</a>] - AdoNetAppender
+ does
+ not support inserting NULL into columns
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-29'>LOG4NET-29</a>] -
+ LevelMatchFilter
+ should return Neutral when no match is found
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-32'>LOG4NET-32</a>] - AdoNetAppender
+ losing first entry
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-35'>LOG4NET-35</a>] - Exception
+ rendering
+ ThreadContextStack if null value pushed into stack
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-36'>LOG4NET-36</a>] -
+ System.Diagnostics.Trace may throw exception if AppDomain does not have config file
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-40'>LOG4NET-40</a>] -
+ RollingFileAppender
+ does not limit files to MaxSizeRollBackups when CountDirection is 1
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-41'>LOG4NET-41</a>] -
+ RollingFileAppender
+ roll over date fail
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-42'>LOG4NET-42</a>] - Serialised
+ LoggingEvent does not preserve the Fix flags
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-43'>LOG4NET-43</a>] - Specifying an
+ empty
+ string as a property in the config file results in an error
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-44'>LOG4NET-44</a>] - XmlLayout emits
+ all
+ properties under a node named global-properties, rather than just properties.
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-49'>LOG4NET-49</a>] -
+ CountingQuietTextWriter does not count strings written with WriteLine
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-50'>LOG4NET-50</a>] -
+ Process.StartTime
+ hangs on some systems
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-60'>LOG4NET-60</a>] - Bug in
+ RollingFileAppender.cs causing failure to timely roll files on monthly interval
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-63'>LOG4NET-63</a>] - 1.2.9.0
+ Documentation typos
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-65'>LOG4NET-65</a>] - Unhandled
+ SecurityException exception for FileIOPermission while loading configuration file
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-67'>LOG4NET-67</a>] - CVE-2006-0743
+ Security vulnerability in LocalSyslogAppender
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-69'>LOG4NET-69</a>] - Exception
+ thrown
+ when *Format methods are given a malformed format string
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-70'>LOG4NET-70</a>] - CoreDll.dll
+ referenced with different capitalisation
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-73'>LOG4NET-73</a>] -
+ ADONetAppender.ActivateOptions() leaks database connection when called multiple times
+ </li>
+ </ul>
+ </section>
- <section id="a1.2.10-new" name="New Features">
- <ul>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-11'>LOG4NET-11</a>] - Add Flush
- command
- to API
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-24'>LOG4NET-24</a>] - Programmatic
- flush
- of BufferingAppenderSkeleton buffer
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-37'>LOG4NET-37</a>] - Allow the
- RepositorySelector type to be specified using the AppSettings config
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-46'>LOG4NET-46</a>] - Support
- appenders
- that can output multiple events efficiently
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-51'>LOG4NET-51</a>] - WmiAppender
- </li>
- </ul>
- </section>
+ <section id="a1.2.10-new" name="New Features">
+ <ul>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-11'>LOG4NET-11</a>] - Add Flush
+ command
+ to API
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-24'>LOG4NET-24</a>] - Programmatic
+ flush
+ of BufferingAppenderSkeleton buffer
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-37'>LOG4NET-37</a>] - Allow the
+ RepositorySelector type to be specified using the AppSettings config
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-46'>LOG4NET-46</a>] - Support
+ appenders
+ that can output multiple events efficiently
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-51'>LOG4NET-51</a>] - WmiAppender
+ </li>
+ </ul>
+ </section>
- <section id="a1.2.10-enh" name="Improvements">
- <ul>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-3'>LOG4NET-3</a>] - Support per event
- patterns in FileAppender File name
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-13'>LOG4NET-13</a>] - Allow
- SMTPAppender
- to have replaceable parameters in Subject
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-15'>LOG4NET-15</a>] - Email high
- "importance" priority setting with SmtpAppender
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-17'>LOG4NET-17</a>] - Line-wrapping
- Appender Layouts
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-33'>LOG4NET-33</a>] - Ability to use
- global property to point to log4net configuration file
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-34'>LOG4NET-34</a>] - Allow xml
- config
- values to be set via XmlNodeType.CDATA or XmlNodeType.Text rather than just value="foo"
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-45'>LOG4NET-45</a>] - PluginAttribute
- does not allow plugin type to be specified as a Type, only as a string
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-52'>LOG4NET-52</a>] - Allow XML
- configurator to set properties of type Object
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-53'>LOG4NET-53</a>] - Allow
- repository
- properties to be set in the config file
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-56'>LOG4NET-56</a>] - Support
- rendering
- IEnumerator objects as well as ICollections
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-58'>LOG4NET-58</a>] - Support clean
- build
- on .NET 2.0
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-72'>LOG4NET-72</a>] - Performance of
- ILog.xxxFormat methods
- </li>
- <li>
- [<a href='http://issues.apache.org/jira/browse/LOG4NET-74'>LOG4NET-74</a>] - Change
- MemoryAppender member variables to protected
- </li>
- </ul>
- </section>
+ <section id="a1.2.10-enh" name="Improvements">
+ <ul>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-3'>LOG4NET-3</a>] - Support per event
+ patterns in FileAppender File name
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-13'>LOG4NET-13</a>] - Allow
+ SMTPAppender
+ to have replaceable parameters in Subject
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-15'>LOG4NET-15</a>] - Email high
+ "importance" priority setting with SmtpAppender
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-17'>LOG4NET-17</a>] - Line-wrapping
+ Appender Layouts
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-33'>LOG4NET-33</a>] - Ability to use
+ global property to point to log4net configuration file
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-34'>LOG4NET-34</a>] - Allow xml
+ config
+ values to be set via XmlNodeType.CDATA or XmlNodeType.Text rather than just value="foo"
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-45'>LOG4NET-45</a>] - PluginAttribute
+ does not allow plugin type to be specified as a Type, only as a string
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-52'>LOG4NET-52</a>] - Allow XML
+ configurator to set properties of type Object
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-53'>LOG4NET-53</a>] - Allow
+ repository
+ properties to be set in the config file
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-56'>LOG4NET-56</a>] - Support
+ rendering
+ IEnumerator objects as well as ICollections
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-58'>LOG4NET-58</a>] - Support clean
+ build
+ on .NET 2.0
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-72'>LOG4NET-72</a>] - Performance of
+ ILog.xxxFormat methods
+ </li>
+ <li>
+ [<a href='http://issues.apache.org/jira/browse/LOG4NET-74'>LOG4NET-74</a>] - Change
+ MemoryAppender member variables to protected
+ </li>
+ </ul>
+ </section>
- </section>
+ </section>
- <section id="a1.2.9" name="1.2.9 Beta">
+ <section id="a1.2.9" name="1.2.9 Beta">
- <section id="a1.2.9-breaking" name="Breaking Changes">
- <h3>Renamed namespaces</h3>
- <p>
- Renamed namespace <span class="code">log4net.spi</span> to <span class="code">
- log4net.Core
- </span>.
- Renamed namespace <span class="code">log4net.helpers</span> to <span class="code">
- log4net.Util
- </span>.
- </p>
- <h3>Renamed config classes and attributes</h3>
- <p>
- In the <span class="code">log4net.Config</span> namespace the <span class="code">
- DOMConfigurator
- </span>,
- <span class="code">DOMConfiguratorAttribute</span>, <span class="code">DomainAttribute</span>,
- and <span class="code">AliasDomainAttribute</span> have been marked as obsolete. These types are
- still available and functional in this release.
- </p>
- <p>
- The <span class="code">XmlConfigurator</span> and
- <span class="code">XmlConfiguratorAttribute</span>
- types replace <span class="code">DOMConfigurator</span> and
- <span class="code">DOMConfiguratorAttribute</span>. The
- <span class="code">RepositoryAttribute</span>
- and <span class="code">AliasRepositoryAttribute</span> types replace
- <span class="code">DomainAttribute</span>
- and <span class="code">AliasDomainAttribute</span>.
- </p>
- <h3>Fixed pascal casing of type names</h3>
- <p>
- Renamed <span class="code">AdoNetAppender</span>, <span class="code">AspNetTraceAppender</span>,
- <span class="code">SmtpAppender</span>, <span class="code">Iso8601DateFormatter</span>,
- <span class="code">MdcFilter</span>, and <span class="code">NdcFilter</span>.
- Note that the config file type resolver is case insensitive so this is only a breaking change
- for code that programmatically creates a type that has been renamed.
- </p>
- <h3>
- Layouts changed to stream their output to a
- <span class="code">TextWriter</span>
- </h3>
- <p>
- Layouts have been changed to format their output to a
- <span class="code">TextWriter</span>
- rather than return a string. This increases performance and reduces temporary object creation.
- </p>
- <h3>C style string escapes no longer supported by config parser</h3>
- <p>
- The XML config parser no longer supports decoding C style escape sequences in strings.
- Previously sequences like <span class="code">\n</span> and
- <span class="code">\\</span>
- where decoded. Instead use the appropriate XML encodings as required.
- </p>
- </section>
+ <section id="a1.2.9-breaking" name="Breaking Changes">
+ <h3>Renamed namespaces</h3>
+ <p>
+ Renamed namespace <span class="code">log4net.spi</span> to <span class="code">
+ log4net.Core
+ </span>.
+ Renamed namespace <span class="code">log4net.helpers</span> to <span class="code">
+ log4net.Util
+ </span>.
+ </p>
+ <h3>Renamed config classes and attributes</h3>
+ <p>
+ In the <span class="code">log4net.Config</span> namespace the <span class="code">
+ DOMConfigurator
+ </span>,
+ <span class="code">DOMConfiguratorAttribute</span>, <span class="code">DomainAttribute</span>,
+ and <span class="code">AliasDomainAttribute</span> have been marked as obsolete. These types are
+ still available and functional in this release.
+ </p>
+ <p>
+ The <span class="code">XmlConfigurator</span> and
+ <span class="code">XmlConfiguratorAttribute</span>
+ types replace <span class="code">DOMConfigurator</span> and
+ <span class="code">DOMConfiguratorAttribute</span>. The
+ <span class="code">RepositoryAttribute</span>
+ and <span class="code">AliasRepositoryAttribute</span> types replace
+ <span class="code">DomainAttribute</span>
+ and <span class="code">AliasDomainAttribute</span>.
+ </p>
+ <h3>Fixed pascal casing of type names</h3>
+ <p>
+ Renamed <span class="code">AdoNetAppender</span>, <span class="code">AspNetTraceAppender</span>,
+ <span class="code">SmtpAppender</span>, <span class="code">Iso8601DateFormatter</span>,
+ <span class="code">MdcFilter</span>, and <span class="code">NdcFilter</span>.
+ Note that the config file type resolver is case insensitive so this is only a breaking change
+ for code that programmatically creates a type that has been renamed.
+ </p>
+ <h3>
+ Layouts changed to stream their output to a
+ <span class="code">TextWriter</span>
+ </h3>
+ <p>
+ Layouts have been changed to format their output to a
+ <span class="code">TextWriter</span>
+ rather than return a string. This increases performance and reduces temporary object creation.
+ </p>
+ <h3>C style string escapes no longer supported by config parser</h3>
+ <p>
+ The XML config parser no longer supports decoding C style escape sequences in strings.
+ Previously sequences like <span class="code">\n</span> and
+ <span class="code">\\</span>
+ where decoded. Instead use the appropriate XML encodings as required.
+ </p>
+ </section>
- <section id="a1.2.9-new" name="New Features">
- <h3>New CLI build</h3>
- <p>
- A new log4net assembly is built that targets all CLI 1.0 compatible runtimes.
- This build is essentially a common subset of the Mono 1.0 and .NET 1.0 builds.
- It is built using the MS .NET 1.0 compiler and libraries but does not use any
- platform specific APIs.
- </p>
- <p>
- This build is only available in release configuration and can be found at
- <span class="code">bin\cli\1.0\release</span>.
- </p>
- <h3>Logging contexts</h3>
- <p>
- Logging contexts can be used to record contextual data that is relevant to the current
- process. Logging contexts are both an extension of the concepts embodied in the
- <span class="code">MDC</span>
- and <span class="code">NDC</span> and a replacement for
- them. The <span class="code">MDC</span> and <span class="code">NDC</span> have been
- reimplemented to use the <span class="code">ThreadContext</span> as storage.
- </p>
- <p>
- The logging contexts provide a single unified view that cuts across different
- scopes within an application.
- The contexts are layered in the following order of narrowing scope:
- <span class="code">GlobalContext</span>, <span class="code">ThreadContext</span>,
- <span class="code">LogicalThreadContext</span>, and <span class="code">LoggingEvent</span>.
- Context values specified in a narrower scope hide the matching value in a wider scope.
- </p>
- <h3>
- <span class="code">PatternLayout</span>
- customization and long pattern names
- </h3>
- <p>
- The <span class="code">PatternLayout</span> now supports long pattern names.
- These pattern names are significantly more readable than the single character patterns.
- </p>
- <p>
- The <span class="code">PatternLayout</span> now supports custom patterns. New patterns
- can be defined in the config file:
- </p>
- <div class="syntax">
- <pre class="code">
- <layout type="log4net.Layout.PatternLayout">
+ <section id="a1.2.9-new" name="New Features">
+ <h3>New CLI build</h3>
+ <p>
+ A new log4net assembly is built that targets all CLI 1.0 compatible runtimes.
+ This build is essentially a common subset of the Mono 1.0 and .NET 1.0 builds.
+ It is built using the MS .NET 1.0 compiler and libraries but does not use any
+ platform specific APIs.
+ </p>
+ <p>
+ This build is only available in release configuration and can be found at
+ <span class="code">bin\cli\1.0\release</span>.
+ </p>
+ <h3>Logging contexts</h3>
+ <p>
+ Logging contexts can be used to record contextual data that is relevant to the current
+ process. Logging contexts are both an extension of the concepts embodied in the
+ <span class="code">MDC</span>
+ and <span class="code">NDC</span> and a replacement for
+ them. The <span class="code">MDC</span> and <span class="code">NDC</span> have been
+ reimplemented to use the <span class="code">ThreadContext</span> as storage.
+ </p>
+ <p>
+ The logging contexts provide a single unified view that cuts across different
+ scopes within an application.
+ The contexts are layered in the following order of narrowing scope:
+ <span class="code">GlobalContext</span>, <span class="code">ThreadContext</span>,
+ <span class="code">LogicalThreadContext</span>, and <span class="code">LoggingEvent</span>.
+ Context values specified in a narrower scope hide the matching value in a wider scope.
+ </p>
+ <h3>
+ <span class="code">PatternLayout</span>
+ customization and long pattern names
+ </h3>
+ <p>
+ The <span class="code">PatternLayout</span> now supports long pattern names.
+ These pattern names are significantly more readable than the single character patterns.
+ </p>
+ <p>
+ The <span class="code">PatternLayout</span> now supports custom patterns. New patterns
+ can be defined in the config file:
+ </p>
+ <div class="syntax">
+ <pre class="code">
+ <layout type="log4net.Layout.PatternLayout">
- <converter>
- <name value="myConverter" />
- <type value="TestApp.MyPatternConverter, TestApp" />
- </converter>
+ <converter>
+ <name value="myConverter" />
+ <type value="TestApp.MyPatternConverter, TestApp" />
+ </converter>
- <conversionPattern value="%-5level %logger - %myConverter - %message%newline" />
- </layout>
- </pre>
- </div>
- <p>
- The above config defines a custom pattern called
- <span class="code">myConverter</span>
- which is bound to the
- <span class="code">TestApp.MyPatternConverter, TestApp</span>
- type. This type must extend the
- <span class="code">log4net.Util.PatternConverter</span>
- base class. The custom pattern can then be used in the pattern string.
- </p>
- <p>
- For full details see the SDK Reference entry: <a
+ <conversionPattern value="%-5level %logger - %myConverter - %message%newline" />
+ </layout>
+ </pre>
+ </div>
+ <p>
+ The above config defines a custom pattern called
+ <span class="code">myConverter</span>
+ which is bound to the
+ <span class="code">TestApp.MyPatternConverter, TestApp</span>
+ type. This type must extend the
+ <span class="code">log4net.Util.PatternConverter</span>
+ base class. The custom pattern can then be used in the pattern string.
+ </p>
+ <p>
+ For full details see the SDK Reference entry: <a
href="sdk/html/T_log4net_Layout_PatternLayout.htm">
- log4net.Layout.PatternLayout
- </a>.
- </p>
- <h3>
- <span class="code">PatternString</span>
- for pattern based configuration
- </h3>
- <p>
- A new pattern based type, <span class="code">PatternString</span>, can be used in
- the config file to set string properties using a pattern syntax. For example the
- File property of the FileAppender could be set as follows:
- </p>
- <div class="syntax">
- <pre class="code">
- <file type="log4net.Util.PatternString">
+ log4net.Layout.PatternLayout
+ </a>.
+ </p>
+ <h3>
+ <span class="code">PatternString</span>
+ for pattern based configuration
+ </h3>
+ <p>
+ A new pattern based type, <span class="code">PatternString</span>, can be used in
+ the config file to set string properties using a pattern syntax. For example the
+ File property of the FileAppender could be set as follows:
+ </p>
+ <div class="syntax">
+ <pre class="code">
+ <file type="log4net.Util.PatternString">
- <converter>
- <name value="folder" />
- <type value="TestApp.SpecialFolderPatternConverter,TestApp" />
- </converter>
+ <converter>
+ <name value="folder" />
+ <type value="TestApp.SpecialFolderPatternConverter,TestApp" />
+ </converter>
- <conversionPattern value="%folder{LocalApplicationData}\log-file.txt" />
- </file>
- </pre>
- </div>
- <p>
- The code for the
- <span class="code">SpecialFolderPatternConverter</span>
- is as follows:
- </p>
- <div class="syntax">
- <pre class="code">
- public class SpecialFolderPatternConverter : log4net.Util.PatternConverter
- {
- override protected void Convert(System.IO.TextWriter writer, object state)
- {
- Environment.SpecialFolder specialFolder =
- (Environment.SpecialFolder)Enum.Parse(typeof(Environment.SpecialFolder), base.Option, true);
+ <conversionPattern value="%folder{LocalApplicationData}\log-file.txt" />
+ </file>
+ </pre>
+ </div>
+ <p>
+ The code for the
+ <span class="code">SpecialFolderPatternConverter</span>
+ is as follows:
+ </p>
+ <div class="syntax">
+ <pre class="code">
+ public class SpecialFolderPatternConverter : log4net.Util.PatternConverter
+ {
+ override protected void Convert(System.IO.TextWriter writer, object state)
+ {
+ Environment.SpecialFolder specialFolder =
+ (Environment.SpecialFolder)Enum.Parse(typeof(Environment.SpecialFolder), base.Option, true);
- writer.Write(Environment.GetFolderPath(specialFolder));
- }
- }
- </pre>
- </div>
- <p>
- For full details see the SDK Reference entry: <a
+ writer.Write(Environment.GetFolderPath(specialFolder));
+ }
+ }
+ </pre>
+ </div>
+ <p>
+ For full details see the SDK Reference entry: <a
href="sdk/html/T_log4net_Util_PatternString_htm">
- log4net.Util.PatternString
- </a>.
- </p>
- <h3>Loading configuration from a URI</h3>
- <p>
- The <span class="code">XmlConfigurator</span> methods now support loading the
- configuration data from a URI. Config can be loaded from any URI supported by the
- <span class="code">System.Net.WebRequest</span>
- class.
- </p>
- <h3>Support for No-Touch deployment</h3>
- <p>
- Log4net supports configuring No-Touch deployment applications using the
- <span class="code">XmlConfiguratorAttribute</span>. If a relative config file
- or extension is specified then this is resolved relative to the deployment
- URI.
- </p>
- <h3>Config file parser enhancements</h3>
- <p>
- The config file parser has been enhanced to support specifying the property subtype, or
- intermediate
- type,
- directly on the property element, for example:
- </p>
- <div class="syntax">
- <pre class="code">
- <layout type="log4net.Layout.PatternLayout" value="%message%newline"
- />
- </pre>
- </div>
- <p>
- Implicit conversion will be attempted between the value string and the type specified,
- and then again between the type and the target property type.
- </p>
- <h3>.NET string formatting syntax</h3>
- <p>
- Added .NET <span class="code">String.Format</span> style formatting syntax methods to
- the <span class="code">ILog</span> interface. The new methods are:
- <span class="code">DebugFormat</span>, <span class="code">InfoFormat</span>,
- <span class="code">WarnFormat</span>,
- <span class="code">ErrorFormat</span>
- and <span class="code">FatalFormat</span>.
- </p>
- <h3>Customizable levels</h3>
- <p>
- Levels are defined by the repository <span class="code">LevelMap</span>. The defined
- levels, the relative ordering of levels and level display names can be configured on
- a per-repository basis.
- </p>
- <h3>Per-appender security contexts</h3>
- <p>
- Appenders that interact with controlled platform resources, e.g. files, can be
- configured to use a separate security context when accessing these resources.
- The calling thread may not have appropriate privileges to access the resource a
- custom <span class="code">SecurityContext</span> can be used to elevate the
- privileges of the appender. The
- <span class="code">WindowsSecurityContext</span>
- is used to specify alternative credentials on the Windows platform.
- </p>
- <h3>Added new appenders</h3>
- <dl>
- <dt>
- <span class="code">AnsiColorTerminalAppender</span>
- </dt>
- <dd>
- <p>
- The <span class="code">AnsiColorTerminalAppender</span> writes events to
- the application's ANSI terminal window. It can be configured to specify
- the text and background colors for different level events. Note that Console
- applications running on Windows do not have an ANSI terminal window and
- should use the <span class="code">ColoredConsoleAppender</span> instead.
- </p>
- </dd>
- <dt>
- <span class="code">LocalSyslogAppender</span>
- </dt>
- <dd>
- <p>
- Logs events to a local syslog service. This appender uses the POSIX libc syslog
- library functions. If these functions are not available on the local system then
- this appender will not work!
- </p>
- </dd>
- <dt>
- <span class="code">RemoteSyslogAppender</span>
- </dt>
- <dd>
- <p>
- The <span class="code">RemoteSyslogAppender</span> uses the BSD syslog protocol to
- log to a syslog daemon. The syslogd listens for for messages on UDP port 514.
- </p>
- </dd>
- <dt>
- <span class="code">TelnetAppender</span>
- </dt>
- <dd>
- <p>
- The <span class="code">TelnetAppender</span> accepts socket connections and streams
- logging messages back to the client. The output is provided in a telnet-friendly way
- so that a log can be monitored over a TCP/IP socket.
- This allows simple remote monitoring of application logging.
- </p>
- </dd>
- </dl>
- <h3>
- Added new <span class="code">LoggerMatchFilter</span> filter
- </h3>
- <p>
- Added <span class="code">LoggerMatchFilter</span> which matches a string against
- the event's logger name.
- </p>
- <h3>
- Pluggable file locking models for the
- <span class="code">FileAppender</span>
- </h3>
- <p>
- The <span class="code">FileAppender</span> (and by extension the
- <span class="code">RollingFileAppender</span>) now support pluggable file
- locking models. The default model, <span class="code">ExclusiveLock</span>,
- maintains the current exclusive file locking behavior. An alternative
- model, <span class="code">MinimalLock</span>, can be used to support writing to
- a single output file from multiple processes.
- </p>
- <p>
- For full details see the SDK Reference entry: <a
+ log4net.Util.PatternString
+ </a>.
+ </p>
+ <h3>Loading configuration from a URI</h3>
+ <p>
+ The <span class="code">XmlConfigurator</span> methods now support loading the
+ configuration data from a URI. Config can be loaded from any URI supported by the
+ <span class="code">System.Net.WebRequest</span>
+ class.
+ </p>
+ <h3>Support for No-Touch deployment</h3>
+ <p>
+ Log4net supports configuring No-Touch deployment applications using the
+ <span class="code">XmlConfiguratorAttribute</span>. If a relative config file
+ or extension is specified then this is resolved relative to the deployment
+ URI.
+ </p>
+ <h3>Config file parser enhancements</h3>
+ <p>
+ The config file parser has been enhanced to support specifying the property subtype, or
+ intermediate
+ type,
+ directly on the property element, for example:
+ </p>
+ <div class="syntax">
+ <pre class="code">
+ <layout type="log4net.Layout.PatternLayout" value="%message%newline"
+ />
+ </pre>
+ </div>
+ <p>
+ Implicit conversion will be attempted between the value string and the type specified,
+ and then again between the type and the target property type.
+ </p>
+ <h3>.NET string formatting syntax</h3>
+ <p>
+ Added .NET <span class="code">String.Format</span> style formatting syntax methods to
+ the <span class="code">ILog</span> interface. The new methods are:
+ <span class="code">DebugFormat</span>, <span class="code">InfoFormat</span>,
+ <span class="code">WarnFormat</span>,
+ <span class="code">ErrorFormat</span>
+ and <span class="code">FatalFormat</span>.
+ </p>
+ <h3>Customizable levels</h3>
+ <p>
+ Levels are defined by the repository <span class="code">LevelMap</span>. The defined
+ levels, the relative ordering of levels and level display names can be configured on
+ a per-repository basis.
+ </p>
+ <h3>Per-appender security contexts</h3>
+ <p>
+ Appenders that interact with controlled platform resources, e.g. files, can be
+ configured to use a separate security context when accessing these resources.
+ The calling thread may not have appropriate privileges to access the resource a
+ custom <span class="code">SecurityContext</span> can be used to elevate the
+ privileges of the appender. The
+ <span class="code">WindowsSecurityContext</span>
+ is used to specify alternative credentials on the Windows platform.
+ </p>
+ <h3>Added new appenders</h3>
+ <dl>
+ <dt>
+ <span class="code">AnsiColorTerminalAppender</span>
+ </dt>
+ <dd>
+ <p>
+ The <span class="code">AnsiColorTerminalAppender</span> writes events to
+ the application's ANSI terminal window. It can be configured to specify
+ the text and background colors for different level events. Note that Console
+ applications running on Windows do not have an ANSI terminal window and
+ should use the <span class="code">ColoredConsoleAppender</span> instead.
+ </p>
+ </dd>
+ <dt>
+ <span class="code">LocalSyslogAppender</span>
+ </dt>
+ <dd>
+ <p>
+ Logs events to a local syslog service. This appender uses the POSIX libc syslog
+ library functions. If these functions are not available on the local system then
+ this appender will not work!
+ </p>
+ </dd>
+ <dt>
+ <span class="code">RemoteSyslogAppender</span>
+ </dt>
+ <dd>
+ <p>
+ The <span class="code">RemoteSyslogAppender</span> uses the BSD syslog protocol to
+ log to a syslog daemon. The syslogd listens for for messages on UDP port 514.
+ </p>
+ </dd>
+ <dt>
+ <span class="code">TelnetAppender</span>
+ </dt>
+ <dd>
+ <p>
+ The <span class="code">TelnetAppender</span> accepts socket connections and streams
+ logging messages back to the client. The output is provided in a telnet-friendly way
+ so that a log can be monitored over a TCP/IP socket.
+ This allows simple remote monitoring of application logging.
+ </p>
+ </dd>
+ </dl>
+ <h3>
+ Added new <span class="code">LoggerMatchFilter</span> filter
+ </h3>
+ <p>
+ Added <span class="code">LoggerMatchFilter</span> which matches a string against
+ the event's logger name.
+ </p>
+ <h3>
+ Pluggable file locking models for the
+ <span class="code">FileAppender</span>
+ </h3>
+ <p>
+ The <span class="code">FileAppender</span> (and by extension the
+ <span class="code">RollingFileAppender</span>) now support pluggable file
+ locking models. The default model, <span class="code">ExclusiveLock</span>,
+ maintains the current exclusive file locking behavior. An alternative
+ model, <span class="code">MinimalLock</span>, can be used to support writing to
+ a single output file from multiple processes.
+ </p>
+ <p>
+ For full details see the SDK Reference entry: <a
href="sdk/html/T_log4net_Appender_FileAppender_LockingModel.htm">
- log4net.Appender.FileAppender.LockingModel
- </a>.
- </p>
- <h3>
- <span class="code">RollingFileAppender</span>
- roll once
- </h3>
- <p>
- The <span class="code">RollingFileAppender</span> now supports a new
- rolling style, <span class="code">Once</span>. In this mode the appender
- will roll the file once per run.
- </p>
- <h3>
- <span class="code">SmtpAppender</span>
- authentication
- </h3>
- <p>
- On the .NET 1.1 platform only, the <span class="code">SmtpAppender</span> supports
- authenticating
- against the mail server using either username and password or integrated NTLM authentication.
- </p>
- <h3>
- <span class="code">AdoNetAppender</span>
- ReconnectOnError
- </h3>
- <p>
- Added new configuration property to <span class="code">AdoNetAppender</span>.
- Setting <span class="code">ReconnectOnError</span> to
- <span class="code">true</span>
- will force the appender to attempt to reconnect to the database if the connection
- is lost.
- </p>
- <h3>
- <span class="code">UdpAppender</span>
- hostname support
- </h3>
- <p>
- The <span class="code">UdpAppender</span> config property
- <span class="code">RemoteAddress</span>
- can now be specified as a DNS hostname string. The hostname is resolved to an IP address.
- </p>
+ log4net.Appender.FileAppender.LockingModel
+ </a>.
+ </p>
+ <h3>
+ <span class="code">RollingFileAppender</span>
+ roll once
+ </h3>
+ <p>
+ The <span class="code">RollingFileAppender</span> now supports a new
+ rolling style, <span class="code">Once</span>. In this mode the appender
+ will roll the file once per run.
+ </p>
+ <h3>
+ <span class="code">SmtpAppender</span>
+ authentication
+ </h3>
+ <p>
+ On the .NET 1.1 platform only, the <span class="code">SmtpAppender</span> supports
+ authenticating
+ against the mail server using either username and password or integrated NTLM authentication.
+ </p>
+ <h3>
+ <span class="code">AdoNetAppender</span>
+ ReconnectOnError
+ </h3>
+ <p>
+ Added new configuration property to <span class="code">AdoNetAppender</span>.
+ Setting <span class="code">ReconnectOnError</span> to
+ <span class="code">true</span>
+ will force the appender to attempt to reconnect to the database if the connection
+ is lost.
+ </p>
+ <h3>
+ <span class="code">UdpAppender</span>
+ hostname support
+ </h3>
+ <p>
+ The <span class="code">UdpAppender</span> config property
+ <span class="code">RemoteAddress</span>
+ can now be specified as a DNS hostname string. The hostname is resolved to an IP address.
+ </p>
+ </section>
+
+ <section id="a1.2.9-other" name="Other Changes">
+ <h3>FxCop compliance</h3>
+ <p>
+ Updates to bring the internal code in line with the current FxCop rules.
+ </p>
+ <h3>Separate NUnit tests</h3>
+ <p>
+ Moved the NUnit tests into a separate project, <span class="code">log4net.Tests</span>.
+ </p>
+ <h3>Bug Fixes</h3>
+ <dl>
+ <dt>
+ <span class="code">RemotingAppender</span>
+ </dt>
+ <dd>
+ <p>
+ Sends events from a <span class="code">ThreadPool</span> thread
+ rather than the calling thread to prevent transfer,
+ and potential loss, of the <span class="code">CallContext</span>.
+ </p>
+ </dd>
+ <dt>
+ <span class="code">RollingFileAppender</span>
+ </dt>
+ <dd>
+ <p>
+ Fixed date rolling period detection for non UTC timezones.
+ </p>
+ </dd>
+ <dt>
+ <span class="code">ColoredConsoleAppender</span>
+ </dt>
+ <dd>
+ <p>
+ Updated to support writing more than 30,000 chars in a single message.
+ Fixed background color overspill if the console window needs to
+ scroll the contents.
+ </p>
+ </dd>
+ </dl>
+ </section>
+
+ </section>
+
+ <section id="a1.2.0" name="1.2.0">
+ <h3>
+ Changed assembly name to
+ <span class="code">log4net</span>
+ </h3>
+ <p>
+ The build output is now
+ <span class="code">log4net.dll</span>
+ for all frameworks. This is a breaking change.
+ </p>
+ <p>
+ To resolve cross platform and cross version issues we have
+ changed the log4net assembly to use a common name for all
+ frameworks. The assembly friendly name is now <span class="code">log4net</span>.
+ The builds for each framework can now be differentiated
+ by the assembly title. This includes the name of the framework
+ that the assembly was built on.
+ </p>
+ <h3>Combined Release and ReleaseStrong builds</h3>
+ <p>
+ The Release and ReleaseStrong builds have been consolidated into
+ a single build called Release. This Release build is strongly named.
+ </p>
+ <h3>New Appender: ColoredConsoleAppender</h3>
+ <p>
+ The <span class="code">ColoredConsoleAppender</span> writes events to the
+ application's console. It can be configured to specify the text and background
+ colors for different level events.
+ </p>
+ <h3>New Appender: SmtpPickupDirAppender</h3>
+ <p>
+ The <span class="code">SmtpPickupDirAppender</span> generates SMTP compliant
+ messages and writes them to a local directory. These files can then be read
+ by an SMTP agent (e.g. the IIS SMTP Agent) and delivered.
+ </p>
+ <h3>New Layout: XmlLayoutSchemaLog4j</h3>
+ <p>
+ This new layout formats the logging events as XML which complies with
+ the Apache log4j™ event dtd. This can be used to transfer log event from log4net
+ to log4j. Currently the only appender that can communicate directly with
+ log4j is the <span class="code">UdpAppender</span>.
+ </p>
+ <h3>New PatternLayout conversion characters</h3>
+ <p>
+ Added support for capturing the current thread principal name and the
+ app domain friendly name for each logging event.
+ </p>
+ <dl>
+ <dt>%a</dt>
+ <dd>
+ Used to output the friendly name of the AppDomain where the
+ logging event was generated.
+ </dd>
+ <dt>%u</dt>
+ <dd>
+ Used to output the user name for the currently active user
+ (<span class="code">Principal.Identity.Name</span>).
+ </dd>
+ </dl>
+ <h3>Types specified in the config file are now loaded ignoring case</h3>
+ <p>
+ All types specified in the configuration files are now loaded
+ using a case insensitive method.
+ </p>
+ <h3>Fine grained fixing for buffered events</h3>
+ <p>
+ The <span class="code">LoggingEvent</span> now supports fine grained
+ fixing of data that needs to be accessed outside the append context,
+ e.g. when an event is buffered. The new
+ <span class="code">Fix</span>
+ property takes a combination of the
+ <span class="code">FixFlags</span>
+ enumeration values.
+ </p>
+ <h3>Code updated inline with FxCop 1.21</h3>
+ <p>
+ In line with the FxCop 1.21 guidelines:
+ Sealed utility classes. Added serialization security demand to GetObjectData.
+ Renamed parameters.
+ </p>
+ <h3>EventLogAppender 32K Limit</h3>
+ <p>
+ There is a limit of 32K characters in an EventLog message. Added a
+ check that only logs the first 32000 characters from the rendered
+ message.
+ </p>
+ <h3>Updated to support the Microsoft .NET Framework 1.1 Final</h3>
+ <p>
+ Updated to support the Microsoft .NET Framework 1.1 Final Beta (1.1.4322).
+ </p>
+ <h3>Features document</h3>
+ <p>
+ Added a new document that covers the main features of log4net.
+ See the
+ <a href="features.html">features</a>
+ document for more information.
+ </p>
+ <h3>Hierarchy disabled until it is configured</h3>
+ <p>
+ The Hierarchy is now disabled until it has been configured.
+ All messages logged to the Hierarchy before it has been
+ configured will be ignored without an error message being
+ written to the console.
+ </p>
+ <p>
+ If you are configuring log4net programmatically (i.e. not using
+ one of the built-in configurators) you must set the
+ <span class="code">ILoggerRepository.Configured</span>
+ property
+ to <span class="code">true</span> once you have configured
+ the repository.
+ </p>
+ <p>
+ The no appenders defined for a logger message will no longer be
+ displayed on the console by default. This message will only be
+ displayed if internal debugging is enabled.
+ </p>
+ <h3>New examples in VisualBasic.NET, JScript and Managed C++</h3>
+ <p>
+ New examples in VisualBasic.NET, JScript and Managed C++.
+ TODO Link to document about examples.
+ </p>
+ <h3>Code and Documentation Updates</h3>
+ <p>
+ Code fixes. Documentation and manual updates.
+ See the ChangeLog for more information.
+ </p>
+ <h3>Added document with example appender configurations</h3>
+ <p>
+ See the
+ <a href="config-examples.html">Example Appender Configuration</a>
+ document for more information.
+ </p>
+ <h3>Added support for multiple frameworks</h3>
+ <p>
+ log4net 1.2.0 beta 6 adds support for the the following frameworks:
+ </p>
+ <div class="table">
+ <table cellspacing="0">
+ <colgroup>
+ <col style="text-align: left;"/>
+ </colgroup>
+ <tr>
+ <th>
+ Framework
+ </th>
+ <th>
+ Website
+ </th>
+ </tr>
+ <tr style="vertical-align: top;">
+ <td>Microsoft .NET Framework 1.1 Final Beta (1.1.4322)</td>
+ <td>
+ <a href="http://msdn.microsoft.com/net">http://msdn.microsoft.com/net</a>
+ </td>
+ </tr>
+ <tr style="vertical-align: top;">
+ <td>Microsoft .NET Compact Framework 1.0 (1.0.5000)</td>
+ <td>
+ <a href="http://msdn.microsoft.com/vstudio/device/compactfx.asp">
+ http://msdn.microsoft.com/vstudio/device/compactfx.asp
+ </a>
+ </td>
+ </tr>
+ <tr style="vertical-align: top;">
+ <td>Mono 0.23</td>
+ <td>
+ <a href="http://www.go-mono.org">http://www.go-mono.org</a>
+ </td>
+ </tr>
+ <tr style="vertical-align: top;">
+ <td>Microsoft Shared Source CLI 1.0</td>
+ <td>
+ <a href="http://msdn.microsoft.com/library/en-us/dndotnet/html/mssharsourcecli.asp">
+ http://msdn.microsoft.com/library/en-us/dndotnet/html/mssharsourcecli.asp
+ </a>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <br/>
+ <p>
+ Not all frameworks are created equal and some features have been excluded from
+ some of the builds. See the <a href="framework-support.html">Framework Support</a> document for more
+ information.
+ </p>
+ <h3>New build system using NAnt</h3>
+ <p>
+ The new build system allows log4net to be built for all supported frameworks and
+ in all build configurations in one go.
+ </p>
+ <h3>New source code & distribution layout</h3>
+ <p>
+ The source code & distribution layout has been updated to support the new
+ build environment and multiple target frameworks.
+ </p>
+ <h3>Removed DomainAttribute.UseDefaultDomain property</h3>
+ <p>
+ Updated default behavior of <span class="code">DefaultRepositorySelector</span>. Assemblies
+ are now by default placed into the default domain. To specify another domain,
+ the <span class="code">DomainAttribute</span> must be used. This is the opposite behavior
+ to what was previously available. If you were previously specifying the
+ <span class="code">DomainAttribute.UseDefaultDomain</span>
+ property then you should remove it, and if the default behavior is now
+ sufficient, you do not need to specify the <span class="code">DomainAttribute</span> at all.
+ </p>
+ <h3>Updated configuration file parser</h3>
+ <p>
+ Updated config file parser to use the element name as the property to set. Also
+ removed <span class="code"><object></span> tag, the type attribute can now be
+ specified on the property element directly.
+ </p>
+ <p>
+ For example:
+ </p>
+ <div class="syntax">
+ <pre class="code">
+ <appender>
+ <param name="Evaluator">
+ <object type="log4net.spi.LevelEvaluator">
+ <constructor>
+ <param type="log4net.spi.Level" value="DEBUG"/>
+ </constructor>
+ </object>
+ </param>
+ </appender>
+ </pre>
+ </div>
+ <p>
+ becomes:
+ </p>
+ <div class="syntax">
+ <pre class="code">
+ <appender>
+ <evaluator type="log4net.spi.LevelEvaluator">
+ <threshold value="DEBUG"/>
+ </evaluator>
+ </appender>
+ </pre>
+ </div>
+ <h3>Support for event ID</h3>
+ <p>
+ The <span class="code">EventLogAppender</span> now supports setting the event ID in the
+ event log, this is taken from the <span class="code">EventID</span> property from the per
+ event <span class="code">Properties</span> map on the <span class="code">LoggingEvent</span>.
+ </p>
+ <h3>Updated ADONetAppender</h3>
+ <p/>
+ <ul>
+ <li>
+ Added support for prepared statements and stored procedures
+ </li>
+ <li>
+ Added <span class="code">RawTimeStampLayout</span>to correctly convert the timestamps into
+ database date time format
+ </li>
+ <li>
+ Added <span class="code">ExceptionLayout</span> to render the exception data
+ </li>
+ </ul>
+ <p/>
+ <h3>Support for front-end extension</h3>
+ <p>
+ This allows the logging API to be wrapped or adapted for specific purposes. Two
+ extension samples are included in the distribution:
+ </p>
+ <div class="table">
+ <table cellspacing="0">
+ <colgroup>
+ <col style="width: 50%; text-align: left;"/>
+ <col style="width: 50%; text-align: left;"/>
+ </colgroup>
+ <tr>
+ <th>
+ Extension
+ </th>
+ <th>
+ Description
+ </th>
+ </tr>
+ <tr style="vertical-align: top;">
+ <td>log4net.Ext.Trace</td>
+ <td>Adds trace logging methods</td>
+ </tr>
+ <tr style="vertical-align: top;">
+ <td>log4net.Ext.EventID</td>
+ <td>Adds additional eventId parameter to all methods</td>
+ </tr>
+ </table>
+ </div>
+ <p/>
+ <h3>Added ForwardingAppender</h3>
+ <p>Forwards events to multiple sub appenders after applying filter rules.</p>
+ <h3>Added BufferingForwardingAppender</h3>
+ <p>Forward events to sub appenders after buffering them.</p>
+ <h3>Added ASPNetTraceAppender</h3>
+ <p>Logs events to the ASP.NET trace system.</p>
+ <h3>Added NetSendAppender</h3>
+ <p>Delivers logging events using the Windows Messenger service.</p>
+ <h3>Added UdpAppender</h3>
+ <p>
+ Sends logging events as connectionless UDP datagrams to a remote host or a
+ multicast group.
+ </p>
+ <h3>Removed obsolete methods</h3>
+ <h3>Lots of updates to improve our compliance with FxCop</h3>
+ <h3>Improved SDK documentation</h3>
+ <h3>
+ Fixed Exception thrown when DOM Configurator called with a null XML
+ Element.
+ </h3>
+ <p>This occurred if the configuration file did not have a log4net section defined.</p>
+ <h3>Made level lookup case insensitive</h3>
+ <h3>Prevented the Hierarchy's Threshold level from being set to a null reference</h3>
+ <h3>Added event specific properties to the logging event object</h3>
+ <p>
+ Appenders can add additional information to the events they are logging. The
+ <span class="code">RemotingAppender</span>
+ and the <span class="code">SMTPAppender</span> both add a 'hostname' property to the events.
+ These properties can be accessed using the <span class="code">PatternLayout</span> with the
+ %P{name} syntax.
+ </p>
+ <h3>Added a plugin framework</h3>
+ <p>
+ An <span class="code">IPlugin</span> interface can be attached to any repository.
+ </p>
+ <h3>
+ A new RemoteLoggingServerPlugin plugin acts as the server for the
+ RemotingAppender
+ </h3>
+ <h3>
+ Updated the core log4net framework to work in an environment with no
+ permissions
+ </h3>
+ <p>Specific appenders still require additional permissions to log correctly</p>
+ <h3>Added support for domain aliasing using the AliasDomainAttribute</h3>
+ <p>
+ This allows a parent assembly to take control of the logging domain for child
+ assemblies.
+ </p>
+ <h3>
+ Added events for repository creation, configuration change, configuration reset
+ and repository shutdown
+ </h3>
+ <h3>Added LevelMap to the ILoggerRepository interface</h3>
+ <p>
+ The mapping from level name to level object is now repository specific,
+ therefore each repository can have independent mappings.
+ </p>
+ <h3>Moved hierarchy specific config file parser to new DOMHierarchyConfigurator class</h3>
+ <p>
+ This is controlled by the <span class="code">Hierarchy</span> object and allows for better
+ encapsulation.
+ </p>
+ <h3>Added OnlyFixPartialEventData property to the buffered appenders</h3>
+ <p>
+ This setting causes slow settings to be ignored. This significantly improves the
+ performance of the buffered appenders.
+ </p>
+ <h3>XML entity references are supported in the XML config file.</h3>
+ <h3>Added support for expanding environment variables in <param> values</h3>
+ <p>
+ The environment variables must be specified as <span class="code">${FOO}</span> where
+ <span class="code">FOO</span>
+ is the name of the variable to expand.
+ </p>
+ <h3>Upgraded to use NUnit 2.0</h3>
+ <h3>File appenders can specify the encoding to use for the file</h3>
+ <h3>Added strong named configuration</h3>
+ <h3>Added log4net.Ext.Trace extension</h3>
+ <p>This is a separate assembly that adds a trace level to log4net.</p>
+ <h3>
+ The default log file output directory is now the application base directory not
+ the current directory
+ </h3>
+ <h3>Added MemoryAppender</h3>
+ <p>Stores all the logging events in an in-memory buffer.</p>
+ <h3>Moved the Hierarchy implementation into a separate namespace</h3>
+ <p>
+ The <span class="code">log4net.Repository.Hierarchy</span> namespace now contains all the
+ code that is specific to the <span class="code">Hierarchy</span> implementation.
+ </p>
+ <h3>Refactored the DOMConfigurator and BasicConfigurator</h3>
+ <p>
+ The <span class="code">Hierarchy</span> specific data schema and implementation could be has
+ now been moved to the <span class="code">log4net.Repository.Hierarchy</span> namespace. The
+ bootstrap code for these configurators remains in the
+ <span class="code">log4net.Config</span>
+ namespace.
+ </p>
+ <h3>
+ Replaced the DOMConfiguratorAttribute UseExecutableDomain
+ property with UseDefaultDomain
+ </h3>
+ <p>
+ This change to the implementation of the <span class="code">DOMConfiguratorAttribute</span> should
+ allow the configuration of multiple assemblies to be accomplished more easily,
+ especially when developing web applications (ASP.NET).
+ </p>
+ <h3>A few good bug fixes!</h3>
+ <h3>Added ADONetAppender</h3>
+ <p>Thanks to TechnologyOneCorp.com.</p>
+ <h3>Added TraceLogAssembly extensibility example</h3>
+ <h3>Lots of bug fixes</h3>
+ <h3>Added 6 new examples</h3>
+ <h3>Split Category class into Logger and LogManager classes</h3>
+ <p>
+ The instance methods from <span class="code">Category</span> have moved to the
+ <span class="code">Logger</span>
+ class. The static methods from <span class="code">Category</span> have moved to the
+ <span class="code">LogManager</span>
+ class. The <span class="code">Category</span> class still exists but for backward
+ compatibility only. Changed interface <span class="code">ICategoryFactory</span> to
+ <span class="code">ILoggerFactory</span>
+ and the implementation class <span class="code">DefaultCategoryFactory</span> to <span class="code">
+ DefaultLoggerFactory
+ </span>.
+ </p>
+ <h3>Replaced Priority class with Level class</h3>
+ <p>
+ The <span class="code">Priority</span> class has been replaced by the <span class="code">
+ Level
+ </span> class.
+ The <span class="code">Priority</span> class still exists for backward compatibility only.
+ The <span class="code">Level</span> class implements a static pool of <span class="code">
+ Level
+ </span> objects.
+ The <span class="code">Level</span> class is sealed and serializable.
+ </p>
+ <h3>Added ILoggerRepository interface implemented by Hierarchy</h3>
+ <p>
+ The <span class="code">Hierarchy</span> class implements the <span class="code">
+ ILoggerRepository
+ </span> interface.
+ This interface is used by the <span class="code">LogManager</span> class and therefore
+ allows different implementations of <span class="code">ILoggerRepository</span> to be used.
+ </p>
+ <h3>Enhanced NUnit tests</h3>
+ <p>
+ All the NUnit tests can be run using a single TestSuite: NUnitGUI
+ log4net.LogManager+AllTests,log4net.dll.
+ </p>
+ <h3>Added support for serializing LoggingEvents</h3>
+ <p>
+ The <span class="code">LoggingEvent</span> class is serializable. All local state is
+ captured before serialization occurs. This now allows
+ <span class="code">LoggingEvent</span>
+ objects to be serialized between applications or machines.
+ </p>
+ <h3>Added RemotingAppender</h3>
+ <p>
+ Delivers <span class="code">LoggingEvents</span> to a remote interface. This can be used to
+ collect distributed logging into a single log file. There is an example
+ remoting sink that receives the logging events, see
+ <span class="code">examples\net\remoting\RemotingServer</span>
+ for details.
+ </p>
+ <h3>Added support for rendering composite objects</h3>
+ <p>
+ The <span class="code">IObjectRenderer</span> interface method <span class="code">DoRender</span> now
+ takes a <span class="code">RendererMap</span> argument. This allows the renderer to use the
+ appropriate renderer from the <span class="code">RendererMap</span> to render any nested
+ objects.
+ </p>
+ <h3>Added support for rendering exceptions</h3>
+ <p>
+ The <span class="code">DefaultRenderer</span> now has support for rendering exceptions to a
+ string. This includes nested exceptions. The <span class="code">RendererMap</span> is now
+ used to render exceptions in the <span class="code">LoggingEvent</span>. This allows the
+ rendering of specific exceptions to be enhanced by specific renderers.
+ </p>
+ <h3>Added ITriggeringEventEvaluator interface</h3>
+ <p>
+ This interface is used by <span class="code">SMTPAppender</span> and
+ <span class="code">RemotingAppender</span>
+ to determine if a <span class="code">LoggingEvent</span> meets a set of user defined
+ criteria. These appenders use the interface to determine whether or not to
+ deliver the current buffer of events to their listener. The interface is
+ implemented by the <span class="code">LevelEvaluator</span> class, which triggers above a
+ set level.
+ </p>
+ <h3>Added regex matching to the MDCFilter, NDCFilter and StringMatchFilter</h3>
+ <p>
+ The <span class="code">MDCFilter</span>, <span class="code">NDCFilter</span> and
+ <span class="code">StringMatchFilter</span>
+ can now be configured to use regex matches in addition to substring matches.
+ Set the <span class="code">RegexToMatch</span> property to use this feature.
+ </p>
+ <h3>Added XMLLayout</h3>
+ <p>
+ emits an XML element for each <span class="code">LoggingEvent</span>. This allows logging
+ events to be stored and manipulated as XML. The DTD for the XML emitted is in
+ the
+ <span class="code">log4net-events.dtd</span>
+ </p>
+ <h3>
+ Added support for <logger> and <level> elements in the
+ DOMConfigurator
+ </h3>
+ <p>
+ As the <span class="code">Category</span> and <span class="code">Priority</span> classes have been
+ replaced by the <span class="code">Logger</span> and <span class="code">Level</span> classes. The
+ <span class="code">DOMConfigurator</span>
+ has been updated to allow the <span class="code"><logger></span> and
+ <span class="code"><level></span>
+ elements to be used in place of the <span class="code"><category></span> and
+ <span class="code"><priority></span>
+ elements. The old elements are still accepted for backward compatibility.
+ </p>
+ <h3>Added Threshold property to Hierarchy</h3>
+ <p>
+ Changed <span class="code">DisableXXX()</span> methods on <span class="code">Hierarchy</span> to a
+ <span class="code">Threshold</span>
+ property.
+ </p>
+ <h3>Added support for logging domains</h3>
+ <p>
+ The <span class="code">LogManager</span> supports multiple logging domains. The
+ <span class="code">LogManager</span>
+ uses an instance of the <span class="code">IRepositorySelector</span> class to map from
+ domains to <span class="code">ILoggerRepository</span> instances. The default implementation
+ is to have a separate <span class="code">ILoggerRepository</span> for each domain. When a
+ call is made to the static methods on <span class="code">LogManager</span> the domain can be
+ specified (as a string) or the domain can be inferred automatically from the
+ calling assembly. The default behavior is for each assembly loaded into the
+ process to have its own domain and <span class="code">ILoggerRepository</span>. These can
+ each be configured separately. This allows standalone assemblies to use log4net
+ without conflicting with other modules in the process. The domain for the
+ assembly is configured using metadata attributes defined on the assembly.
+ </p>
+ <h3>DOMConfigurator can set params to arbitrary objects</h3>
+ <p>
+ Using a new <span class="code"><object></span> element, params can now be set to any
+ creatable object.
+ </p>
+ </section>
+
</section>
-
- <section id="a1.2.9-other" name="Other Changes">
- <h3>FxCop compliance</h3>
- <p>
- Updates to bring the internal code in line with the current FxCop rules.
- </p>
- <h3>Separate NUnit tests</h3>
- <p>
- Moved the NUnit tests into a separate project, <span class="code">log4net.Tests</span>.
- </p>
- <h3>Bug Fixes</h3>
- <dl>
- <dt>
- <span class="code">RemotingAppender</span>
- </dt>
- <dd>
- <p>
- Sends events from a <span class="code">ThreadPool</span> thread
- rather than the calling thread to prevent transfer,
- and potential loss, of the <span class="code">CallContext</span>.
- </p>
- </dd>
- <dt>
- <span class="code">RollingFileAppender</span>
- </dt>
- <dd>
- <p>
- Fixed date rolling period detection for non UTC timezones.
- </p>
- </dd>
- <dt>
- <span class="code">ColoredConsoleAppender</span>
- </dt>
- <dd>
- <p>
- Updated to support writing more than 30,000 chars in a single message.
- Fixed background color overspill if the console window needs to
- scroll the contents.
- </p>
- </dd>
- </dl>
- </section>
-
- </section>
-
- <section id="a1.2.0" name="1.2.0">
- <h3>
- Changed assembly name to
- <span class="code">log4net</span>
- </h3>
- <p>
- The build output is now
- <span class="code">log4net.dll</span>
- for all frameworks. This is a breaking change.
- </p>
- <p>
- To resolve cross platform and cross version issues we have
- changed the log4net assembly to use a common name for all
- frameworks. The assembly friendly name is now <span class="code">log4net</span>.
- The builds for each framework can now be differentiated
- by the assembly title. This includes the name of the framework
- that the assembly was built on.
- </p>
- <h3>Combined Release and ReleaseStrong builds</h3>
- <p>
- The Release and ReleaseStrong builds have been consolidated into
- a single build called Release. This Release build is strongly named.
- </p>
- <h3>New Appender: ColoredConsoleAppender</h3>
- <p>
- The <span class="code">ColoredConsoleAppender</span> writes events to the
- application's console. It can be configured to specify the text and background
- colors for different level events.
- </p>
- <h3>New Appender: SmtpPickupDirAppender</h3>
- <p>
- The <span class="code">SmtpPickupDirAppender</span> generates SMTP compliant
- messages and writes them to a local directory. These files can then be read
- by an SMTP agent (e.g. the IIS SMTP Agent) and delivered.
- </p>
- <h3>New Layout: XmlLayoutSchemaLog4j</h3>
- <p>
- This new layout formats the logging events as XML which complies with
- the Apache log4j™ event dtd. This can be used to transfer log event from log4net
- to log4j. Currently the only appender that can communicate directly with
- log4j is the <span class="code">UdpAppender</span>.
- </p>
- <h3>New PatternLayout conversion characters</h3>
- <p>
- Added support for capturing the current thread principal name and the
- app domain friendly name for each logging event.
- </p>
- <dl>
- <dt>%a</dt>
- <dd>
- Used to output the friendly name of the AppDomain where the
- logging event was generated.
- </dd>
- <dt>%u</dt>
- <dd>
- Used to output the user name for the currently active user
- (<span class="code">Principal.Identity.Name</span>).
- </dd>
- </dl>
- <h3>Types specified in the config file are now loaded ignoring case</h3>
- <p>
- All types specified in the configuration files are now loaded
- using a case insensitive method.
- </p>
- <h3>Fine grained fixing for buffered events</h3>
- <p>
- The <span class="code">LoggingEvent</span> now supports fine grained
- fixing of data that needs to be accessed outside the append context,
- e.g. when an event is buffered. The new
- <span class="code">Fix</span>
- property takes a combination of the
- <span class="code">FixFlags</span>
- enumeration values.
- </p>
- <h3>Code updated inline with FxCop 1.21</h3>
- <p>
- In line with the FxCop 1.21 guidelines:
- Sealed utility classes. Added serialization security demand to GetObjectData.
- Renamed parameters.
- </p>
- <h3>EventLogAppender 32K Limit</h3>
- <p>
- There is a limit of 32K characters in an EventLog message. Added a
- check that only logs the first 32000 characters from the rendered
- message.
- </p>
- <h3>Updated to support the Microsoft .NET Framework 1.1 Final</h3>
- <p>
- Updated to support the Microsoft .NET Framework 1.1 Final Beta (1.1.4322).
- </p>
- <h3>Features document</h3>
- <p>
- Added a new document that covers the main features of log4net.
- See the
- <a href="features.html">features</a>
- document for more information.
- </p>
- <h3>Hierarchy disabled until it is configured</h3>
- <p>
- The Hierarchy is now disabled until it has been configured.
- All messages logged to the Hierarchy before it has been
- configured will be ignored without an error message being
- written to the console.
- </p>
- <p>
- If you are configuring log4net programmatically (i.e. not using
- one of the built-in configurators) you must set the
- <span class="code">ILoggerRepository.Configured</span>
- property
- to <span class="code">true</span> once you have configured
- the repository.
- </p>
- <p>
- The no appenders defined for a logger message will no longer be
- displayed on the console by default. This message will only be
- displayed if internal debugging is enabled.
- </p>
- <h3>New examples in VisualBasic.NET, JScript and Managed C++</h3>
- <p>
- New examples in VisualBasic.NET, JScript and Managed C++.
- TODO Link to document about examples.
- </p>
- <h3>Code and Documentation Updates</h3>
- <p>
- Code fixes. Documentation and manual updates.
- See the ChangeLog for more information.
- </p>
- <h3>Added document with example appender configurations</h3>
- <p>
- See the
- <a href="config-examples.html">Example Appender Configuration</a>
- document for more information.
- </p>
- <h3>Added support for multiple frameworks</h3>
- <p>
- log4net 1.2.0 beta 6 adds support for the the following frameworks:
- </p>
- <div class="table">
- <table cellspacing="0">
- <colgroup>
- <col style="text-align: left;"/>
- </colgroup>
- <tr>
- <th>
- Framework
- </th>
- <th>
- Website
- </th>
- </tr>
- <tr style="vertical-align: top;">
- <td>Microsoft .NET Framework 1.1 Final Beta (1.1.4322)</td>
- <td>
- <a href="http://msdn.microsoft.com/net">http://msdn.microsoft.com/net</a>
- </td>
- </tr>
- <tr style="vertical-align: top;">
- <td>Microsoft .NET Compact Framework 1.0 (1.0.5000)</td>
- <td>
- <a href="http://msdn.microsoft.com/vstudio/device/compactfx.asp">
- http://msdn.microsoft.com/vstudio/device/compactfx.asp
- </a>
- </td>
- </tr>
- <tr style="vertical-align: top;">
- <td>Mono 0.23</td>
- <td>
- <a href="http://www.go-mono.org">http://www.go-mono.org</a>
- </td>
- </tr>
- <tr style="vertical-align: top;">
- <td>Microsoft Shared Source CLI 1.0</td>
- <td>
- <a href="http://msdn.microsoft.com/library/en-us/dndotnet/html/mssharsourcecli.asp">
- http://msdn.microsoft.com/library/en-us/dndotnet/html/mssharsourcecli.asp
- </a>
- </td>
- </tr>
- </table>
- </div>
- <br/>
- <p>
- Not all frameworks are created equal and some features have been excluded from
- some of the builds. See the <a href="framework-support.html">Framework Support</a> document for more
- information.
- </p>
- <h3>New build system using NAnt</h3>
- <p>
- The new build system allows log4net to be built for all supported frameworks and
- in all build configurations in one go.
- </p>
- <h3>New source code & distribution layout</h3>
- <p>
- The source code & distribution layout has been updated to support the new
- build environment and multiple target frameworks.
- </p>
- <h3>Removed DomainAttribute.UseDefaultDomain property</h3>
- <p>
- Updated default behavior of <span class="code">DefaultRepositorySelector</span>. Assemblies
- are now by default placed into the default domain. To specify another domain,
- the <span class="code">DomainAttribute</span> must be used. This is the opposite behavior
- to what was previously available. If you were previously specifying the
- <span class="code">DomainAttribute.UseDefaultDomain</span>
- property then you should remove it, and if the default behavior is now
- sufficient, you do not need to specify the <span class="code">DomainAttribute</span> at all.
- </p>
- <h3>Updated configuration file parser</h3>
- <p>
- Updated config file parser to use the element name as the property to set. Also
- removed <span class="code"><object></span> tag, the type attribute can now be
- specified on the property element directly.
- </p>
- <p>
- For example:
- </p>
- <div class="syntax">
- <pre class="code">
- <appender>
- <param name="Evaluator">
- <object type="log4net.spi.LevelEvaluator">
- <constructor>
- <param type="log4net.spi.Level" value="DEBUG"/>
- </constructor>
- </object>
- </param>
- </appender>
- </pre>
- </div>
- <p>
- becomes:
- </p>
- <div class="syntax">
- <pre class="code">
- <appender>
- <evaluator type="log4net.spi.LevelEvaluator">
- <threshold value="DEBUG"/>
- </evaluator>
- </appender>
- </pre>
- </div>
- <h3>Support for event ID</h3>
- <p>
- The <span class="code">EventLogAppender</span> now supports setting the event ID in the
- event log, this is taken from the <span class="code">EventID</span> property from the per
- event <span class="code">Properties</span> map on the <span class="code">LoggingEvent</span>.
- </p>
- <h3>Updated ADONetAppender</h3>
- <p/>
- <ul>
- <li>
- Added support for prepared statements and stored procedures
- </li>
- <li>
- Added <span class="code">RawTimeStampLayout</span>to correctly convert the timestamps into
- database date time format
- </li>
- <li>
- Added <span class="code">ExceptionLayout</span> to render the exception data
- </li>
- </ul>
- <p/>
- <h3>Support for front-end extension</h3>
- <p>
- This allows the logging API to be wrapped or adapted for specific purposes. Two
- extension samples are included in the distribution:
- </p>
- <div class="table">
- <table cellspacing="0">
- <colgroup>
- <col style="width: 50%; text-align: left;"/>
- <col style="width: 50%; text-align: left;"/>
- </colgroup>
- <tr>
- <th>
- Extension
- </th>
- <th>
- Description
- </th>
- </tr>
- <tr style="vertical-align: top;">
- <td>log4net.Ext.Trace</td>
- <td>Adds trace logging methods</td>
- </tr>
- <tr style="vertical-align: top;">
- <td>log4net.Ext.EventID</td>
- <td>Adds additional eventId parameter to all methods</td>
- </tr>
- </table>
- </div>
- <p/>
- <h3>Added ForwardingAppender</h3>
- <p>Forwards events to multiple sub appenders after applying filter rules.</p>
- <h3>Added BufferingForwardingAppender</h3>
- <p>Forward events to sub appenders after buffering them.</p>
- <h3>Added ASPNetTraceAppender</h3>
- <p>Logs events to the ASP.NET trace system.</p>
- <h3>Added NetSendAppender</h3>
- <p>Delivers logging events using the Windows Messenger service.</p>
- <h3>Added UdpAppender</h3>
- <p>
- Sends logging events as connectionless UDP datagrams to a remote host or a
- multicast group.
- </p>
- <h3>Removed obsolete methods</h3>
- <h3>Lots of updates to improve our compliance with FxCop</h3>
- <h3>Improved SDK documentation</h3>
- <h3>
- Fixed Exception thrown when DOM Configurator called with a null XML
- Element.
- </h3>
- <p>This occurred if the configuration file did not have a log4net section defined.</p>
- <h3>Made level lookup case insensitive</h3>
- <h3>Prevented the Hierarchy's Threshold level from being set to a null reference</h3>
- <h3>Added event specific properties to the logging event object</h3>
- <p>
- Appenders can add additional information to the events they are logging. The
- <span class="code">RemotingAppender</span>
- and the <span class="code">SMTPAppender</span> both add a 'hostname' property to the events.
- These properties can be accessed using the <span class="code">PatternLayout</span> with the
- %P{name} syntax.
- </p>
- <h3>Added a plugin framework</h3>
- <p>
- An <span class="code">IPlugin</span> interface can be attached to any repository.
- </p>
- <h3>
- A new RemoteLoggingServerPlugin plugin acts as the server for the
- RemotingAppender
- </h3>
- <h3>
- Updated the core log4net framework to work in an environment with no
- permissions
- </h3>
- <p>Specific appenders still require additional permissions to log correctly</p>
- <h3>Added support for domain aliasing using the AliasDomainAttribute</h3>
- <p>
- This allows a parent assembly to take control of the logging domain for child
- assemblies.
- </p>
- <h3>
- Added events for repository creation, configuration change, configuration reset
- and repository shutdown
- </h3>
- <h3>Added LevelMap to the ILoggerRepository interface</h3>
- <p>
- The mapping from level name to level object is now repository specific,
- therefore each repository can have independent mappings.
- </p>
- <h3>Moved hierarchy specific config file parser to new DOMHierarchyConfigurator class</h3>
- <p>
- This is controlled by the <span class="code">Hierarchy</span> object and allows for better
- encapsulation.
- </p>
- <h3>Added OnlyFixPartialEventData property to the buffered appenders</h3>
- <p>
- This setting causes slow settings to be ignored. This significantly improves the
- performance of the buffered appenders.
- </p>
- <h3>XML entity references are supported in the XML config file.</h3>
- <h3>Added support for expanding environment variables in <param> values</h3>
- <p>
- The environment variables must be specified as <span class="code">${FOO}</span> where
- <span class="code">FOO</span>
- is the name of the variable to expand.
- </p>
- <h3>Upgraded to use NUnit 2.0</h3>
- <h3>File appenders can specify the encoding to use for the file</h3>
- <h3>Added strong named configuration</h3>
- <h3>Added log4net.Ext.Trace extension</h3>
- <p>This is a separate assembly that adds a trace level to log4net.</p>
- <h3>
- The default log file output directory is now the application base directory not
- the current directory
- </h3>
- <h3>Added MemoryAppender</h3>
- <p>Stores all the logging events in an in-memory buffer.</p>
- <h3>Moved the Hierarchy implementation into a separate namespace</h3>
- <p>
- The <span class="code">log4net.Repository.Hierarchy</span> namespace now contains all the
- code that is specific to the <span class="code">Hierarchy</span> implementation.
- </p>
- <h3>Refactored the DOMConfigurator and BasicConfigurator</h3>
- <p>
- The <span class="code">Hierarchy</span> specific data schema and implementation could be has
- now been moved to the <span class="code">log4net.Repository.Hierarchy</span> namespace. The
- bootstrap code for these configurators remains in the
- <span class="code">log4net.Config</span>
- namespace.
- </p>
- <h3>
- Replaced the DOMConfiguratorAttribute UseExecutableDomain
- property with UseDefaultDomain
- </h3>
- <p>
- This change to the implementation of the <span class="code">DOMConfiguratorAttribute</span> should
- allow the configuration of multiple assemblies to be accomplished more easily,
- especially when developing web applications (ASP.NET).
- </p>
- <h3>A few good bug fixes!</h3>
- <h3>Added ADONetAppender</h3>
- <p>Thanks to TechnologyOneCorp.com.</p>
- <h3>Added TraceLogAssembly extensibility example</h3>
- <h3>Lots of bug fixes</h3>
- <h3>Added 6 new examples</h3>
- <h3>Split Category class into Logger and LogManager classes</h3>
- <p>
- The instance methods from <span class="code">Category</span> have moved to the
- <span class="code">Logger</span>
- class. The static methods from <span class="code">Category</span> have moved to the
- <span class="code">LogManager</span>
- class. The <span class="code">Category</span> class still exists but for backward
- compatibility only. Changed interface <span class="code">ICategoryFactory</span> to
- <span class="code">ILoggerFactory</span>
- and the implementation class <span class="code">DefaultCategoryFactory</span> to <span class="code">
- DefaultLoggerFactory
- </span>.
- </p>
- <h3>Replaced Priority class with Level class</h3>
- <p>
- The <span class="code">Priority</span> class has been replaced by the <span class="code">
- Level
- </span> class.
- The <span class="code">Priority</span> class still exists for backward compatibility only.
- The <span class="code">Level</span> class implements a static pool of <span class="code">
- Level
- </span> objects.
- The <span class="code">Level</span> class is sealed and serializable.
- </p>
- <h3>Added ILoggerRepository interface implemented by Hierarchy</h3>
- <p>
- The <span class="code">Hierarchy</span> class implements the <span class="code">
- ILoggerRepository
- </span> interface.
- This interface is used by the <span class="code">LogManager</span> class and therefore
- allows different implementations of <span class="code">ILoggerRepository</span> to be used.
- </p>
- <h3>Enhanced NUnit tests</h3>
- <p>
- All the NUnit tests can be run using a single TestSuite: NUnitGUI
- log4net.LogManager+AllTests,log4net.dll.
- </p>
- <h3>Added support for serializing LoggingEvents</h3>
- <p>
- The <span class="code">LoggingEvent</span> class is serializable. All local state is
- captured before serialization occurs. This now allows
- <span class="code">LoggingEvent</span>
- objects to be serialized between applications or machines.
- </p>
- <h3>Added RemotingAppender</h3>
- <p>
- Delivers <span class="code">LoggingEvents</span> to a remote interface. This can be used to
- collect distributed logging into a single log file. There is an example
- remoting sink that receives the logging events, see
- <span class="code">examples\net\remoting\RemotingServer</span>
- for details.
- </p>
- <h3>Added support for rendering composite objects</h3>
- <p>
- The <span class="code">IObjectRenderer</span> interface method <span class="code">DoRender</span> now
- takes a <span class="code">RendererMap</span> argument. This allows the renderer to use the
- appropriate renderer from the <span class="code">RendererMap</span> to render any nested
- objects.
- </p>
- <h3>Added support for rendering exceptions</h3>
- <p>
- The <span class="code">DefaultRenderer</span> now has support for rendering exceptions to a
- string. This includes nested exceptions. The <span class="code">RendererMap</span> is now
- used to render exceptions in the <span class="code">LoggingEvent</span>. This allows the
- rendering of specific exceptions to be enhanced by specific renderers.
- </p>
- <h3>Added ITriggeringEventEvaluator interface</h3>
- <p>
- This interface is used by <span class="code">SMTPAppender</span> and
- <span class="code">RemotingAppender</span>
- to determine if a <span class="code">LoggingEvent</span> meets a set of user defined
- criteria. These appenders use the interface to determine whether or not to
- deliver the current buffer of events to their listener. The interface is
- implemented by the <span class="code">LevelEvaluator</span> class, which triggers above a
- set level.
- </p>
- <h3>Added regex matching to the MDCFilter, NDCFilter and StringMatchFilter</h3>
- <p>
- The <span class="code">MDCFilter</span>, <span class="code">NDCFilter</span> and
- <span class="code">StringMatchFilter</span>
- can now be configured to use regex matches in addition to substring matches.
- Set the <span class="code">RegexToMatch</span> property to use this feature.
- </p>
- <h3>Added XMLLayout</h3>
- <p>
- emits an XML element for each <span class="code">LoggingEvent</span>. This allows logging
- events to be stored and manipulated as XML. The DTD for the XML emitted is in
- the
- <span class="code">log4net-events.dtd</span>
- </p>
- <h3>
- Added support for <logger> and <level> elements in the
- DOMConfigurator
- </h3>
- <p>
- As the <span class="code">Category</span> and <span class="code">Priority</span> classes have been
- replaced by the <span class="code">Logger</span> and <span class="code">Level</span> classes. The
- <span class="code">DOMConfigurator</span>
- has been updated to allow the <span class="code"><logger></span> and
- <span class="code"><level></span>
- elements to be used in place of the <span class="code"><category></span> and
- <span class="code"><priority></span>
- elements. The old elements are still accepted for backward compatibility.
- </p>
- <h3>Added Threshold property to Hierarchy</h3>
- <p>
- Changed <span class="code">DisableXXX()</span> methods on <span class="code">Hierarchy</span> to a
- <span class="code">Threshold</span>
- property.
- </p>
- <h3>Added support for logging domains</h3>
- <p>
- The <span class="code">LogManager</span> supports multiple logging domains. The
- <span class="code">LogManager</span>
- uses an instance of the <span class="code">IRepositorySelector</span> class to map from
- domains to <span class="code">ILoggerRepository</span> instances. The default implementation
- is to have a separate <span class="code">ILoggerRepository</span> for each domain. When a
- call is made to the static methods on <span class="code">LogManager</span> the domain can be
- specified (as a string) or the domain can be inferred automatically from the
- calling assembly. The default behavior is for each assembly loaded into the
- process to have its own domain and <span class="code">ILoggerRepository</span>. These can
- each be configured separately. This allows standalone assemblies to use log4net
- without conflicting with other modules in the process. The domain for the
- assembly is configured using metadata attributes defined on the assembly.
- </p>
- <h3>DOMConfigurator can set params to arbitrary objects</h3>
- <p>
- Using a new <span class="code"><object></span> element, params can now be set to any
- creatable object.
- </p>
- </section>
-
- </section>
- </body>
+ </body>
</document>
diff --git a/src/site/xdoc/release/security-reports.xml b/src/site/xdoc/release/security-reports.xml
index 30c57bd..e1e6466 100644
--- a/src/site/xdoc/release/security-reports.xml
+++ b/src/site/xdoc/release/security-reports.xml
@@ -17,48 +17,64 @@
limitations under the License.
-->
<document>
- <properties>
- <title>Apache log4net: Security Reports</title>
- <author email="dev@logging.apache.org">Logging Documentation Team</author>
- </properties>
- <body>
- <section name="General Information">
- <p>For information about reporting or asking questions about
+ <properties>
+ <title>Apache log4net: Security Reports</title>
+ <author email="dev@logging.apache.org">Logging Documentation Team</author>
+ </properties>
+ <body>
+ <section name="General Information">
+ <p>
+ For information about reporting or asking questions about
security problems, please see the <a
- href="https://logging.apache.org/security.html">security page
- of the Logging project</a>.</p>
- </section>
+ href="https://logging.apache.org/security.html">
+ security page
+ of the Logging project
+ </a>.
+ </p>
+ </section>
- <section name="Apache log4net Security Vulnerabilities">
- <p>This page lists all security vulnerabilities fixed in
+ <section name="Apache log4net Security Vulnerabilities">
+ <p>
+ This page lists all security vulnerabilities fixed in
released versions of Apache log4net. Each
vulnerability is given a security impact rating by the
development team - please note that this rating may vary from
platform to platform. We also list the versions of log4net the
- flaw is known to affect, and where a flaw has not
- been verified list the version with a question mark.</p>
+ flaw is known to affect, and where a flaw has not
+ been verified list the version with a question mark.
+ </p>
- <p>Please note that binary patches are never provided. If you
+ <p>
+ Please note that binary patches are never provided. If you
need to apply a source code patch, use the building
instructions for the log4net version that you are
- using.</p>
+ using.
+ </p>
- <p>If you need help on building log4net or other help
+ <p>
+ If you need help on building log4net or other help
on following the instructions to mitigate the known
vulnerabilities listed here, please send your questions to the
- public <a href="../mail-lists.html">Logging Users mailing
- list</a>.</p>
+ public <a href="../mail-lists.html">
+ Logging Users mailing
+ list
+ </a>.
+ </p>
- <p>If you have encountered an unlisted security vulnerability
+ <p>
+ If you have encountered an unlisted security vulnerability
or other unexpected behaviour that has security impact, or if
the descriptions here are incomplete, please report them
- privately to the Apache Security Team. Thank you.</p>
+ privately to the Apache Security Team. Thank you.
+ </p>
- </section>
+ </section>
- <section name="Errors and Ommissions">
- <p>Please report any errors or omissions to <a
- href="../mail-lists.html">the dev mailing list</a>.</p>
- </section>
- </body>
+ <section name="Errors and Ommissions">
+ <p>
+ Please report any errors or omissions to <a
+ href="../mail-lists.html">the dev mailing list</a>.
+ </p>
+ </section>
+ </body>
</document>