diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..7df7fdcb --- /dev/null +++ b/.gitattributes @@ -0,0 +1,46 @@ +*.apt text +*.asax text +*.aspx text +*.build text +*.cgi eol=lf +*.config text +*.cpp text +*.cs text diff=csharp +*.csdproj text +*.csproj text +*.css text +*.dll binary +*.dtd text +*.html text diff=html +*.include text +*.js text +*.json text +*.log4net text +*.md text +*.nuspec text +*.readme text +*.resx text +*.rng text +*.rngc text +*.sh eol=lf +*.shfbproj text +*.sln text +*.snk binary +*.txt text +*.vb text +*.vbdproj text +*.vbproj text +*.vcproj text +*.vm text +*.vsdisco text +*.webinfo text +*.xml text +*.xproj text +*.xsd text +*.xsl text +*.yml text +.gitattributes text +.gitignore text +KEYS text +LICENSE text +NOTICE text diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..1ce22ce3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,230 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +build/ +bld/ +[Bb]in/ +[Oo]bj/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config + +# Windows Azure Build Output +csx/ +*.build.csdef + +# Windows Azure Emulator +efc/ +rfc/ + +# Windows Store app package directory +AppPackages/ + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe + +# FAKE - F# Make +.fake/ \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..d6d5c241 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,53 @@ +Contributing to Apache log4net +====================== + +You have found a bug or you have an idea for a cool new feature? Contributing code is a great way to give something back to +the open source community. Before you dig right into the code there are a few guidelines that we need contributors to +follow so that we can have a chance of keeping on top of things. + +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 you're 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. + + Clearly describe the issue including steps to reproduce when it is a bug. + + Make sure you fill in the earliest version that you know has the issue. ++ Fork the repository on GitHub. + +Making Changes +-------------- + ++ Create a topic branch from where you want to base your work (this is usually the master/trunk branch). ++ Make commits of logical units. ++ 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 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. + +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. +In this case, it is appropriate to start the first line of a commit with '(doc)' instead of a ticket number. + +Submitting Changes +------------------ + ++ 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/) + +[cla]:https://www.apache.org/licenses/#clas diff --git a/KEYS b/KEYS new file mode 100644 index 00000000..d8de1236 --- /dev/null +++ b/KEYS @@ -0,0 +1,602 @@ +This file contains the PGP keys of various Apache developers. +These keys are primarily used for code signing. + +These keys can be verified using any OpenPGP compatible system, +for example, http://www.gnupg.org. + +Developers: To add key information use: + gpg --list-keys UID + gpg --export -a UID + +(Where UID is your email address) + +The original source of this file is +https://svn.apache.org/repos/asf/logging/log4net/trunk/KEYS + +User: To import this key file into your keyring use: + gpg --import KEYS + + + + + +pub 1024D/914A4D28 2005-03-07 +uid Nicko Cadell +sub 2048g/6923CBDA 2005-03-07 + +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.4.0 (MingW32) + +mQGiBEIsjHURBAC9JqRzMEh6pEZuuyqHGwfBkQZnvOuj0Yp88lDsJtNl62cRaQJk +7eP+kVxCbl12qr1EDz1z/ZON7/+vF9YoiRh7Cydck6wLe/kQcJtUevm00q35pUQJ +7c2TSY+QbTKWriUKueOyRR6p2lpscUHhbCPB9NOLfQmJvZsa47gDZSybCwCgh0+u +8KkkcovlV55K/WrSGg16o8kEAKFGmpDKDnv0Sg1rRnvBGJv5WZFR/57p1SArMXHi +oBkj71wlWz9Ia4tonfc12TXUwoVs3WbIFOoLz1Iw31cGnwUsNkvEclaZigG9iYhx +S6+2i7jrQIivO5iXJtTuePb4zFgLwZcaoFySvLIKRm8+X6KXvoslKAYM/F/Yd0jm +OebkA/4uwIt7cGOWGIaiH2n/80QgXN6FyOhNsgCihZZcPwXo7c/gtszpJ74CwtXD +SVghIwTQ0zK4wtWcHSjf7FelPmeDSga7dLgnxQmmhjIK+sBnPIcBrNiUc3jFnRzK +o3ZIBPsGoo0jUsemgkiQA4ptVybeak/SmrTsRgxWkT4Paw41zrQfTmlja28gQ2Fk +ZWxsIDxuaWNrb0BhcGFjaGUub3JnPoheBBMRAgAeBQJCLIx1AhsDBgsJCAcDAgMV +AgMDFgIBAh4BAheAAAoJEA3R7CqRSk0ooTIAnRZ+vUY+ZN8CgL0fvDbZv76kgQG+ +AJ9vp4BwPLU5jM+YOY3hJPp1bNw1RLkCDQRCLIx/EAgArSrXU4kkXNLCTBIAMaIx +diiVvQ2JqzrFkXf4yAlE+xiy19bqGewmslt+dLmLUEtt1UFMU5b2kAiZLNMvdBWQ +OStwK0SABRESjb5sAjAcFXUeqBzjVBDvsSGxJZZa5He1pQMjFzm4hG6GNl3+vOx6 +r6fly9W5Ddc8wqfDb8JU0c6gG8s10D4gthWWyJ2K1u3BcvpggoGyqyxisvF/QM68 +KnXf8/wp+5sOfl6glyluR/OyGMCU3c38eHYU2XMzlcT3fh1VcU5MvPastp+76vUy +ImrAfb7RhS3sDrmRd9ZS8FE5JRB3967hETRSLjHW+/TZeyvxaGMJkBPdv2BdwnD8 +6wADBQf+NaK8teolegPc1LdmX3bAhR2bhfqIpuUwPBRHqIU2OtWsMJ9sEsVZY4LC +OLOHMHI1spWHEo39mx3fz5MR4x2z3+HzZRq8tzMFn5PC3c7yb06CMfqRf8pvYWVP +0cMvEctViAc+xwSpZgXQGLkwZ37KtqWncfBVocxQMj4CVUx3PeyozWGEG+bpGSso +Mrvnch41AGL3NA9bA2cgTVuOYSXZLK9TOgh4gXCM4jWTI4BqTY5w0riDwqwt5+qH +e8/HBowGa4jNopl9kWaQuEoXH7GGOTJsc9eKMK+k++iqSWiqVXFTLd7/UhUPv6Oj +7Pqm7+oSumphn00rC2DVeAAWDt7umohJBBgRAgAJBQJCLIx/AhsMAAoJEA3R7CqR +Sk0ouF4An1sFuJ+/kJlvKRs+nNjFqrQdsuDCAJ9WDNgUqnAkdLVTRJq8UeK0AjOq +oQ== +=4aNz +-----END PGP PUBLIC KEY BLOCK----- + +pub 1024D/5F6B8B72 2001-05-28 +uid Stefan Bodewig +sig 3 5F6B8B72 2001-05-28 Stefan Bodewig +sig 51898504 2002-01-11 Conor MacNeill +sig 3 F88341D9 2003-03-17 Lars Eilebrecht +sig 3 2261D073 2003-03-17 Astrid Kessler (Kess) +sig 21D0A71B 2003-03-17 Dirk-Willem van Gulik (http://www.anywi.com/ - Senior partner) +sig 75A67692 2003-03-18 Erik Abele +sig B3B2A12C 2003-05-20 ct magazine CERTIFICATE +sig 3 8103A37E 2003-04-04 Andre Malo +sig 3 5F6B8B72 2001-05-28 Stefan Bodewig +sig D6298F01 2003-04-27 Paulo Henrique Gaspar Jorge +sig 0CAA68B4 2004-11-11 Patrick Rentsch +sig 2FE28BCF 2005-07-01 Harald Wilhelm (HAWI) +sig 5793498F 2005-07-21 Tim Ellison +sig E4136392 2005-07-21 Noel J. Bergman +sig 8408F755 2005-07-21 Christian Geisert +sig 2 FC243F3C 2005-07-20 Henk P. Penning +sig 3 EC140B81 2005-07-20 Dirk-Willem van Gulik (http://www.anywi.com/ - Senior partner) +sig 3 EE65E321 2005-07-20 Martin Kraemer +sig 3 A99F75DD 2005-07-21 Rodent of Unusual Size +sig 3 3642CB4B 2005-07-20 Martin Kraemer +sig 3 302DA568 2005-07-21 Rodent of Unusual Size (DSA) +sig 3 2C312D2F 2005-07-21 Rodent of Unusual Size +sig 3 CC78C893 2005-07-22 Rich Bowen +sig 3 E2D774DF 2005-07-22 Sylvain Wallez +sig 3 E04F9A89 2005-07-22 Roy T. Fielding +sig 3 015AFC8A 2005-07-22 Bertrand Delacretaz +sig 3 87315C31 2005-07-23 Raphal Luta +sig 3 E41EDC7E 2005-07-24 Carsten Ziegeler +sig 3 F39B3750 2005-07-24 Colm MacCarthaigh +sig 1CD4861F 2005-07-25 Eran Chinthaka +sig EA1BA38D 2005-07-25 Ajith Harshana Ranabahu (Made at Apachecon 2005) +sig 333E4E84 2005-07-26 Chathura Kamalanath Herath (Apachecon Europe 2005) +sig 152924AF 2005-07-29 Sander Temme +sig 3 9C85222B 2005-07-24 Henning Schmiedehausen +sig 3 9978AF86 2005-07-25 [User ID not found] +sig 3 2A623F72 2005-07-25 [User ID not found] +sig 3 F8EA2967 2005-07-26 [User ID not found] +sig 3 C152431A 2005-07-27 Steve Loughran +sig DE885DD3 2005-11-25 Sander Striker +sig CE419C8F 2007-01-05 Upayavira +sig E222DE4F 2007-05-02 Mathias Herberts +sig 911203E4 2007-05-02 [User ID not found] +sig F12F6072 2007-05-05 [User ID not found] +sig 3 990ED4AA 2007-05-02 Knut Anders Hatlen +sig 3 311A3DE5 2007-05-05 Ruediger Pluem +sig 3 88817402 2007-05-06 Thomas Vandahl +sig 5F298824 2007-05-06 Simon Pepping +sig 4CEED75F 2007-05-06 Nick Burch +sig 4358C584 2007-05-06 Vincent Hennebert +sig 0B7E6CFA 2007-05-06 Sami Siren +sig 3 01530235 2007-05-02 Luc Maisonobe (SpaceRoots) +sig 40581837 2007-05-08 Nick Kew +uid Stefan Bodewig +sig 3 5F6B8B72 2003-03-07 Stefan Bodewig +sig 3 F88341D9 2003-03-17 Lars Eilebrecht +sig 3 2261D073 2003-03-17 Astrid Kessler (Kess) +sig 21D0A71B 2003-03-17 Dirk-Willem van Gulik (http://www.anywi.com/ - Senior partner) +sig 75A67692 2003-03-18 Erik Abele +sig B3B2A12C 2003-05-20 ct magazine CERTIFICATE +sig 3 8103A37E 2003-04-04 Andre Malo +sig 51898504 2005-06-21 Conor MacNeill +sig 0CAA68B4 2004-11-11 Patrick Rentsch +sig 2FE28BCF 2005-07-01 Harald Wilhelm (HAWI) +sig 5793498F 2005-07-21 Tim Ellison +sig 8408F755 2005-07-21 Christian Geisert +sig 3 EC140B81 2005-07-20 Dirk-Willem van Gulik (http://www.anywi.com/ - Senior partner) +sig 3 EE65E321 2005-07-20 Martin Kraemer +sig 3 A99F75DD 2005-07-21 Rodent of Unusual Size +sig 3 3642CB4B 2005-07-20 Martin Kraemer +sig 3 302DA568 2005-07-21 Rodent of Unusual Size (DSA) +sig 3 2C312D2F 2005-07-21 Rodent of Unusual Size +sig 3 CC78C893 2005-07-22 Rich Bowen +sig 3 E2D774DF 2005-07-22 Sylvain Wallez +sig 3 E04F9A89 2005-07-22 Roy T. Fielding +sig 3 87315C31 2005-07-23 Raphal Luta +sig 3 E41EDC7E 2005-07-24 Carsten Ziegeler +sig 3 F39B3750 2005-07-24 Colm MacCarthaigh +sig 1CD4861F 2005-07-25 Eran Chinthaka +sig EA1BA38D 2005-07-25 Ajith Harshana Ranabahu (Made at Apachecon 2005) +sig 333E4E84 2005-07-26 Chathura Kamalanath Herath (Apachecon Europe 2005) +sig 152924AF 2005-07-29 Sander Temme +sig 3 9C85222B 2005-07-24 Henning Schmiedehausen +sig 3 9978AF86 2005-07-25 [User ID not found] +sig 3 2A623F72 2005-07-25 [User ID not found] +sig 3 F8EA2967 2005-07-26 [User ID not found] +sig 3 C152431A 2005-07-27 Steve Loughran +sig DE885DD3 2005-11-25 Sander Striker +sig E222DE4F 2007-05-02 Mathias Herberts +sig 911203E4 2007-05-02 [User ID not found] +sig F12F6072 2007-05-05 [User ID not found] +sig 3 990ED4AA 2007-05-02 Knut Anders Hatlen +sig 3 311A3DE5 2007-05-05 Ruediger Pluem +sig 3 88817402 2007-05-06 Thomas Vandahl +sig 4CEED75F 2007-05-06 Nick Burch +sig 4358C584 2007-05-06 Vincent Hennebert +sig 0B7E6CFA 2007-05-06 Sami Siren +sig 3 DE8884A0 2007-05-07 Xavier Hanin +sig 3 01530235 2007-05-02 Luc Maisonobe (SpaceRoots) +sig 40581837 2007-05-08 Nick Kew +uid Stefan Bodewig +sig 3 5F6B8B72 2005-05-31 Stefan Bodewig +sig 51898504 2005-06-21 Conor MacNeill +sig 2FE28BCF 2005-07-01 Harald Wilhelm (HAWI) +sig 5793498F 2005-07-21 Tim Ellison +sig 3 EC140B81 2005-07-20 Dirk-Willem van Gulik (http://www.anywi.com/ - Senior partner) +sig 3 EE65E321 2005-07-20 Martin Kraemer +sig 3 A99F75DD 2005-07-21 Rodent of Unusual Size +sig 3 21D0A71B 2005-07-20 Dirk-Willem van Gulik (http://www.anywi.com/ - Senior partner) +sig 3 3642CB4B 2005-07-20 Martin Kraemer +sig 3 302DA568 2005-07-21 Rodent of Unusual Size (DSA) +sig 3 2C312D2F 2005-07-21 Rodent of Unusual Size +sig 3 CC78C893 2005-07-22 Rich Bowen +sig 3 E2D774DF 2005-07-22 Sylvain Wallez +sig 3 E04F9A89 2005-07-22 Roy T. Fielding +sig 3 87315C31 2005-07-23 Raphal Luta +sig 3 E41EDC7E 2005-07-24 Carsten Ziegeler +sig 3 F39B3750 2005-07-24 Colm MacCarthaigh +sig 1CD4861F 2005-07-25 Eran Chinthaka +sig EA1BA38D 2005-07-25 Ajith Harshana Ranabahu (Made at Apachecon 2005) +sig 333E4E84 2005-07-26 Chathura Kamalanath Herath (Apachecon Europe 2005) +sig 152924AF 2005-07-29 Sander Temme +sig 3 9C85222B 2005-07-24 Henning Schmiedehausen +sig 3 9978AF86 2005-07-25 [User ID not found] +sig 3 2A623F72 2005-07-25 [User ID not found] +sig 3 F8EA2967 2005-07-26 [User ID not found] +sig 3 C152431A 2005-07-27 Steve Loughran +sig DE885DD3 2005-11-25 Sander Striker +sig E222DE4F 2007-05-02 Mathias Herberts +sig 911203E4 2007-05-02 [User ID not found] +sig F12F6072 2007-05-05 [User ID not found] +sig 3 990ED4AA 2007-05-02 Knut Anders Hatlen +sig 3 311A3DE5 2007-05-05 Ruediger Pluem +sig 3 88817402 2007-05-06 Thomas Vandahl +sig 4CEED75F 2007-05-06 Nick Burch +sig 4358C584 2007-05-06 Vincent Hennebert +sig 0B7E6CFA 2007-05-06 Sami Siren +sig 3 01530235 2007-05-02 Luc Maisonobe (SpaceRoots) +sig 40581837 2007-05-08 Nick Kew +sub 1024g/24774157 2001-05-28 +sig 5F6B8B72 2001-05-28 Stefan Bodewig + +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.4.2 (GNU/Linux) + +mQGiBDsSIk4RBADSCj6rUjV64tYCGT1DYKYR7GthyWpNdGHSYLbETBcDatAe1dzQ +5NsCgfrlybfyeY+y1lxr3T9bqf6zJWDw/718wff96qmmv1qzexSYtmIrj+h53V82 +EXwWOFuYMJisuxdT940iQzosm3GOv4MJdEg3oI2SgfEyRQQ6vO4Ob5rHDwCg5taZ +nrHOrXx2dIGHxpxRZ0SUl30D/jmtttFjYOQ3LBMriikz5mh2sK3ZnoSRF4o5O0zW +Ve6e2SFXOEjVjImKsH6KCbdQNelrAdgiyOoXClyQKsQ27pncbdWo6bO0E3POJZVm +XaeW7iudHVr63rU5PViXObIQrdQl0D59j5brKj4vdlTyUw8kaHPvbKPDEOwvZq4Y +LJQ5BACA1YilTeXRJqwFsNlpcxCHwlULD4QUVP496prQWf1B7Z6g0KvLGrQsO0Vn +Jcn+fEqukysTJixSXCPebosltd4RalJIupVYkp4w6MJ7biaDAlLuNhDcI/AiXTmV +dXUedVXIaM8I3Ne23gucwbAyc0Hvb+3cSAKRhl/azFQhuHBvlrQjU3RlZmFuIEJv +ZGV3aWcgPGJvZGV3aWdAYXBhY2hlLm9yZz6IaAQTEQIAIAIXgAIZAQUCSgkegwUL +CQgHAwQVCgkIBRYCAwEAAh4BABIHZUdQRwABAQkQohFa4V9ri3IWMwCghs0wCe4g +GMPBq6jtBXK46e4aHKIAoNn+9NX6NlhF04qaHyDBhXK2HMmuiEYEEBECAAYFAjw+ +1Y8ACgkQgQRkT1GJhQSdkgCeM6RDHUF/E334TtiLPgw7GpmNJSkAoNCLQCW/9VHr +V+ZHsodnXUnaD4dIiJkEEwECAAYFAj513wwACgkQPo+38viDQdknZAPlHNiMnR+L +Uavo2yOYiJT+W9+8+qNs2grYDZ+WSYujaWT2NJrUCYXQRM6gKDyFlkcJvHI9lF2y +YMkVetllZVN1TJkeEdtbHncNHcdq+ZUQR0NkFKTF9d1K7UI2rfWxt1y6a13TcUjp +JXzbtw/OXX9EZSI6QQt4rSFlvci9J3mIRgQTEQIABgUCPnXawQAKCRDu0eo5ImHQ +c0W4AJ9vuq4wlkc6TmmmZPF/gZVLluHcTgCeItrnvzyS11xkIETk6v4b7K4gaiiI +PwMFED51qhr9b4jGIdCnGxECRAUAoOaVZW5CdZ9oYr3PwI/i8RJN+JfJAKCmd/XI +lYOCpa9Qc4C855pM8NFw6YhGBBARAgAGBQI+d6QQAAoJEBU/oM11pnaSL+sAn1DT +HmbhITeEw0ZSgyBLQw2ZhcM5AJ0ZrRBbZ9lbgHXBKOJQiLpWBj4XsYhGBBARAgAG +BQI+yi6WAAoJENvSRfyzsqEsF/AAoNXq7Cp/0AwEmWvhoTjmtY6eVYB5AKCMFhBU +dYWNXVyalPTq8ThswNUnr4hGBBMRAgAGBQI+jc4sAAoJEMppOXSBA6N+kUoAn1Nj +6YqarQg0sL2KrFsQROM3A6fSAKCyl40SpfVJSO33fYuPci9dHp+QCIhXBBMRAgAX +BQI7EiJOBQsHCgMEAxUDAgMWAgECF4AACgkQohFa4V9ri3IsngCfbIpJDWj6UgXY +7rBH8To12BgB+RIAn3jw72WJzplAtShVTmuMlRFS+FUNiEYEEBECAAYFAj6sazwA +CgkQqywx6dYpjwFkeQCeOkJrnO5r2hWDhX4ACPPLObZvXLIAnR0VHAgkEH1W/t7B +4zdDYdBBZrd5iEYEEBECAAYFAkGS8mMACgkQ5BNhMwyqaLQs9ACgio5zJcieYLpp +igvSYLBfubUVrXUAnRKZJ6MACpH6fpoz2vkc2dh69tbSiEYEEBECAAYFAkLFMoEA +CgkQm/IjRS/ii88aCQCfd1cIawDqpkYU86f3JEjcN85ntFcAni0m8WR6s+bkh3fd ++EIrSRsru3uQiEYEEBECAAYFAkLfRQIACgkQQeoJoFeTSY8XxQCdFd+XEWqyDkCx +37gaIQAG4dHpwiUAoOZ/K5OHyTJCNFaBUDtpCh7hL8TPiEYEEBECAAYFAkLfkncA +CgkQAQVmvOQTY5L3SgCgiEi5/1vYvJrKoAdl0hRWU57ieUIAn2n08BQfMZJQ439a +NW/CnIK8jPBPiEYEEBECAAYFAkLgNdAACgkQc84u+4QI91XdNQCgoBB1ebohIfli +nAPlvI37pFHuu0MAoJ4yMtbKZMaq0xIBnxV9c5uu99tGiEYEEhECAAYFAkLerWMA +CgkQi5YpQ/wkPzxD7ACgqKnyeb/fjVS8vov4FePxeLju4msAn1SCGaiF9gEf+qIa +ZUnjcT7JDJ96iJwEEwECAAYFAkLerG8ACgkQMaY9luwUC4Ea9gP/WON+0xIWOvWP +7mKkg/+X0ukW+mbjE426qKtG/B0vNrTKpElmz8ttR+oajqbg20LazoEUuA9ZXjLP +fsdWA+vFkxgV6qIdtxYPMamPm7ytEBOmgMowYXUftGteqM5fxLlceHiwdUlynG2f +mtMqvPnd2OCezSFRx3W6nvAiIjoLZpCInAQTAQIABgUCQt7H0wAKCRA34/Rf7mXj +IcAUA/4nDlQbnToSSDOZkFj1CoGL8TjsVgzrO3r3S3x38uQQTFAE/AGBY4mtHgNc +YmiJaC2hN1Y+mlEGu/80Rjv185ZfJsFEerU6Y/9tRJJ1So9AAe5AmvGpD9ysXae5 +geB+k+epIMSuf9WMeTRUCbQs9ufGZLV5a8jqstv+btcrzNaY9oicBBMBAgAGBQJC +32x4AAoJEJrNPMCpn3XdRBkD/iNi0Y6A3afDG9ZL/K4JrOPgHUFWC/DgAEBme4AY +62agUsT0uXlz+Mu1Ps2E0t26ejScuVMMvqpXg7iJ2+3yKzsnX0ySEXW6/696XEpe +3TFn1iVOmMElPKxakn3t/jr6SDepo9jqD5P5CJR4GsDsG3iKIisWdDf81ZXpf86y +7A5eiEYEExECAAYFAkLeuuUACgkQMsnkzjZCy0vmSQCdHGC6jOEVo96yyospTq7b +L+EEeioAoNMKIZy5qFLXXZbSNvsj7mDRg2c8iEYEExECAAYFAkLfbHoACgkQUI6u +xTAtpWhYhQCaAvqVBsTX5s4c+sTOo06BNMdzHIUAoIwpThAKq936Szy/3Gfv8K3g +s5NOiEYEExECAAYFAkLfbHwACgkQ3bpkuiwxLS9z8ACfYeocOK4J204xwbXgEdUJ +QyvHK2UAoKz2AF1I2b8Ebu7vTUZLNFV1QMtwiEYEExECAAYFAkLgyTgACgkQXP03 ++sx4yJNbEgCfRcj6QKHVHQtYVXdCYKUbrj97wAoAnimqV15cvz1siDjUK9K/aTsk +GwajiEYEExECAAYFAkLg7MsACgkQybWm7OLXdN8UoQCdFfqef8My1xhn6mLd9WTL +LaIewTQAnRXGh/Af4hVG0KwtZcJEA464nCoJiEYEExECAAYFAkLg7TwACgkQW5aA +EOBPmol+JwCeLxZjKNisjgP4AxV5BCKR+5SU9NoAoIwPF/7B2NmGNR0t3EZze8wp +NhQ0iEYEExECAAYFAkLg7V8ACgkQN/aP9QFa/IqerACfafKJi4s8LYV2JxNfQKHg +mRXzeIIAoNBHOzukDCdxIvmYJfamItnCP45giEYEExECAAYFAkLiYm8ACgkQbZiN +F4cxXDH8HwCgq8P29CwMX7PKhRmY3T32APsOaMEAnjdd/WvzVBFtTcJFWkH6iF4L +8EQpiEYEExECAAYFAkLjVb4ACgkQEy5J1OQe3H56DACcDPfWLO5cDkeKFCvIP8mc +4p4KkfkAoJITROldIRxXqUiML1oTJxieuHJfiEYEExECAAYFAkLjZNoACgkQdcqi +o/ObN1CItACgsJhqBxeZTaSrRVNk3aj6ciAJrgEAoIxPXYTvIpnWBr4/WMbN0jpV +0TGEiEYEEBECAAYFAkLkbxIACgkQjON2uBzUhh/gZQCbBpIqkCEuIbd6tqChz3Pz +cIGiZbgAnjluBFHl4l1/NHtP9fEYCgl8nbCviEYEEBECAAYFAkLkkr4ACgkQBJE0 +Quobo42f+QCgjtO6EOdDRiruCi6gKvwM1a2eRwcAn0XUELm5AZezL5E0rEfIM2FB +iMi5iEYEEBECAAYFAkLlwh0ACgkQYRlqLjM+ToS9pwCfUEgO834XY/clWzkw/VLB +fe7MLZQAmwdz0nleOHYWFBrnYgEz53d4MxUPiEYEEBECAAYFAkLqY/QACgkQsr68 +QBUpJK/oMQCfc7M9KpApCWW7eE22PlLoN1sPK+4AoJdwE8TsDM2Pmehk9K+uHIx6 +FoRviEYEExECAAYFAkLj7WcACgkQMoZOQZyFIitClACfWpH0+V/N6vuucWZ7bsMm +2BcmM3oAn3fF5qqovlog4/PcgvKCToNEF8uWiEYEExECAAYFAkLlELcACgkQUnkv +r5l4r4YUZwCgg7vJpDpUXnuNvgc5RHgG7UYhRQYAoIEKHsrswh6XzVn5yQRkfjdB +/A0OiEYEExECAAYFAkLlEaQACgkQa3OhBipiP3JA4QCffb8NgQssOQXaVR0dSwPC +eU2nQPUAn15EAjykVZsUi2tZWqEM08SNOKI9iEYEExECAAYFAkLmmWIACgkQaOuM +dvjqKWd7AQCbBpwyitQ77kd9KIT6y95Im1vmWt8AnAnkNTBctVtMfwddYTG+xLka +OllOiEYEExECAAYFAkLnYVAACgkQbpR1lMFSQxqIRACffQqUXTgOa4hyHYQBUwrl +GEqmWt4AnRMXVGhd47loS27MmiEiWwDlkNjJiEYEEBECAAYFAkOHn54ACgkQZjW2 +wN6IXdOr9gCgh2fn26W0DSL5WZATvvQkwZeJNiMAnR6+0AlUK8uFSFIVhl+RZMnY ++XFwiEYEEBECAAYFAkWdnk0ACgkQIYJJVs5BnI/0SgCeKCw39INy9ISFunlAojYg +SInHfokAn2vU8q4JNjg13qNeclZN9kmN9mbWiEYEEBECAAYFAkY44sMACgkQFUWz +/uIi3k+qvACffppBpoY82MEvDV7c4/6cjw544CQAoJAPCdZA/LRqICJm0iFbDrwh +sSb6iEYEEBECAAYFAkY4558ACgkQY9CtrpESA+QrAACglRB/VdEmovbyWdMDmsTd +yw4kha4An0uKwZeKHfBR3cC2s7MvqqmMoz9jiEUEEBECAAYFAkY8kyoACgkQmHDv +8/EvYHIkCgCYgXQZTJ8VmHwSX3pXOxnMhp7mbACeIPXwcPvmfP709nfgQ8/GpT2z +9ISIRgQTEQIABgUCRjkasQAKCRDh4fKwmQ7UqhZKAJ9iraDBstzeXPMtst3x+ZXd +LQm7cgCfWDDgaQOa8CoM5/+7WCtkyasP6BiIRgQTEQIABgUCRjxQRwAKCRBMBCgY +MRo95eP4AKCuEQU6fjPy/cPEiqhGH23J2YEr7gCfS8vBTEU4sRbOomTEuINPxb96 +OZmIRgQTEQIABgUCRj2gkgAKCRAuuUaCiIF0AgOBAJ0bJmFzA9WkG5FmfaP4ieG9 ++SCbXACgw+2wcOA/B94LKRtjhJT6j6zSiDmIRgQQEQIABgUCRj4VvwAKCRA+Km/C +XymIJIvcAJ9QSE4mCQldVnpbYwLTCk+xHDqhcQCggT9P3/rHIzIvv1tJ+A1ZJPvX +OcqIRgQQEQIABgUCRj3WeAAKCRD1wmAWTO7XXwpbAJ4mr2IxFtx0ppkefxx0l0TJ +6cFkrQCdEFbc+aMxRKhK9SCAWi3mq1UqEWiIRgQQEQIABgUCRj31AAAKCRCgctTQ +Q1jFhByKAJ9SIielTuD3StxPQpBkAkYP6Ld88ACgg1oPX9ryJA7YuhMD7byXQsET +zD+IRgQQEQIABgUCRj4FxQAKCRACpaYFC35s+k/GAJ9/VDyw2vNzk1xjcu/QZCa3 +gGI2zgCfeG8klJ78bAGknzxBlK3XtmoNqASISgQQEQIACgUCRjj3hAMFAzwACgkQ +c92MFgFTAjVJogCeL+3FTTVR5snJx9qbGQsgv23ZaT0An2Hy1CcXVklcYBF7Lbnb +Agbe1HpfiEYEEBECAAYFAkZAtkMACgkQbQvHOkBYGDePegCbBe6rmz9/kYDV7w5p +vwnugVsvbiEAniTfLW7NW8z1SRBWf6lMH3clGAs8iEYEEBECAAYFAkZMRFMACgkQ +HyEjw2vYcqB22gCg1np1JYFYPqCB3ekZts3K+pn7RkwAnRWd6HmtjRolZdrZfkqQ +DJKmd5zviEYEEBECAAYFAkZMfQEACgkQD0UKJmIQv8DJYgCfW0C9rDAToLU+0BKL +YCiWwtFJ98MAn2HvQ3CDhv8WTm+av36lETLqhjnfiEYEEBECAAYFAkZSb1kACgkQ +MsHW7w8UO8GGZwCg0l2T1O/OpOECXs/vYE2649wNTaYAoLrUpLKYev8uHAfc53lZ +6LE0h1T0iEYEEBECAAYFAkZSb2AACgkQy66+OaRsTKHZbwCdFSloWJh3uuTLk87a +St4uYeZrKToAoIrN7epZxeu9n9e6hqVOLz85zc3TiEYEEBECAAYFAkZe1aoACgkQ +mobXzNGq6mD+cwCg3k4BRrRi6pjrY/UggHjhiHWSD1YAniDQn1MVB620Ik2cVL7h +R1V0ZL6biEYEEBECAAYFAkalTCwACgkQOb5RoQhMkROqQwCdHhIdklVR341azVFB +O6aGArSOP2QAn0WtSIiqaLTEQ57+ir62FxRYBQdWiEYEEBECAAYFAkatzFQACgkQ +M81nM69exFIdRgCfSGft6KIZ+CTEPIGr8lp8oOpNaHMAn1NCXZTJOW+r0G5ply4h +lu8UXC4AiQEcBBABAgAGBQJHwH2YAAoJEBllhVDDEQYRZ4cH/3XnLW6UAdDd4k0x +l2lUAj9gB7ITUbejCwvnFqUyKAE9P38boBHNfc6cliQUOz4ITWDPhiinbjNnJHgl +p9vK0o4R/tFFyGImIvbmu1C8lyO2BJPgF2yMNrBgZhx0+IkAG3R4iy9JFIDGgddj +LQSP4TX3uRUFUXEAhHzGA//XP4tnC3CisvOsuoc6ZjyZGSt/HUzZoKf+wsdJlfab +iK3QpD8lSOw8KEZF54JUC8uaYGuBGs7ih4FcO+Aqb52UAx4/+13eEdAognVF2Hba +iI+G2jEekyAwD0bP3DWyg+9fGBtnwtDMj0OrHklvA8qoHxAMvXHIGhxjqZBOFehh +8DNEB6SIRgQQEQIABgUCScqH2QAKCRDJx5JOUQR9Zj6WAJwOtRlhq45DedrYNH54 +QIJSFw3XJQCfQI9fZl6zmKWSm1nJqXRC+awKmwyIRgQQEQIABgUCSc/UtQAKCRAk +waN4agF7F75XAJ0TyTdCMGIZGCooM/xr3w+qvyZLgACg0W8O9WOf0qwSVgynmh2v +QggUiyKIRgQQEQIABgUCSdI2jwAKCRCusBoVO3x1sZHiAKClsXinnJfHMQYewFPq +y16zr//f4ACgulnu+ObADHMquuGCw4BLwrvqMIK0IFN0ZWZhbiBCb2Rld2lnIDxi +b2Rld2lnQGJvc3QuZGU+iF8EExECABcFAjsSOYEFCwcKAwQDFQMCAxYCAQIXgAAS +CRCiEVrhX2uLcgdlR1BHAAEByboAoNoD/9Jgm/alxfAYELz05LMa/HLeAKDWTHqq +7rMkppZoTUv2gWpVzrk5RIhGBBARAgAGBQI8PtWVAAoJEIEEZE9RiYUE0LMAn22/ +u01Lo3Bo5lDxxHSkayUkYq25AKCm20yaGFGtTDJW4Rdz50pfut1AwoiZBBMBAgAG +BQI+dd8PAAoJED6Pt/L4g0HZWboD4gPGJi0y93+Zp37uFGgpe8PkB10HVLCe9B0l +7R7BK0UFhnFl004td2RWeALAAnOI8ZlxCahwQdUys34zF77c5fQ8Rn7co46wBSL5 +9Oi/bG9/wRYqBf13SWL2ITK1UDgzRznZrds9MLQqSL8oBjebyg28CZPBYH10FKig +UUMwiEYEExECAAYFAj512scACgkQ7tHqOSJh0HOu5gCcDO9Ou8NA2+gChoNAn6j/ +J2owDxkAnA0Q5AMezP7rKdsw+hCYqZSp8QhIiD8DBRA+daoh/W+IxiHQpxsRAiSn +AJ4id/ijcLliSH/EGh1UiaunYK9zLwCgyfeZ7mnhKXauba2NXFMlm3axSvuIRgQQ +EQIABgUCPnekGgAKCRAVP6DNdaZ2kikaAKCJMBE/oJ/4ko7FRpUWvQv0MLmhRwCg +jEXsPmY5Ur8AVynVzE2TcEu12reIRgQQEQIABgUCPsouMgAKCRDb0kX8s7KhLABs +AKCU2ntXY/DhTnvki6igzrvttl/ynACfZTZNwePs9imtT6phGTInelrsXLKIRgQT +EQIABgUCPo3ONQAKCRDKaTl0gQOjflg/AJ4khT+aic33qc/iMmMC5+URcxt6ZQCg +leruhUJi44Kpav9PdVbQMzdb52eIRgQQEQIABgUCQZLz6wAKCRDkE2EzDKpotDZH +AJ4xwN/htv44yNFQnACTYsc322HjZACfTd9WoxRkRWY6tVd9YgumNc0swMiIRgQQ +EQIABgUCQsUyhgAKCRCb8iNFL+KLz+ClAJ99ddEJ5l/VW/mKHvTITZleDSv+uwCg +lgqx3HQrlqp+gTPKIEKPkjjom+GIagQwEQIAKgUCQuE4ECMdIFRoaXMgd2FzIGEg +am9iIGFkZHJlc3MgYW5kIEkgcXVpdAAKCRCiEVrhX2uLcvEYAKCJD7CVpr2Iw657 +kO6G3Is8xKa6IgCgiStyJgU5/dUEEPQctZ8ZVZSrHNGIRgQQEQIABgUCQt9FDAAK +CRBB6gmgV5NJj+d2AJ9QRCXhFzmee7cbhlfejg7LBsXsMQCfce2/Wz+if56L7WaZ +Lpn893CAzu+InAQTAQIABgUCQt6scQAKCRAxpj2W7BQLgXUkA/96klgNlfh+VTSx +rwCUW1JE5j87qDeJWrnN5ibVYPd7TE45hNeWQie2RgWGpsHNlDekVh9aZuHMJb9N +zRGKAAJ2augQQuvDKt8sge+ydRMXsLkAvpK4VBmobqqgyO0cV3ooMyizawMRndVc +MbVu5b6Gkdj2tZEko/Nv9KBJ61MJ64icBBMBAgAGBQJC3sfZAAoJEDfj9F/uZeMh +rGYEAKJgLDFku3GdpF/BI4GQBKqadLygF3Igq9Np310sTcLOI2ARb4B18Tvq9CyR +4PEvdlVC5uEpaJozgHthTadjGTgg1WmiTWqG31s3U+zL5NLdK+k8qqrxGLzFzhk8 +PB1wJwImJcvLmJHm3HeIGycdEzn4swgmD4uI6p39mcGyCCONiJwEEwECAAYFAkLf +bHkACgkQms08wKmfdd2sxAP/e8W2cqyypPqYHs05nTxNzD5wLl72ABWvljfdf5mA +97sEl3q48234j3sUN1Uk6c21NlK+eRBn8Lv1ihyLTJkACgdiXNFvi1eC4vLhQMGO +PcGW8+wI4olmsqftvG+2hNt4eCMead6IjAK7LNKgDWEBjGI+WIOvC5UJBO50cNXG +OXWIRgQTEQIABgUCQt667QAKCRAyyeTONkLLSxJgAJ9faCKziDmN6nQeMoAECTfV +vIdTRACgjnb3h8sc54gcosIh28qb7uBUuf6IRgQTEQIABgUCQt9sewAKCRBQjq7F +MC2laDoHAJ9VC11NFs0+BAYWoZBJSUEnjn3F9gCgsqGPrxhTBkHlWAh4iiumq31t +ZHaIRgQTEQIABgUCQt9sfQAKCRDdumS6LDEtL3hJAKCEHj7lHAZHRk7LLbFQDh7o +iY7plACgiORbBhF3VWn1JCglbk51Kq5hJy2IRgQTEQIABgUCQuDJOwAKCRBc/Tf6 +zHjIk6wAAJ4qjf2FNE1VXK+PnL2iFP1h7f8L4wCfbtoQqsaDE1vCrnSobEUT6nfq +Pt+IRgQTEQIABgUCQuDszAAKCRDJtabs4td03yLQAKCz5pbjUWdyEHQr85R0He3Q +uDiLkgCgz6XQ/LFLdcmwDAj4lsKbRpHdUDyIRgQTEQIABgUCQuDtQAAKCRBbloAQ +4E+aiRuoAJwLeKfpT6aqNLBvrusHnNNjROFi5wCgjhXup7RcdMNTDBY6BGj83NHu +TU6IRgQTEQIABgUCQuJibwAKCRBtmI0XhzFcMZwOAKCLkKunJnUNy7QgowvTkV+/ +DyU+FgCfScvQFzMSj1Gk1ViDbK0n5i2MpQWIRgQTEQIABgUCQuNVwAAKCRATLknU +5B7cfur2AJ9XnFPKjlIPsbrZVJRuNh96py7FfACgoC5yGwyRq9hYK3SMGGAu5MmQ +WpSIRgQTEQIABgUCQuNk2wAKCRB1yqKj85s3UB1kAKClSCLmqecNSlVeFOwlSijh +TjzmxgCg5eYxuHJo4wf2D2d1gWbloc8xt/2IRgQQEQIABgUCQuRvFAAKCRCM43a4 +HNSGH1JzAKCoUQuAh01aTLbbUS4WCMrOAQblagCfdwFlsT48wWEBnJSFAiXaEcRt +UkiIRgQQEQIABgUCQuSSxwAKCRAEkTRC6hujjcShAJ9EK1u8wehMaZLt2ZnexHIC +PhbtagCgkN+i7LXBnm1IwlP5cGbmgW3BJRKIRgQQEQIABgUCQuXCIAAKCRBhGWou +Mz5OhEAfAJsHEwc1jK9tiYBvWRMS3zJ0XrrShgCffOyuZlrBNeuO9s8T9WkL7/vC +nOmIRgQQEQIABgUCQupj+AAKCRCyvrxAFSkkrxWDAJ9oJHjkm3MWfPS/iMK6iipo +UaAfzQCfYFygT+mws9MQIZEMoTi/sk0AOcKIRgQTEQIABgUCQuPtagAKCRAyhk5B +nIUiKxsGAJ4mMBcsZ/PlqEN2CjOoNits7PFYbwCeLuEXDDEcUAh7jb46wvrHB5EP +jp+IRgQTEQIABgUCQuUQtwAKCRBSeS+vmXivhlvNAJ4wGMXMO8EgWYrlU0i+9wrd +6N0M/ACgvODXK0oKDcDQ55t8xf2evmJA7HCIRgQTEQIABgUCQuURpQAKCRBrc6EG +KmI/cl6+AJ4kaPB7Ois5KuLwhbEwmpO3e07OQQCgw1kJOjcCZwogIWG1222By45k +1YCIRgQTEQIABgUCQuaZYgAKCRBo64x2+OopZ+DxAJ91h0aGRvukGqAWEafe4nnT +6xj9CACfU91kJ9G1WB2T8lW/fkXt8mnlrUKIRgQTEQIABgUCQudhVwAKCRBulHWU +wVJDGgmCAJ9DsO7lkpvuigmPoIX6d7vufFW5iACeMsXW1nX0DWf6E9pPgDaeZ+db +a1GIRgQQEQIABgUCQ4efngAKCRBmNbbA3ohd09++AJ9GFjNIUutctozuFNreIeS2 +xATWJQCfTUwt6nd4R13f5U0+iOsTwWVX6h2IRgQQEQIABgUCQ4efngAKCRBmNbbA +3ohd06v2AKCHZ+fbpbQNIvlZkBO+9CTBl4k2IwCdHr7QCVQry4VIUhWGX5Fkydj5 +cXCJARwEEAECAAYFAkfAfZgACgkQGWWFUMMRBhFLagf6AqFi2y+DPg+duogX5hHs +lLpeRVXbqEqX9bB2BzzinUhTmmRpEpiVnCkTd69scXh/ZVTECfA2zBYV67gp3eit +UB7CDSeLZwqQCIz42uF5ADq9oj+j6uf8pPmsk9qO4VZcr7mUwJ4tDy6znG7Qg5H7 +y4HRRQ8cwodDIa2jpLdQ+v9+fms4Nq5j/IJRmHjT7Ha6n78arpl8DlBtjjG0dpmK +fBB9n68MbiFLX19yIxO98X/nEoDCk6DuLX79Ratt4jEr08YCyJ4PfAqJKUy+F5jr +Knp3G/qj6H2N72vHZLzoZRfZjBzbpN3V9rPossxQauoRqmU5M9wFDnBoqyszMMU+ +KokBHAQQAQIABgUCR8B9mAAKCRAZZYVQwxEGEWeHB/915y1ulAHQ3eJNMZdpVAI/ +YAeyE1G3owsL5xalMigBPT9/G6ARzX3OnJYkFDs+CE1gz4Yop24zZyR4JafbytKO +Ef7RRchiJiL25rtQvJcjtgST4BdsjDawYGYcdPiJABt0eIsvSRSAxoHXYy0Ej+E1 +97kVBVFxAIR8xgP/1z+LZwtworLzrLqHOmY8mRkrfx1M2aCn/sLHSZX2m4it0KQ/ +JUjsPChGReeCVAvLmmBrgRrO4oeBXDvgKm+dlAMeP/td3hHQKIJ1Rdh22oiPhtox +HpMgMA9Gz9w1soPvXxgbZ8LQzI9Dqx5JbwPKqB8QDL1xyBocY6mQThXoYfAzRAek +tCpTdGVmYW4gQm9kZXdpZyA8c3RlZmFuLmJvZGV3aWdAZnJlZW5ldC5kZT6IYAQT +EQIAIAIbAwIeAQIXgAUCSgkeigULCQgHAwQVCgkIBRYCAwEAAAoJEKIRWuFfa4ty +6SoAn2X4c0dOTQp0dk+ofvPDMtNWBbIXAKDdrSAnSP/iaXIouTg9ncAERnXFgoiZ +BBMBAgAGBQI+dd8PAAoJED6Pt/L4g0HZhpID51GCXx5Q60No2CVrjw73vZ+KVfTr +8iJZSsi3X1C47C1l8OCZvnzECYFq9hhKL9WWCMktvqxg2aW8/78WgVW4KjPEz3Yl +88cFPABauJPhJuHyl0efAci0iY7yy82utbKTRyXp5xFBad7U6RLK+GzbrmqEWIbY +is06jbqAvtMfiEYEExECAAYFAj512scACgkQ7tHqOSJh0HOZXACfRTqAC+LhzLqh +1668bBFTybxCdvwAoIGjkethM4lKnKqXZv9Wctz+E9toiD8DBRA+dao4/W+IxiHQ +pxsRAlrLAKCp5Eet21hghQweWCbX2Sfp0Kt0wACg9W8xv5CE0KSB7E9rwmNcgZpV +mwWIRgQQEQIABgUCPnekGgAKCRAVP6DNdaZ2kvvSAJ9JBZVwMzoYbuK+X4JTFbsO +W0wHdACgrWEV9hElP/rbBPL7l1rbDAhniOWIRgQQEQIABgUCPsouuwAKCRDb0kX8 +s7KhLEnHAKCqht/V9susaEGuep74heYgo/6ExQCcCysfRsihFG0jPX/yEOwLGT4R +0+eIRgQTEQIABgUCPo3ONQAKCRDKaTl0gQOjfsWIAJ9R2xmpnF0w2EhY591OYpNr +0GvJ7gCgv7lDNNYLHZ/u9RIgJJq45R+h/TCIRgQQEQIABgUCQrgKqwAKCRCBBGRP +UYmFBNDFAJ93FhVVtNwg7jLgO00lKk3/3lgEVgCgvxo0Jz2dPoOzWw8OvGUmN5PF +rrqIRgQQEQIABgUCQZLz+QAKCRDkE2EzDKpotBiEAJ9ZqXR8/8Ffvq0lNkJ+0d9r +JXzXaQCgyT6qZ5nDeDFJpPdMmRHhwHSZq4SIRgQQEQIABgUCQsUyhgAKCRCb8iNF +L+KLz92FAJ9c/C9RJy3SGLbVq09c7NBPPS8+AQCeLBc3EqtjTtzmbBEH4fRegq1H +t1KIRgQQEQIABgUCQt9FDAAKCRBB6gmgV5NJjyFIAKDhfzgs3KPp/97Biee5tPmq +hizsIwCfWwvOgdoUb5GmZRpv53t08woBRp6IRgQQEQIABgUCQuA10wAKCRBzzi77 +hAj3VbBKAJ9oavMNCVLXyabt0pjFJBWSwRZt/gCePKcZox146ASRqaJF8OIvQn2+ +egaImwQTAQIABgUCQt6scQAKCRAxpj2W7BQLgRg1A/d5x83A1kegLg8Q72g6dcUf +KCWR6I3mfbFkkUH34jSShdO773Yxm8oKolm0JrUzPagZwMRIgaUqSXpgYbxkyorz +5G/R/PCkHto6qMAztyCaKyFTE/nlBQfuKZ+XPpBSw/yIRu6IWdqwSHOOy+thRbg9 +fXrMbzHFXpawRauu2VeCiJwEEwECAAYFAkLex9kACgkQN+P0X+5l4yGPbwQA6q4L +s5TTiRZFrxJIHVVwgh9kz9zlLj2fSULWyX25INZ59YQpzCE2qTSZRBN8sowe5BKQ +ZJlLcir91UsDg7KX4rP6bOsyUSJ3v9kecarU9/B3/7GLnKDGVHHoqRQKAi2DqpCi +SsE6WDNONNXVKbsadcvC6uTdEg7U1vXyjDbPY4qInAQTAQIABgUCQt9seQAKCRCa +zTzAqZ913XpNBADS498IdhQrpMnbH0s6oIxQ6ZFY4gcW07QnqfOn5WizKxdx9InX +JBgozFH/yaLLQbI8AqS9lZQrb4cJeWYCM5vJbnHh7qatoguYb1DdCIyriFzC22T+ +wxPi33L8PNpyrfCTT6Y6LF4jIcrEGZrNl37jT+n/xMvCeY2gdmdiQmFiQYhGBBMR +AgAGBQJC3rrtAAoJEDLJ5M42QstLwa4AoJXwrbSMRRqlUy06v54T50RTB1/WAKDO +GdOaE7jxcRlkuEc8Qswm976bAIhGBBMRAgAGBQJC32x7AAoJEFCOrsUwLaVoIqQA +n0wc28m+1XNI69hWQ4lyRVEgQqBGAJ0fsklpnnZHCVhEkrakbLQ/E+9pjohGBBMR +AgAGBQJC32x9AAoJEN26ZLosMS0v+UQAoJvPJaWA8ctG2Bff7mxW76gsOovWAJ46 +0KDi0QbUOEJiD0fk//R0XjnknIhGBBMRAgAGBQJC4Mk8AAoJEFz9N/rMeMiTV8UA +n36HHFAVjudWCBDNJm7KqZyh7WsKAJ9sU4g4KN047W0SbJAA7sPkJwE0C4hGBBMR +AgAGBQJC4OzMAAoJEMm1puzi13TfGz8An3irX0FipvIvirhSUyKDE7wDeuUEAJ9g +PRtcLRDeFc4Oh35077YLrN9q0YhGBBMRAgAGBQJC4O1AAAoJEFuWgBDgT5qJwJMA +n3hd5dZRNloo0BdAZjzH6r5MgNlHAJ0UM7nOz1sj9J8nRqCb3xFBwclbO4hGBBMR +AgAGBQJC4mJvAAoJEG2YjReHMVwxAuoAoKiAof3Y87dYurmnSQDs7WXP88ZdAJ40 +dTmjNicUfsKit5aEkxCl9bjqQYhGBBMRAgAGBQJC41XAAAoJEBMuSdTkHtx+60cA +niVi5i8j86YN56+uY+wMahkSXg31AJ0U9jmvOXQDNNsIHWJY9xXoz7jRc4hGBBMR +AgAGBQJC42TbAAoJEHXKoqPzmzdQwPoAnjmnjGqxCQz22Y2jd8vz3+Twfwr9AKDB +j4z0kxrf4hydmgK38ndDBP0edohGBBARAgAGBQJC5G8UAAoJEIzjdrgc1IYfpZ0A +n1WzxheVFpcxW8SvsSpmNg2yl2+cAJ46aAMX30kTtT2ZUFB4FpUvjWngs4hGBBAR +AgAGBQJC5JLHAAoJEASRNELqG6ONH2wAoKPWAiV7uR6aHP0lad6xwmJk7hDGAKCL +dquqzy/yW25IpG0amrrBJxbLc4hGBBARAgAGBQJC5cIgAAoJEGEZai4zPk6ET/MA +njlQCKWhvqvRu7iYFQsg2dCW443yAKCYIPjawX4TXjgbruZktT0hg87UPohGBBAR +AgAGBQJC6mP4AAoJELK+vEAVKSSvB38An1oDZWDSwVpp/53o5cdJujbLU9grAJ0X +YbLrL+kW3CjaFVLncRhuF5t5xohGBBMRAgAGBQJC4+1qAAoJEDKGTkGchSIr+o0A +njIqK/E4OJrK0XPhX134+VJZ9N3eAJ90U2hylPkr+EoBHnF5VtEWJVWunohGBBMR +AgAGBQJC5RC3AAoJEFJ5L6+ZeK+GQvYAmweV9Ky/w7aRqbYjTtdg3U0Ks7DDAKDl +qSRYN1u8wK+2pVY6pcdLdb0uCohGBBMRAgAGBQJC5RGlAAoJEGtzoQYqYj9y2GsA +oIrkKoVWsuxRPHtOWWuvbHkMBeAmAJwMQVTcr17v9WngLkot4gurcsLxaIhGBBMR +AgAGBQJC5pliAAoJEGjrjHb46iln3W0AnR3w53mDPp1l0/6GDqqIWpi75PIkAJ9S +yyYZC4gjDmvf24hduMyrfjI2h4hGBBMRAgAGBQJC52FXAAoJEG6UdZTBUkMaINAA +oKf5u3fzXTT9MOtOVcqyVgnaIHhvAJ9hPhaRQUIMryWg+pJcw0TTWC3O9YhGBBAR +AgAGBQJDh5+eAAoJEGY1tsDeiF3TYA4An1FTBiWVfw9UBHZ8K05EZjG9+ykeAJ0S +w1jLCrauKil0I2G5rizXR2tREIhGBBARAgAGBQJGOOLIAAoJEBVFs/7iIt5PB/wA +oJihHU6IgWsNcADF1yo4/vD01PPNAJ401g1Y1dn2Z4/Il2jiuzE8dNYDEYhGBBAR +AgAGBQJGOOeiAAoJEGPQra6REgPkF3AAnAhbVLxHJk0+XswLDLFj20SQKrcKAJ4x +XaigKAQ5D6/Of1SPPRoX7bTEXYhGBBARAgAGBQJGPJMqAAoJEJhw7/PxL2By3XsA +oKONmq8YyhYqvpafW9dX7k6r4pg5AJ9Sjki0Wqrm1AYXxAYGc8fZIesIf4hGBBMR +AgAGBQJGORq5AAoJEOHh8rCZDtSqiDoAnR8FA/yGXEAd6gP0AoioyMHj6e0KAKCA +dnxXUB/eSwN98EkeVwSPpiBLG4hGBBMRAgAGBQJGPFBHAAoJEEwEKBgxGj3l+XYA +n2Okz5W6SabKyirUGjF30lr9BP8VAKCBqsPWR50O8vcG0lDLkp1tuW+63YhGBBMR +AgAGBQJGPaCSAAoJEC65RoKIgXQCTFkAoIq89nYh6AmxcqwQFeYiloD+FGv0AJ41 +la0vkis1JUIDM3FNO8xw5VbNZIhGBBARAgAGBQJGPdZ4AAoJEPXCYBZM7tdfcxkA +nAsMAnhrvQNVPQJs/P5ysQTKHXZ7AKCGrxUFi5FQ93oEuWBGqw/xHcMfVIhGBBAR +AgAGBQJGPfUFAAoJEKBy1NBDWMWESn4AnjHzaapJEaIYFhc/39hIRm5n0dl9AJ9l +AXqmz+YQSqJKQ/cchdKbLdhSGYhGBBARAgAGBQJGPgXFAAoJEAKlpgULfmz6xg8A +n1EFGiCeI1C+7BUDqI5xlPps6WB5AJ9cUoE8g1ipE/QtCVYcOUhD53yxY4hGBBMR +AgAGBQJGPwYxAAoJEAP2jL3eiISgjbsAoLzdvLd5d8mADMZDFLi9ywPLk4pBAKCt +23xxWAwNSj5W+uPGLL6R0IEb6IhKBBARAgAKBQJGOPeHAwUDPAAKCRBz3YwWAVMC +NT3pAJ0d+kpqF2GHoIhFEisRwox0J52J2wCfc5nQgpaGmgyMqodqq+cdoybHIx2I +RgQQEQIABgUCRkC2TAAKCRBtC8c6QFgYN2F+AJ9l6y2ms478IKVMFRI/SghwKvRW +AQCeJIR6hCR46QY0IqKhkHy9mfzaiPaIRgQQEQIABgUCRkxEUwAKCRAfISPDa9hy +oOhdAJ45vxMRMgaHj1548DkUttPv0cdYHQCdGlc//bHVnJwwlUFz/1O4sXwDttaI +RgQQEQIABgUCRkx9AQAKCRAPRQomYhC/wO8fAJ44L3d9QLaMvMvcI78aMBJH2y2d +SgCfe9xYYMuYvf9qElihil/7a/9p68CIRgQQEQIABgUCRlJvWQAKCRAywdbvDxQ7 +wRIDAJ9xo4egUgVo6h/N7A5nMBuT3dZ6jACgy2Oc2uFYYhGvBAgQpHqESZf4suOI +RgQQEQIABgUCRlJvYAAKCRDLrr45pGxMoYJUAKC/iURBlu5JKxZJqUJ6D2kzYuo4 +tQCgxTpvpDWKqrGIM8OeA/PbdUJqTkCIRgQQEQIABgUCRl7VqgAKCRCahtfM0arq +YMd8AKDHCkES+rZ5lM7aewuV+/ouOknGQACfePMsXa5L4OKjA3szncnZkcc6Wl6I +RgQQEQIABgUCRqVMLgAKCRA5vlGhCEyREz3aAKCFX/1eYbphSmP2KYfgHkhg6Hf1 +UwCgtjZrJUNnuhsPGRK+Fooeds3MatGIRgQQEQIABgUCRq3MVwAKCRAzzWczr17E +UvI9AKC1QzfFpES4rgb6+6lqzYYO2JW9SwCgtZkhqsaH5evRZiIglzjHmfgPJjeJ +ARwEEAECAAYFAkfAfZgACgkQGWWFUMMRBhEjoAgA4cFAPqtCYVpEf0Nc7eciqxpU +LGLaUCOuDfMZiz1kSkXi4FiDAKbSfrcGAPmLh+8AiQbID+1PKItsfWs5ZjuBzJw2 +toF7OKSWxNKUSJoT+SapGGrs3qbywZWRi82dcwqSxPyZmsQfLXONJRePwgWy4+RB +Nvo38j1hKZclf8xMI4w1wJMUs34Xae9BGMoLhpuJ+jOCoG4JE3cUdf7hvhyJKtMh +xrAiYVYmVlurShtNF3Czhq5tm80Jb9m1wlZRFgvUE6m/2XWwPjjS0lnZnoBFVZ0H +lMd47b0YOu8ieS1wNgkqtpRwBqBBH2XOM4kR5p/uT7rJN9yav6z1fEEgmV5TG4hG +BBARAgAGBQJJyofZAAoJEMnHkk5RBH1mxrcAnj6+e5JOVqw2yHEYGIL5d+z9iURf +AKCR6Y89jMFzzv2rEPbArCxOeGmurrQkU3RlZmFuIEJvZGV3aWcgPHN0ZWZhbkBz +YW1hZmxvc3QuZGU+iGAEExECACACGwMCHgECF4AFAkoJHooFCwkIBwMEFQoJCAUW +AgMBAAAKCRCiEVrhX2uLcoYCAKC4KNTcBwjOEIfMOgFsF3uTQTvL5QCfQ2960jGi +s9Jye9Ly/fI1CBMVQxiIRgQQEQIABgUCQrgKqwAKCRCBBGRPUYmFBP0VAKCPH0b7 +S+TylV1uBuYcYnWIb/RJzwCeJvRTMPnWNjVz+CVOvVzJTH4ol5mIRgQQEQIABgUC +QsUyhgAKCRCb8iNFL+KLz3iqAKCXRZWdGjBVbj3IBFl3kvh3xF2gsgCcD3H79mbV +DRNMxpGArFQ1hqQFzleIRgQQEQIABgUCQt9FDAAKCRBB6gmgV5NJjzHQAJ9IfkjK +kiEuFxUhznsghAQ8bsBWnACgoT0kWSB3iUepLIDoWhhGtDIS5FSInAQTAQIABgUC +Qt6scQAKCRAxpj2W7BQLgebOBACAFFpEKETO3ZHbjMnPogACNr6EZCQxzGTIXrXS +yWQs68VcH54wUOA4yk3cGpfH2pgAxYjaHejTJRvDKvGrPGlKHgCZFy4+wHzo17pW +9J1aKk2sUWlT67snDVdMun/i8WxD9yz299cXR6iCxPfP2HIMEqbsxWJaXITo7drW +SjO35YicBBMBAgAGBQJC3sfZAAoJEDfj9F/uZeMhRawEAM9wfn9sBIsFzQRQbAO+ +ll83f8ki++A4Anj6DXQ4xRmClUxqahL1BjxxeQhE+Qomq1IebDJr0Se34XB0g3J7 +bzr/i9QmEwEqnDJfWVobv1Ugjy+1jzErlZBhm8hnCI+zPnrWKLk0n78vzJ5RrnVa +TTV+OW5r4rdVZ86yKYHtpVSoiJwEEwECAAYFAkLfbHkACgkQms08wKmfdd0HDQP8 +DDD+1FQU8PPPe+Kuf2bJOO7Ycrej4JF1I/Gbs2HH3xXgOZsRv6WJ41M/ovxJLYrp +VqQA2YF/Gxwguwrf4lPk+4spFdabguiJK0d2/KZAtnLsjIzdYcoY01IKGT3xkPwI +DErNFSmxX6bKCUePcFNHYZ6dDBHFFcYVTsdo/wbAe6aIRgQTEQIABgUCQt6wsgAK +CRD9b4jGIdCnG30UAKDCxsPZksKIcvj7tbHQEwm+PV5+DwCg7PorUCgIvTIWnID8 +zRWDBG4ACXaIRgQTEQIABgUCQt667QAKCRAyyeTONkLLS/d2AJwM7BQIQgqLA0qA +75R2EjHFXQKZWACgo7iaANHxIRc/Nw19j8CxNbWJRJ6IRgQTEQIABgUCQt9sewAK +CRBQjq7FMC2laIx3AJsF0Hjrm4N21EwdrmhS9PHKQL2KdgCgjlus2GyuCzafgb9J +HVhBDrhelkmIRgQTEQIABgUCQt9sfQAKCRDdumS6LDEtL7MWAKC6rQU6ZjSS6gVn +wswutaqBwfwtvwCgv2mMGJf2hnYVaNNqV5WIFAuycmOIRgQTEQIABgUCQuDJOwAK +CRBc/Tf6zHjIk9TlAJ9dbM2HowI5oD6hGSnADhI2dKfBrQCg4O9WtFiRzLqC1TgC +Asbigqy+JDiIRgQTEQIABgUCQuDszAAKCRDJtabs4td0311pAJ9L3yUe7GUeDqMz +d3WLWatclf7ruQCeOenA9nhyKgHASeEK/ZXQXDDBW0uIRgQTEQIABgUCQuDtQAAK +CRBbloAQ4E+aibNVAJ4wnAfcA/rtUs3+Hu9nNn8ar/2Q5wCfe6W+k9yHjd7hZWnY +HdnCkAZkOMeIRgQTEQIABgUCQuJibwAKCRBtmI0XhzFcMezQAKCnk+So0Anm4kLD +wl+srHvIB7b6jACgqROBN5MeEGXQm+Gan2VSt+nvTZ+IRgQTEQIABgUCQuNVwAAK +CRATLknU5B7cflR0AKCTAlfhPFwHPXnBo+5IROopwNQnsQCgh2vHS9VRZRt5I9is +NDaNf1biCQmIRgQTEQIABgUCQuNk2wAKCRB1yqKj85s3UK9XAKCELi7ymxtLxdwY +fdfV3dxd63mV2wCgjgaUlQqFXjx5mXnRsgy4S6cS9yuIRgQQEQIABgUCQuRvFAAK +CRCM43a4HNSGH5/sAJ9JVHMVwBwHD8PN3DQq8hHEumn8twCfVQSXooNY2P744K+8 +k6lLO8nOH6GIRgQQEQIABgUCQuSSxwAKCRAEkTRC6hujjb+qAJ0Z+AoGDYe122wR +AOYAKayl9f9e0QCeKetoll6NZ+Rm/NKbFJGP6fYywIuIRgQQEQIABgUCQuXCIAAK +CRBhGWouMz5OhDd7AJ40l37cLZcSxfPt3M7/aOPgVGpa5wCfciaEynzuHDfIQD/v +tXrZb2m0+NeIRgQQEQIABgUCQupj+AAKCRCyvrxAFSkkrwQsAJwM8IqtXQk/TBiQ +i6Fyq/HHm5/zvACg5atZV8F+r7jVRhT1SJ+FaVsaQDiIRgQTEQIABgUCQuPtagAK +CRAyhk5BnIUiKwuyAJwOljL2++fVQ0BSKRvFSvS+fSu3KACeJxsOhbyCd3o3rqwa +VeY5FFi+Fm+IRgQTEQIABgUCQuUQtwAKCRBSeS+vmXivhv0OAJ0Sg/UEnB/IAoqj +HzKoBivCMYDtrQCfVY3IDKRHbbLNfWBSDERWCTpHXtiIRgQTEQIABgUCQuURpQAK +CRBrc6EGKmI/cqGBAKDEgTewzt6TjmCkI9RrYjF46a9H4wCeJPh4bmTymcfwRGn6 +0h0a9Mz1mKaIRgQTEQIABgUCQuaZYgAKCRBo64x2+OopZ3lEAJ9w4EWAgRUMxf0U +d1zoygYDQedAgQCeJPHSbk62Ej11NljNGN1zdwzRHuSIRgQTEQIABgUCQudhVwAK +CRBulHWUwVJDGkOfAKCgQM+50dTktJDaDd8gVOGBKRiSIgCgkT9gdtDac0m9s2IH +Aqktk0mc0U+IRgQQEQIABgUCQ4efngAKCRBmNbbA3ohd05uvAKCjMnn4GpnZhjWF +S7iN0LIXgxm5PwCfYodjKF5zSbIROx79dJ41Gg0/VxWIRgQQEQIABgUCRjjiyAAK +CRAVRbP+4iLeTznPAKCaIUKdiySarhu//zEVn67y9q/szACcDUob1L2ac1R1FHB9 +XE4fTf/PV1KIRgQQEQIABgUCRjjnogAKCRBj0K2ukRID5FlVAJoDhc0dijUvPmOK +ILkX6fG5g73DugCePsOrjW+YIc5+T9qeVMzHyfm2opuIRgQQEQIABgUCRjyTKgAK +CRCYcO/z8S9gctnJAKCc7DZ7JzXgaB4ImiwB2dyGMFUC8QCgitOFKEw1y4+V1dNN +3kZYL4P/M/uIRgQTEQIABgUCRjkauQAKCRDh4fKwmQ7UqvVYAJ9BjHLDyGmR56xK +lKF3qVq1+jAmgwCfQR+0qbVWaSIaVS1DCg8yUr2txOeIRgQTEQIABgUCRjxQRwAK +CRBMBCgYMRo95VO1AKCewEwAscfj9VfTxswF6BL6zNj8rACfW/3kG7zPI2dSjWJz +GYPQYPAa0smIRgQTEQIABgUCRj2gkgAKCRAuuUaCiIF0AjxRAKCu9kiQfvVmSrVZ +b9HK8Mazhut+hwCfY5guSOz96KH5dJ2585cm5wPyT5mIRgQQEQIABgUCRj3WeAAK +CRD1wmAWTO7XX04yAJ4/ZvOfsexCgIQRuoREg1/D9bniKgCfTcKh9dLFkPjlD3yI +w/NCc1L0/ruIRgQQEQIABgUCRj31BQAKCRCgctTQQ1jFhJmBAJ0TPZlIksq1EnAY +tTTSb/tHpXxNUACfd/m3jaTHdJljRXGI7UBsVHnL0nWIRgQQEQIABgUCRj4FxQAK +CRACpaYFC35s+iQnAJ0eGzB7NIQtXLEgyuphyW0nBppVrQCcDj6tm1MCKXA7f4zV +1R0u30jrUeCISgQQEQIACgUCRjj3hwMFAzwACgkQc92MFgFTAjV92QCeI+02yLkS +qmdJlMBVfVE9joT/pBAAnjJlywot38PS8FtodliCfNvqn6VIiEYEEBECAAYFAkZA +tkwACgkQbQvHOkBYGDcfVwCfbS6bS20V1ElnuQBAofsmi0yjbzoAn3eztrDQIrh+ +/BkXIJo7IF0Ny+gViEYEEBECAAYFAkZMRFMACgkQHyEjw2vYcqBPqACg1jy6peeP +fEuvYJEKfJBNG7FVwPwAn3y5/eBtZdRefj90FeIiS3dr3D3siEYEEBECAAYFAkZM +fQEACgkQD0UKJmIQv8AfLQCfeHzJB6tJdA4bjPEcJKi0sMFceCwAnAovkjdUhF2a +JrpK2cr4bZhm5RbhiEYEEBECAAYFAkZSb1kACgkQMsHW7w8UO8FdFACfSFzmzz3l +ZmB+qclUq7q+YVgd3hYAnRyNi3iYLUVrk746XsvzWcv8UonRiEYEEBECAAYFAkZS +b2AACgkQy66+OaRsTKE0LgCfYZfXtB9Er7iKXoDfhNuuDIdKmqQAniGNC3piLBCg +gMPpJ5vQp2KsptvJiEYEEBECAAYFAkZe1aoACgkQmobXzNGq6mC8pQCfeV2ib+Ym +o/KQ+jYsr1BxYVFCOmsAoO312vLgv8Q46hucGIq9aN2isEnEiEYEEBECAAYFAkal +TC4ACgkQOb5RoQhMkRPl4wCfebfolpLZYdGk48JuUwd2shtkicwAoMGAdNOSoXyn +I/6/b9jsxQl8qmwZiEYEEBECAAYFAkatzFcACgkQM81nM69exFIBlgCg0CUQ1h61 +lCLBjE9+/Kvskrh1QAgAn0gXeq1NKEuepDB6hQo7fVZrSpF8iQEcBBABAgAGBQJH +wH2YAAoJEBllhVDDEQYR8ZEIALAYFxipk7FfpDbEnUrTI237QugKjpvrX9n7CdHx +JLnwOBr1g2/e/RMgoJHH8yqP8iQPGMfZXCVLM6ME/EoUQAVT0M0I1QsBVxTIXyPq +QIzCv6zibLYyEXDlQDNVB4hqdhozzxyjGruqbn75zfb8mlTMoj9lElNhVIdcUOVL +2xHkBy6g/YpmuZb/pt4HXBOUyWkmFK8zBMxhXw5bOuOP2zSJk9rZt7wdKNj3iC+/ ++936yXZzqWFuUOq0RX61RtW8e3SJfowGFBd728snsiD0IFLTXor62aBfBJ5yiGKF +UBM8LQ27FcJasfo7a8SiBbJOO/OsyQ1lRvLS85kM+XZDXZaIRgQQEQIABgUCScqH +2QAKCRDJx5JOUQR9Zlt8AKCAMAc8652qgKVPdH0XJbzoq6ykNwCgkTboPY7d+GFy +EwNCHk+0PAmkPru0KFN0ZWZhbiBCb2Rld2lnIDxzdGVmYW4uYm9kZXdpZ0BlcG9z +dC5kZT6IdwQwEQIANwUCQsVK6jAdIEkgbm8gbG9uZ2VyIGhhdmUgYWNjZXNzIHRv +IHRoYXQgZW1haWwgYWRkcmVzcy4ACgkQohFa4V9ri3LW7wCdEc6hdCr094a8LG+c +hTd+OzGxfFUAnR3FvtuG8sv367Knk0ybMnpOM/4hiEYEEBECAAYFAj53pBoACgkQ +FT+gzXWmdpL1ewCeOSe7lOufhc3mfTXs7eSvqECt89oAn0VM+YgQHbfdVp32YE7H +t6N6GPf0iJkEEwECAAYFAj513w8ACgkQPo+38viDQdkP7QPmPZXPi7m6wRiLofsT +lHCbBrR+ehWoSSqCmHQjN1DGRtamGE6X8QbMIttD+NLp+uTx8j/E0sGUdPnWkky6 +fwt1f3AYeoAgCXNvPoewsC6mZn3FMdEo6vJc43FmhsUfumOtunvGNBnXdM8GSCJ+ +RBS/ASMjRrECF12/14xwgyyIVwQTEQIAFwUCPD7aNgULBwoDBAMVAwIDFgIBAheA +AAoJEKIRWuFfa4tys/4AoND5QhEdyVIypBvCUHv5SCaAKcd/AKDFthtZTrjF+eEY +lktPLRtI9zjeE4hGBBMRAgAGBQI+jc41AAoJEMppOXSBA6N+jAIAoIcAeCIKt2QB +PnAthnUk4DhlmM7FAKCA0Iz9ZutXGb2l+p8s7hhF3+Y9L4hGBBMRAgAGBQI+ddrH +AAoJEO7R6jkiYdBzi84AnRddvByuDodl5KaCSdpe6k9aYkLqAJoC/ud28X0M478K +lmacVVjb+PqzBIg/AwUQPnWqLv1viMYh0KcbEQJ6DwCff918LRigFUyEvYj04C12 +so87JNUAn0RNFw+P1/SR9Mr/JQmOzJVhlwdriEYEEBECAAYFAkLFMoYACgkQm/Ij +RS/ii8+wZwCfRvfW6NyBoAp7oS9ILRHNYh2GbhsAnRYGs1hSaGK4rGxm/fmqxj+D +vqI2iQEcBBABAgAGBQJHwH2YAAoJEBllhVDDEQYRqFAH/28B/f92MsQX9ZRJG1v9 +EDGVx1U+pcE16a7iplCP4QuUR6uA2EUe9fptzZfX2iT2nr2XgCB3x2NHf0rzNpTA +M3OtqKQhXdvS3EWzWqR8UaDf6dxKN57B4QONRIhuImf3m9DWFNwIr3oOtO25Q+tG +7YcZen/zbwU5O23CEakNsysxGEHn/3BPjRyA1FE7NVLrAmxFu8LXBUD9y3HNNetM +4WlucnObqw5cBFsZMtnGcVLs3suTAsxwrnBo7jq/DbZVvzUZtEkGdV7LpSWkivSr +q0+h9Gzug8EcYTjrdR6LFA5xGan6R9zrSe4mxe7vja10fmGEdIOQIapgO/iOWDR8 +3MG5AQ0EOxIiVBAEAM1SlkvEK5MrMnW0ybtv9eMCG89gqIvd2gBnpcAsF0sX+dCa +WHWNy5HL3dBak/G3BJ8+NzAksfL5Srm0LVKcfVjBiG+IsbUoSyeJQGuhSZXYcnIc +/3Z8Ujcs+TfFurG8uHU1cWnNK5aMYwDrqxmp4Ru0zLYHw4tHBBKF0cgFaCsjAAMF +A/49aSZuDaatppSaBOzCt7wIYCsGBxX5ZibrJqr0gLUbhXU9eaWzCawOWwCvpQN0 +lTjoYVkwiLZaYUkdqsSQgHAU3jjKlIuaIRXApEkTb8Jg7R/vNAdwXoZRLBCjZPGd +5qGtnIezsZ2+lxFx+bRieUL8fUInemXwWl8e23PMisgm+IhOBBgRAgAGBQI7EiJU +ABIJEKIRWuFfa4tyB2VHUEcAAQENMgCgnc22kj8TfjktU6u4SUUqud25ZZcAn0B2 +b0zPjKjGuiwdKSnkFbNcFS3g +=UxMc +-----END PGP PUBLIC KEY BLOCK----- diff --git a/KEYS.txt b/KEYS.txt deleted file mode 100755 index d4180a29..00000000 --- a/KEYS.txt +++ /dev/null @@ -1,54 +0,0 @@ -This file contains the PGP keys of various Apache developers. -These keys are primarily used for code signing. - -These keys can be verified using any OpenPGP compatible system, -for example, http://www.gnupg.org. - -Developers: To add key information use: - gpg --list-keys UID - gpg --export -a UID - -(Where UID is your email address) - - -User: To import this key file into your keyring use: - gpg --import KEYS.txt - - - - - -pub 1024D/914A4D28 2005-03-07 -uid Nicko Cadell -sub 2048g/6923CBDA 2005-03-07 - ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1.4.0 (MingW32) - -mQGiBEIsjHURBAC9JqRzMEh6pEZuuyqHGwfBkQZnvOuj0Yp88lDsJtNl62cRaQJk -7eP+kVxCbl12qr1EDz1z/ZON7/+vF9YoiRh7Cydck6wLe/kQcJtUevm00q35pUQJ -7c2TSY+QbTKWriUKueOyRR6p2lpscUHhbCPB9NOLfQmJvZsa47gDZSybCwCgh0+u -8KkkcovlV55K/WrSGg16o8kEAKFGmpDKDnv0Sg1rRnvBGJv5WZFR/57p1SArMXHi -oBkj71wlWz9Ia4tonfc12TXUwoVs3WbIFOoLz1Iw31cGnwUsNkvEclaZigG9iYhx -S6+2i7jrQIivO5iXJtTuePb4zFgLwZcaoFySvLIKRm8+X6KXvoslKAYM/F/Yd0jm -OebkA/4uwIt7cGOWGIaiH2n/80QgXN6FyOhNsgCihZZcPwXo7c/gtszpJ74CwtXD -SVghIwTQ0zK4wtWcHSjf7FelPmeDSga7dLgnxQmmhjIK+sBnPIcBrNiUc3jFnRzK -o3ZIBPsGoo0jUsemgkiQA4ptVybeak/SmrTsRgxWkT4Paw41zrQfTmlja28gQ2Fk -ZWxsIDxuaWNrb0BhcGFjaGUub3JnPoheBBMRAgAeBQJCLIx1AhsDBgsJCAcDAgMV -AgMDFgIBAh4BAheAAAoJEA3R7CqRSk0ooTIAnRZ+vUY+ZN8CgL0fvDbZv76kgQG+ -AJ9vp4BwPLU5jM+YOY3hJPp1bNw1RLkCDQRCLIx/EAgArSrXU4kkXNLCTBIAMaIx -diiVvQ2JqzrFkXf4yAlE+xiy19bqGewmslt+dLmLUEtt1UFMU5b2kAiZLNMvdBWQ -OStwK0SABRESjb5sAjAcFXUeqBzjVBDvsSGxJZZa5He1pQMjFzm4hG6GNl3+vOx6 -r6fly9W5Ddc8wqfDb8JU0c6gG8s10D4gthWWyJ2K1u3BcvpggoGyqyxisvF/QM68 -KnXf8/wp+5sOfl6glyluR/OyGMCU3c38eHYU2XMzlcT3fh1VcU5MvPastp+76vUy -ImrAfb7RhS3sDrmRd9ZS8FE5JRB3967hETRSLjHW+/TZeyvxaGMJkBPdv2BdwnD8 -6wADBQf+NaK8teolegPc1LdmX3bAhR2bhfqIpuUwPBRHqIU2OtWsMJ9sEsVZY4LC -OLOHMHI1spWHEo39mx3fz5MR4x2z3+HzZRq8tzMFn5PC3c7yb06CMfqRf8pvYWVP -0cMvEctViAc+xwSpZgXQGLkwZ37KtqWncfBVocxQMj4CVUx3PeyozWGEG+bpGSso -Mrvnch41AGL3NA9bA2cgTVuOYSXZLK9TOgh4gXCM4jWTI4BqTY5w0riDwqwt5+qH -e8/HBowGa4jNopl9kWaQuEoXH7GGOTJsc9eKMK+k++iqSWiqVXFTLd7/UhUPv6Oj -7Pqm7+oSumphn00rC2DVeAAWDt7umohJBBgRAgAJBQJCLIx/AhsMAAoJEA3R7CqR -Sk0ouF4An1sFuJ+/kJlvKRs+nNjFqrQdsuDCAJ9WDNgUqnAkdLVTRJq8UeK0AjOq -oQ== -=4aNz ------END PGP PUBLIC KEY BLOCK----- diff --git a/LICENSE b/LICENSE old mode 100755 new mode 100644 diff --git a/NOTICE b/NOTICE old mode 100755 new mode 100644 index 0b6c93ab..86d4dfed --- a/NOTICE +++ b/NOTICE @@ -1,13 +1,5 @@ - ** - ** NOTICE file corresponding to the section 4 (d) of the Apache License, - ** Version 2.0, in this case for the Apache log4net distribution. - ** - - Please read the LICENSE files present in the root directory of this - distribution. - Apache log4net - Copyright 2001-2007 The Apache Software Foundation + Copyright 2004-2017 The Apache Software Foundation This product includes software developed at - The Apache Software Foundation (http://www.apache.org/). \ No newline at end of file + The Apache Software Foundation (http://www.apache.org/). diff --git a/README.txt b/README.txt old mode 100755 new mode 100644 index 40a4b012..ce2bfb01 --- a/README.txt +++ b/README.txt @@ -14,3 +14,17 @@ doc/index.html For the latest documentation see the log4net web site at: http://logging.apache.org/log4net + +Contributing +============ + +log4net development happens on the log4net dev mailing list, see +. Please join the +mailing list and discuss bigger changes before working on them. + +For bigger changes we must ask you to sign a Contributor License +Agreement . + +github pull requests are one way to contribute, but our real issue +tracker is JIRA . + diff --git a/STATUS.txt b/STATUS.txt old mode 100755 new mode 100644 index 0beb09ad..110415fe --- a/STATUS.txt +++ b/STATUS.txt @@ -11,9 +11,9 @@ Apache log4net graduated from the Apache Incubator in February 2007. Project Details =============== -Web site: http://logging.apache.org/log4net +Web site: http://logging.apache.org/log4net/ Issue Tracking: http://issues.apache.org/jira/browse/LOG4NET -Source Code: http://svn.apache.org/viewcvs.cgi/logging/log4net/ +Source Code: http://svn.apache.org/viewvc/logging/log4net/ Mailing Lists: User: log4net-user@logging.apache.org Dev: log4net-dev@logging.apache.org @@ -26,5 +26,6 @@ Active Committers * Niall Daley (niall) * Gert Driesen (drieseng) * Ron Grabowski (rgrabowski) - +* Stefan Bodewig (bodewig) +* Dominik Psenner (dpsenner) diff --git a/build.cmd b/build.cmd index e82ef1ab..db885124 100755 --- a/build.cmd +++ b/build.cmd @@ -1,111 +1,131 @@ -@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 - +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/doap_log4net.rdf b/doap_log4net.rdf deleted file mode 100644 index 5885ea1b..00000000 --- a/doap_log4net.rdf +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - 2007-02-09 - - Apache log4net - - - Apache log4net provides logging services for .NET. - - - - C - - - - - - - - - diff --git a/doc/contributing.html b/doc/contributing.html deleted file mode 100755 index 3cd47353..00000000 --- a/doc/contributing.html +++ /dev/null @@ -1,498 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Apache log4net: Contributing to log4net Development - - - - - - - - - - - - - - - - - -
- - - - -

Contributing to log4net Development

-
-

Contents

- -

Developer Mailing List

-
-

- All discussion relating to log4net development takes place on this list. All SVN checkin - notifications are also copied to this list. -

-

Mailing List Archives

-
-

- You can browse the mailing list archives at the following locations: -

- -
-

Subscribe

-
-

- Subscribe to either the list or to the digest list: -

- -
-

Unsubscribe

-
-

- To unsubscribe send an email to the relevant email address: -

- -
-

Posting

-
-

- Most of the guidelines for the log4net-user list also apply to the dev list. - Please have a quick read through the guidelines, thanks. -

-

- To prevent spam, we require you to be subscribed to the list before posting to it. -

-

- This is the log4net developer list, it holds discussions relating to the - development of log4net not the use of log4net. If you have a question that begins - with the word "How" or you are unsure as the the appropriate list to post to then - you probably want to start with the log4net-user list. -

-

- Post to the list by sending mail to - log4net-dev@logging.apache.org. -

-
-
-

Source Access

-
-

- The source for log4net is held in the Apache Subversion source code control repository. -

-

Browsing SVN

-
-

- Browse log4net - SVN repository using ViewCVS. -

-
-

Anonymous SVN Access

-
-

- Anyone can checkout source code from our anonymous SVN - server. To do so, simply use the following command (if you are - using a GUI SVN client, configure it appropriately). -

-

- Checkout the logging/log4net module. -

- -
-svn checkout http://svn.apache.org/repos/asf/logging/log4net/trunk log4net
- -

- If you are not familiar with SVN, the Apache - Source Code Repositories - page has links to more information on SVN. -

-
-
-

Issue Tracking

-
-

- Many bugs reported end up not being a bug in the log4net code, - but are due to incorrect configuration, problems caused by installed applications, - the operating system, etc. -

-

- Before reporting a bug please make every effort to investigate and resolve the problem yourself. - Just reporting a bug will not fix it. A good bug report includes a detailed - description of the problem and a succinct test case which can reproduce the problem. -

-

- Before reporting an issue please investigate the following information sources for - a potential resolution. -

- -

- Before reporting a bug, you are advised to discuss it on the relevant mailing list first. -

-

- Search the bug database to see if the bug - you are seeing has already been reported. If it has been reported then you can vote for the issue. -

-

Reporting an Issue

-
-

- If after you have exhausted all other resources to resolve a problem you may want to file a bug report. - Please make sure the problem is a bug in Logging and not a bug in your application. -

-

- Please make sure you provide as much information as possible. Its very hard to fix a bug if the person - looking into the problem can't reproduce it. Here is a listing of information which should be included: -

-
    -
  • Version - log4net version, or if from a nightly build, version and date of build.
  • -
  • Application Type - Assembly type, i.e. exe or dll, and how your code is launched, e.g. console application, windows application, ASP.NET project, COM+ hosted object, etc...
  • -
  • Framework - The .NET framework running the application, name (e.g. MS .NET, Mono, SSCLI) and version.
  • -
  • Platform - Computer operating system, version, and hardware platform in use.
  • -
  • Configuration - Attach configuration files if they would help track down the bug.
  • -
  • Log Files - Review your logs files, produced with internal log4net debug enabled. Submit any relevant sections of the log which help document the bug.
  • -
  • Stack Traces - Any stack traces generated by the bug, if any.
  • -
  • Example - Example configuration files or web applications which demonstrate the bug. When submitting an example which reproduces the bug, please try to make it as simple as possible.
  • -
  • Bug Fix Patch - A patch created using diff -u which fixes the bug. (If you have found a bug fix which can be applied to the code).
  • -
  • Description of the Bug - A description of the bug, include observed as well as expected behavior.
  • -
  • Miscellaneous - Any other information you feel will help track down the problem.
  • -
-

- Just reporting a bug will not fix it. A good bug report includes a detailed description of the - problem and a succinct test case which can reproduce the problem. The very best sort of report - includes an NUnit testcase which reproduces the issue, this means that we can fix it and that we can - be sure that it stays fixed in future! -

-

- Report a log4net issue here. You will need to login to JIRA before you can submit an issue. -

-
-
-

Contributing Patches

-
-

- Before starting to work on a patch it is probably a good idea to join the log4net-dev - mailing list to check that equivalent or complementary work is not already underway. -

-

- Currently the only supported way of submitting patches to log4net - is via the JIRA issue tracking system. -

-

- The preferred method of generating a patch is a unified context diff against - the latest development version in SVN. To do this you should do the following: -

-
    -
  • -

    - Get the latest version of the code from SVN, see the section above on - Anonymous SVN Access for details on how to obtain the SVN version. -

    -
  • -
  • -

    - Make your code changes to the log4net source. Please follow existing - code styles where possible. If adding new API methods or classes then - these should be appropriately documented with code comments. - Contributions intended for inclusion in ASF products must be licensed - to ASF under the terms of the - Apache Software License. -

    -
  • -
  • -

    - Generate a unified context diff for the files you have changed. Run the - svn diff > patch-file command from the root of the log4net - codebase to generate a diff file. -

    -
  • -
  • -

    - If you have added new files these will not be included in the diff. You - will need to attach these files separately. -

    -
  • -
-

- If you are not using SVN then you can still generate a unified context diff - using the diff GNU tool with the -u command line options. - The GNU tools are available for Windows as part - of the Cygwin package. -

-

- If you are unable to generate a diff please submit each file separately and place - block comments around each code change to highlight the differences. -

-

- In order to submit your patch please follow the following steps: -

-
    -
  • -

    - Create a new issue for your patch. On the - log4net issues home page - select the Create New Issue from the menu bar. You will need to be logged - into JIRA in order to create an issue. -

    -
  • -
  • -

    - Select the issue type as appropriate. -

    -
  • -
  • -

    - Prefix the summary with [PATCH]. Enter a description of the changes made, - new features, or bug fixes in your patch. -

    -
  • -
  • -

    - Once the issue has been created you can attach your patch file to the issue - by selecting the Attach file to this issue operation from the left hand - menu. When attaching your patch you must select the Grant license to ASF for - inclusion in ASF works option. When attaching a patch please include in the - description the baseline version of log4net you used to build your patch, if against - an SVN version please include the version number and if from a tag or branch include - the repository path. -

    -
  • -
  • -

    - If you have other files to attach, e.g. you have added new files to log4net, then - attach each file separately. Please include in the description the name of the file - attached and the path it should live in the project. -

    -
  • -
-

- A notification will be sent to the log4net-dev list once you have created your issue, - however it may also be worth mailing the log4net-dev list to encourage the project - committers to apply your patch, or at least find out when they may do so. -

-
-
- - - - - -

 

- -
- Copyright © - 2004-2007, - Apache Software Foundation -
- - -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/css/site.css b/doc/css/site.css deleted file mode 100755 index 149f6c0d..00000000 --- a/doc/css/site.css +++ /dev/null @@ -1,140 +0,0 @@ - -H1, H2, H3 { - color: #101099; -} - -A:link, A:visited { - text-decoration: none; - color: #006699; -} - -A:link:hover { - text-decoration: underline; -} - -.centercol { - margin-top: 120px; - margin-left: 210px; - margin-right:210px; - max-width: 800px; -} - -.leftcol { - position: absolute; - left: 10px; - top: 130px; - width: 190px; -} - -.banner { - position: absolute; - left: 10px; - top: 10px; - height: 130px; - width: 1000px; -} - -.menu_header, .menu_item { -/* width: 190px; */ - font-family: "trebuchet MS", Arial, Helvetica, sans-serif; - font-size: smaller; -} - -.menu_header { - border:1px solid #AAAAAA; - background: #CCCCCC; - padding-left: 1ex; -} - -.menu_item:hover { - background: #DDD; -} - -.menu_item { - background: #EEEEEE; - padding-left: 2ex; - border-top: 0px solid #AAAAAA; - border-right: 1px solid #AAAAAA; - border-bottom:1px solid #AAAAAA; - border-left: 1px solid #AAAAAA; -} - -.source { - border-top: 1px solid #DDDDDD; - border-bottom: 1px solid #DDDDDD; - background:#eee; - font-family: Courier, "MS Courier New", Prestige, Everson Monocourrier, monospace; - font-size: smaller; - padding-bottom: 0.5ex; - padding-top: 0.5ex; - padding-left: 2ex; -} - -table.ls { - background: #FFFFFF; -} -table.ls td { - background: #f4f4f4; - vertical-align: top; - padding-bottom: 1ex; -} - -table.ls th { - background: #E4E4E4; -} - -.index-faqSection { - font-size: larger; - padding-left: 0em; - font-weight: bolder; -} -.index-question { - padding-left: 1em; -} - -.faqSection { - font-size: larger; - font-weight: bolder; -} - -.question { - font-weight: bolder; -} - -/* this class is used for screen output placed in
 tags */
-.screen_output {
-  padding-left:  1em;
-  padding-right: 1em;
-  border-top:   1px solid #AAAAAA;
-  border-right: 1px solid #AAAAAA;
-  border-bottom:1px solid #AAAAAA;
-  border-left:  1px solid #AAAAAA;
-}
-
-
-.big {
-  font-size: larger;
-  font-weight: bold;
-}
-
-.small {
-  font-size: smaller;
-}
-
-.red {
-  color: #AA0000;
-}
-
-.msg_title {
-  padding-left:  1ex;
-  padding-right: 1ex;
-  font-family: Courier, "MS Courier New", Prestige, Everson Monocourrier, monospace;
-  border:   1px solid #AAAAAA;
-  background: #DDDDFF;
-
-}
-
-.msg_meaning {
-  padding-left:  1em;
-  padding-right: 1em;
-}
diff --git a/doc/css/style.css b/doc/css/style.css
deleted file mode 100755
index 513f6439..00000000
--- a/doc/css/style.css
+++ /dev/null
@@ -1,244 +0,0 @@
-body
-{
-	margin: 0px 0px 0px 0px;
-	padding: 0px 0px 0px 0px;
-	background: white;
-	color: black;
-	font-family: Verdana, Arial, Helvetica, sans-serif;
-	font-size: 70%;
-	width: 100%;
-}
-
-h1, h2, h3, h4, h5
-{
-	margin-bottom: .8em;
-	margin-top: 1em;
-}
-
-h1
-{
-	/*font-size: 120%;*/
-	font-size: 20px;
-	margin-top: 0em;
-}
-
-h2
-{
-	/*font-size: 115%;*/
-	font-size: 15px;
-}
-
-h3
-{
-	/*font-size: 105%;*/
-	font-size: 13px;
-}
-
-h4
-{
-	/*font-size: 95%;*/
-	font-size: 11px;
-}
-
-h5
-{
-	/*font-size: 85%;*/
-	font-size: 9px;
-}
-
-
-div.table
-{
-	text-align: center;
-}
-
-.table table
-{
-	font-size: 100%;
-	border-collapse: collapse;
-	width: 90%;
-}
-
-.table th
-{
-	background-color: #cccccc;
-	color: black;
-	font-weight: bolder;
-	padding: 5px;
-	border: 1px solid #999999;
-}
-
-.table tr
-{
-	background-color: inherit;
-	color: black;
-	padding: 5px;
-	text-align: left;
-	border: 1px solid #999999;
-}
-
-.table td
-{
-	border: 1px solid #999999;
-	padding: 5px;
-}
-
-p
-{
-	margin: .5em 0em .5em 0em;
-}
-
-pre
-{
-	margin-top: .5em;
-	margin-bottom: .5em;
-	font-size: 11px;
-}
-
-pre.code
-{
-	font-family: Monospace, Courier New, Courier;
-	background-color: inherit;
-	color: black;
-	font-size: 100%;
-	margin-left: 20px;
-}
-
-span.code
-{
-	font-family: Monospace, Courier New, Courier;
-	background-color: inherit;
-	/* color: #0000EE; */
-	color: #101080;
-	font-size: 100%;
-}
-
-.syntax
-{
-	font-family: Monospace, Courier New, Courier;
-	letter-spacing: .1em;
-	background-color: #f5f5ff;
-	color: white;
-	font-size: 100%;
-	font-weight: inherit;
-	padding: 5px;
-	border: 1px solid #999999;
-	margin-left: 20px;
-	padding: 4px 8px;
-	margin-top: 1em;
-	margin-bottom: 1em;
-	width: 95%;
-}
-
-.rule dt 
-{
-	font-weight: bolder;
-}
-
-.rule
-{
-	background-color: #f5f5f5;
-	color: black;
-	font-size: 100%;
-	padding: 5px;
-	border: 1px solid #999999;
-	margin-left: 30px;
-	padding: 4px 8px;
-	margin-top: 1em;
-	margin-bottom: 1em;
-	width: 90%;
-}
-
-
-.i1
-{
-	margin-left: 20px;
-}
-
-.i2
-{
-	margin-left: 40px;
-}
-
-.i3
-{
-	margin-left: 60px;
-}
-
-
-div#header
-{
-	width: 100%;
-	margin: 0px 0px 0px 0px;
-	border-width: 0px;
-	border-bottom: 1px solid #999999;
-	padding: 0px 0px 0px 0px;
-	background-color: #99ccff;
-	color: black;
-}
-
-div#header h1
-{
-	margin: 0px 0px 0px 0px;
-	border-width: 0px;
-	padding: 0 .4em .3em .4em;
-	background-color: #99ccff;
-	color: black;
-}
-
-div#footer
-{
-	font-size: 100%;
-	font-style:italic;
-	border-top: 1px solid #999999;
-	margin-left: 20px;
-	margin-top: 1em;
-	margin-bottom: 1em;
-	width: 96%;
-}
-
-div#content
-{
-	margin: 0px 0px 0px 0px;
-	padding: 4px 4px 4px 4px;
-}
-
-a:link
-{
-	color: #0000ff;
-	background-color: inherit;
-}
-
-a:visited
-{
-	color: #0000ff;
-	background-color: inherit;
-}
-
-a:hover
-{
-	color: #3366ff;
-	background-color: inherit;
-}
-
-
-/* Override site.css */
-
-.centercol {
-	margin-left: 190px;
-	margin-right:20px;
-	max-width: 100%;
-}
-
-.leftcol {
-	width: 160px;
-}
-
-.menu_header, .menu_item {
-	font-size: inherit;
-}
-
-.menu_item:hover {
-  background: #EEEEEE; 
-}
-
diff --git a/doc/downloads.html b/doc/downloads.html
deleted file mode 100755
index be1d11be..00000000
--- a/doc/downloads.html
+++ /dev/null
@@ -1,222 +0,0 @@
-
-
-
-
-
-    
-    
-
-        
-
-    
-    
-    
-    
-    
-        
-            
-
-                                                    
-            
-            
-           
-                                     
- 
-                        
-            
-            
-                            
-            
-            Apache log4net: Downloads
-            
-                    
-
-        
-                    
-          
-
-            
-                             
-     
-       
-       
-     
-   
-               
-
-
-       
- - - - -

log4net Downloads

-
-

Project Status

-
-

- log4net has graduated from the Incubator project, however at the time - the following releases were made, log4net was still undergoing incubation, - therefore these releases are not officially endorsed by the ASF. -

-

- Future releases of log4net will be officially endorsed by the ASF. -

-
-

Stable Releases

-
-

- The following stable releases are available: -

- -
-

Archive Releases

-
- -

- Previous releases of log4net are available from the sourceforge site: -

- -
-
- - - - - -

 

- -
- Copyright © - 2004-2007, - Apache Software Foundation -
- - -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/history.html b/doc/history.html deleted file mode 100755 index c57bd0f2..00000000 --- a/doc/history.html +++ /dev/null @@ -1,203 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Apache log4net: Project History - - - - - - - - - - - - - - - - - -
- - - - -

log4net Project History

-
-

- The log4net project was started by Neoworks Limited - in June 2001. It was created as an internal project within Neoworks to port the Apache - log4j code base to the Microsoft .NET Framework. The code base was initially branched - from a pre-alpha log4j 1.2. -

-

- In July 2001 a Sourceforge project was started - and log4net was published under the Apache Software License. The first public release of - log4net was made in September 2001. A further 10 releases were made on the sourceforge - site. -

-

- In December 2003 the Apache Logging Services project was created. - In February 2004 log4net was donated by Neoworks to the Apache Software Foundation - to become a member of the Logging Services project. -

-

- In February 2007 log4net graduated from the Apache Incubator project to become a - fully fledged Apache project. Apache log4net is a subproject of the Logging Services project. -

-
- - - - - -

 

- -
- Copyright © - 2004-2007, - Apache Software Foundation -
- - -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/index.html b/doc/index.html deleted file mode 100755 index 390e60ec..00000000 --- a/doc/index.html +++ /dev/null @@ -1,280 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Apache log4net: Home - - - - - - - - - - - - - - - - - -
- - - - -

About Apache log4net

-
-

Introduction

-
-

- log4net is a tool to help the programmer output log statements to a variety - of output targets. log4net is a port of the excellent log4j framework to the - .NET runtime. We have kept the framework similar in spirit to the original log4j - while taking advantage of new features in the .NET runtime. - For more information on log4net see the features document. -

-

- log4net is part of the Apache Logging Services - project. The Logging Services project is intended to provide cross-language logging - services for purposes of application debugging and auditing. -

-
-

Contributors

-
-

Active Committers

-
-
    -
  • -

    - Curt Arnold -

    -
  • -
  • -

    - Nicko Cadell -

    -
  • -
  • -

    - Niall Daley -

    -
  • -
  • -

    - Gert Driesen -

    -
  • -
  • -

    - Ron Grabowski -

    -
  • -
-
-

Community Contributors

-
-
    -
  • -

    - Julian Biddle -

    -
  • -
  • -

    - Daniel Cazzulino -

    -
  • -
  • -

    - Aspi Havewala -

    -
  • -
  • -

    - Rick Hobbs -

    -
  • -
  • -

    - Lance Nehring -

    -
  • -
  • -

    - Angelika Schnagl -

    -
  • -
  • -

    - Edward Smit -

    -
  • -
  • -

    - Douglas de la Torre -

    -
  • -
  • -

    - Thomas Voss -

    -
  • -
-
-
-
- - - - - -

 

- -
- Copyright © - 2004-2007, - Apache Software Foundation -
- - -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/license.html b/doc/license.html deleted file mode 100755 index c738cde8..00000000 --- a/doc/license.html +++ /dev/null @@ -1,416 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Apache log4net: License - - - - - - - - - - - - - - - - - -
- - - - -

Apache log4net License

-
-

Current License

-
-

- The Apache Software License Version 2.0 applies to all releases of - log4net starting with log4net 1.2.1. -

- -
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-
-                
- -

- The License is accompanied by this NOTICE: -

- -
-   **
-   **  NOTICE file corresponding to the section 4 (d) of the Apache License, 
-   **  Version 2.0, in this case for the Apache log4net distribution.
-   **
-
-   Please read the LICENSE files present in the root directory of this 
-   distribution.
-
-   Apache log4net
-   Copyright 2001-2007 The Apache Software Foundation
-
-   This product includes software developed at
-   The Apache Software Foundation (http://www.apache.org/).
-
-                
- -
-
- - - - - -

 

- -
- Copyright © - 2004-2007, - Apache Software Foundation -
- - -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/release/building.html b/doc/release/building.html deleted file mode 100755 index b58d413f..00000000 --- a/doc/release/building.html +++ /dev/null @@ -1,360 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Apache log4net: Building log4net - - - - - - - - - - - - - - - - - -
- - - - -

Building log4net

-
-

Contents

- -

- The log4net release builds are built using NAnt. Log4net can also be built - using Visual Studio .NET 2002, 2003, or 2005. -

-

- To build a release build of log4net you will need to create a strong - name key file. See the Strong Name section below. -

-

Visual Studio

-
-

- Visual Studio .NET 2002, 2003 and 2005 are supported build platforms for log4net. -

-

Visual Studio .NET 2002

-
-

- The log4net distribution includes a solution and project file - for Visual Studio .NET 2002. Open the log4net.sln - from the src directory in the distribution. -

-

- The log4net project requires only the following references: -

-
    -
  • System
  • -
  • System.Data
  • -
  • System.Web
  • -
  • System.XML
  • -
-
-

Visual Studio .NET 2003

-
-

- Open the Visual Studio .NET 2002 solution file as above. - Visual Studio will convert the solution and project files - to Visual Studio .NET 2003 format. -

-

- After converting the log4net project you must change the - Conditional Compilation Constants specified for the - log4net project. Open the project properties dialog and - select the Configuration Properties/Build sheet. - Replace the NET_1_0 constant with NET_1_1. - Remember to do this for both Debug and Release configurations. -

-

- The log4net project file is not suitable for building log4net - for the .NET Compact Framework. To build for the Compact Framework - you must create a new C# project for Smart Devices. Configure the - project as a library project. Add all the C# files from the - src directory in the distribution. -

-
-

Visual Studio 2005

-
-

- Open the Visual Studio .NET 2002 solution file as above. - Visual Studio will convert the solution and project files - to Visual Studio .NET 2003 format. -

-

- After converting the log4net project you must change the - Conditional compilation symbols specified for the - log4net project. Open the project properties page and - select the Build sheet. - Replace the NET_1_0 symbol with NET_2_0. - Remember to do this for both Debug and Release configurations. -

-

- In addition the log4net project requires the following new references: -

-
    -
  • System.Configuration
  • -
-

- The log4net project file is not suitable for building log4net - for the .NET Compact Framework. To build for the Compact Framework - you must create a new C# project for Smart Devices. Configure the - project as a library project. Add all the C# files from the - src directory in the distribution. -

-
-
-

NAnt

-
-

- The log4net distribution is built using the NAnt tool. - A recent NAnt version 0.85 nightly build is required to build log4net, this is - available from nant.sourceforge.net. -

-

- To support building log4net for the SSCLI framework the NAnt configuration - files need to be updated to specify the SSCLI framework directory. -

-

- To build log4net from the command line, change directory to the root of the - log4net distribution, ensure that the nant executable is in the - PATH, and then run the following command: -

-
-nant -buildfile:log4net.build compile-all
-

- This command will build log4net for all the supported frameworks - that are available on the current machine. To list all the build - targets that are available run the following command: -

-
-nant -buildfile:log4net.build -projecthelp
-

- Under windows the build.cmd can be used - to script the nant build. This can be called from a different - directory and will locate the correct log4net.build file to use. - For example: -

-
-build.cmd compile-all
-
-

Strong Name

-
-

- In order to build the Release builds of log4net a Strong - Name key is required. -

-

- Use the sn.exe tool in the - .NET Framework SDK to generate a strong name key pair. -

-
-sn -k log4net.snk
-

- The log4net.snk file should be placed in the root of the - log4net distribution, in the same folder as the log4net.build - file. -

-
-

SDK Reference

-
-

- NDoc 1.3 is used to build the log4net SDK documentation. - NDoc is available from ndoc.sourceforge.net. -

-
-

HTML Documentation

-
-

- The log4net HTML documentation is built using Velocity. - The source are XML files in the xdocs/src directory. - Building the documentation requires Java, Ant, and Velocity. - Run ant from within the xdocs directory. -

-
-
- - - - - -

 

- -
- Copyright © - 2004-2007, - Apache Software Foundation -
- - -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/release/config-examples.html b/doc/release/config-examples.html deleted file mode 100755 index e4980eb9..00000000 --- a/doc/release/config-examples.html +++ /dev/null @@ -1,1320 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Apache log4net: Config Examples - - - - - - - - - - - - - - - - - -
- - - - -

log4net Config Examples

-
-

Contents

- -

Overview

-
-

- This document presents example configurations for the built-in appenders. - These configurations are designed to work with the - log4net.Config.DOMConfigurator and the - log4net.Repository.Hierarchy.Hierarchy. -

-

- These examples are by no means exhaustive configurations for the appenders. - For a full list of the parameters that can be specified to each appender and - more details on each options see the SDK documentation for the appender. -

-
-

AdoNetAppender

-
-

- For full details see the SDK Reference entry: log4net.Appender.AdoNetAppender. -

-

- The configuration of the AdoNetAppender depends on the - provider selected for the target database. Here are some examples. -

-

MS SQL Server

-
-

- The following example shows how to configure the AdoNetAppender - to log messages to a SQL Server database. The events are written in batches of 100 - (BufferSize). The ConnectionType specifies the fully qualified type name - for the System.Data.IDbConnection to use to connect to the - database. The ConnectionString is database provider specific. - The CommandText is either a prepared statement or a stored procedure, in this - case it is a prepared statement. Each parameter to the prepared statement or stored procedure - is specified with its name, database type and a layout that renders the value for the - parameter. -

-

- The database table definition is: -

- -
-CREATE TABLE [dbo].[Log] (
-    [Id] [int] IDENTITY (1, 1) NOT NULL,
-    [Date] [datetime] NOT NULL,
-    [Thread] [varchar] (255) NOT NULL,
-    [Level] [varchar] (50) NOT NULL,
-    [Logger] [varchar] (255) NOT NULL,
-    [Message] [varchar] (4000) NOT NULL,
-    [Exception] [varchar] (2000) NULL
-)
-                    
- -

- The appender configuration is: -

- -
-<appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
-    <bufferSize value="100" />
-    <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
-    <connectionString value="data source=[database server];initial catalog=[database name];integrated security=false;persist security info=True;User ID=[user];Password=[password]" />
-    <commandText value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message],[Exception]) VALUES (@log_date, @thread, @log_level, @logger, @message, @exception)" />
-    <parameter>
-        <parameterName value="@log_date" />
-        <dbType value="DateTime" />
-        <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>
-    <parameter>
-        <parameterName value="@exception" />
-        <dbType value="String" />
-        <size value="2000" />
-        <layout type="log4net.Layout.ExceptionLayout" />
-    </parameter>
-</appender>
-                    
- -
-

MS Access

-
-

- This example shows how to write events to an Access Database. -

- -
-<appender name="AdoNetAppender_Access" type="log4net.Appender.AdoNetAppender">
-    <connectionString value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\log\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>
-                    
- -
-

Oracle9i

-
-

- This example shows how to write events to an Oracle9i Database. -

-

- The database table definition is: -

- -
-create table log (
-   Datetime timestamp(3),
-   Thread varchar2(255),
-   Log_Level varchar2(255),
-   Logger varchar2(255),
-   Message varchar2(4000)
-   );
-                    
- -

- The appender configuration is: -

- -
-<appender name="AdoNetAppender_Oracle" type="log4net.Appender.AdoNetAppender">
-    <connectionType value="System.Data.OracleClient.OracleConnection, System.Data.OracleClient, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
-    <connectionString value="data source=[mydatabase];User ID=[user];Password=[password]" />
-    <commandText value="INSERT INTO Log (Datetime,Thread,Log_Level,Logger,Message) VALUES (:log_date, :thread, :log_level, :logger, :message)" />
-    <bufferSize value="128" />
-    <parameter>
-        <parameterName value=":log_date" />
-        <dbType value="DateTime" />
-        <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>
-                    
- -
-

Oracle8i

-
-

- This example shows how to write events to an Oracle8i Database. -

-

- The database table definition is: -

- -
-CREATE TABLE CSAX30.LOG
-(
-      THREAD      VARCHAR2(255),
-      LOG_LEVEL   VARCHAR2(255),
-      LOGGER      VARCHAR2(255),
-      MESSAGE     VARCHAR2(4000)
-)
-TABLESPACE CSAX30D LOGGING
-                    
- -

- The appender configuration is: -

- -
-<appender name="AdoNetAppender_Oracle" type="log4net.Appender.AdoNetAppender">
-    <connectionType value ="System.Data.OracleClient.OracleConnection, System.Data.OracleClient, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
-    <connectionString value="data source=<dsname>;User ID=<userid>;Password=<password>" />
-    <commandText value="INSERT INTO Log (Log_Level,Logger,Message) VALUES (:log_level, :logger, :message)" />
-    <bufferSize value="250" />
-    <parameter>
-        <parameterName value=":log_level" />
-        <layout type="log4net.Layout.PatternLayout">
-            <conversionPattern value="%level" />
-        </layout>
-    </parameter>
-    <parameter>
-        <parameterName value=":logger" />
-        <layout type="log4net.Layout.PatternLayout">
-            <conversionPattern value="%logger" />
-        </layout>
-    </parameter>
-    <parameter>
-        <parameterName value=":message" />
-        <dbType value="String" />
-        <layout type="log4net.Layout.PatternLayout">
-            <conversionPattern value="%message" />
-        </layout>
-    </parameter>
-</appender>
-                    
- -
-

IBM DB2

-
-

- This example shows how to write events to an IBM DB2 8.2 Database. - The following syntax should also work with older DB2 database servers. -

-

- The database table definition is: -

- -
-CREATE TABLE "myschema.LOG" (
-    "ID" INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (
-        START WITH +1
-        INCREMENT BY +1
-        MINVALUE +1
-        MAXVALUE +2147483647
-        NO CYCLE
-        NO CACHE
-        NO ORDER
-    ),
-    "DATE" TIMESTAMP NOT NULL,
-    "THREAD" VARCHAR(255) NOT NULL,
-    "LEVEL" VARCHAR(500) NOT NULL,
-    "LOGGER" VARCHAR(255) NOT NULL,
-    "MESSAGE" VARCHAR(4000) NOT NULL,
-    "EXCEPTION" VARCHAR(2000)
-)
-IN "LRGTABLES";
-                    
- -

- The appender configuration is: -

- -
-<appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
-    <bufferSize value="100" />
-    <connectionType value="IBM.Data.DB2.DB2Connection,IBM.Data.DB2, Version=8.1.2.1" />
-    <connectionString value="server=192.168.0.0;database=dbuser;user Id=username;password=password;persist security info=true" />
-    <commandText value="INSERT INTO myschema.Log (Date,Thread,Level,Logger,Message,Exception) VALUES (@log_date,@thread,@log_level,@logger,@message,@exception)" />
-    <parameter>
-        <parameterName value="@log_date" />
-        <dbType value="DateTime" />
-        <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="500" />
-        <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>
-    <parameter>
-        <parameterName value="@exception" />
-        <dbType value="String" />
-        <size value="2000" />
-        <layout type="log4net.Layout.ExceptionLayout" />
-    </parameter>
-</appender>
-                    
- -
-

SQLite

-
-

- This example shows how to write events to a SQLite Database. - This was tested against v0.21 of the - SQLite .NET provider. -

-

- SQLite doesn't have strongly-typed columns or field lengths but its - recommended you still include this information for readability. - The database table definition is: -

- -
-CREATE TABLE Log (
-    LogId        INTEGER PRIMARY KEY,
-    Date        DATETIME NOT NULL,
-    Level        VARCHAR(50) NOT NULL,
-    Logger        VARCHAR(255) NOT NULL,
-    Message        TEXT DEFAULT NULL
-);
-                    
- -

- The appender configuration is: -

- -
-<appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
-    <bufferSize value="100" />
-    <connectionType value="Finisar.SQLite.SQLiteConnection, SQLite.NET, Version=0.21.1869.3794, Culture=neutral, PublicKeyToken=c273bd375e695f9c" />
-    <connectionString value="Data Source=c:\\inetpub\\wwwroot\\logs\\log4net.db;Version=3;" />
-    <commandText value="INSERT INTO Log (Date, Level, Logger, Message) VALUES (@Date, @Level, @Logger, @Message)" />
-    <parameter>
-        <parameterName value="@Date" />
-        <dbType value="DateTime" />
-        <layout type="log4net.Layout.RawTimeStampLayout" />
-    </parameter>
-    <parameter>
-        <parameterName value="@Level" />
-        <dbType value="String" />
-        <layout type="log4net.Layout.PatternLayout">
-            <conversionPattern value="%level" />
-        </layout>
-    </parameter>
-    <parameter>
-        <parameterName value="@Logger" />
-        <dbType value="String" />
-        <layout type="log4net.Layout.PatternLayout">
-            <conversionPattern value="%logger" />
-        </layout>
-    </parameter>
-    <parameter>
-        <parameterName value="@Message" />
-        <dbType value="String" />
-        <layout type="log4net.Layout.PatternLayout">
-            <conversionPattern value="%message" />
-        </layout>
-    </parameter>
-</appender>
-                    
- -
-
-

AspNetTraceAppender

-
-

- For full details see the SDK Reference entry: log4net.Appender.AspNetTraceAppender. -

-

- The following example shows how to configure the AspNetTraceAppender - to log messages to the ASP.NET TraceContext. The messages are written to the - System.Web.TraceContext.Write method if they are below - level WARN. If they are WARN or above they are written to the - System.Web.TraceContext.Warn method. -

- -
-<appender name="AspNetTraceAppender" type="log4net.Appender.AspNetTraceAppender" >
-    <layout type="log4net.Layout.PatternLayout">
-        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
-    </layout>
-</appender>
-                
- -
-

BufferingForwardingAppender

-
-

- For full details see the SDK Reference entry: log4net.Appender.BufferingForwardingAppender. -

-

- The following example shows how to configure the BufferingForwardingAppender - to buffer 100 messages before delivering them to the ConsoleAppender. -

- -
-<appender name="BufferingForwardingAppender" type="log4net.Appender.BufferingForwardingAppender" >
-    <bufferSize value="100"/>
-    <appender-ref ref="ConsoleAppender" />
-</appender>
-                
- -

- This example shows how to deliver only significant events. A LevelEvaluator - is specified with a threshold of WARN. This means that the events will only - be delivered when a message with level of WARN or higher level is logged. - Up to 512 (BufferSize) previous messages of any level will also be delivered to provide context - information. Messages not sent will be discarded. -

- -
-<appender name="BufferingForwardingAppender" type="log4net.Appender.BufferingForwardingAppender" >
-    <bufferSize value="512" />
-    <lossy value="true" />
-    <evaluator type="log4net.Core.LevelEvaluator">
-        <threshold value="WARN"/>
-    </evaluator>
-    <appender-ref ref="ConsoleAppender" />
-</appender>
-                
- -
-

ColoredConsoleAppender

-
-

- For full details see the SDK Reference entry: log4net.Appender.ColoredConsoleAppender. -

-

- The following example shows how to configure the ColoredConsoleAppender - to log messages to the console. By default the messages are sent to the console - standard output stream. This example shows how to highlight error messages. -

- -
-<appender name="ColoredConsoleAppender" type="log4net.Appender.ColoredConsoleAppender">
-    <mapping>
-        <level value="ERROR" />
-        <foreColor value="White" />
-        <backColor value="Red, HighIntensity" />
-    </mapping>
-    <layout type="log4net.Layout.PatternLayout">
-        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
-    </layout>
-</appender>
-                
- -

- This example shows how to colorize multiple levels. -

- -
-<appender name="ColoredConsoleAppender" type="log4net.Appender.ColoredConsoleAppender">
-    <mapping>
-        <level value="ERROR" />
-        <foreColor value="White" />
-        <backColor value="Red, HighIntensity" />
-    </mapping>
-    <mapping>
-        <level value="DEBUG" />
-        <backColor value="Green" />
-    </mapping>
-    <layout type="log4net.Layout.PatternLayout">
-        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
-    </layout>
-</appender>
-                
- -
-

ConsoleAppender

-
-

- For full details see the SDK Reference entry: log4net.Appender.ConsoleAppender. -

-

- The following example shows how to configure the ConsoleAppender - to log messages to the console. By default the messages are sent to the console - standard output stream. -

- -
-<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
-    <layout type="log4net.Layout.PatternLayout">
-        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
-    </layout>
-</appender>
-                
- -

- This example shows how to direct the log messages to the console error stream. -

- -
-<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
-    <target value="Console.Error" />
-    <layout type="log4net.Layout.PatternLayout">
-        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
-    </layout>
-</appender>
-                
- -
-

EventLogAppender

-
-

- For full details see the SDK Reference entry: log4net.Appender.EventLogAppender. -

-

- The following example shows how to configure the EventLogAppender to log - to the Application event log on the local machine using the - event Source of the AppDomain.FriendlyName. -

- -
-<appender name="EventLogAppender" type="log4net.Appender.EventLogAppender" >
-    <layout type="log4net.Layout.PatternLayout">
-        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
-    </layout>
-</appender>
-                
- -

- This example shows how to configure the EventLogAppender to - use a specific event Source. -

- -
-<appender name="EventLogAppender" type="log4net.Appender.EventLogAppender" >
-    <applicationName value="MyApp" />
-    <layout type="log4net.Layout.PatternLayout">
-        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
-    </layout>
-</appender>
-                
- -

- For more information on how to setup the event log to allow the - EventLogAppender to write to it, see the - FAQ: Why doesn't the EventLogAppender work?. -

-
-

FileAppender

-
-

- For full details see the SDK Reference entry: log4net.Appender.FileAppender. -

-

- The following example shows how to configure the FileAppender - to write messages to a file. The file specified is log-file.txt. The file will - be appended to rather than overwritten each time the logging process starts. -

- -
-<appender name="FileAppender" type="log4net.Appender.FileAppender">
-    <file value="log-file.txt" />
-    <appendToFile value="true" />
-    <layout type="log4net.Layout.PatternLayout">
-        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
-    </layout>
-</appender>
-                
- -

- This example shows how to configure the file name to write to using - an environment variable TMP. The encoding to use to write - to the file is also specified. -

- -
-<appender name="FileAppender" type="log4net.Appender.FileAppender">
-    <file value="${TMP}\log-file.txt" />
-    <appendToFile value="true" />
-    <encoding value="unicodeFFFE" />
-    <layout type="log4net.Layout.PatternLayout">
-        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
-    </layout>
-</appender>
-                
- -

- This example shows how to configure the appender to use the minimal locking - model that allows multiple processes to write to the same file. -

- -
-<appender name="FileAppender" type="log4net.Appender.FileAppender">
-    <file value="${TMP}\log-file.txt" />
-    <appendToFile value="true" />
-    <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
-    <layout type="log4net.Layout.PatternLayout">
-        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
-    </layout>
-</appender>
-                
- -
-

ForwardingAppender

-
-

- For full details see the SDK Reference entry: log4net.Appender.ForwardingAppender. -

-

- The following example shows how to configure the ForwardingAppender. - The forwarding appender allows a set of constraints to be used to decorate an appender. - In this example the ConsoleAppender is decorated with a Threshold of - level WARN. This means that an event directed to the ConsoleAppender - directly will be logged regardless of its level, but an event directed to the ForwardingAppender - will only be passed on to the ConsoleAppender if its level is WARN - or higher. This appender is used only in special circumstances. -

- -
-<appender name="ForwardingAppender" type="log4net.Appender.ForwardingAppender" >
-    <threshold value="WARN"/>
-    <appender-ref ref="ConsoleAppender" />
-</appender>
-                
- -
-

MemoryAppender

-
-

- For full details see the SDK Reference entry: log4net.Appender.MemoryAppender. -

-

- It is unlikely that the MemoryAppender will be configured - using a config file, but if you want to do it here's how. -

- -
-<appender name="MemoryAppender" type="log4net.Appender.MemoryAppender">
-    <onlyFixPartialEventData value="true" />
-</appender>
-                
- -
-

NetSendAppender

-
-

- For full details see the SDK Reference entry: log4net.Appender.NetSendAppender. -

-

- The following example shows how to configure the NetSendAppender - to deliver messages to a specific user's screen. As this appender is typically only - used for important notifications a Threshold of level Error - is specified. This example delivers the messages to the user nicko on the - machine SQUARE. However things are not always straight forward using the Windows - Messenger Service, one possible outcome using this configuration is that the Server - will broadcast looking for a WINS server which it will then ask to deliver the message - to the Recipient, the WINS server will deliver it to the first terminal that the - user logged in from. -

- -
-<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 [%property{NDC}] - %message%newline" />
-    </layout>
-</appender>
-                
- -
-

OutputDebugStringAppender

-
-

- For full details see the SDK Reference entry: log4net.Appender.OutputDebugStringAppender. -

-

- The following example shows how to configure the OutputDebugStringAppender - to write logging messages to the OutputDebugString API. -

- -
-<appender name="OutputDebugStringAppender" type="log4net.Appender.OutputDebugStringAppender" >
-    <layout type="log4net.Layout.PatternLayout">
-        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
-    </layout>
-</appender>
-                
- -
-

RemotingAppender

-
-

- For full details see the SDK Reference entry: log4net.Appender.RemotingAppender. -

-

- The following example shows how to configure the RemotingAppender - to deliver logging events to a specified Sink (in this example - the sink is tcp://localhost:8085/LoggingSink). - In this example the events are delivered in blocks of 95 events because - of the BufferSize. No events are discarded. The OnlyFixPartialEventData - option allows the appender to ignore certain logging event properties that - can be very slow to generate (e.g. the calling location information). -

- -
-<appender name="RemotingAppender" type="log4net.Appender.RemotingAppender" >
-    <sink value="tcp://localhost:8085/LoggingSink" />
-    <lossy value="false" />
-    <bufferSize value="95" />
-    <onlyFixPartialEventData value="true" />
-</appender>
-                
- -

- This example configures the RemotingAppender to - deliver the events only when an event with level ERROR - or above is logged. When the events are delivered, up to 200 (BufferSize) - previous events (regardless of level) will be delivered to provide context. - Events not delivered will be discarded. -

- -
-<appender name="RemotingAppender" type="log4net.Appender.RemotingAppender" >
-    <sink value="tcp://localhost:8085/LoggingSink" />
-    <lossy value="true" />
-    <bufferSize value="200" />
-    <onlyFixPartialEventData value="true" />
-    <evaluator type="log4net.Core.LevelEvaluator">
-        <threshold value="ERROR"/>
-    </evaluator>
-</appender>
-                
- -
-

RollingFileAppender

-
-

- For full details see the SDK Reference entry: log4net.Appender.RollingFileAppender. -

-

- The RollingFileAppender builds on the - FileAppender and has the same options - as that appender. -

-

- The following example shows how to configure the RollingFileAppender - to write to the file log.txt. The file written to will always be called log.txt - because the StaticLogFileName param is specified. The file will be rolled based on - a size constraint (RollingStyle). Up to 10 (MaxSizeRollBackups) - old files of 100 KB each (MaximumFileSize) will be kept. These rolled files will be - named: log.txt.1, log.txt.2, log.txt.3, etc... -

- -
-<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
-    <file value="log.txt" />
-    <appendToFile value="true" />
-    <rollingStyle value="Size" />
-    <maxSizeRollBackups value="10" />
-    <maximumFileSize value="100KB" />
-    <staticLogFileName value="true" />
-    <layout type="log4net.Layout.PatternLayout">
-        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
-    </layout>
-</appender>
-                
- -

- This example show how to configure the RollingFileAppender - to roll log files on a date period. This example will roll the log file every minute! - To change the rolling period adjust the DatePattern value. - For example, a date pattern of "yyyyMMdd" will roll every day. - See System.Globalization.DateTimeFormatInfo for a list of available patterns. -

- -
-<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
-    <file value="logfile" />
-    <appendToFile value="true" />
-    <rollingStyle value="Date" />
-    <datePattern value="yyyyMMdd-HHmm" />
-    <layout type="log4net.Layout.PatternLayout">
-        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
-    </layout>
-</appender>
-                
- -

- This example show how to configure the RollingFileAppender - to roll log files on a date period and within a date period on file size. For each day - only the last 10 files of 1MB will be kept. -

- -
-<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
-    <file value="logfile" />
-    <appendToFile value="true" />
-    <rollingStyle value="Composite" />
-    <datePattern value="yyyyMMdd" />
-    <maxSizeRollBackups value="10" />
-    <maximumFileSize value="1MB" />
-    <layout type="log4net.Layout.PatternLayout">
-        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
-    </layout>
-</appender>
-                
- -

- This example show how to configure the RollingFileAppender - to roll log files once per program execution. The appendToFile - property is set to false to prevent the appender from overwriting - the existing files. The maxSizeRollBackups is set to negative - 1 to allow an infinite number of backup files. The file size does have to be limited but - here it is set to 50 Gigabytes which, if a log file exceeds this size limit during a single - run then it will also be rolled. -

- -
-<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
-    <file value="logfile.txt" />
-    <appendToFile value="false" />
-    <rollingStyle value="Size" />
-    <maxSizeRollBackups value="-1" />
-    <maximumFileSize value="50GB" />
-    <layout type="log4net.Layout.PatternLayout">
-        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
-    </layout>
-</appender>
-                
- -
-

SmtpAppender

-
-

- For full details see the SDK Reference entry: log4net.Appender.SmtpAppender. -

-

- The following example shows how to configure the SmtpAppender - to deliver log events via SMTP email. The To, From, Subject and - SmtpHost are required parameters. - This example shows how to deliver only significant events. A LevelEvaluator - is specified with a threshold of WARN. This means that an email - will be sent for each WARN or higher level message that is logged. - Each email will also contain up to 512 (BufferSize) previous messages of any level to - provide context. Messages not sent will be discarded. -

- -
-<appender name="SmtpAppender" type="log4net.Appender.SmtpAppender">
-    <to value="to@domain.com" />
-    <from value="from@domain.com" />
-    <subject value="test logging message" />
-    <smtpHost value="SMTPServer.domain.com" />
-    <bufferSize value="512" />
-    <lossy value="true" />
-    <evaluator type="log4net.Core.LevelEvaluator">
-        <threshold value="WARN"/>
-    </evaluator>
-    <layout type="log4net.Layout.PatternLayout">
-        <conversionPattern value="%newline%date [%thread] %-5level %logger [%property{NDC}] - %message%newline%newline%newline" />
-    </layout>
-</appender>
-                
- -

- This example shows how to configure the SmtpAppender - to deliver all messages in emails with 512 (BufferSize) messages per - email. -

- -
-<appender name="SmtpAppender" type="log4net.Appender.SmtpAppender">
-    <to value="to@domain.com" />
-    <from value="from@domain.com" />
-    <subject value="test logging message" />
-    <smtpHost value="SMTPServer.domain.com" />
-    <bufferSize value="512" />
-    <lossy value="false" />
-    <layout type="log4net.Layout.PatternLayout">
-        <conversionPattern value="%newline%date [%thread] %-5level %logger [%property{NDC}] - %message%newline%newline%newline" />
-    </layout>
-</appender>
-                
- -

- This example shows a more verbose formatting layout for the mail messages. -

- -
-<appender name="SmtpAppender" type="log4net.Appender.SmtpAppender,log4net">
-    <to value="to@domain.com" />
-    <from value="from@domain.com" />
-    <subject value="test logging message" />
-    <smtpHost value="SMTPServer.domain.com" />
-    <bufferSize value="512" />
-    <lossy value="false" />
-    <evaluator type="log4net.Core.LevelEvaluator,log4net">
-        <threshold value="WARN" />
-    </evaluator>
-    <layout type="log4net.Layout.PatternLayout,log4net">
-        <conversionPattern value="%property{log4net:HostName} :: %level :: %message %newlineLogger: %logger%newlineThread: %thread%newlineDate: %date%newlineNDC: %property{NDC}%newline%newline" />
-    </layout>
-</appender>
-                
- -
-

SmtpPickupDirAppender

-
-

- For full details see the SDK Reference entry: log4net.Appender.SmtpPickupDirAppender. -

-

- The SmtpPickupDirAppender is configured similarly - to the SmtpAppender. The only difference is that rather - than specify a SmtpHost parameter a PickupDir must be specified. -

-

- The PickupDir parameter is a path that must exist and the code executing the - appender must have permission to create new files and write to them in this directory. - The path is relative to the application's base directory (AppDomain.BaseDirectory). -

-

- The following example shows how to configure the SmtpPickupDirAppender - to deliver log events via SMTP email. The To, From, Subject and - PickupDir are required parameters. - This example shows how to deliver only significant events. A LevelEvaluator - is specified with a threshold of WARN. This means that an email - will be sent for each WARN or higher level message that is logged. - Each email will also contain up to 512 (BufferSize) previous messages of any level to - provide context. Messages not sent will be discarded. -

- -
-<appender name="SmtpPickupDirAppender" type="log4net.Appender.SmtpPickupDirAppender">
-    <to value="to@domain.com" />
-    <from value="from@domain.com" />
-    <subject value="test logging message" />
-    <pickupDir value="C:\SmtpPickup" />
-    <bufferSize value="512" />
-    <lossy value="true" />
-    <evaluator type="log4net.Core.LevelEvaluator">
-        <threshold value="WARN"/>
-    </evaluator>
-    <layout type="log4net.Layout.PatternLayout">
-        <conversionPattern value="%newline%date [%thread] %-5level %logger [%property{NDC}] - %message%newline%newline%newline" />
-    </layout>
-</appender>
-                
- -
-

TraceAppender

-
-

- For full details see the SDK Reference entry: log4net.Appender.TraceAppender. -

-

- The following example shows how to configure the TraceAppender - to log messages to the System.Diagnostics.Trace system. - This is the tracing system supplied with the .net base class libraries. - See the MSDN documentation for the System.Diagnostics.Trace - class for more details on how to configure the trace system. -

- -
-<appender name="TraceAppender" type="log4net.Appender.TraceAppender">
-    <layout type="log4net.Layout.PatternLayout">
-        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
-    </layout>
-</appender>
-                
- -
-

UdpAppender

-
-

- For full details see the SDK Reference entry: log4net.Appender.UdpAppender. -

-

- The following example shows how to configure the UdpAppender - to send events to a RemoteAddress on the specified RemotePort. -

- -
-<appender name="UdpAppender" type="log4net.Appender.UdpAppender">
-    <localPort value="8080" />
-    <remoteAddress value="224.0.0.1" />
-    <remotePort value="8080" />
-    <layout type="log4net.Layout.PatternLayout, log4net">
-        <conversionPattern value="%-5level %logger [%property{NDC}] - %message%newline" />
-    </layout>
-</appender>
-                
- -
-
- - - - - -

 

- -
- Copyright © - 2004-2007, - Apache Software Foundation -
- - -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/release/example-apps.html b/doc/release/example-apps.html deleted file mode 100755 index 2d881e50..00000000 --- a/doc/release/example-apps.html +++ /dev/null @@ -1,712 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Apache log4net: Examples - - - - - - - - - - - - - - - - - - - - -
- - - - -

log4net Examples

-
-

Contents

- -

Overview

-
-

- The following examples are only available in the log4net release download, not - on-line. To obtain the examples download one of the log4net releases. - -

-
-

Building Examples

-
-

Building An Example

-
-

- A single example can be build by running nant from - the example directory. -

-

- For example running nant in the - examples\net\1.0\Tutorials\ConsoleApp\cs directory - will build the C# version of the .NET 1.0 ConsoleApp example. -

-

- nant can be run in any directory containing a - nant.build file. The typical behavior of the build file - is to build all projects under the current directory. -

-

- For example running nant in the - examples\net\1.1 directory - will build all the examples for the .NET 1.1 platform. -

-
-

Building All Examples

-
-

- To build all the examples either run nant in the - examples directory or you can specify the - compile-examples target to the main log4net nant build. -

-
-

Visual Studio .NET

-
-

- There are Visual Studio .NET 2002 project files for the .NET 1.0 framework. - The solution files for C# and VB are in the examples\net\1.0 - folder. -

-

- For the Managed C++ project there is a Visual Studio .NET 2003 project file - in the examples\net\1.1 folder. -

-
-
-

Examples

-
-

Tutorial - ConsoleApp

-
-

- ConsoleApp shows how to write a simple console application that initializes - logging and logs various events. -

-

- This example is available for the following platforms and languages. If a version - is not available for your chosen platform and language combination then select the - nearest platform for the appropriate language. -

- -

- To run this example execute ConsoleApp.exe from the build output directory. -

-
-

Tutorial - WebApp

-
-

- ConsoleApp shows how to write a simple ASP.NET web application that initializes - logging and logs various events. -

-

- This example is available for the following platforms and languages. If a version - is not available for your chosen platform and language combination then select the - nearest platform for the appropriate language. -

-
    -
  • - .NET 1.0: - C#, - VB -
  • -
-

- To run this example you need to have an ASP.NET container application to - host the web application, for example IIS. In IIS create a new virtual - directory pointing to the WebApp src directory. Configure IIS to recognize - this virtual directory as an application. Open up a web browser, navigate to - the virtual directory and to the WebForm1.aspx page within it. -

-
-

Remoting - RemotingClient

-
-

- The RemotingClient application is a simple console application that configures - log4net with the RemotingAppender. This appender will attempt to deliver the - logging events to a remoting listener. This example should be run in conjunction - with the RemotingServer. -

-

- This example is available for the following platforms and languages. If a version - is not available for your chosen platform and language combination then select the - nearest platform for the appropriate language. -

-
    -
  • - .NET 1.0: - C# -
  • -
-

- To run this example execute RemotingClient.exe from the build output directory. -

-
-

Remoting - RemotingServer

-
-

- The RemotingServer application is a simple console application that listens for - logging events from a remote RemotingAppender and then logs them through the - local log4net instance. This example should be run in conjunction - with the RemotingClient. -

-

- This example is available for the following platforms and languages. If a version - is not available for your chosen platform and language combination then select the - nearest platform for the appropriate language. -

-
    -
  • - .NET 1.0: - C# -
  • -
-

- To run this example execute RemotingServer.exe from the build output directory. - While this process is running execute the RemotingClient.exe program on - the same machine. The logging events from the client are transferred to the server. -

-
-

Repository - SimpleModule

-
-

- The SimpleModule is a class library that is intended to be used as part of - the SimpleApp example, - This class library uses the log4net.Config.Repository - attribute to create a separate configuration space from other assemblies. -

-

- This example is available for the following platforms and languages. If a version - is not available for your chosen platform and language combination then select the - nearest platform for the appropriate language. -

-
    -
  • - MONO 1.0: - C# -
  • -
  • - .NET 1.0: - C#, - VB -
  • -
  • - .NET 1.1: - JScript.NET -
  • -
  • - SSCLI 1.0: - C# -
  • -
-

- This library is intended to be used as part of the SimpleApp example. -

-
-

Repository - SharedModule

-
-

- The SharedModule is a class library that is intended to be used as part of - the SimpleApp example, - This class library uses log4net but does not attempt to configure logging. -

-

- This example is available for the following platforms and languages. If a version - is not available for your chosen platform and language combination then select the - nearest platform for the appropriate language. -

-
    -
  • - MONO 1.0: - C# -
  • -
  • - .NET 1.0: - C#, - VB -
  • -
  • - .NET 1.1: - JScript.NET -
  • -
  • - SSCLI 1.0: - C# -
  • -
-

- This library is intended to be used as part of the SimpleApp example. -

-
-

Repository - SimpleApp

-
-

- The SimpleApp example uses the SimpleModule and SharedModule to demonstrate - the ways in which multiple assemblies within the same process may be - separately configured. -

-

- This example is available for the following platforms and languages. If a version - is not available for your chosen platform and language combination then select the - nearest platform for the appropriate language. -

-
    -
  • - MONO 1.0: - C# -
  • -
  • - .NET 1.0: - C#, - VB -
  • -
  • - .NET 1.1: - JScript.NET -
  • -
  • - SSCLI 1.0: - C# -
  • -
-

- To run this example execute SimpleApp.exe from the build output directory. -

-
-

Extensibility - EventIDLogApp

-
-

- The EventIDLogApp example demonstrates using the log4net.Ext.EventID extension. - The extension needs to be built separately from the - extensions\net\1.0\log4net.Ext.EventID directory. -

-

- This example is available for the following platforms and languages. If a version - is not available for your chosen platform and language combination then select the - nearest platform for the appropriate language. -

-
    -
  • - .NET 1.0: - C# -
  • -
-

- To run this example execute EventIDLogApp.exe from the build output directory. -

-
-

Extensibility - TraceLogApp

-
-

- The TraceLogApp example demonstrates using the log4net.Ext.Trace extension. - The extension needs to be built separately from the - extensions\net\1.0\log4net.Ext.Trace directory. -

-

- This example is available for the following platforms and languages. If a version - is not available for your chosen platform and language combination then select the - nearest platform for the appropriate language. -

-
    -
  • - .NET 1.0: - C# -
  • -
-

- To run this example execute TraceLogApp.exe from the build output directory. -

-
-

SampleAppenders

-
-

- This project includes the following example appenders. -

-
    -
  • - AsyncAppender -
  • -
  • - FastDbAppender -
  • -
  • - FireEventAppender -
  • -
  • - MessageBoxAppender -
  • -
  • - MessageObjectExpanderAppender -
  • -
  • - MsmqAppender -
  • -
  • - PatternFileAppender -
  • -
  • - SimpleSmtpAppender -
  • -
-

- This example is available for the following platforms and languages. If a version - is not available for your chosen platform and language combination then select the - nearest platform for the appropriate language. -

-
    -
  • - .NET 1.0: - C# -
  • -
-

- To run this example execute SampleAppendersApp.exe from the build output directory. -

-
-

SampleLayouts

-
-

- This project includes the following example layouts. -

-
    -
  • - ForwardingLayout -
  • -
  • - LineWrappingLayout -
  • -
-

- This example is available for the following platforms and languages. If a version - is not available for your chosen platform and language combination then select the - nearest platform for the appropriate language. -

-
    -
  • - .NET 1.0: - C# -
  • -
-

- To run this example execute SampleLayoutsApp.exe from the build output directory. -

-
-

Performance - NotLogging

-
-

- The NotLogging example benchmarks the performance of log4net logging statements in - user code in various scenarios including when logging is disabled. -

-

- This example is available for the following platforms and languages. If a version - is not available for your chosen platform and language combination then select the - nearest platform for the appropriate language. -

-
    -
  • - MONO 1.0: - C# -
  • -
  • - .NET 1.0: - C#, - VB -
  • -
-

-

-
-

WmiAppender

-
-

- The WmiAppender sample shows an example appender that fires events through - Windows Management Instrumentation. -

-

- This example is available for the following platforms and languages. If a version - is not available for your chosen platform and language combination then select the - nearest platform for the appropriate language. -

-
    -
  • - .NET 1.0: - C# -
  • -
-

-

-
-
-
- - - - - -

 

- -
- Copyright © - 2004-2007, - Apache Software Foundation -
- - -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/release/faq.html b/doc/release/faq.html deleted file mode 100755 index d9351eab..00000000 --- a/doc/release/faq.html +++ /dev/null @@ -1,1240 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Apache log4net: Frequently Asked Questions - - - - - - - - - - - - - - - - - -
- - - - -

Apache log4net Frequently Asked Questions

-
-

Contents

-
- Information
- - Configuration
- - Implementing Logging
- - Customization
- - Troubleshooting
- - Miscellaneous
- -
-

Information

-
-

What is log4net?

-
-

- 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 production 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 (and common to all of - the log4x libraries) 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. There - is a tight balance between these two requirements. -

-
-

Back to Top

-

Is log4net a reliable logging system?

-
-

- No. log4net is not reliable. It is a best-effort and fail-stop logging system. -

-

- By fail-stop, we mean that log4net will not throw unexpected exceptions at - run-time potentially causing your application to crash. If for any reason, log4net - throws an uncaught exception (except for ArgumentException and - ArgumentNullException which may be thrown), please send an email - to the - log4net-user@logging.apache.org mailing list. Uncaught exceptions - are handled as serious bugs requiring immediate attention. -

-

- Moreover, log4net will not revert to System.Console.Out - or System.Console.Error 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 - System.Console.Error and System.Diagnostics.Trace - indicating that logging can not be performed. -

-
-

Back to Top

-

What are the prerequisites for log4net?

-
-

- 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). -

-

- Not all frameworks are created equal and some features have been excluded from - some of the builds. See the Framework Support - document for more information. -

-
-

Back to Top

-

Is there example code for using log4net?

-
-

- There is a directory containing examples in log4net\examples. - The examples are broken down by framework. -

-
-

Back to Top

-

What are the features of log4net?

-
-
    -
  • - log4net is optimized for speed.
  • -
  • - log4net is based on a named logger hierarchy.
  • -
  • - log4net is fail-stop but not reliable.
  • -
  • - log4net is thread-safe.
  • -
  • - log4net is not restricted to a predefined set of facilities.
  • -
  • - Logging behavior can be set at runtime using a configuration file. - Configuration files are in XML format.
  • -
  • - log4net is designed to handle exceptions from the start.
  • -
  • - log4net can direct its output to many sinks including: a file, the console, the NT EventLog or even e-mail.
  • -
  • - log4net categorizes logging into levels: DEBUG, INFO, WARN, ERROR and FATAL.
  • -
  • - The format of the log output can be easily changed by implementing a new layout class.
  • -
  • - The target of the log output as well as the writing strategy can be altered by - writing a new appender class.
  • -
  • - log4net supports multiple output appenders per logger.
  • -
-

- See the features overview document for more information on the features of log4net. -

-
-

Back to Top

-

Is log4net thread-safe?

-
-

- Yes, log4net is thread-safe. -

-
-

Back to Top

-

What does log output look like?

-
-

- The log output can be customized in many ways. Moreover, one can completely - override the output format by implementing one's own ILayout -

-

- Here is an example output using PatternLayout with the conversion - pattern %timestamp [%thread] %-5level %logger{2} %ndc - %message%newline -

- -
-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.
-276 [main] DEBUG SortAlgo.SWAP i=1 j=0 - Swapping intArray[0] = 1 and intArray[1] = 0
-290 [main] DEBUG SortAlgo.OUTER i=0 - Outer loop.
-304 [main] INFO  SortAlgo.DUMP - Dump of integer array:
-317 [main] INFO  SortAlgo.DUMP - Element [0] = 0
-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.
- -

- 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 nested diagnostic context (NDC). Note the - nested diagnostic context may be empty as in the first two statements. The text - after the '-' is the message of the statement. -

-
-

Back to Top

-

What are Loggers?

-
-

- The logger concept lies at the heart of log4net's configuration. Loggers are organized into a - hierarchy and give the programmer run-time control on which logging statements - are printed or not. -

-

- Loggers are assigned levels through the configuration of log4net. A log statement is - routed through to the appender depending on its level and its logger. -

-
-

Back to Top

-

Why should I donate my extensions to log4net back to the project?

-
-

- 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. You are free to do whatever you wish with - your proprietary log4net extensions. In particular, you may choose to - never release your extensions to the wider public. For details see the - Apache License, Version 2.0. -

-

- 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. -

-

- 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. -

-

- Unless the proprietary log4net extension is business critical, there is little - reason for not donating your extensions back to the project. -

-
-

Back to Top

-

What should I keep in mind when contributing code?

-
-
    -
  1. - Stick to the existing indentation style even if you hate it. -

    - Alternating between indentation styles makes it hard to understand the source - code. Make it hard on yourself but easier on others. -

    -
  2. -
  3. - Thoroughly test your code. -

    - There is nothing more irritating than finding the bugs in debugging (i.e. logging) code. -

    -
  4. -
  5. - Keep it simple, small and fast. -

    - It's all about the application not about logging. -

    -
  6. -
  7. - Did I mention sticking with the indentation style?
  8. -
-
-

Back to Top

-

How fast do bugs in log4net get fixed?

-
-

- As fast as they get reported ;-) -

-
-

Back to Top

-

What is the history of log4net?

-
-

- log4net is a port of the popular log4j 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 history page for more details. -

-
-

Back to Top

-

Where can I find the latest distribution of log4net?

-
-

- The log4net home page is a good place to start. -

-
-

Back to Top

-
-

Configuration

-
-

How can I change log behavior at runtime?

-
-

- 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. -

-

- Configuration files are specified in XML. See log4net.Config.XmlConfigurator - for more details. -

-

- See the various log4net.Layout and log4net.Appender - components for specific configuration options. -

-
-

Back to Top

-

How do I completely disable all logging at runtime?

-
-

- Setting the Threshold 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: -

- -
-<log4net threshold="OFF" />
- -
-

Back to Top

-

What are the configurable options for an appender?

-
-

- log4net uses public properties to configure components such as - Appenders, Layouts, Loggers etc. -

-

- Thus, any writable public property in on the appender corresponds to a - configurable option. For example, in RollingFileAppender the - public int MaxSizeRollBackups { set; } property corresponds to - the MaxSizeRollBackups option. -

-

- Layouts options are also defined by their writable properties. Same goes for most - other log4net components. -

-
-

Back to Top

-

Is it possible to direct log output to different appenders by level?

-
-

- Yes it is. Setting the Threshold option of any appender extending - AppenderSkeleton, (most log4net appenders extend - AppenderSkeleton) will filter out all log events - with a lower level than the value of the threshold option. -

-

- 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. -

-

- This policy usually best encapsulates what the user actually wants to do, as - opposed to her mind-projected solution. -

-

- If you must filter events by exact level match, then you can attach a - LevelMatchFilter to any appender to filter out logging - events by exact level match. -

-
-

Back to Top

-

Is there a way to get log4net to automatically reload a configuration file if it changes?

-
-

- Yes. The XmlConfigurator supports automatic - reloading through the ConfigureAndWatch APIs. See the API - documentation for more details. -

-
-

Back to Top

-

Can I load an appender from another assembly?

-
-

- Yes. When specifying the type in the configuration file you can give the assembly - qualified name of the type. For example: -

- -
-<appender name="..." type="MyNamespace.MyAppender, MyAssembly">
- -

- The .NET runtime will try to locate the assembly called MyAssembly. - How .NET locates assemblies is beyond the scope of this FAQ. -

-

- 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 System.Type.GetType. - See the next FAQ on how to get the version and public key for an assembly. -

-
-

Back to Top

-

How do I get the Public Key for an assembly?

-
-

- 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 - http://www.aisto.com/roeder/dotnet. -

-
-

Back to Top

-

How do I insert newlines into the layout header?

-
-

- 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. -

- -
-<layout type="log4net.Layout.PatternLayout">
-    <header value="[Header]&#13;&#10;" />
-    <footer value="[Footer]&#13;&#10;" />
-    <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
-</layout>
- -
-

Back to Top

-

How do I use a pattern to set the value of a string property?

-
-

- Log4net supports a pattern syntax for setting string properties similar to the - PatternLayout used to format the output messages. - This pattern syntax can be used by specifying type="log4net.Util.PatternString" - on the string property in the config file. This tells the config parser to pass the - value to the PatternString type before converting the result - to a string. For details on the patterns supported see the - PatternString SDK Reference. -

-

- The following example sets the file name for a FileAppender to include the - current process id by specifying the %processid pattern in the - File property. -

- -
-<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>
- -
-

Back to Top

-
-

Implementing Logging

-
-

Are there any suggested ways for naming loggers?

-
-

- Yes, there are. -

-

- You can name logging loggers by locality. 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: -

-
    -
  • - It is very simple to implement.
  • -
  • - It is very simple to explain to new developers.
  • -
  • - It automatically mirrors your application's own modular design.
  • -
  • - It can be further refined at will.
  • -
  • - Printing the logger automatically gives information on the locality of the - log statement.
  • -
-

- However, this is not the only way for naming loggers. A common alternative - is to name loggers by functional areas. For example, the - "database" logger, "remoting" logger, "security" logger, or the "XML" - logger. -

-

- You may choose to name loggers by functionality and subcategorize by - locality, as in "DATABASE.MyApp.MyClass" or - "DATABASE.MyApp.MyModule.MyOtherClass". -

-

- You are totally free in choosing the names of your loggers. The - log4net package merely allows you to manage your names in a hierarchy. However, - it is your responsibility to define this hierarchy. -

-

- Note: by naming loggers by locality one tends to name things by - functionality, since in most cases the locality relates closely to - functionality. -

-
-

Back to Top

-

How do I get the fully-qualified name of a class in a static block?

-
-

- You can easily retrieve the fully-qualified name of a class in a static block - for class X, with the statement typeof(X).Name. - Note that X is the class name and span an instance. - However because the LogManager.GetLogger method is overloaded - to take an instance of Type as well as string - usually only the type of the class is required. -

-

- Here is the suggested usage template: -

- -
-public class Foo
-{
-    private static readonly ILog log = LogManager.GetLogger(typeof(Foo));
-    ... other code
-}
- -

- An equivalent and more portable solution, though slightly longer, is to use the declaring type - of the static constructor. -

- -
-public class Foo
-{
-    private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
-    ... other code
-}
- -

- Note: the .NET Compact Framework 1.0 does not support System.Reflection.MethodBase.GetCurrentMethod(). -

-
-

Back to Top

-

What is the fastest way of (not) logging?

-
-

- For some logger log, writing, -

- -
-log.Debug("Entry number: " + i + " is " + entry[i]);
- -

- incurs the cost of constructing the message parameter, that is converting both - integer i and entry[i] to - a string, and concatenating intermediate strings. This, regardless of whether - the message will be logged or not. -

-

- If you are worried about speed, then write -

- -
-if(log.IsDebugEnabled) 
-{
-    log.Debug("Entry number: " + i + " is " + entry[i]);
-}
- -

- This way you will not incur the cost of parameter construction if debugging is - disabled for logger log. 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 IsDebugEnabled and once in Debug. - This is an insignificant overhead since evaluating a logger takes less than - 1% of the time it takes to actually log a statement. -

-
-

Back to Top

-

What is REALLY the FASTEST way of (not) logging?

-
-

- 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: -

- -
-if(log.IsDebugEnabled) 
-{
-    log.Debug("Entry number: " + i + " is " + entry[i]);
-}
- -

- It is possible to further eliminate the calls to IsDebugEnabled - 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: -

- -
-public class FastLogger
-{
-    private static readonly ILog log = LogManager.GetLogger(typeof(FastLogger));
-    private static readonly bool isDebugEnabled = log.IsDebugEnabled;
-
-    public void MyMethod()
-    {
-        if(isDebugEnabled) 
-        {
-            log.Debug("Entry number: " + i + " is " + entry[i]);
-        }
-    }
-}
- -

- So why exactly is this faster? Well to start with the IsDebugEnabled - is not called for each log statement, it is called once per logger. Furthermore as the - isDebugEnabled variable is private static readonly - the JIT compiler can at run-time optimize out the if 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. -

-

- 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 XmlConfigurator.ConfigureAndWatch 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. -

-
-

Back to Top

-

Can the outputs of multiple client request go to different log files?

-
-

- 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. -

-

- It is simpler to use a context property or stack (ThreadContext). - Typically, one would ThreadContext.Properties["ID"] = "XXX" - 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. -

-

- See the ThreadContext and the PatternLayout classes for more - information. -

-
-

Back to Top

-

Logger instances seem to be create only. Why isn't there a method to remove logger instances?

-
-

- It is quite nontrivial to define the semantics of a "removed" logger which is - still referenced by the user. -

-
-

Back to Top

-

How do I get multiple process to log to the same file?

-
-

- By default the FileAppender holds an exclusive write - lock on the log file while it is logging. This prevents other processes from - writing to the file. The FileAppender can be configured - to use a different locking model, MinimalLock, that - 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 loss in performance. - See the FileAppender config examples - for an example MinimalLock configuration. -

-

- While the MinimalLock model may be used to interleave - writes to a single file it may not be the optimal solution, especially when - logging from multiple machines. Alternatively you may have one or more processes - log to RemotingAppenders. - Using the RemoteLoggingServerPlugin (or - IRemoteLoggingSink) a process can receive all the events and - log them to a single log file. -

-
-

Back to Top

-

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?

-
-

- The timestamp is created when the logging event is created. That is so say, - when the Debug, Info, - Warn, Error - or Fatal 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 RemotingAppender, - 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. -

-
-

Back to Top

-

When should I log my first message?

-
-

- The simple answer is as soon as possible. The long answer is more complex. -

-

- If you are configuring log4net programmatically, i.e. by calling the - XmlConfigurator.Configure method then you should do so - before you begin logging and it is reasonable to do this very soon after application - start. -

-

- 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 LogManager.GetLogger is made. It is necessary - that the first call to LogManager.GetLogger 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. -

-
-

Back to Top

-
-

Customization

-
-

Can the log output format be customized?

-
-

- Yes. You can implement the log4net.Layout.ILayout - interface to create you own customized log format, or you can extend the - LayoutSkeleton class which provides a default - implementation of the ILayout interface. - Appenders can be parameterized to use the layout of your choice. -

-
-

Back to Top

-

Can I write a custom appender?

-
-

- Yes. You can implement the log4net.Appender.IAppender - interface to create you own customized appender. We recommend that you extend the - log4net.Appender.AppenderSkeleton 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 log4net.Appender.TraceAppender as an - example of the minimum amount of code required to get an appender working. -

-

- 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: -

- -
-<appender name="..." type="MyNamespace.MyAppender, MyAssembly">
- -

- The .NET runtime will try to locate the assembly called MyAssembly. - How .NET locates assemblies is beyond the scope of this FAQ. -

-
-

Back to Top

-
-

Troubleshooting

-
-

How do I enable log4net internal debugging?

-
-

- There are 2 different ways to enable internal debugging in log4net. - These are listed below. The preferred method is to specify - the log4net.Internal.Debug option in the application's - config file. -

-
    -
  • -

    - 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 log4net.Internal.Debug - application setting must be set to the value true. - For example: -

    -
    -<?xml version="1.0" encoding="utf-8" ?>
    -<configuration>
    -    <appSettings>
    -        <add key="log4net.Internal.Debug" value="true"/>
    -    </appSettings>
    -</configuration>
    -

    - This setting is read immediately on startup an will cause all internal - debugging messages to be emitted. -

    -
  • -
  • -

    - To enable log4net's internal debug programmatically you need - to set the log4net.Util.LogLog.InternalDebugging - property to true. Obviously the sooner this - is set the more debug will be produced. -

    -
  • -
-

- Internal debugging messages are written to the console and to the - System.Diagnostics.Trace - 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 System.Console.Out. 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 - http://www.sysinternals.com - may be used to capture these messages. -

-

- As log4net internal debug messages are written to the System.Diagnostics.Trace - 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: -

-
-<configuration>
-    ...
-    
-    <system.diagnostics>
-        <trace autoflush="true">
-            <listeners>
-                <add 
-                    name="textWriterTraceListener" 
-                    type="System.Diagnostics.TextWriterTraceListener" 
-                    initializeData="C:\tmp\log4net.txt" />
-            </listeners>
-        </trace>
-    </system.diagnostics>
-
-    ...
-</configuration>
-

- Make sure that the process running your application has permission - to write to this file. -

-
-

Back to Top

-

Why doesn't the EventLogAppender work?

-
-

- 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. -

-

- 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. -

-

- There are a couple of solutions: -

-
    -
  1. -

    - Make the ASPNET user a member of the Administrators group. This will work because the - user will then have the required permissions. This is not recommended - for production use. -

    -
  2. -
  3. -

    - 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 - System.Diagnostics.EventLogInstaller in the Microsoft .NET - Framework SDK for an example of how to create a simple event log installer. -

    -
  4. -
-

- There is a Microsoft Knowledge Base article that covers this issue and how to resolve - it. - PRB: "Requested Registry Access Is Not Allowed" Error Message When ASP.NET - Application Tries to Write New EventSource in the EventLog. -

-
-

Back to Top

-

Why can't I log to a FileAppender from a web application?

-
-

- 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. -

-
-

Back to Top

-

Why doesn't the logging in my service work?

-
-

- 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. -

-

- A windows service is launched by windows. The current directory in - a service is set to the windows system directory (e.g. - C:\Windows\System32). 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 - AppDomain.BaseDirectory. - Note that the log4net internals never use the current directory. -

-
-

Back to Top

-

I am having trouble using the AdoNetAppender to connect to my database?

-
-

- For details on the different ways in which ADO.NET can connect to a database see: - Connecting to a Data Source Using ADO.NET. -

-

- 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: - ODBC .NET Data Provider. -

-
-

Back to Top

-

How do I report bugs?

-
-

- See the support page for details. -

-
-

Back to Top

-
-

Miscellaneous

-
-

How do I make log4net appear in the Visual Studio Add References dialog?

-
-

- There is a good discussion of this topic on Robert McLaws blog: - Building a Better Server Control Experience, Part 2. -

-
-

Back to Top

-
-
- - - - - -

 

- -
- Copyright © - 2004-2007, - Apache Software Foundation -
- - -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/release/features.html b/doc/release/features.html deleted file mode 100755 index 67d14e95..00000000 --- a/doc/release/features.html +++ /dev/null @@ -1,462 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Apache log4net: Features - - - - - - - - - - - - - - - - - -
- - - - -

log4net Features

-
-

Contents

- -

Overview

-
-

- 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. -

-

- log4net is designed with two distinct goals in mind: speed and flexibility -

-
-

Features

-
-
    -
  • Support for multiple frameworks

  • -
  • Output to multiple logging targets

  • -
  • Hierarchical logging architecture

  • -
  • XML Configuration

  • -
  • Dynamic Configuration

  • -
  • Logging Context

  • -
  • Proven architecture

  • -
  • Modular and extensible design

  • -
  • High performance with flexibility

  • -
-
-

Support for multiple frameworks

-
-

- log4net runs on all ECMA CLI 1.0 compatible runtimes. - log4net has specific builds for the following frameworks: -

-
    -
  • Microsoft .NET Framework 1.0 (1.0.3705)
  • -
  • Microsoft .NET Framework 1.1 (1.1.4322)
  • -
  • Microsoft .NET Framework 2.0 (2.0.50727)
  • -
  • Microsoft .NET Compact Framework 1.0
  • - -
  • Mono 1.0
  • -
  • Mono 2.0
  • -
  • Microsoft Shared Source CLI 1.0
  • -
  • CLI 1.0 Compatible
  • -
-

- Note: Due to the .NET frameworks support for backward compatibility - log4net will run on future versions of the runtimes listed above. -

-
-

Output to multiple logging targets

-
-

- log4net ships with the following appenders (not on all frameworks): -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Type - Description
log4net.Appender.AdoNetAppender - Writes logging events to a database using either prepared statements or stored - procedures. -
log4net.Appender.AnsiColorTerminalAppender - Writes color highlighted logging events to a an ANSI terminal window. -
log4net.Appender.AspNetTraceAppender - 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. -
log4net.Appender.ColoredConsoleAppender - Writes color highlighted logging events to the application's Windows Console. -
log4net.Appender.ConsoleAppender - Writes logging events to the application's Console. The events may go to either - the standard our stream or the standard error stream. -
log4net.Appender.EventLogAppender - Writes logging events to the Windows Event Log. -
log4net.Appender.FileAppender - Writes logging events to a file in the file system. -
log4net.Appender.LocalSyslogAppender - Writes logging events to the local syslog service (UNIX only). -
log4net.Appender.MemoryAppender - Stores logging events in an in memory buffer. -
log4net.Appender.NetSendAppender - Writes logging events to the Windows Messenger service. These messages are - displayed in a dialog on a users terminal. -
log4net.Appender.OutputDebugStringAppender - 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. -
log4net.Appender.RemoteSyslogAppender - Writes logging events to a remote syslog service using UDP networking. -
log4net.Appender.RemotingAppender - Writes logging events to a remoting sink using .NET remoting. -
log4net.Appender.RollingFileAppender - 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. -
log4net.Appender.SmtpAppender - Sends logging events to an email address. -
log4net.Appender.TelnetAppender - Clients connect via Telnet to receive logging events. -
log4net.Appender.TraceAppender - Writes logging events to the .NET trace system. -
log4net.Appender.UdpAppender - Sends logging events as connectionless UDP datagrams to a remote host or a - multicast group using a UdpClient. -
-
-

-

-

Hierarchical logging architecture

-
-

- 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. -

-
-

XML 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 - flexibility to express all configurations. -

-

- Alternatively log4net can be configured programmatically. -

-
-

Dynamic Configuration

-
-

- 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 - terminating the process in question. This can a very valuable tool in - investigating issues with deployed applications. -

-
-

Logging Context

-
-

- 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 - logged as part of each subsequent logging message made from the same thread. -

-
-

Proven architecture

-
-

- log4net is based on the highly successful log4j logging library, - in development since 1996. This popular and proven architecture has - so far been ported to 12 languages. -

-
-
- - - - - -

 

- -
- Copyright © - 2004-2007, - Apache Software Foundation -
- - -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/release/framework-support.html b/doc/release/framework-support.html deleted file mode 100755 index 91d86482..00000000 --- a/doc/release/framework-support.html +++ /dev/null @@ -1,773 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Apache log4net: Supported Frameworks - - - - - - - - - - - - - - - - - -
- - - - -

log4net Supported Frameworks

-
-

Contents

- -

Summary of .NET frameworks supported by log4net

-
-

- 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. -

-

- 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. -

-

- While the number of different builds available may seem confusing, you only need to select the - nearest build for your platform that is equal to or earlier than your chosen deployment framework. - If you intend to deploy your application on the Microsoft .NET Framework 1.0 don't pick the - log4net build that is built against the Microsoft .NET Framework 1.1 because the .NET framework - does not guarantee forward compatibility only backward compatibility. -

-

- The lowest common denominator build is the CLI 1.0 Compatible build. This build is compatible with - the ECMA/ISO CLI 1.0 standard APIs and will run on all frameworks that support the standard. (Note - that the Microsoft .NET Compact Framework does not support this standard). Use this build if you - intend to deploy you application on both the Microsoft .NET Frameworks and the Mono frameworks. -

-

- log4net now builds on 6 frameworks: -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameworkWebsite
Microsoft .NET Framework 1.0 (1.0.3705)http://msdn.microsoft.com/net
Microsoft .NET Framework 1.1 (1.1.4322)http://msdn.microsoft.com/net
Microsoft .NET Framework 2.0 (2.0.50727)http://msdn.microsoft.com/net
Microsoft .NET Compact Framework 1.0http://msdn2.microsoft.com/en-us/netframework/aa497273.aspx
Mono 1.2.3http://www.mono-project.com
Microsoft Shared Source CLI 1.0http://msdn.microsoft.com/library/en-us/dndotnet/html/mssharsourcecli.asp
CLI 1.0 Compatiblehttp://msdn.microsoft.com/net/ecma/
-
-

- For each of these frameworks a log4net assembly targeting the framework is supplied. Although it's - perfectly possible to use the .NET Framework 1.0 version of log4net on the .NET Framework 1.1, having - an assembly that really targets a specific framework allows us to use features in that framework that - are not available in other frameworks or remove features from log4net that are not supported in a - specific framework. -

-
-

Appenders

-
-

- The appenders available to each framework depend on the functionality of the - framework and the platform it runs on: -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Appender.NET Framework 1.0.NET Framework 1.1.NET Framework 2.0.NET CF 1.0Mono 1.2Shared Source CLI 1.0CLI 1.0 Compatible
AdoNetAppenderxxxxx - x
AnsiColorTerminalAppenderxxxxxxx
AspNetTraceAppenderxxx - x - x
BufferingForwardingAppenderxxxxxxx
ColoredConsoleAppenderxxx - - - -
ConsoleAppenderxxxxxxx
DebugAppenderxxxxxxx
EventLogAppenderxxx - x - x
FileAppenderxxxxxxx
ForwardingAppenderxxxxxxx
LocalSyslogAppenderxxx - x - x
MemoryAppenderxxxxxxx
NetSendAppenderxxx - - - -
OutputDebugStringAppenderxxxx - - -
RemoteSyslogAppenderxxxxxxx
RemotingAppenderxxx - xxx
RollingFileAppenderxxxxxxx
SmtpAppenderxxx - x - x
SmtpPickupDirAppenderxxxxxxx
TelnetAppenderxxxxxxx
TraceAppenderxxxxxxx
UdpAppenderxxxxxxx
-
-
-

Framework Specific Notes

-
-

Microsoft .NET Framework 1.0 (1.0.3705)

-
-

- none -

-
-

Microsoft .NET Framework 1.1 (1.1.4322)

-
-

- none -

-
-

Microsoft .NET Framework 2.0 (2.0.50727)

-
-

- none -

-
-

Microsoft .NET Compact Framework 1.0

-
-
    -
  • -

    Assembly attributes

    -

    - The .NET Compact Framework 1.0 does not support retrieving assembly level - attributes, therefore all log4net configuration attributes were removed from - the .NET Compact Framework 1.0 version of log4net. -

    -

    - For Smart-device applications, the log4net system can be configured by passing - the location of the log4net configuration file to the - log4net.Config.XmlConfigurator.Configure(FileInfo) - method in the entry point of the application. -

    -

    For example:

    -

    -

    -namespace TestApp
    -{
    -    using System.IO;
    -
    -    public class EntryPoint
    -    {
    -        /// <summary>
    -        /// Application entry point.
    -        /// </summary>
    -        public static void Main() 
    -        {
    -            // Uncomment the next line to enable log4net internal debugging
    -            // log4net.Util.LogLog.InternalDebugging = true;
    -
    -            // This will instruct log4net to look for a configuration file
    -            // called config.log4net in the root directory of the device
    -            log4net.Config.XmlConfigurator.Configure(new FileInfo(@"\config.log4net"));
    -
    -            ...
    -            
    -            // This will shutdown the log4net system
    -            log4net.LogManager.Shutdown();
    -        }
    -    }
    -}                        
    -                            
    -
  • -
  • -

    Notification events

    -

    - The .NET Compact Framework 1.0 does not support notification events during the - application shutdown, therefore log4net cannot automatically hook the - application shutdown notification. -

    -

    - Applications will need to programmatically shutdown the log4net system during - the application's shutdown using the - log4net.LogManager.Shutdown() - method in order to prevent losing logging events. - See the code above for an example. -

    -
  • -
  • -

    FileSystemWatcher

    -

    - The .NET Compact Framework 1.0 does not support the - System.IO.FileSystemWatcher - class. As a result, the - XmlConfiguratorAttribute.Watch - property and the - XmlConfigurator.ConfigureAndWatch - methods are not available. Watching changes to the log4net configuration - file is not supported on the .NET Compact Framework 1.0. -

    -
  • -
  • -

    UserName

    -

    - The .NET Compact Framework 1.0 does not support the - System.Security.Principal.WindowsIdentity class. - This is used to capture the current thread's user identity. Therefore - the LoggingEvent.UserName property will return the value - "NOT AVAILABLE". -

    -
  • -
  • -

    Identity

    -

    - The .NET Compact Framework 1.0 does not support the - System.Security.Principal.IPrincipal interface. - This is used to capture the current thread's user identity. Therefore - the LoggingEvent.Identity property will return the value - "NOT AVAILABLE". -

    -
  • -
  • -

    Environment variables

    -

    - The .NET Compact Framework 1.0 does not support retrieving environment - variables, therefore it's not possible to substitute environment variables in - parameter values when using the .NET Compact Framework 1.0 version of log4net. -

    -
  • -
  • -

    Serialization

    -

    - The .NET Compact Framework 1.0 does not support serialization, therefore none of - the log4net classes in the .NET Compact Framework 1.0 version are serializable. -

    -
  • -
  • -

    LoggingEvent.Domain

    -

    - The .NET Compact Framework 1.0 does not support AppDomain functionality. The - friendly name for the current AppDomain is stored in the LoggingEvent.Domain - property and is accessed using the %a pattern of the - PatternLayout. On the .NET Compact Framework 1.0 this - value is generated by taking the file name for the application's primary module. -

    -
  • -
-
-

Mono

-
-

- There are 2 separate builds of log4net for mono; Mono 1.0, built using the C# compiler in a mode - which is compatible with the CLI 1.0 language specification, and; Mono 2.0, built using the .NET - 2.0 extensions to the C# language. -

-

Mono 1.0

-
-

- none -

-
-

Mono 2.0

-
-

- none -

-
-
-

Microsoft Shared Source CLI 1.0

-
-
    -
  • -

    FileSystemWatcher

    -

    - SSCLI 1.0 does not support the - System.IO.FileSystemWatcher - class. As a result, the - XmlConfiguratorAttribute.Watch - property and the - XmlConfigurator.ConfigureAndWatch - methods are not available. Watching changes to the log4net configuration - file is not supported on SSCLI 1.0. -

    -
  • -
  • -

    UserName

    -

    - SSCLI 1.0 does not support the - System.Security.Principal.WindowsIdentity class. - This is used to capture the current thread's user identity. Therefore - the LoggingEvent.UserName property will return the value - "NOT AVAILABLE". -

    -
  • -
  • -

    Identity

    -

    - SSCLI 1.0 does not support the - System.Security.Principal.IPrincipal interface. - This is used to capture the current thread's user identity. Therefore - the LoggingEvent.Identity property will return the value - "NOT AVAILABLE". -

    -
  • -
-
-

CLI 1.0 Compatible

-
-

- This build of log4net is designed to run on any ECMA CLI 1.0 compatible runtime. - The assembly does not support any platform specific features. The build includes - the common subset of functionality found in the .NET 1.0 and Mono 1.0 builds. - The output assembly is built using the Microsoft .NET 1.0 compiler and library. -

-

- The log4net CLI 1.0 assembly is runtime compatible with the following frameworks: -

-
    -
  • Microsoft .NET Framework 1.0 (and higher)
  • -
  • Mono 1.0 (and higher)
  • -
-

- Only a Release build is generated for this configuration because the assembly - debugging information has not been standardized. -

-
-
-
- - - - - -

 

- -
- Copyright © - 2004-2007, - Apache Software Foundation -
- - -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/release/howto/chainsaw.html b/doc/release/howto/chainsaw.html deleted file mode 100755 index a6eef08e..00000000 --- a/doc/release/howto/chainsaw.html +++ /dev/null @@ -1,276 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Apache log4net: How To view logging events using Apache log4j Chainsaw - - - - - - - - - - - - - - - - - -
- - - - -

How To view logging events using Apache log4j Chainsaw

-
-

Contents

- -

- Apache log4j includes Chainsaw - a graphical log viewer. -

-

- Chainsaw can either receive and display log events in realtime over - the network, or it can load a previously created log file. -

-

- Before Chainsaw can display data, one or more receivers must be setup. - This is usually done by specifying an xml config file when the program - first starts up.
- Save one or more of the sample xml config files to your local system and - load them when Chainsaw starts. -

-

Logging via UDP

-
-

- log4net can be configured to log messages via UDP in such a way that Chainsaw - can receive and display them. -

-

log4net UDP Configuration

-
-

- Configure log4net to use a UdpAppender with the following config snippet: -

- -
-<appender name="UdpAppender" type="log4net.Appender.UdpAppender">
-    <remoteAddress value="127.0.0.1" />
-    <remotePort value="8080" />
-    <layout type="log4net.Layout.XmlLayoutSchemaLog4j">
-        <locationInfo value="true" />
-    </layout>
-</appender>
- -
-

Chainsaw UDP receiver Configuration

-
-

- Chainsaw should be configured to start a UDPReceiver using the - following configuration document: -

- -
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> 
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="true">    
-    <plugin name="UDPReceiver" class="org.apache.log4j.net.UDPReceiver">
-        <param name="Port" value="8080" />
-    </plugin>    
-</log4j:configuration>
- -
-
-

Logging to XML file

-
-

- Chainsaw can also load an XML log file if it is formatted according - to the log4j schema. Use the following log4net config to output - to file using the log4j schema: -

- -
-<appender name="FileAppender" type="log4net.Appender.FileAppender">
-    <file value="log-file.txt" />
-    <appendToFile value="true" />
-    <layout type="log4net.Layout.XmlLayoutSchemaLog4j">
-        <locationInfo value="true" />
-    </layout>
-</appender>
- -

- To load the file into Chainsaw drag the file into the Chainsaw - app and drop it on the tab labeled Drag & Drop log files here. -

-
-
- - - - - -

 

- -
- Copyright © - 2004-2007, - Apache Software Foundation -
- - -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/release/howto/index.html b/doc/release/howto/index.html deleted file mode 100755 index 6ac5c06e..00000000 --- a/doc/release/howto/index.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Apache log4net: How Tos - - - - - - - - - - - - - - - - - -
- - - - -

log4net How Tos

-
-

- Below are presented, in no particular order, a series of documents - on how to get stuff done. -

-

- New documents can be contributed via the issue tracking system. - See the Contributing page for - details. -

- -
- - - - - -

 

- -
- Copyright © - 2004-2007, - Apache Software Foundation -
- - -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/release/manual/configuration.html b/doc/release/manual/configuration.html deleted file mode 100755 index 1a82748d..00000000 --- a/doc/release/manual/configuration.html +++ /dev/null @@ -1,1437 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Apache log4net Manual: Configuration - - - - - - - - - - - - - - - - - -
- - - - -

log4net Manual - Configuration

-
-

Contents

- -

Configuration

-
-

- Inserting log requests into the application code requires a fair amount of - planning and effort. Observation shows that approximately 4 percent of code is - dedicated to logging. Consequently, even moderately sized applications will - have thousands of logging statements embedded within their code. Given their - number, it becomes imperative to manage these log statements without the need - to modify them manually. -

-

- The log4net environment is fully configurable programmatically. However, it is - far more flexible to configure log4net using configuration files. Currently, - configuration files are written in XML. -

-

- Let us give a taste of how this is done with the help of an imaginary - application - MyApp - that uses log4net. -

-
-using Com.Foo;
-
-// Import log4net classes.
-using log4net;
-using log4net.Config;
-
-public class MyApp 
-{
-    // Define a static logger variable so that it references the
-    // Logger instance named "MyApp".
-    private static readonly ILog log = LogManager.GetLogger(typeof(MyApp));
-
-    static void Main(string[] args) 
-    {
-        // Set up a simple configuration that logs on the console.
-        BasicConfigurator.Configure();
-
-        log.Info("Entering application.");
-        Bar bar = new Bar();
-        bar.DoIt();
-        log.Info("Exiting application.");
-    }
-}
-

- MyApp - begins by importing log4net related classes. It then defines a static logger - variable with the name - MyApp - which happens to be the fully qualified name of the class. -

-

- MyApp - uses the following - Bar - class: -

-
-// Import log4net classes.
-using log4net;
-
-namespace Com.Foo
-{
-    public class Bar 
-    {
-        private static readonly ILog log = LogManager.GetLogger(typeof(Bar));
-
-        public void DoIt()
-        {
-            log.Debug("Did it again!");
-        }
-    }
-}
-

- The invocation of the - BasicConfigurator.Configure() - method creates a rather simple log4net setup. This method is hardwired to add - to the root logger a - ConsoleAppender. The output will be formatted using a - PatternLayout - set to the pattern - "%-4timestamp [%thread] %-5level %logger %ndc - %message%newline". -

-

- Note that by default, the root logger is assigned to - Level.DEBUG. -

-

- The output of MyApp is: -

- -
-0    [main] INFO  MyApp  - Entering application.
-36   [main] DEBUG Com.Foo.Bar  - Did it again!
-51   [main] INFO  MyApp  - Exiting application.
- -

- As a side note, let me mention that in log4net child loggers link only to their - existing ancestors. In particular, the logger named - Com.Foo.Bar - is linked directly to the - root - logger, thereby circumventing the unused - Com - or - Com.Foo - loggers. This significantly increases performance and reduces log4net's memory - footprint. -

-

- The - MyApp - class configures log4net by invoking - BasicConfigurator.Configure() - method. Other classes only need to import the - log4net - namespace, retrieve the loggers they wish to use, and log away. -

-

- The previous example always outputs the same log information. Fortunately, it - is easy to modify - MyApp - so that the log output can be controlled at run-time. Here is a slightly - modified version. -

-
-using Com.Foo;
-
-// Import log4net classes.
-using log4net;
-using log4net.Config;
-
-public class MyApp 
-{
-    private static readonly ILog log = LogManager.GetLogger(typeof(MyApp));
-
-    static void Main(string[] args) 
-    {
-        // BasicConfigurator replaced with XmlConfigurator.
-        XmlConfigurator.Configure(new System.IO.FileInfo(args[0]));
-
-        log.Info("Entering application.");
-        Bar bar = new Bar();
-        bar.DoIt();
-        log.Info("Exiting application.");
-    }
-}
-

- This version of - MyApp - instructs the - XmlConfigurator - to parse a configuration file and set up logging accordingly. The path to the - configuration file is specified on the command line. -

-

- Here is a sample configuration file that results in exactly same output as the - previous - BasicConfigurator - based example. -

- -
-<log4net>
-    <!-- A1 is set to be a ConsoleAppender -->
-    <appender name="A1" type="log4net.Appender.ConsoleAppender">
-
-        <!-- A1 uses PatternLayout -->
-        <layout type="log4net.Layout.PatternLayout">
-            <conversionPattern value="%-4timestamp [%thread] %-5level %logger %ndc - %message%newline" />
-        </layout>
-    </appender>
-    
-    <!-- Set root logger level to DEBUG and its only appender to A1 -->
-    <root>
-        <level value="DEBUG" />
-        <appender-ref ref="A1" />
-    </root>
-</log4net>
- -

- Suppose we are no longer interested in seeing the output of any component - belonging to the - Com.Foo - package. The following configuration file shows one possible way of achieving - this. -

- -
-<log4net>
-    <!-- A1 is set to be a ConsoleAppender -->
-    <appender name="A1" type="log4net.Appender.ConsoleAppender">
-
-        <!-- A1 uses PatternLayout -->
-        <layout type="log4net.Layout.PatternLayout">
-            <!-- Print the date in ISO 8601 format -->
-            <conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" />
-        </layout>
-    </appender>
-    
-    <!-- Set root logger level to DEBUG and its only appender to A1 -->
-    <root>
-        <level value="DEBUG" />
-        <appender-ref ref="A1" />
-    </root>
-    
-    <!-- Print only messages of level WARN or above in the package Com.Foo -->
-    <logger name="Com.Foo">
-        <level value="WARN" />
-    </logger>
-</log4net>
- -

- The output of - MyApp - configured with this file is shown below. -

- -
-2000-09-07 14:07:41,508 [main] INFO  MyApp - Entering application.
-2000-09-07 14:07:41,529 [main] INFO  MyApp - Exiting application.
- -

- As the logger - Com.Foo.Bar - does not have an assigned level, it inherits its level from - Com.Foo, which was set to WARN in the configuration - file. The log statement from the - Bar.DoIt - method has the level DEBUG, lower than the logger level WARN. Consequently, - DoIt() - method's log request is suppressed. -

-

- Here is another configuration file that uses multiple appenders. -

- -
-<log4net>
-    <appender name="Console" type="log4net.Appender.ConsoleAppender">
-        <layout type="log4net.Layout.PatternLayout">
-            <!-- Pattern to output the caller's file name and line number -->
-            <conversionPattern value="%5level [%thread] (%file:%line) - %message%newline" />
-        </layout>
-    </appender>
-    
-    <appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
-        <file value="example.log" />
-        <appendToFile value="true" />
-        <maximumFileSize value="100KB" />
-        <maxSizeRollBackups value="2" />
-
-        <layout type="log4net.Layout.PatternLayout">
-            <conversionPattern value="%level %thread %logger - %message%newline" />
-        </layout>
-    </appender>
-    
-    <root>
-        <level value="DEBUG" />
-        <appender-ref ref="Console" />
-        <appender-ref ref="RollingFile" />
-    </root>
-</log4net>
- -

- Calling the enhanced MyApp with the this configuration file will output the - following on the console. -

- -
- INFO [main] (MyApp.cs:16) - Entering application.
-DEBUG [main] (Bar.cs:12) - Doing it again!
- INFO [main] (MyApp.cs:19) - Exiting application.
- -

- In addition, as the root logger has been allocated a second appender, output - will also be directed to the - example.log - file. This file will be rolled over when it reaches 100KB. When roll-over - occurs, the old version of - example.log - is automatically moved to - example.log.1. -

-

- Note that to obtain these different logging behaviors we did not need to - recompile code. We could just as easily have logged to an email address, - redirected all - Com.Foo - output to an NT Event logger, or forwarded logging events to a remote log4net - server, which would log according to local server policy. -

-

- For more examples of configuring appenders using the XmlConfigurator - see the Example Appender Configuration - document. -

-

Configuration Attributes

-
-

- The log4net configuration can be configured using assembly-level attributes rather than - specified programmatically. -

-
    -
  • - XmlConfiguratorAttribute -

    - The log4net.Config.XmlConfiguratorAttribute Allows the - XmlConfigurator to be configured using the following properties: -

    -
      -
    • - ConfigFile -

      - If specified, this is the filename of the configuration file to use with the - XmlConfigurator. This file path is relative to the - application base directory (AppDomain.CurrentDomain.BaseDirectory). -

      -

      - This property cannot be used in conjunction with the - ConfigFileExtension property. -

      -
    • -
    • - ConfigFileExtension -

      - If specified, this is the extension for the configuration file. The assembly - file name is used as the base name with the this extension appended. For example - if the assembly is loaded from the a file TestApp.exe - and the ConfigFileExtension property is set to - log4net then the configuration file name is - TestApp.exe.log4net. This is equivalent to setting the - ConfigFile property to TestApp.exe.log4net. -

      -

      - The path to the configuration file is build by using the application base - directory (AppDomain.CurrentDomain.BaseDirectory), - the assembly file name and the configuration file extension. -

      -

      - This property cannot be used in conjunction with the - ConfigFile property. -

      -
    • -
    • - Watch -

      - If this flag is specified and set to true - then the framework will watch the configuration file and will reload the config - each time the file is modified. -

      -
    • -
    -

    - If neither of the ConfigFile or ConfigFileExtension - properties are specified, the application configuration file (e.g. TestApp.exe.config) - will be used as the log4net configuration file. -

    -

    - Example usage: -

    -
    -// Configure log4net using the .config file
    -[assembly: log4net.Config.XmlConfigurator(Watch=true)]
    -// This will cause log4net to look for a configuration file
    -// called TestApp.exe.config in the application base
    -// directory (i.e. the directory containing TestApp.exe)
    -// The config file will be watched for changes.
    -                            
    -
    -// Configure log4net using the .log4net file
    -[assembly: log4net.Config.XmlConfigurator(ConfigFileExtension="log4net",Watch=true)]
    -// This will cause log4net to look for a configuration file
    -// called TestApp.exe.log4net in the application base
    -// directory (i.e. the directory containing TestApp.exe)
    -// The config file will be watched for changes.
    -                            
    -

    - This attribute may only be used once per assembly. -

    -
  • -
-

- Using attributes can be a clearer method for defining where the application's - configuration will be loaded from. However it is worth noting that attributes - are purely passive. They are information only. Therefore if you use configuration - attributes you must invoke log4net to allow it to read the attributes. A simple - call to LogManager.GetLogger will cause the attributes - on the calling assembly to be read and processed. Therefore it is imperative - to make a logging call as early as possible during the application start-up, and - certainly before any external assemblies have been loaded and invoked. -

-
-

Configuration Files

-
-

- Typically the log4net configuration is specified using a file. This file can - be read in one of two ways: -

-
    -
  • Using the .NET System.Configuration API
  • -
  • Reading the file contents directly
  • -
-

.config Files

-
-

- The System.Configuration API is only available if the - configuration data is in the application's config file; the file named - MyApp.exe.config or Web.config. Because the System.Configuration - API does not support reloading of the config file the configuration settings - cannot be watched using the log4net.Config.XmlConfigurator.ConfigureAndWatch - methods. The main advantage of using the System.Configuration - APIs to read the configuration data is that it requires less permissions than accessing - the configuration file directly. -

-

- The only way to configure an application using the System.Configuration - APIs is to call the log4net.Config.XmlConfigurator.Configure() method or - the log4net.Config.XmlConfigurator.Configure(ILoggerRepository) method. -

-

- In order to embed the configuration data in the .config file the section name must be - identified to the .NET config file parser using a configSections element. - The section must specify the log4net.Config.Log4NetConfigurationSectionHandler - that will be used to parse the config section. This type must be fully assembly qualified - because it is being loaded by the .NET config file parser not by log4net. The correct - assembly name for the log4net assembly must be specified. - The following is a simple example configuration file that specifies the correct - section handler to use for the log4net section. -

- -
-<?xml version="1.0" encoding="utf-8" ?>
-<configuration>
-    <configSections>
-        <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
-    </configSections>
-    <log4net>
-        <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
-            <layout type="log4net.Layout.PatternLayout">
-                <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
-            </layout>
-        </appender>
-        <root>
-            <level value="INFO" />
-            <appender-ref ref="ConsoleAppender" />
-        </root>
-    </log4net>
-</configuration>
- -

- In the above example the log4net assembly is specified. - This assembly must be located where the .NET runtime can find it. For example it could - be located in the same directory as the application. If the log4net assembly is stored in - the GAC then the fully qualified assembly name must be specified including the culture, - version and public key. -

-

- When using the .config file to specify the configuration the section name and - XML element name must be log4net. -

-
-

Reading Files Directly

-
-

- The XmlConfigurator can directly read any XML file and use it to configure log4net. - This includes the application's .config file; the file named MyApp.exe.config - or Web.config. The only reason not to read the configuration file directly is if the - application does not have sufficient permissions to read the file, then the configuration - must be loaded using the .NET configuration APIs (see above). -

-

- The file to read the configuration from can be specified using any of - the log4net.Config.XmlConfigurator methods that - accept a System.IO.FileInfo object. Because the - file system can be monitored for file change notifications the - ConfigureAndWatch methods can be used to monitor - the configuration file for modifications and automatically reconfigure log4net. -

-

- Additionally the log4net.Config.XmlConfiguratorAttribute - can be used to specify the file to read the configuration from. -

-

- The configuration is read from the log4net element - in the file. Only one log4net element can be specified - in the file but it may be located anywhere in the XML hierarchy. For example it - may be the root element: -

- -
-<?xml version="1.0" encoding="utf-8" ?>
-<log4net>
-    <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
-        <layout type="log4net.Layout.PatternLayout">
-            <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
-        </layout>
-    </appender>
-    <root>
-        <level value="INFO" />
-        <appender-ref ref="ConsoleAppender" />
-    </root>
-</log4net>
- -

- Or it may be nested within other elements: -

- -
-<?xml version="1.0" encoding="utf-8" ?>
-<configuration>
-    <configSections>
-        <section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
-    </configSections>
-    <log4net>
-        <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
-            <layout type="log4net.Layout.PatternLayout">
-                <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
-            </layout>
-        </appender>
-        <root>
-            <level value="INFO" />
-            <appender-ref ref="ConsoleAppender" />
-        </root>
-    </log4net>
-</configuration>
- -

- The above example shows how the configuration data can be embedded - inside a .config file even though the file is being read directly - by log4net. An important note is that the .NET config file parser - will throw an exception if it finds an element that has not been - registered using the configSections element. - Therefore in the above example the log4net - section name is registered, but the type specified to handle the - section is System.Configuration.IgnoreSectionHandler. - This is a built-in class that indicates that another method for reading - the config section will be employed. -

-
-
-

Configuration Syntax

-
-

- log4net includes a configuration reader that parses an XML DOM, the - log4net.Config.XmlConfigurator. This section defines the - syntax accepted by the configurator. -

-

- This is an example of a valid XML configuration. The root element - must be <log4net>. Note that this does not mean - that this element cannot be embedded in another XML document. See the section above - on Configuration Files for more information - on how to embed the XmlConfigurator XML in a configuration file. -

- -
-<log4net>
-    <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
-        <layout type="log4net.Layout.PatternLayout">
-            <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
-        </layout>
-    </appender>
-    <root>
-        <level value="INFO" />
-        <appender-ref ref="ConsoleAppender" />
-    </root>
-</log4net>
- -

- The <log4net> element supports the following attributes: -

-
- - - - - - - - - - - - - - - - - - - - - -
AttributeDescription
debug - Optional attribute. Value must be either true or false. - The default value is false. Set this attribute to true - to enable internal log4net debugging for this configuration. -
update - Optional attribute. Value must be either Merge or Overwrite. - The default value is Merge. Set this attribute to Overwrite - to reset the configuration of the repository being configured before applying this configuration. -
threshold - Optional attribute. Value must be the name of a level registered on the repository. - The default value is ALL. Set this attribute to limit the messages - that are logged across the whole repository, regardless of the logger that the message is logged to. -
-
-

- The <log4net> element supports the following child elements: -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ElementDescription
appender - Zero or more elements allowed. Defines an appender. -
logger - Zero or more elements allowed. Defines the configuration of a logger. -
renderer - Zero or more elements allowed. Defines an object renderer. -
root - Optional element, maximum of one allowed. Defines the configuration of the root logger. -
param - Zero or more elements allowed. Repository specific parameters -
-
-

Appenders

-
-

- Appenders may only be defined as child elements of the <log4net> - element. Each appender must be uniquely named. The implementing type for the appender must be specified. -

-

- This example shows an appender of type log4net.Appender.ConsoleAppender being - defined. The appender will be known as ConsoleAppender. -

- -
-<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
-    <layout type="log4net.Layout.PatternLayout">
-        <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
-    </layout>
-</appender>
- -

- The <appender> element supports the following attributes: -

-
- - - - - - - - - - - - - - - - - -
AttributeDescription
name - Required attribute. Value must be a string name for this appender. The name must be unique - among all the appenders defined in this configuration file. This name is used by the - <appender-ref> element of a Logger to reference an appender. -
type - Required attribute. Value must be the type name for this appender. If the appender is - not defined in the log4net assembly this type name must be fully assembly qualified. -
-
-

- The <appender> element supports the following child elements: -

-
- - - - - - - - - - - - - - - - - - - - - - - - - -
ElementDescription
appender-ref - Zero or more elements allowed. Allows the appender to reference other appenders. - Not supported by all appenders. -
filter - Zero or more elements allowed. Defines the filters used by this appender. -
layout - Optional element, maximum of one allowed. Defines the layout used by this appender. -
param - Zero or more elements allowed. Appender specific parameters. -
-
-

- For examples of configuring appenders see the - Example Appender Configuration - document. -

-
Filters
-
-

- Filters elements may only be defined as children of <appender> elements. -

-

- The <filter> element supports the following attributes: -

-
- - - - - - - - - - - - - -
AttributeDescription
type - Required attribute. Value must be the type name for this filter. If the filter is - not defined in the log4net assembly this type name must be fully assembly qualified. -
-
-

- The <filter> element supports the following child elements: -

-
- - - - - - - - - - - - - -
ElementDescription
param - Zero or more elements allowed. Filter specific parameters. -
-
-

- Filters form a chain that the event has to pass through. Any filter along the way can accept the event - and stop processing, deny the event and stop processing, or allow the event on to the next filter. - If the event gets to the end of the filter chain without being denied it is implicitly accepted and will be logged. -

- -
-<filter type="log4net.Filter.LevelRangeFilter">
-    <levelMin value="INFO" />
-    <levelMax value="FATAL" />
-</filter>
- -

- This filter will deny events that have a level that is lower than INFO - or higher than FATAL. - All events between INFO and FATAL will be logged. -

-

- If we want to only allow messages through that have a specific substring (e.g. 'database') - then we need to specify the following filters: -

- -
-<filter type="log4net.Filter.StringMatchFilter">
-    <stringToMatch value="database" />
-</filter>
-<filter type="log4net.Filter.DenyAllFilter" />
- -

- The first filter will look for the substring 'database' in the message text of the event. - If the text is found the filter will accept the message and filter processing will stop, - the message will be logged. If the substring is not found the event will be passed to - the next filter to process. If there is no next filter the event would be implicitly - accepted and would be logged. But because we don't want the non matching events to be - logged we need to use a log4net.Filter.DenyAllFilter - that will just deny all events that reach it. This filter is only useful at the end of the filter chain. -

-

- If we want to allow events that have either 'database' or 'ldap' in the message text we can use the following filters: -

- -
-<filter type="log4net.Filter.StringMatchFilter">
-    <stringToMatch value="database"/>
-</filter>
-<filter type="log4net.Filter.StringMatchFilter">
-    <stringToMatch value="ldap"/>
-</filter>
-<filter type="log4net.Filter.DenyAllFilter" />
- -
-
Layouts
-
-

- Layout elements may only be defined as children of <appender> elements. -

-

- The <layout> element supports the following attributes: -

-
- - - - - - - - - - - - - -
AttributeDescription
type - Required attribute. Value must be the type name for this layout. If the layout is - not defined in the log4net assembly this type name must be fully assembly qualified. -
-
-

- The <layout> element supports the following child elements: -

-
- - - - - - - - - - - - - -
ElementDescription
param - Zero or more elements allowed. Layout specific parameters. -
-
-

- This example shows how to configure a layout that uses the log4net.Layout.PatternLayout. -

- -
-<layout type="log4net.Layout.PatternLayout">
-    <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
-</layout>
- -
-
-

Root Logger

-
-

- Only one root logger element may only be defined and it must be a child of <log4net> element. - The root logger is the root of the logger hierarchy. All loggers ultimately inherit from this logger. -

-

- An example root logger: -

- -
-<root>
-    <level value="INFO" />
-    <appender-ref ref="ConsoleAppender" />
-</root>
- -

- The <root> element supports no attributes. -

-

- The <root> element supports the following child elements: -

-
- - - - - - - - - - - - - - - - - - - - - -
ElementDescription
appender-ref - Zero or more elements allowed. Allows the logger to reference appenders by name. -
level - Optional element, maximum of one allowed. Defines the logging level for this logger. - This logger will only accept event that are at this level or above. -
param - Zero or more elements allowed. Logger specific parameters. -
-
-
-

Loggers

-
-

- Logger elements may only be defined as children of the <log4net> element. -

-

- An example logger: -

- -
-<logger name="LoggerName">
-    <level value="DEBUG" />
-    <appender-ref ref="ConsoleAppender" />
-</logger>
- -

- The <logger> element supports the following attributes. -

-
- - - - - - - - - - - - - - - - - -
AttributeDescription
name - Required attribute. Value must be the name of the logger. -
additivity - Optional attribute. Value may be either true or false. - The default value is true. Set this attribute to false - to prevent this logger from inheriting the appenders defined on parent loggers. -
-
-

- The <logger> element supports the following child elements: -

-
- - - - - - - - - - - - - - - - - - - - - -
ElementDescription
appender-ref - Zero or more elements allowed. Allows the logger to reference appenders by name. -
level - Optional element, maximum of one allowed. Defines the logging level for this logger. - This logger will only accept event that are at this level or above. -
param - Zero or more elements allowed. Logger specific parameters. -
-
-
-

Renderers

-
-

- Renderer elements may only be defined as children of the <log4net> element. -

-

- An example renderer: -

- -
-<renderer renderingClass="MyClass.MyRenderer" renderedClass="MyClass.MyFunkyObject" />
- -

- The <renderer> element supports the following attributes. -

-
- - - - - - - - - - - - - - - - - -
AttributeDescription
renderingClass - Required attribute. Value must be the type name for this renderer. If the type is - not defined in the log4net assembly this type name must be fully assembly qualified. - This is the type of the object that will take responsibility for rendering the - renderedClass. -
renderedClass - Required attribute. Value must be the type name for the target type for this renderer. If the type is - not defined in the log4net assembly this type name must be fully assembly qualified. - This is the name of the type that this renderer will render. -
-
-

- The <renderer> element supports no child elements. -

-
-

Parameters

-
-

- Parameter elements may be children of many elements. See the specific elements above for details. -

-

- An example param: -

- -
-<param name="ConversionPattern" value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
- -

- The <param> element supports the following attributes. -

-
- - - - - - - - - - - - - - - - - - - - - -
AttributeDescription
name - Required attribute. Value must be the name of the parameter to set on the parent object. -
value - Optional attribute. One of value or type attributes must be specified. - The value of this attribute is a string that can be converted to the value of the - parameter. -
type - Optional attribute. One of value or type attributes must be specified. - The value of this attribute is a type name to create and set as the value of the - parameter. If the type is not defined in the log4net assembly this type name must - be fully assembly qualified. -
-
-

- The <param> element supports the following child elements: -

-
- - - - - - - - - - - - - -
ElementDescription
param - Zero or more elements allowed. Parameter specific parameters. -
-
-

- An example param that uses nested param elements: -

- -
-<param name="evaluator" type="log4net.spi.LevelEvaluator">
-    <param name="Threshold" value="WARN"/>
-<param>
- -
Extension Parameters
-
-

- Configuration parameters map directly to writable properties on an object. - The properties available depend on the actual type of the object being - configured. The log4net SDK documentation contains the API reference for - all the components included in the log4net assembly. -

-

- For 3rd party components please see their relevant API reference for - details of the properties available. -

-
-
Compact Parameter Syntax
-
-

- All parameters may alternately be specified using the parameter name as the element name - rather than using the param element and name attribute. -

-

- For example a param: -

- -
-<param name="evaluator" type="log4net.spi.LevelEvaluator">
-    <param name="Threshold" value="WARN"/>
-<param>
- -

- may be written as: -

- -
-<evaluator type="log4net.spi.LevelEvaluator">
-    <threshold value="WARN"/>
-<evaluator>
- -
-
-
-
-
- - - - - -

 

- -
- Copyright © - 2004-2007, - Apache Software Foundation -
- - -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/release/manual/contexts.html b/doc/release/manual/contexts.html deleted file mode 100755 index afacb06c..00000000 --- a/doc/release/manual/contexts.html +++ /dev/null @@ -1,420 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Apache log4net Manual: Contexts - - - - - - - - - - - - - - - - - -
- - - - -

log4net Manual - Contexts

-
-

Contents

- -

- Most real-world systems have to deal with multiple clients simultaneously. In a - typical multithreaded implementation of such a system, different threads will - handle different clients. Logging is especially well suited to trace and debug - complex distributed applications. An approach to differentiate the - logging output of one client from another is to instantiate a new separate - logger for each client. However this promotes the proliferation of loggers and - increases the management overhead of logging. -

-

- A lighter technique is to uniquely stamp each log request initiated from the - same client interaction. -

-

- Log4net supports different types of contextual logging and contexts with different scopes. -

-

Scopes

-
-

- Contextual data can be set in different scopes. These contexts have progressively narrower visibility. - In the logging event itself the values from all of the contexts are combined together such that - values specified in a lower scoped context hide values from a higher context. -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - -
ScopeTypeDescription
Globallog4net.GlobalContext - The global context is shared by all threads in the current AppDomain. - This context is thread safe for use by multiple threads concurrently. -
Threadlog4net.ThreadContext - The thread context is visible only to the current managed thread. -
Logical Threadlog4net.ThreadLogicalContext - The logical thread context is visible to a logical thread. Logical - threads can jump from one managed thread to another. For more details - see the .NET API System.Runtime.Remoting.Messaging.CallContext. -
Eventlog4net.Core.LoggingEvent - Each event captures the current contextual state at the time the event - is generated. Contextual data can be set on the event itself. This context - is only visible to the code generating the event itself. -
-
-
-

Context Properties

-
-

- The log4net contexts store properties, i.e. name value pairs. The name is a string - the value is any object. A property can be set as follows: -

- -
-log4net.GlobalContext.Properties["name"] = value;
-
- -

- If properties with the same name are set in more than one context scope then - the value in the narrowest scope (lower down in the list above) will hide the - other values. -

-

- The property values are stored as objects within the LoggingEvent. - The PatternLayout supports rendering the value of a named - property using the %property{name} syntax. The value is - converted to a string by passing it to the log4net.ObjectRenderer.RendererMap - which will locate any custom renderer for the value type. The default behavior for - custom types is to call the object's ToString() method. -

-

Active Property Values

-
-

- An active property value is one who's value changes over time. -

-

- For example, imagine a custom type that implemented the - ToString() method to return the - number of bytes allocated by the runtime garbage collector. -

- -
-public class GCAllocatedBytesHelper
-{
-    public override string ToString()
-    {
-        return GC.GetTotalMemory(true).ToString();
-    }
-}
- -

- An instance of this type can be added to the log4net.GlobalContext - during application startup: -

- -
-log4net.GlobalContext.Properties["GCAllocatedBytes"] = new GCAllocatedBytesHelper();
-
- -

- Once this property is set in the context all subsequent logging events will have a property - called GCAllocatedBytes. The value of the property will be an instance of the - GCAllocatedBytesHelper type. When this value is rendered to a - string by calling the ToString method the current number of bytes - allocated by the garbage collector will be returned and included in the output. -

-
-
-

Context Stacks

-
-

- Sometimes simple key value pairs are not the most convenient way of capturing contextual - information. A stack of information is a very convenient way of storing data especially - as our applications tend to be stack based. -

-

- The ThreadContext and LogicalThreadContext - also support storing contextual data in a stack. The stack is stored in context property, - therefore stacks have names and more than one stack can exist in the same context. A property - value set in a narrower context would override a stack with the same property name set in a - wider scoped context. -

-

- The stack supports Push and Pop methods. - As more contextual data is pushed onto the stack the stack grows. When the stack is rendered - all the data pushed onto the stack is output with the most recent data to the right hand - end of the string. -

-

- As the stack is just an object stored in the context properties it is also rendered - using the same PatternLayout syntax: %property{name}. - Where name is the name of the stack. -

-

- Calls the the stack's Push and Pop - methods must be matched up so that each push has a corresponding pop. The - Push method also returns an IDisposable - object that will perform the required pop operation when it is disposed. This allows - the C# using syntax to be used to automate the stack management. -

- -
-using(log4net.ThreadContext.Stacks["NDC"].Push("context"))
-{
-    log.Info("Message");
-}
-
- -

- The INFO level log has a stack stored in its NDC property. The top item in the - stack is the string context. - The using syntax ensures that the value context is popped off the stack - at the end of the block. -

-

- The using - syntax is recommended because it removes some work load from the developer and - reduces errors in matching up the Push and Pop calls, especially when exceptions - can occur. -

-
-

Nested Diagnostic Contexts

-
-

- The NDC (Nested Diagnostic Context) exists for compatibility - with older versions of log4net. This helper class implements a stack which is stored - in the thread context property named NDC. -

-
-

Mapped Diagnostic Contexts

-
-

- The MDC (MappedDiagnostic Context) exists for compatibility - with older versions of log4net. This helper class implements a properties map which is - mapped directly through to the thread context properties. -

-
-

- To illustrate this point, let us take the example of a web service delivering - content to numerous clients. The web service can build the NDC at the very - beginning of the request before executing other code. The contextual - information can be the client's host name and other information inherent to the - request, typically information contained in cookies. Hence, even if the web - service is serving multiple clients simultaneously, the logs initiated by the - same code, i.e. belonging to the same logger, can still be distinguished - because each client request will have a different NDC stack. Contrast this with - the complexity of passing a freshly instantiated logger to all code exercised - during the client's request. -

-

- Nevertheless, some sophisticated applications, such as virtual hosting web - servers, must log differently depending on the virtual host context and also - depending on the software component issuing the request. Log4net supports - multiple logger repositories. This would allow each virtual host to possess its own copy - of the logger hierarchy. Configuring multiple logger hierarchies is beyond the - scope of this document. -

-
- - - - - -

 

- -
- Copyright © - 2004-2007, - Apache Software Foundation -
- - -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/release/manual/internals.html b/doc/release/manual/internals.html deleted file mode 100755 index 11d56cbd..00000000 --- a/doc/release/manual/internals.html +++ /dev/null @@ -1,419 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Apache log4net Manual: Internals - - - - - - - - - - - - - - - - - -
- - - - -

log4net Manual - Internals

-
-

Contents

- -

Performance

-
-

- One of the often-cited arguments against logging is its computational cost. - This is a legitimate concern as even moderately sized applications can generate - thousands of log requests. Much effort was spent measuring and tweaking logging - performance. Log4net claims to be fast and flexible: speed first, flexibility - second. -

-

- The user should be aware of the following performance issues. -

-
    -
  1. - Logging performance when logging is turned off. -

    - When logging is turned off entirely or just for a set of levels, the cost of a - log request consists of a method invocation plus an integer comparison. -

    -

    - However, The method invocation involves the "hidden" cost of parameter - construction. -

    -

    - For example, for some logger - log, writing, -

    -
    -log.Debug("Entry number: " + i + " is " + entry[i].ToString());
    -

    - incurs the cost of constructing the message parameter, i.e. converting both - integer - i - and - entry[i] - to strings, and concatenating intermediate strings, regardless of whether the - message will be logged or not. This cost of parameter construction can be quite - high and it depends on the number and type of the parameters involved. -

    -

    - To avoid the parameter construction cost write: -

    -
    -if(log.IsDebugEnabled)
    -{
    -    log.Debug("Entry number: " + i + " is " + entry[i].ToString());
    -}
    -

    - This will not incur the cost of parameter construction if debugging is - disabled. On the other hand, if the logger is debug-enabled, it will incur - twice the cost of evaluating whether the logger is enabled or not: once in - IsDebugEnabled - and once in - Debug. This is an insignificant overhead because - evaluating a logger takes about 1% of the time it takes to actually log. -

    -

    - Certain users resort to pre-processing or compile-time techniques to compile - out all log statements. This leads to perfect performance efficiency with - respect to logging. However, since the resulting application binary does not - contain any log statements, logging cannot be turned on for that binary. In - many people's opinion this is a disproportionate price to pay in exchange for a - small performance gain. -

    -
  2. -
  3. - The performance of deciding whether to log or not to log when logging is - turned on. -

    - This is essentially the performance of walking the logger hierarchy. When - logging is turned on, log4net still needs to compare the level of the log - request with the level of the request logger. However, loggers may not have an - assigned level; they can inherit them from the logger hierarchy. Thus, before - inheriting a level, the logger may need to search its ancestors. -

    -

    - There has been a serious effort to make this hierarchy walk to be as fast as - possible. For example, child loggers link only to their existing ancestors. In - the - BasicConfigurator - example shown earlier, the logger named - Com.Foo.Bar - is linked directly to the root logger, thereby circumventing the nonexistent - Com - or - Com.Foo - loggers. This significantly improves the speed of the walk, especially in - "sparse" hierarchies. -

    -

    - The typical cost of walking the hierarchy is typically 3 times slower than when - logging is turned off entirely. -

    -
  4. -
  5. - Actually outputting log messages -

    - This is the cost of formatting the log output and sending it to its target - destination. Here again, a serious effort was made to make layouts (formatters) - perform as quickly as possible. The same is true for appenders. -

    -
  6. -
-

- Although log4net has many features, its first design goal was speed. Some - log4net components have been rewritten many times to improve performance. - Nevertheless, contributors frequently come up with new optimizations. You - should be pleased to know that when configured with the - SimpleLayout - performance tests have shown log4net to log within an order of magnitude of - System.Console.WriteLine. -

-
-

Logging Event Flow

-
-

- The following is the series of steps and checks that a messages goes through while being logged. - For the purposes of this example we will document an INFO level - message being logged on logger ConsoleApp.LoggingExample. This logger is configured - to use the log4net.Appender.ConsoleAppender. The repository used - in this example is a log4net.Repository.Hierarchy object. -

-
    -
  1. -

    - The user logs a message using the ILog.Info method on the logger - obtained using a call to log4net.LogManager.GetLogger("ConsoleApp.LoggingExample"). - For example: log4net.LogManager.GetLogger("ConsoleApp.LoggingExample").Info("Application Start"); - The ILog interface is actually an extension to log4net that provides level - specific logging methods (i.e. Debug, Info, Warn, Error, and Fatal). -

    -
  2. -
  3. -

    - The message is then logged through to the ILogger.Log method on the - appropriate log4net.Repository.Hierarchy.Logger object. The - ILogger.Log method takes the Level to - log at as a parameter and therefore works for all levels. -

    -
  4. -
  5. -

    - The repository threshold level is compared to the message level to determine if the message - can be logged. If the message level is below the threshold level the message is not logged. - In this case the repository is a log4net.Repository.Hierarchy object. -

    -
  6. -
  7. -

    - The Logger level is compared to the message level to determine if the - message can be logged. Note that the Logger level is inherited from a - parent Logger if not specified explicitly for this Logger. - If the message level is below the Logger level the message is not logged. -

    -
  8. -
  9. -

    - A LoggingEvent instance is created to encapsulate the message being logged. -

    -
  10. -
  11. -

    - The list of appenders for the Logger is built. This includes appenders - attached to parent Loggers except where excluded by the - Logger.Additivity property. -

    -
  12. -
  13. -

    - The LoggingEvent object is passed to the - IAppender.DoAppend method for each appender. -

    -
  14. -
-

- For Each Appender that the LoggingEvent is delivered to the following - actions take place: -

-
    -
  1. -

    - The appender threshold level is compared to the message level to determine if the message - can be logged. If the message level is below the threshold level the message is not logged. -

    -
  2. -
  3. -

    - If the appender has a filter chain the LoggingEvent is passed down the - filter chain which can decide if the message can be logged or not. -

    -
  4. -
  5. -

    - Next an appender specific check is performed. Usually this check will verify that all the - required properties are set for the appender (e.g. a Layout is set if required). -

    -
  6. -
  7. -

    - The LoggingEvent is passed to the appender specific - Append method. What happens now is specific to the appender. -

    -
  8. -
-

- The following actions take place in the ConsoleAppender.Append method: -

-
    -
  1. -

    - The ConsoleAppender uses a Layout to - format the message as a string for display. -

    -
  2. -
  3. -

    - The Layout uses the LoggingEvent.RenderedMessage - property to get the string for the message object. This uses the registered - IObjectRenderer for the type of the message object. -

    -
  4. -
  5. -

    - The message text is displayed on the console using the Console.WriteLine method. -

    -
  6. -
-
-
- - - - - -

 

- -
- Copyright © - 2004-2007, - Apache Software Foundation -
- - -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/release/manual/introduction.html b/doc/release/manual/introduction.html deleted file mode 100755 index 0adc0e3e..00000000 --- a/doc/release/manual/introduction.html +++ /dev/null @@ -1,1210 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Apache log4net Manual: Introduction - - - - - - - - - - - - - - - - - -
- - - - -

log4net Manual - Introduction

-
-

Contents

- -

Overview

-
-

- This document is based on Short introduction to log4j by Ceki Glc. -

-

- The log4net framework is based on log4j, see - http://logging.apache.org/log4j for more information on log4j. - The log4net framework, source code, binaries, documentation, examples and related - materials are published under the terms of the - Apache License, Version 2.0, - a copy of which has been included with this distribution in the LICENSE.txt file. -

-

- This document is an introduction to the log4net API, its unique features and - design rationale. Log4net is an open source project based on the work of many - authors. It allows the developer to control which log statements are output - with arbitrary granularity. It is fully configurable at runtime using external - configuration files. -

-

- Almost every large application includes its own logging or tracing API. - Inserting log statements into code is a low-tech method for debugging it. It - may also be the only way because debuggers are not always available or - applicable. This is usually the case for multithreaded applications and - distributed applications at large. -

-

- Once an application has been deployed it may not be possible to utilize - development and debugging tools. An administrator can use effective logging - systems to diagnose and fix many configuration issues. -

-

- Experience indicates that logging is an important component of the development - cycle. It offers several advantages. It provides precise context about the - execution of the application. Once inserted into the code, the generation of - logging output requires no human intervention. Moreover, log output can be - saved in persistent medium to be studied at a later time. In addition to its - use in the development cycle, a sufficiently rich logging package can also be - viewed as an auditing tool. -

-

- Logging does have its drawbacks. It can slow down an application. If too - verbose, it can cause scrolling blindness. To alleviate these concerns, log4net - is designed to be reliable, fast and extensible. Since logging is rarely the - main focus of an application, the log4net API strives to be simple to - understand and to use. -

-
-

Frameworks

-
-

- Log4net is available for several frameworks. For each supported framework an - assembly targeting that framework is built: -

-
    -
  • Microsoft .NET Framework 1.0 (1.0.3705)
  • -
  • Microsoft .NET Framework 1.1 (1.1.4322)
  • -
  • Microsoft .NET Compact Framework 1.0
  • -
  • Microsoft .NET Compact Framework 2.0
  • -
  • Mono 1.0
  • -
  • Mono 2.0
  • -
  • Microsoft Shared Source CLI 1.0
  • -
  • CLI 1.0 Compatible
  • -
-

- Not all frameworks are created equal and some features have been excluded from - some of the builds. See the Framework Support - document for more information. -

-
-

Loggers and Appenders

-
-

- Log4net has three main components: loggers, appenders and layouts. - These three types of components work together to enable developers to log - messages according to message type and level, and to control at runtime how - these messages are formatted and where they are reported. These components are - helped by filters that control the actions of the appender and - object renderers that turn objects into strings. -

-

Logger hierarchy

-
-

- The first and foremost advantage of any logging API over plain - System.Console.WriteLine - resides in its ability to disable certain log statements while allowing others - to print unhindered. This capability assumes that the logging space, that is, - the space of all possible logging statements, is categorized according to some - developer-chosen criteria. -

-

- Loggers are named entities. Logger names are case-sensitive and they follow the - following hierarchical naming rule: -

-
-
Named Hierarchy
-
-

- A logger is said to be an ancestor of another logger if its name - followed by a dot is a prefix of the descendant logger name. A logger is - said to be a parent of a child logger if there are no ancestors - between itself and the descendant logger. -

-

- The hierarchy works very much in the same way as the namespace and class - hierarchy in .NET. This is very convenient as we shall soon see. -

-
-
-

- For example, the logger named - "Foo.Bar" - is a parent of the logger named - "Foo.Bar.Baz". Similarly, - "System" - is a parent of - "System.Text" - and an ancestor of - "System.Text.StringBuilder". This naming scheme - should be familiar to most developers. -

-

- The root logger resides at the top of the logger hierarchy. It is exceptional - in three ways: -

-
    -
  1. - It always exists
  2. -
  3. - It cannot be retrieved by name
  4. -
  5. - It always has an assigned level
  6. -
-

- Loggers are retrieved using the static method from the - log4net.LogManager - class. The - GetLogger - methods take the name of the desired logger as a parameter. They are listed - below: -

- -
-namespace log4net
-{
-    public class LogManager
-    {
-        public static ILog GetLogger(string name);
-        public static ILog GetLogger(Type type);
-    }
-}
- -

- The - GetLogger - methods that takes a - Type - parameter uses the fully qualified type name as the name of the logger to - retrieve. -

-

- These - GetLogger - methods return an - ILog - interface. That is the representation of the Logger passed back to the - developer. The - ILog - interface is defined below: -

- -
-namespace log4net
-{
-    public interface ILog
-    {
-        /* Test if a level is enabled for logging */
-        bool IsDebugEnabled { get; }
-        bool IsInfoEnabled { get; }
-        bool IsWarnEnabled { get; }
-        bool IsErrorEnabled { get; }
-        bool IsFatalEnabled { get; }
-        
-        /* Log a message object */
-        void Debug(object message);
-        void Info(object message);
-        void Warn(object message);
-        void Error(object message);
-        void Fatal(object message);
-        
-        /* Log a message object and exception */
-        void Debug(object message, Exception t);
-        void Info(object message, Exception t);
-        void Warn(object message, Exception t);
-        void Error(object message, Exception t);
-        void Fatal(object message, Exception t);
-        
-        /* Log a message string using the System.String.Format syntax */
-        void DebugFormat(string format, params object[] args);
-        void InfoFormat(string format, params object[] args);
-        void WarnFormat(string format, params object[] args);
-        void ErrorFormat(string format, params object[] args);
-        void FatalFormat(string format, params object[] args);
-        
-        /* Log a message string using the System.String.Format syntax */
-        void DebugFormat(IFormatProvider provider, string format, params object[] args);
-        void InfoFormat(IFormatProvider provider, string format, params object[] args);
-        void WarnFormat(IFormatProvider provider, string format, params object[] args);
-        void ErrorFormat(IFormatProvider provider, string format, params object[] args);
-        void FatalFormat(IFormatProvider provider, string format, params object[] args);
-    }
-}
- -

- Loggers may be assigned levels. Levels are instances of the - log4net.Core.Level - class. The following levels are defined in order of increasing priority: -

-
    -
  • - ALL -
  • -
  • - DEBUG -
  • -
  • - INFO -
  • -
  • - WARN -
  • -
  • - ERROR -
  • -
  • - FATAL -
  • -
  • - OFF -
  • -
-

- If a given logger is not assigned a level, then it inherits one from its - closest ancestor with an assigned level. More formally: -

-
-
Level Inheritance
-
-

- The inherited level for a given logger X, is equal to the first - non-null level in the logger hierarchy, starting at X and proceeding - upwards in the hierarchy towards the root logger. -

-
-
-

- To ensure that all loggers can eventually inherit a level, the root logger - always has an assigned level. The default value for the root logger is - DEBUG. -

-

- Below are four tables with various assigned level values and the resulting - inherited levels according to the above rule. -

-

-
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- Logger name - Assigned level - Inherited level
rootProotProot
XnoneProot
X.YnoneProot
X.Y.ZnoneProot
-
-

- In Example 1 above, only the root logger is assigned a level. This level - value, - Proot, is inherited by the other loggers - X, - X.Y - and - X.Y.Z. -

-

-
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- Logger name - Assigned level - Inherited level
rootProotProot
XPxPx
X.YPxyPxy
X.Y.ZPxyzPxyz
-
-

- In Example 2 above, all loggers have an assigned level value. There is - no need for level inheritance. -

-

-
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- Logger name - Assigned level - Inherited level
rootProotProot
XPxPx
X.YnonePx
X.Y.ZPxyzPxyz
-
-

- In Example 3 above, the loggers - root, - X - and - X.Y.Z - are assigned the levels - Proot, - Px - and - Pxyz - respectively. The logger - X.Y - inherits its level value from its parent - X. -

-

-
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- Logger name - Assigned level - Inherited level
rootProotProot
XPxPx
X.YnonePx
X.Y.ZnonePx
-
-

- In Example 4 above, the loggers root and - X - and are assigned the levels - Proot - and - Px - respectively. The loggers - X.Y - and - X.Y.Z - inherits their level value from their nearest parent - X - having an assigned level. -

-

- Logging requests are made by invoking one of the printing methods of a logger - instance (through the log4net.ILog). These printing methods are - Debug, - Info, - Warn, - Error, and - Fatal. -

-

- By definition, the printing method determines the level of a logging request. - For example, if - log - is a logger instance, then the statement - log.Info("..") - is a logging request of level INFO. -

-

- A logging request is said to be enabled if its level is higher than or - equal to the level of its logger. Otherwise, the request is said to be disabled. - A logger without an assigned level will inherit one from the hierarchy. This - rule is summarized below. -

-
-
Basic Selection Rule
-
-

- A log request of level L in a logger with (either assigned or inherited, - whichever is appropriate) level K, is enabled if L >= K. -

-
-
-

- This rule is at the heart of log4net. It assumes that levels are ordered. For - the standard levels, we have - DEBUG < INFO < WARN < ERROR < FATAL. -

-

- Calling the - log4net.LogManager.GetLogger - method with the same name will always return a reference to the exact same - logger object. -

-

- For example, in: -

- -
-ILog x = LogManager.GetLogger("wombat");
-ILog y = LogManager.GetLogger("wombat");
- -

- x - and - y - refer to exactly the same logger object. -

-

- Thus, it is possible to configure a logger and then to retrieve the same - instance somewhere else in the code without passing around references. In - fundamental contradiction to biological parenthood, where parents always - precede their children, log4net loggers can be created and configured in any - order. In particular, a "parent" logger will find and link to its descendants - even if it is instantiated after them. -

-

- Configuration of the log4net environment is typically done at application - initialization. The preferred way is by reading a configuration file. This - approach will be discussed shortly. -

-

- Log4net makes it easy to name loggers by software component. This can be - accomplished by statically instantiating a logger in each class, with the - logger name equal to the fully qualified name of the class. This is a useful - and straightforward method of defining loggers. As the log output bears the - name of the generating logger, this naming strategy makes it easy to identify - the origin of a log message. However, this is only one possible, albeit common, - strategy for naming loggers. Log4net does not restrict the possible set of - loggers. The developer is free to name the loggers as desired. -

-

- Nevertheless, naming loggers after the class where they are located seems to be - the best strategy known so far. It is simple an obvious to the developers where - each log message came from. Most importantly it leverages the design of the - application to produce the design of the logger hierarchy. Hopefully some - thought has gone into the design of the application. -

-
-

Appenders

-
-

- The ability to selectively enable or disable logging requests based on their - logger is only part of the picture. Log4net allows logging requests to print to - multiple destinations. In log4net speak, an output destination is called an appender. - Appenders must implement the log4net.Appenders.IAppender - interface. -

-

- The following appenders are defined in the log4net package: -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Type - Description
log4net.Appender.AdoNetAppender - Writes logging events to a database using either prepared statements or stored - procedures. -
log4net.Appender.AnsiColorTerminalAppender - Writes color highlighted logging events to a an ANSI terminal window. -
log4net.Appender.AspNetTraceAppender - 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. -
log4net.Appender.BufferingForwardingAppender - Buffers logging events before forwarding them to child appenders. -
log4net.Appender.ColoredConsoleAppender - Writes logging events to the application's Console. The events may go to either - the standard our stream or the standard error stream. The events may have configurable - text and background colors defined for each level. -
log4net.Appender.ConsoleAppender - Writes logging events to the application's Console. The events may go to either - the standard our stream or the standard error stream. -
log4net.Appender.EventLogAppender - Writes logging events to the Windows Event Log. -
log4net.Appender.FileAppender - Writes logging events to a file in the file system. -
log4net.Appender.ForwardingAppender - Forwards logging events to child appenders. -
log4net.LocalSyslogAppender - Writes logging events to the local syslog service (UNIX only). -
log4net.Appender.MemoryAppender - Stores logging events in an in memory buffer. -
log4net.Appender.NetSendAppender - Writes logging events to the Windows Messenger service. These messages are - displayed in a dialog on a users terminal. -
log4net.Appender.OutputDebugStringAppender - 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. -
log4net.Appender.RemoteSyslogAppender - Writes logging events to a remote syslog service using UDP networking. -
log4net.Appender.RemotingAppender - Writes logging events to a remoting sink using .NET remoting. -
log4net.Appender.RollingFileAppender - 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. -
log4net.Appender.SmtpAppender - Sends logging events to an email address. -
log4net.Appender.SmtpPickupDirAppender - Writes SMTP messages as files into a pickup directory. - These files can then be read and sent by an SMTP agent - such as the IIS SMTP agent. -
log4net.Appender.TelnetAppender - Clients connect via Telnet to receive logging events. -
log4net.Appender.TraceAppender - Writes logging events to the .NET trace system. -
log4net.Appender.UdpAppender - Sends logging events as connectionless UDP datagrams to a remote host or a - multicast group using a UdpClient. -
-
-

- More than one appender can be attached to a logger. -

-

- - Each enabled logging request for a given logger will be forwarded to all - the appenders in that logger as well as the appenders higher in the hierarchy. - - In other words, appenders are inherited additively from the logger hierarchy. - For example, if a console appender is added to the root logger, then all - enabled logging requests will at least print on the console. If in addition a - file appender is added to a logger, say X, then enabled logging requests - for X and X's children will print on a file and on the - console. It is possible to override this default behavior so that appender - accumulation is no longer additive by setting the additivity flag on the logger - to - false. -

-

- The rules governing appender additivity are summarized below. -

-
-
Appender Additivity
-
-

- The output of a log statement of logger X will go to all the appenders - in X and its ancestors. This is the meaning of the term "appender - additivity". -

-

- However, if an ancestor of logger X, say Y, has the additivity - flag set to - false, then X's output will be directed to all - the appenders in X and it's ancestors up to and including Y but - not the appenders in any of the ancestors of Y. -

-

- Loggers have their additivity flag set to - true - by default. -

-
-
-

- The table below shows an example: -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Logger Name - Added Appenders - Additivity Flag - Output Targets - Comment
rootA1not applicableA1There is no default appender attached to root.
xA-x1, A-x2trueA1, A-x1, A-x2Appenders of "x" and root.
x.ynonetrueA1, A-x1, A-x2Appenders of "x" and root.
x.y.zA-xyz1trueA1, A-x1, A-x2, A-xyz1Appenders in "x.y.z", "x" and root.
securityA-secfalseA-secNo appender accumulation since the additivity flag is set to - false.
security.accessnonetrueA-secOnly appenders of "security" because the additivity flag in "security" is set - to - false.
-
-
-

Filters

-
-

- Appenders can filter the events that are delivered to them. The filters can be - specified in the configuration to allow fine control of the events that are - logged through different appenders. -

-

- The simplest form of control is to specify a - Threshold - on the appender. This works by logging only the events that have a level that - is greater than or equal to the threshold. -

-

- More complex and custom event filtering can be done using the filter chain - defined on each appender. Filters must implement the - log4net.Filter.IFilter interface. -

-

- The following filters are defined in the log4net package: -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Type - Description
log4net.Filter.DenyAllFilter - Drops all logging events. -
log4net.Filter.LevelMatchFilter - An exact match to the event's level. -
log4net.Filter.LevelRangeFilter - Matches against a range of levels. -
log4net.Filter.LoggerMatchFilter - Matches against a the start of the logger name. -
log4net.Filter.PropertyFilter - Matches a substring from a specific property value. -
log4net.Filter.StringMatchFilter - Matches a substring from the event's message. -
-
-

- The filters can be configured to either accept or reject the event based upon - the match. -

-
-

Layouts

-
-

- More often than not, users wish to customize not only the output destination - but also the output format. This is accomplished by associating a layout - with an appender. The layout is responsible for formatting the logging request - according to the user's wishes, whereas an appender takes care of sending the - formatted output to its destination. The - PatternLayout, part of the standard log4net - distribution, lets the user specify the output format according to conversion - patterns similar to the C language - printf - function. -

-

- For example, the PatternLayout with the conversion pattern - "%timestamp [%thread] %-5level %logger - %message%newline" - will output something akin to: -

- -
-176 [main] INFO  Com.Foo.Bar - Located nearest gas station.
- -

- The first field is the number of milliseconds elapsed since the start of the - program. The second field is the thread making the log request. The third field - is the level of the log statement. The fourth field is the name of the logger - associated with the log request. The text after the '-' is the message of the - statement. -

-

- The following layouts are included in the log4net package: -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Type - Description
log4net.Layout.ExceptionLayout - Renders the exception text from the logging - event. -
log4net.Layout.PatternLayout - Formats the logging event according to a flexible - set of formatting flags. -
log4net.Layout.RawTimeStampLayout - Extracts the timestamp from the logging event. -
log4net.Layout.RawUtcTimeStampLayout - Extracts the timestamp from the logging event in Universal Time. -
log4net.Layout.SimpleLayout - Formats the logging event very simply: - [level] - [message] -
log4net.Layout.XmlLayout - Formats the logging event as an XML element. -
log4net.Layout.XmlLayoutSchemaLog4j - Formats the logging event as an XML element that - complies with the log4j event dtd. -
-
-
-

Object Renderers

-
-

- Just as importantly, log4net will render the content of the log message - according to user specified criteria. For example, if you frequently need to - log - Oranges, an object type used in your current project, - then you can register an - OrangeRenderer - that will be invoked whenever an orange needs to be logged. -

-

- Object rendering follows the class hierarchy. For example, assuming oranges are - fruits, if you register an - FruitRenderer, all fruits including oranges will be - rendered by the - FruitRenderer, unless of course you registered an - orange specific - OrangeRenderer. -

-

- Object renderers have to implement the - log4net.ObjectRenderer.IObjectRenderer - interface. -

-
-
-
- - - - - -

 

- -
- Copyright © - 2004-2007, - Apache Software Foundation -
- - -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/release/manual/plugins.html b/doc/release/manual/plugins.html deleted file mode 100755 index 88bd5621..00000000 --- a/doc/release/manual/plugins.html +++ /dev/null @@ -1,261 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Apache log4net Manual: Plugins - - - - - - - - - - - - - - - - - -
- - - - -

log4net Manual - Plugins

-
-

Contents

-
- Plugins
- -
-

Plugins

-
-

- Plugins are additional modular components that are attached to a logger repository. -

-

- Plugins are stored in the PluginMap of an - ILoggerRepository. - Plugins are attached to the repository by using the PluginMap.Add - method. -

-

- The following plugins are included in the log4net package: -

-
- - - - - - - - - -
- Type - Description
log4net.Plugin.RemoteLoggingServerPlugin - Creates a remote logging sink that can receive logging events from a - RemotingAppender. -
-
-
    -
  • -

    RemoteLoggingServerPlugin

    -

    - Creates a remote logging sink that can receive logging events from a - RemotingAppender. -

    -

    - Creates a remoting logging sink. A single - parameter must be passed to the constructor that specifies the sink URI. This is a - name used to identify the logging sink object published via remoting and must be - agreed with the client before communication can take place. -

    -

    - Example usage: -

    - -
  • -
-

Plugin Attributes

-
-

- Plugins can be configured using the following assembly-level attributes: -

-
    -
  • -

    PluginAttribute

    -

    - Specifies a plugin type to create and attach to the default repository. This attribute - does not allow plugins to be parameterized. The plugin class must have a public default constructor. -

    -

    - This attribute may be used as many times as necessary to attach plugins to the repository. -

    -
  • -
-
-
-
- - - - - -

 

- -
- Copyright © - 2004-2007, - Apache Software Foundation -
- - -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/release/manual/repositories.html b/doc/release/manual/repositories.html deleted file mode 100755 index aa1c4347..00000000 --- a/doc/release/manual/repositories.html +++ /dev/null @@ -1,271 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Apache log4net Manual: Repositories - - - - - - - - - - - - - - - - - -
- - - - -

log4net Manual - Repositories

-
-

Contents

- -

Logging Repositories

-
-

- Logging repositories are considered advanced functionality. The default behavior - should be sufficient for most users. -

-

- Log4net supports logging repositories. A repository is uniquely named. - Each repository is a (ILoggerRepository). - Multiple assemblies can link to the same repository. -

-

- By default there is a single logging repository per process (more precisely per AppDomain). This extends - across all assemblies loaded into the process and allows them to all share a - single configuration. The configuration of the repository only needs to be done once, - typically in the entry point to the application, either programmatically or using - a configuration attribute. -

-

- Named logging repositories can be created using the LogManager.CreateRepository - method. The repository for can be retrieved using the - LogManager.GetRepository method. - A repository created in this way will need to be configured programmatically. -

-

Attributes

-
-

- An assembly may choose to utilize a named logging repository rather than the default repository. - This completely separates the logging for the assembly from the rest of the application. - This can be very useful to component developers that wish to use log4net for their - components but do not want to require that all the applications that use their - component are aware of log4net. It also means that their debugging configuration is - separated from the applications configuration. The assembly should specify the - RepositoryAttribute to set its logging repository. -

-

- The log4net logging repositories can be configured using the following assembly-level - attributes: -

-
    -
  • - AliasRepositoryAttribute -

    - Specifies a named repository to use as this assembly's repository. -

    -

    - An assembly's logger repository is defined by its - RepositoryAttribute, however this can be overridden by an - assembly loaded before the target assembly. -

    -

    - An assembly can alias another assembly's repository by specifying - this attribute with the name of the target repository. -

    -

    - This attribute may be used as many times as necessary to alias all the required - repositories. -

    -
  • -
  • - RepositoryAttribute -

    - Specifies the logging repository for the assembly. -

    -

    - Assemblies are mapped to logging repositories. This attribute controls the configuration of the repository. The - Name property specifies the name of the repository - for this assembly. The RepositoryType - property specifies the type of the repository object to create for the assembly. - If this attribute is not specified and a Name - is not specified then the assembly will be part of the default shared logging - repository. -

    -

    - This attribute may only be used once per assembly. -

    -
  • -
-
-
-
- - - - - -

 

- -
- Copyright © - 2004-2007, - Apache Software Foundation -
- - -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/release/release-notes.html b/doc/release/release-notes.html deleted file mode 100755 index 06e42ff3..00000000 --- a/doc/release/release-notes.html +++ /dev/null @@ -1,1282 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Apache log4net: Release Notes - - - - - - - - - - - - - - - - - -
- - - - -

log4net Release Notes

-
-

Contents

- -

1.2.10

-
-

Bug Fixes

-
-
    -
  • [LOG4NET-21] - RemotingAppender fails once NDC becomes empty
  • -
  • [LOG4NET-22] - XmlLayout allows output of invalid control characters
  • -
  • [LOG4NET-23] - example-apps.html links are off by one folder level
  • -
  • [LOG4NET-25] - RollingFileAppender can fail if RollOverIfDateBoundaryCrossing required
  • -
  • [LOG4NET-28] - AdoNetAppender does not support inserting NULL into columns
  • -
  • [LOG4NET-29] - LevelMatchFilter should return Neutral when no match is found
  • -
  • [LOG4NET-32] - AdoNetAppender losing first entry
  • -
  • [LOG4NET-35] - Exception rendering ThreadContextStack if null value pushed into stack
  • -
  • [LOG4NET-36] - System.Diagnostics.Trace may throw exception if AppDomain does not have config file
  • -
  • [LOG4NET-40] - RollingFileAppender does not limit files to MaxSizeRollBackups when CountDirection is 1
  • -
  • [LOG4NET-41] - RollingFileAppender roll over date fail
  • -
  • [LOG4NET-42] - Serialised LoggingEvent does not preserve the Fix flags
  • -
  • [LOG4NET-43] - Specifying an empty string as a property in the config file results in an error
  • -
  • [LOG4NET-44] - XmlLayout emits all properties under a node named global-properties, rather than just properties.
  • -
  • [LOG4NET-49] - CountingQuietTextWriter does not count strings written with WriteLine
  • -
  • [LOG4NET-50] - Process.StartTime hangs on some systems
  • -
  • [LOG4NET-60] - Bug in RollingFileAppender.cs causing failure to timely roll files on monthly interval
  • -
  • [LOG4NET-63] - 1.2.9.0 Documentation typos
  • -
  • [LOG4NET-65] - Unhandled SecurityException exception for FileIOPermission while loading configuration file
  • -
  • [LOG4NET-67] - CVE-2006-0743 Security vulnerability in LocalSyslogAppender
  • -
  • [LOG4NET-69] - Exception thrown when *Format methods are given a malformed format string
  • -
  • [LOG4NET-70] - CoreDll.dll referenced with different capitalisation
  • -
  • [LOG4NET-73] - ADONetAppender.ActivateOptions() leaks database connection when called multiple times
  • -
-
-

New Features

-
-
    -
  • [LOG4NET-11] - Add Flush command to API
  • -
  • [LOG4NET-24] - Programmatic flush of BufferingAppenderSkeleton buffer
  • -
  • [LOG4NET-37] - Allow the RepositorySelector type to be specified using the AppSettings config
  • -
  • [LOG4NET-46] - Support appenders that can output multiple events efficiently
  • -
  • [LOG4NET-51] - WmiAppender
  • -
-
-

Improvements

-
-
    -
  • [LOG4NET-3] - Support per event patterns in FileAppender File name
  • -
  • [LOG4NET-13] - Allow SMTPAppender to have replaceable parameters in Subject
  • -
  • [LOG4NET-15] - Email high "importance" priority setting with SmtpAppender
  • -
  • [LOG4NET-17] - Line-wrapping Appender Layouts
  • -
  • [LOG4NET-33] - Ability to use global property to point to log4net configuration file
  • -
  • [LOG4NET-34] - Allow xml config values to be set via XmlNodeType.CDATA or XmlNodeType.Text rather than just value="foo"
  • -
  • [LOG4NET-45] - PluginAttribute does not allow plugin type to be specified as a Type, only as a string
  • -
  • [LOG4NET-52] - Allow XML configurator to set properties of type Object
  • -
  • [LOG4NET-53] - Allow repository properties to be set in the config file
  • -
  • [LOG4NET-56] - Support rendering IEnumerator objects as well as ICollections
  • -
  • [LOG4NET-58] - Support clean build on .NET 2.0
  • -
  • [LOG4NET-72] - Performance of ILog.xxxFormat methods
  • -
  • [LOG4NET-74] - Change MemoryAppender member variables to protected
  • -
-
-
-

1.2.9 Beta

-
-

Breaking Changes

-
-
    -
  • -

    Renamed namespaces

    -

    - Renamed namespace log4net.spi to log4net.Core. - Renamed namespace log4net.helpers to log4net.Util. -

    -
  • -
  • -

    Renamed config classes and attributes

    -

    - In the log4net.Config namespace the DOMConfigurator, - DOMConfiguratorAttribute, DomainAttribute, - and AliasDomainAttribute have been marked as obsolete. These types are - still available and functional in this release. -

    -

    - The XmlConfigurator and XmlConfiguratorAttribute - types replace DOMConfigurator and - DOMConfiguratorAttribute. The RepositoryAttribute - and AliasRepositoryAttribute types replace - DomainAttribute and AliasDomainAttribute. -

    -
  • -
  • -

    Fixed pascal casing of type names

    -

    - Renamed AdoNetAppender, AspNetTraceAppender, - SmtpAppender, Iso8601DateFormatter, - MdcFilter, and NdcFilter. - 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. -

    -
  • -
  • -

    Layouts changed to stream their output to a TextWriter

    -

    - Layouts have been changed to format their output to a TextWriter - rather than return a string. This increases performance and reduces temporary object creation. -

    -
  • -
  • -

    C style string escapes no longer supported by config parser

    -

    - The XML config parser no longer supports decoding C style escape sequences in strings. - Previously sequences like \n and \\ - where decoded. Instead use the appropriate XML encodings as required. -

    -
  • -
-
-

New Features

-
-
    -
  • -

    New CLI build

    -

    - 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. -

    -

    - This build is only available in release configuration and can be found at - bin\cli\1.0\release. -

    -
  • -
  • -

    Logging contexts

    -

    - 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 - MDC and NDC and a replacement for - them. The MDC and NDC have been - reimplemented to use the ThreadContext as storage. -

    -

    - 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: - GlobalContext, ThreadContext, - LogicalThreadContext, and LoggingEvent. - Context values specified in a narrower scope hide the matching value in a wider scope. -

    -
  • -
  • -

    PatternLayout customization and long pattern names

    -

    - The PatternLayout now supports long pattern names. - These pattern names are significantly more readable than the single character patterns. -

    -

    - The PatternLayout now supports custom patterns. New patterns - can be defined in the config file: -

    -
    -<layout type="log4net.Layout.PatternLayout">
    -
    -  <converter>
    -    <name value="myConverter" />
    -    <type value="TestApp.MyPatternConverter, TestApp" />
    -  </converter>
    -
    -  <conversionPattern value="%-5level %logger - %myConverter - %message%newline" />
    -</layout>
    -

    - The above config defines a custom pattern called myConverter - which is bound to the TestApp.MyPatternConverter, TestApp - type. This type must extend the log4net.Util.PatternConverter - base class. The custom pattern can then be used in the pattern string. -

    -

    - For full details see the SDK Reference entry: log4net.Layout.PatternLayout. -

    -
  • -
  • -

    PatternString for pattern based configuration

    -

    - A new pattern based type, PatternString, 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: -

    -
    -<file type="log4net.Util.PatternString">
    -
    -  <converter>
    -    <name value="folder" />
    -    <type value="TestApp.SpecialFolderPatternConverter,TestApp" />
    -  </converter>
    -
    -  <conversionPattern value="%folder{LocalApplicationData}\log-file.txt" />
    -</file>
    -

    - The code for the SpecialFolderPatternConverter - is as follows: -

    -
    -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));
    -  }
    -}
    -

    - For full details see the SDK Reference entry: log4net.Util.PatternString. -

    -
  • -
  • -

    Loading configuration from a URI

    -

    - The XmlConfigurator methods now support loading the - configuration data from a URI. Config can be loaded from any URI supported by the - System.Net.WebRequest class. -

    -
  • -
  • -

    Support for No-Touch deployment

    -

    - Log4net supports configuring No-Touch deployment applications using the - XmlConfiguratorAttribute. If a relative config file - or extension is specified then this is resolved relative to the deployment - URI. -

    -
  • -
  • -

    Config file parser enhancements

    -

    - The config file parser has been enhanced to support specifying the property subtype, or intermediate type, - directly on the property element, for example: -

    -
    -<layout type="log4net.Layout.PatternLayout" value="%message%newline" />
    -

    - Implicit conversion will be attempted between the value string and the type specified, - and then again between the type and the target property type. -

    -
  • -
  • -

    .NET string formatting syntax

    -

    - Added .NET String.Format style formatting syntax methods to - the ILog interface. The new methods are: - DebugFormat, InfoFormat, - WarnFormat, ErrorFormat - and FatalFormat. -

    -
  • -
  • -

    Customizable levels

    -

    - Levels are defined by the repository LevelMap. The defined - levels, the relative ordering of levels and level display names can be configured on - a per-repository basis. -

    -
  • -
  • -

    Per-appender security contexts

    -

    - 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 SecurityContext can be used to elevate the - privileges of the appender. The WindowsSecurityContext - is used to specify alternative credentials on the Windows platform. -

    -
  • -
  • -

    Added new appenders

    -
    -
    AnsiColorTerminalAppender
    -
    -

    - The AnsiColorTerminalAppender 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 ColoredConsoleAppender instead. -

    -
    -
    LocalSyslogAppender
    -
    -

    - 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! -

    -
    -
    RemoteSyslogAppender
    -
    -

    - The RemoteSyslogAppender uses the BSD syslog protocol to - log to a syslog daemon. The syslogd listens for for messages on UDP port 514. -

    -
    -
    TelnetAppender
    -
    -

    - The TelnetAppender 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. -

    -
    -
    -
  • -
  • -

    Added new LoggerMatchFilter filter

    -

    - Added LoggerMatchFilter which matches a string against - the event's logger name. -

    -
  • -
  • -

    Pluggable file locking models for the FileAppender

    -

    - The FileAppender (and by extension the - RollingFileAppender) now support pluggable file - locking models. The default model, ExclusiveLock, - maintains the current exclusive file locking behavior. An alternative - model, MinimalLock, can be used to support writing to - a single output file from multiple processes. -

    -

    - For full details see the SDK Reference entry: log4net.Appender.FileAppender.LockingModel. -

    -
  • -
  • -

    RollingFileAppender roll once

    -

    - The RollingFileAppender now supports a new - rolling style, Once. In this mode the appender - will roll the file once per run. -

    -
  • -
  • -

    SmtpAppender authentication

    -

    - On the .NET 1.1 platform only, the SmtpAppender supports authenticating - against the mail server using either username and password or integrated NTLM authentication. -

    -
  • -
  • -

    AdoNetAppender ReconnectOnError

    -

    - Added new configuration property to AdoNetAppender. - Setting ReconnectOnError to true - will force the appender to attempt to reconnect to the database if the connection - is lost. -

    -
  • -
  • -

    UdpAppender hostname support

    -

    - The UdpAppender config property RemoteAddress - can now be specified as a DNS hostname string. The hostname is resolved to an IP address. -

    -
  • -
-
-

Other Changes

-
-
    -
  • -

    FxCop compliance

    -

    - Updates to bring the internal code in line with the current FxCop rules. -

    -
  • -
  • -

    Separate NUnit tests

    -

    - Moved the NUnit tests into a separate project, log4net.Tests. -

    -
  • -
  • -

    Bug Fixes

    -
    -
    RemotingAppender
    -
    -

    - Sends events from a ThreadPool thread - rather than the calling thread to prevent transfer, - and potential loss, of the CallContext. -

    -
    -
    RollingFileAppender
    -
    -

    - Fixed date rolling period detection for non UTC timezones. -

    -
    -
    ColoredConsoleAppender
    -
    -

    - 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. -

    -
    -
    -
  • -
-
-
-

1.2.0 Beta 8

-
-
    -
  • -

    Changed assembly name to log4net

    -

    - The build output is now log4net.dll - for all frameworks. This is a breaking change. -

    -

    - 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 log4net. - 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. -

    -
  • -
  • -

    Combined Release and ReleaseStrong builds

    -

    - The Release and ReleaseStrong builds have been consolidated into - a single build called Release. This Release build is strongly named. -

    -
  • -
  • -

    New Appender: ColoredConsoleAppender

    -

    - The ColoredConsoleAppender writes events to the - application's console. It can be configured to specify the text and background - colors for different level events. -

    -
  • -
  • -

    New Appender: SmtpPickupDirAppender

    -

    - The SmtpPickupDirAppender 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. -

    -
  • -
  • -

    New Layout: XmlLayoutSchemaLog4j

    -

    - This new layout formats the logging events as XML which complies with - the 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 UdpAppender. -

    -
  • -
  • -

    New PatternLayout conversion characters

    -

    - Added support for capturing the current thread principal name and the - app domain friendly name for each logging event. -

    -
    -
    %a
    -
    - Used to output the friendly name of the AppDomain where the - logging event was generated. -
    -
    %u
    -
    - Used to output the user name for the currently active user - (Principal.Identity.Name). -
    -
    -
  • -
  • -

    Types specified in the config file are now loaded ignoring case

    -

    - All types specified in the configuration files are now loaded - using a case insensitive method. -

    -
  • -
  • -

    Fine grained fixing for buffered events

    -

    - The LoggingEvent 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 Fix - property takes a combination of the FixFlags - enumeration values. -

    -
  • -
  • -

    Code updated inline with FxCop 1.21

    -

    - In line with the FxCop 1.21 guidelines: - Sealed utility classes. Added serialization security demand to GetObjectData. - Renamed parameters. -

    -
  • -
  • -

    EventLogAppender 32K Limit

    -

    - 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. -

    -
  • -
-
-

1.2.0 Beta 7

-
-
    -
  • -

    Updated to support the Microsoft .NET Framework 1.1 Final

    -

    - Updated to support the Microsoft .NET Framework 1.1 Final Beta (1.1.4322). -

    -
  • -
  • -

    Features document

    -

    - Added a new document that covers the main features of log4net. - See the features - document for more information. -

    -
  • -
  • -

    Hierarchy disabled until it is configured

    -

    - 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. -

    -

    - If you are configuring log4net programmatically (i.e. not using - one of the built-in configurators) you must set the - ILoggerRepository.Configured property - to true once you have configured - the repository. -

    -

    - 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. -

    -
  • -
  • -

    New examples in VisualBasic.NET, JScript and Managed C++

    -

    - New examples in VisualBasic.NET, JScript and Managed C++. - TODO Link to document about examples. -

    -
  • -
  • -

    Code and Documentation Updates

    -

    - Code fixes. Documentation and manual updates. - See the ChangeLog for more information. -

    -
  • -
  • -

    Added document with example appender configurations

    -

    - See the Example Appender Configuration - document for more information. -

    -
  • -
-
-

1.2.0 Beta 6

-
-
    -
  • -

    Added support for multiple frameworks

    -

    - log4net 1.2.0 beta 6 adds support for the the following frameworks: -

    -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    - Framework - Website
    Microsoft .NET Framework 1.1 Final Beta (1.1.4322)http://msdn.microsoft.com/net
    Microsoft .NET Compact Framework 1.0 (1.0.5000)http://msdn.microsoft.com/vstudio/device/compactfx.asp
    Mono 0.23http://www.go-mono.org
    Microsoft Shared Source CLI 1.0http://msdn.microsoft.com/library/en-us/dndotnet/html/mssharsourcecli.asp
    -
    -
    -

    - Not all frameworks are created equal and some features have been excluded from - some of the builds. See the Framework Support document for more information. -

    -
  • -
  • -

    New build system using NAnt

    -

    - The new build system allows log4net to be built for all supported frameworks and - in all build configurations in one go. -

    -
  • -
  • -

    New source code & distribution layout

    -

    - The source code & distribution layout has been updated to support the new - build environment and multiple target frameworks. -

    -
  • -
  • -

    Removed DomainAttribute.UseDefaultDomain property

    -

    - Updated default behavior of DefaultRepositorySelector. Assemblies - are now by default placed into the default domain. To specify another domain, - the DomainAttribute must be used. This is the opposite behavior - to what was previously available. If you were previously specifying the DomainAttribute.UseDefaultDomain - property then you should remove it, and if the default behavior is now - sufficient, you do not need to specify the DomainAttribute at all. -

    -
  • -
  • -

    Updated configuration file parser

    -

    - Updated config file parser to use the element name as the property to set. Also - removed <object> tag, the type attribute can now be - specified on the property element directly. -

    -

    - For example: -

    -
    -<appender>
    -  <param name="Evaluator">
    -    <object type="log4net.spi.LevelEvaluator">
    -      <constructor>
    -        <param type="log4net.spi.Level" value="DEBUG"/>
    -      </constructor>
    -    </object>
    -  </param>
    -</appender>
    -

    - becomes: -

    -
    -<appender>
    -  <evaluator type="log4net.spi.LevelEvaluator">
    -    <threshold value="DEBUG"/>
    -  </evaluator>
    -</appender>
    -
  • -
  • -

    Support for event ID

    -

    - The EventLogAppender now supports setting the event ID in the - event log, this is taken from the EventID property from the per - event Properties map on the LoggingEvent. -

    -
  • -
  • -

    Updated ADONetAppender

    -

    -

      -
    • - Added support for prepared statements and stored procedures
    • -
    • - Added RawTimeStampLayoutto correctly convert the timestamps into - database date time format
    • -
    • - Added ExceptionLayout to render the exception data
    • -
    -

    -

  • -
  • -

    Support for front-end extension

    -

    - This allows the logging API to be wrapped or adapted for specific purposes. Two - extension samples are included in the distribution: -

    -
    - - - - - - - - - - - - - - - - - -
    - Extension - Description
    log4net.Ext.TraceAdds trace logging methods
    log4net.Ext.EventIDAdds additional eventId parameter to all methods
    -
    -

    -

  • -
  • -

    Added ForwardingAppender

    -

    Forwards events to multiple sub appenders after applying filter rules.

    -
  • -
  • -

    Added BufferingForwardingAppender

    -

    Forward events to sub appenders after buffering them.

    -
  • -
  • -

    Added ASPNetTraceAppender

    -

    Logs events to the ASP.NET trace system.

    -
  • -
  • -

    Added NetSendAppender

    -

    Delivers logging events using the Windows Messenger service.

    -
  • -
  • -

    Added UdpAppender

    -

    Sends logging events as connectionless UDP datagrams to a remote host or a - multicast group.

    -
  • -
  • -

    Removed obsolete methods

    -
  • -
  • -

    Lots of updates to improve our compliance with FxCop

    -
  • -
  • -

    Improved SDK documentation

    -
  • -
-
-

1.2.0 Beta 5

-
-
    -
  • -

    Fixed Exception thrown when DOM Configurator called with a null XML - Element.

    -

    This occurred if the configuration file did not have a log4net section defined.

    -
  • -
  • -

    Made level lookup case insensitive

    -
  • -
  • -

    Prevented the Hierarchy's Threshold level from being set to a null reference

    -
  • -
-
-

1.2.0 Beta 4

-
-
    -
  • -

    Added event specific properties to the logging event object

    -

    - Appenders can add additional information to the events they are logging. The RemotingAppender - and the SMTPAppender both add a 'hostname' property to the events. - These properties can be accessed using the PatternLayout with the - %P{name} syntax. -

    -
  • -
  • -

    Added a plugin framework

    -

    An IPlugin interface can be attached to any repository.

    -
  • -
  • -

    A new RemoteLoggingServerPlugin plugin acts as the server for the - RemotingAppender

    -
  • -
  • -

    Updated the core log4net framework to work in an environment with no - permissions

    -

    Specific appenders still require additional permissions to log correctly

    -
  • -
  • -

    Added support for domain aliasing using the AliasDomainAttribute

    -

    This allows a parent assembly to take control of the logging domain for child - assemblies.

    -
  • -
  • -

    Added events for repository creation, configuration change, configuration reset - and repository shutdown

    -
  • -
  • -

    Added LevelMap to the ILoggerRepository interface

    -

    The mapping from level name to level object is now repository specific, - therefore each repository can have independent mappings.

    -
  • -
  • -

    Moved hierarchy specific config file parser to new DOMHierarchyConfigurator class

    -

    This is controlled by the Hierarchy object and allows for better - encapsulation.

    -
  • -
  • -

    Added OnlyFixPartialEventData property to the buffered appenders

    -

    This setting causes slow settings to be ignored. This significantly improves the - performance of the buffered appenders.

    -
  • -
  • -

    XML entity references are supported in the XML config file.

    -
  • -
  • -

    Added support for expanding environment variables in <param> values

    -

    - The environment variables must be specified as ${FOO} where FOO - is the name of the variable to expand. -

    -
  • -
  • -

    Upgraded to use NUnit 2.0

    -
  • -
  • -

    File appenders can specify the encoding to use for the file

    -
  • -
  • -

    Added strong named configuration

    -
  • -
-
-

1.2.0 Beta 3

-
-
    -
  • -

    Added log4net.Ext.Trace extension

    -

    This is a separate assembly that adds a trace level to log4net.

    -
  • -
  • -

    The default log file output directory is now the application base directory not - the current directory

    -
  • -
  • -

    Added MemoryAppender

    -

    Stores all the logging events in an in-memory buffer.

    -
  • -
  • -

    Moved the Hierarchy implementation into a separate namespace

    -

    - The log4net.Repository.Hierarchy namespace now contains all the - code that is specific to the Hierarchy implementation. -

    -
  • -
  • -

    Refactored the DOMConfigurator and BasicConfigurator

    -

    - The Hierarchy specific data schema and implementation could be has - now been moved to the log4net.Repository.Hierarchy namespace. The - bootstrap code for these configurators remains in the log4net.Config - namespace. -

    -
  • -
  • -

    Replaced the DOMConfiguratorAttribute UseExecutableDomain - property with UseDefaultDomain

    -

    - This change to the implementation of the DOMConfiguratorAttribute should - allow the configuration of multiple assemblies to be accomplished more easily, - especially when developing web applications (ASP.NET). -

    -
  • -
  • -

    A few good bug fixes!

    -
  • -
-
-

1.2.0 Beta 2

-
-
    -
  • -

    Added ADONetAppender

    -

    Thanks to TechnologyOneCorp.com.

    -
  • -
  • -

    Added TraceLogAssembly extensibility example

    -
  • -
  • -

    Lots of bug fixes

    -
  • -
-
-

1.2.0 Beta 1

-
-
    -
  • -

    Added 6 new examples

    -
  • -
  • -

    Split Category class into Logger and LogManager classes

    -

    - The instance methods from Category have moved to the Logger - class. The static methods from Category have moved to the LogManager - class. The Category class still exists but for backward - compatibility only. Changed interface ICategoryFactory to ILoggerFactory - and the implementation class DefaultCategoryFactory to DefaultLoggerFactory. -

    -
  • -
  • -

    Replaced Priority class with Level class

    -

    - The Priority class has been replaced by the Level class. - The Priority class still exists for backward compatibility only. - The Level class implements a static pool of Level objects. - The Level class is sealed and serializable. -

    -
  • -
  • -

    Added ILoggerRepository interface implemented by Hierarchy

    -

    - The Hierarchy class implements the ILoggerRepository interface. - This interface is used by the LogManager class and therefore - allows different implementations of ILoggerRepository to be used. -

    -
  • -
  • -

    Enhanced NUnit tests

    -

    - All the NUnit tests can be run using a single TestSuite: NUnitGUI - log4net.LogManager+AllTests,log4net.dll. -

    -
  • -
  • -

    Added support for serializing LoggingEvents

    -

    - The LoggingEvent class is serializable. All local state is - captured before serialization occurs. This now allows LoggingEvent - objects to be serialized between applications or machines. -

    -
  • -
  • -

    Added RemotingAppender

    -

    - Delivers LoggingEvents 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 examples\net\remoting\RemotingServer - for details. -

    -
  • -
  • -

    Added support for rendering composite objects

    -

    - The IObjectRenderer interface method DoRender now - takes a RendererMap argument. This allows the renderer to use the - appropriate renderer from the RendererMap to render any nested - objects. -

    -
  • -
  • -

    Added support for rendering exceptions

    -

    - The DefaultRenderer now has support for rendering exceptions to a - string. This includes nested exceptions. The RendererMap is now - used to render exceptions in the LoggingEvent. This allows the - rendering of specific exceptions to be enhanced by specific renderers. -

    -
  • -
  • -

    Added ITriggeringEventEvaluator interface

    -

    - This interface is used by SMTPAppender and RemotingAppender - to determine if a LoggingEvent 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 LevelEvaluator class, which triggers above a - set level. -

    -
  • -
  • -

    Added regex matching to the MDCFilter, NDCFilter and StringMatchFilter

    -

    - The MDCFilter, NDCFilter and StringMatchFilter - can now be configured to use regex matches in addition to substring matches. - Set the RegexToMatch property to use this feature. -

    -
  • -
  • -

    Added XMLLayout

    -

    - emits an XML element for each LoggingEvent. This allows logging - events to be stored and manipulated as XML. The DTD for the XML emitted is in - the log4net-events.dtd -

    -
  • -
  • -

    Added support for <logger> and <level> elements in the - DOMConfigurator

    -

    - As the Category and Priority classes have been - replaced by the Logger and Level classes. The DOMConfigurator - has been updated to allow the <logger> and <level> - elements to be used in place of the <category> and <priority> - elements. The old elements are still accepted for backward compatibility. -

    -
  • -
  • -

    Added Threshold property to Hierarchy

    -

    - Changed DisableXXX() methods on Hierarchy to a Threshold - property. -

    -
  • -
  • -

    Added support for logging domains

    -

    - The LogManager supports multiple logging domains. The LogManager - uses an instance of the IRepositorySelector class to map from - domains to ILoggerRepository instances. The default implementation - is to have a separate ILoggerRepository for each domain. When a - call is made to the static methods on LogManager 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 ILoggerRepository. 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. -

    -
  • -
  • -

    DOMConfigurator can set params to arbitrary objects

    -

    - Using a new <object> element, params can now be set to any - creatable object. -

    -
  • -
-
-
- - - - - -

 

- -
- Copyright © - 2004-2007, - Apache Software Foundation -
- - -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/roadmap.html b/doc/roadmap.html deleted file mode 100755 index f891f97f..00000000 --- a/doc/roadmap.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Apache log4net: Development Roadmap - - - - - - - - - - - - - - - - - -
- - - - -

Apache log4net Development Roadmap

-
-

- The log4net development roadmap is managed by our JIRA issue tracking system. -

-

- For a list of upcoming fixes and in-progress tasks see: -

- -
- - - - - -

 

- -
- Copyright © - 2004-2007, - Apache Software Foundation -
- - -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/support.html b/doc/support.html deleted file mode 100755 index 34f3acda..00000000 --- a/doc/support.html +++ /dev/null @@ -1,369 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Apache log4net: Support - - - - - - - - - - - - - - - - - -
- - - - -

log4net Support

-
-

- log4net user support is provided via a mailing list. Discussion on log4net is held on the - log4net-user mailing list. Please search the archives before posting because it - is likely that your question has been answered before. -

-

Mailing List Archives

-
-

- You can browse the mailing list archives at the following locations: -

- -
-

Subscribe

-
-

- Subscribe to either the list or to the digest list: -

- -
-

Unsubscribe

-
-

- To unsubscribe send an email to the relevant email address: -

- -
-

Posting

-
-

- Before posting please read the following guidelines: -

-
    -
  • -

    - Ask smart questions
    - Every volunteer project obtains its strength from the people involved - in it. You are welcome to join any of our mailing lists. You can - choose to lurk, or actively participate; it's up to you. The level of - community responsiveness to specific questions is generally directly - proportional to the amount of effort you spend formulating your - question. Eric Raymond and Rick Moen have even written an essay entitled - "Asking Smart Questions" - precisely on this topic. -

    -
  • - -
  • -

    - Keep your email short and to the point
    - If your email is more than about a page of text, chances are that it - won't get read by very many people. It is much better to try to pack a - lot of informative information (see above about asking smart questions) - into as small of an email as possible. If you are replying to a previous - email, it is a good idea to only quote the parts that you are replying - to and to remove the unnecessary bits. This makes it easier for people - to follow a thread as well as making the email archives easier to search - and read. -

    -
  • - -
  • -

    - Do your best to ensure that you are not sending HTML or "Stylelized" email to the list
    - If you are using Outlook or Outlook Express or Eudora, chances are that - you are sending HTML email by default. There is usually a setting that - will allow you to send "Plain Text" email. If you are using Microsoft - products to send email, there are several bugs in the software that - prevent you from turning off the sending of HTML email. Please read this - page as well. -

    -
  • - -
  • -

    - Watch where you are sending email
    - Our mailing lists have set the Reply-To to go back to the - list. That means that when you Reply to a message, it will go to the list - and not to the original author directly. The reason is because it helps - facilitate discussion on the list for everyone to benefit from. Be careful - of this as sometimes you may intend to reply to a message directly to someone - instead of the entire list. -

    -

    - The appropriate contents of the Reply-To header is an age-old debate that - should not be brought up on the mailing lists. You can examine opposing points of view - condemning - our convention and condoning - it. Bringing this topic up for debate again on a mailing list will add nothing new - and is considered off-topic. -

    -
  • - -
  • -

    - Do not cross post messages
    - In other words, pick a mailing list and send your messages to that mailing - list only. Do not send your messages to multiple mailing lists. The reason is - that people may be subscribed to one list and not to the other. Therefore, - some people will only see part of the conversation. -

    -
  • -
-

- Where relevant please try to include the following information in your postings. -

-
    -
  • -

    - Specify the version of log4net you are using. -

    -
  • - -
  • -

    - Specify what your assembly type is, i.e. exe or dll, and how your code is launched, - e.g. console application, windows application, ASP.NET project, COM+ hosted object, etc... -

    -
  • - -
  • -

    - Specify which runtime platform (e.g. MS .NET, Mono, SSCLI) you are using and which version. -

    -
  • - -
  • -

    - If you are having configuration issues then include logging configuration files if any, plus source code. -

    -
  • - -
  • -

    - If possible please reproduce your issue with the - internal log4net debugging - enabled. Include this debug output in your post, it is usually the first thing we ask for in diagnosing issues. -

    -
  • - -
  • -

    - If you think you have found a bug then a short example reproducing the problem is very much appreciated. -

    -
  • -
-

- To prevent spam, we require you to be subscribed to the list before posting to it. -

-

- Ask questions and report bugs via email to the - log4net-user@logging.apache.org - mailing list. -

-
-
- - - - - -

 

- -
- Copyright © - 2004-2007, - Apache Software Foundation -
- - -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/mono/1.0/Performance/NotLogging/cs/nant.build b/examples/mono/1.0/Performance/NotLogging/cs/nant.build old mode 100755 new mode 100644 diff --git a/examples/mono/1.0/Performance/NotLogging/cs/nant.config b/examples/mono/1.0/Performance/NotLogging/cs/nant.config old mode 100755 new mode 100644 diff --git a/examples/mono/1.0/Performance/NotLogging/cs/src/AssemblyInfo.cs b/examples/mono/1.0/Performance/NotLogging/cs/src/AssemblyInfo.cs old mode 100755 new mode 100644 diff --git a/examples/mono/1.0/Performance/NotLogging/cs/src/NotLogging.cs b/examples/mono/1.0/Performance/NotLogging/cs/src/NotLogging.cs old mode 100755 new mode 100644 diff --git a/examples/mono/1.0/Performance/NotLogging/nant.build b/examples/mono/1.0/Performance/NotLogging/nant.build old mode 100755 new mode 100644 diff --git a/examples/mono/1.0/Performance/NotLogging/nant.config b/examples/mono/1.0/Performance/NotLogging/nant.config old mode 100755 new mode 100644 diff --git a/examples/mono/1.0/Performance/nant.build b/examples/mono/1.0/Performance/nant.build old mode 100755 new mode 100644 diff --git a/examples/mono/1.0/Performance/nant.config b/examples/mono/1.0/Performance/nant.config old mode 100755 new mode 100644 diff --git a/examples/mono/1.0/Repository/SharedModule/cs/nant.build b/examples/mono/1.0/Repository/SharedModule/cs/nant.build old mode 100755 new mode 100644 diff --git a/examples/mono/1.0/Repository/SharedModule/cs/nant.config b/examples/mono/1.0/Repository/SharedModule/cs/nant.config old mode 100755 new mode 100644 diff --git a/examples/mono/1.0/Repository/SharedModule/cs/src/AssemblyInfo.cs b/examples/mono/1.0/Repository/SharedModule/cs/src/AssemblyInfo.cs old mode 100755 new mode 100644 diff --git a/examples/mono/1.0/Repository/SharedModule/cs/src/Math.cs b/examples/mono/1.0/Repository/SharedModule/cs/src/Math.cs old mode 100755 new mode 100644 diff --git a/examples/mono/1.0/Repository/SharedModule/nant.build b/examples/mono/1.0/Repository/SharedModule/nant.build old mode 100755 new mode 100644 diff --git a/examples/mono/1.0/Repository/SharedModule/nant.config b/examples/mono/1.0/Repository/SharedModule/nant.config old mode 100755 new mode 100644 diff --git a/examples/mono/1.0/Repository/SimpleApp/cs/nant.build b/examples/mono/1.0/Repository/SimpleApp/cs/nant.build old mode 100755 new mode 100644 diff --git a/examples/mono/1.0/Repository/SimpleApp/cs/nant.config b/examples/mono/1.0/Repository/SimpleApp/cs/nant.config old mode 100755 new mode 100644 diff --git a/examples/mono/1.0/Repository/SimpleApp/cs/src/App.config b/examples/mono/1.0/Repository/SimpleApp/cs/src/App.config old mode 100755 new mode 100644 index d87f2d9f..10a5b298 --- a/examples/mono/1.0/Repository/SimpleApp/cs/src/App.config +++ b/examples/mono/1.0/Repository/SimpleApp/cs/src/App.config @@ -1,4 +1,25 @@ + + diff --git a/examples/mono/1.0/Repository/SimpleApp/cs/src/AssemblyInfo.cs b/examples/mono/1.0/Repository/SimpleApp/cs/src/AssemblyInfo.cs old mode 100755 new mode 100644 diff --git a/examples/mono/1.0/Repository/SimpleApp/cs/src/EntryPoint.cs b/examples/mono/1.0/Repository/SimpleApp/cs/src/EntryPoint.cs old mode 100755 new mode 100644 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 old mode 100755 new mode 100644 diff --git a/examples/mono/1.0/Repository/SimpleApp/nant.build b/examples/mono/1.0/Repository/SimpleApp/nant.build old mode 100755 new mode 100644 diff --git a/examples/mono/1.0/Repository/SimpleApp/nant.config b/examples/mono/1.0/Repository/SimpleApp/nant.config old mode 100755 new mode 100644 diff --git a/examples/mono/1.0/Repository/SimpleModule/cs/nant.build b/examples/mono/1.0/Repository/SimpleModule/cs/nant.build old mode 100755 new mode 100644 diff --git a/examples/mono/1.0/Repository/SimpleModule/cs/nant.config b/examples/mono/1.0/Repository/SimpleModule/cs/nant.config old mode 100755 new mode 100644 diff --git a/examples/mono/1.0/Repository/SimpleModule/cs/src/AssemblyInfo.cs b/examples/mono/1.0/Repository/SimpleModule/cs/src/AssemblyInfo.cs old mode 100755 new mode 100644 diff --git a/examples/mono/1.0/Repository/SimpleModule/cs/src/Math.cs b/examples/mono/1.0/Repository/SimpleModule/cs/src/Math.cs old mode 100755 new mode 100644 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 old mode 100755 new mode 100644 diff --git a/examples/mono/1.0/Repository/SimpleModule/nant.build b/examples/mono/1.0/Repository/SimpleModule/nant.build old mode 100755 new mode 100644 diff --git a/examples/mono/1.0/Repository/SimpleModule/nant.config b/examples/mono/1.0/Repository/SimpleModule/nant.config old mode 100755 new mode 100644 diff --git a/examples/mono/1.0/Repository/nant.build b/examples/mono/1.0/Repository/nant.build old mode 100755 new mode 100644 diff --git a/examples/mono/1.0/Repository/nant.config b/examples/mono/1.0/Repository/nant.config old mode 100755 new mode 100644 diff --git a/examples/mono/1.0/Tutorials/ConsoleApp/cs/nant.build b/examples/mono/1.0/Tutorials/ConsoleApp/cs/nant.build old mode 100755 new mode 100644 diff --git a/examples/mono/1.0/Tutorials/ConsoleApp/cs/nant.config b/examples/mono/1.0/Tutorials/ConsoleApp/cs/nant.config old mode 100755 new mode 100644 diff --git a/examples/mono/1.0/Tutorials/ConsoleApp/cs/src/App.config b/examples/mono/1.0/Tutorials/ConsoleApp/cs/src/App.config old mode 100755 new mode 100644 index 4680e125..f312d5f2 --- a/examples/mono/1.0/Tutorials/ConsoleApp/cs/src/App.config +++ b/examples/mono/1.0/Tutorials/ConsoleApp/cs/src/App.config @@ -1,4 +1,25 @@ + + + - \ No newline at end of file + diff --git a/examples/net/1.1/Repository/SimpleApp/js/src/AssemblyInfo.js b/examples/net/1.1/Repository/SimpleApp/js/src/AssemblyInfo.js old mode 100755 new mode 100644 diff --git a/examples/net/1.1/Repository/SimpleApp/js/src/EntryPoint.js b/examples/net/1.1/Repository/SimpleApp/js/src/EntryPoint.js old mode 100755 new mode 100644 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 old mode 100755 new mode 100644 diff --git a/examples/net/1.1/Repository/SimpleApp/nant.build b/examples/net/1.1/Repository/SimpleApp/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/1.1/Repository/SimpleApp/nant.config b/examples/net/1.1/Repository/SimpleApp/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/1.1/Repository/SimpleModule/js/nant.build b/examples/net/1.1/Repository/SimpleModule/js/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/1.1/Repository/SimpleModule/js/nant.config b/examples/net/1.1/Repository/SimpleModule/js/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/1.1/Repository/SimpleModule/js/src/AssemblyInfo.js b/examples/net/1.1/Repository/SimpleModule/js/src/AssemblyInfo.js old mode 100755 new mode 100644 diff --git a/examples/net/1.1/Repository/SimpleModule/js/src/Math.js b/examples/net/1.1/Repository/SimpleModule/js/src/Math.js old mode 100755 new mode 100644 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 old mode 100755 new mode 100644 diff --git a/examples/net/1.1/Repository/SimpleModule/nant.build b/examples/net/1.1/Repository/SimpleModule/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/1.1/Repository/SimpleModule/nant.config b/examples/net/1.1/Repository/SimpleModule/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/1.1/Repository/nant.build b/examples/net/1.1/Repository/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/1.1/Repository/nant.config b/examples/net/1.1/Repository/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/1.1/Tutorials/ConsoleApp/cpp/nant.build b/examples/net/1.1/Tutorials/ConsoleApp/cpp/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/1.1/Tutorials/ConsoleApp/cpp/nant.config b/examples/net/1.1/Tutorials/ConsoleApp/cpp/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/1.1/Tutorials/ConsoleApp/cpp/src/App.config b/examples/net/1.1/Tutorials/ConsoleApp/cpp/src/App.config old mode 100755 new mode 100644 index c46c37b4..de78cf09 --- a/examples/net/1.1/Tutorials/ConsoleApp/cpp/src/App.config +++ b/examples/net/1.1/Tutorials/ConsoleApp/cpp/src/App.config @@ -1,4 +1,25 @@ + + + + + + + + Local 8.0.50727 @@ -140,4 +162,4 @@ - \ No newline at end of file + diff --git a/examples/net/2.0/Appenders/SampleAppendersApp/nant.build b/examples/net/2.0/Appenders/SampleAppendersApp/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Appenders/SampleAppendersApp/nant.config b/examples/net/2.0/Appenders/SampleAppendersApp/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Appenders/WmiAppender/cs/nant.build b/examples/net/2.0/Appenders/WmiAppender/cs/nant.build index 75a7b772..ead5d2e8 100644 --- a/examples/net/2.0/Appenders/WmiAppender/cs/nant.build +++ b/examples/net/2.0/Appenders/WmiAppender/cs/nant.build @@ -1,48 +1,48 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/net/2.0/Appenders/WmiAppender/cs/nant.config b/examples/net/2.0/Appenders/WmiAppender/cs/nant.config index b0553a7f..52613e83 100644 --- a/examples/net/2.0/Appenders/WmiAppender/cs/nant.config +++ b/examples/net/2.0/Appenders/WmiAppender/cs/nant.config @@ -1,23 +1,23 @@ - - - - - - - - + + + + + + + + diff --git a/examples/net/2.0/Appenders/WmiAppender/cs/src/AssemblyInfo.cs b/examples/net/2.0/Appenders/WmiAppender/cs/src/AssemblyInfo.cs index 9105dfe5..16c39de3 100644 --- a/examples/net/2.0/Appenders/WmiAppender/cs/src/AssemblyInfo.cs +++ b/examples/net/2.0/Appenders/WmiAppender/cs/src/AssemblyInfo.cs @@ -1,67 +1,67 @@ -#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\. 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("")] +#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\. 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 index 90445119..0ccd376e 100644 --- a/examples/net/2.0/Appenders/WmiAppender/cs/src/IWmiBoundEvent.cs +++ b/examples/net/2.0/Appenders/WmiAppender/cs/src/IWmiBoundEvent.cs @@ -1,53 +1,53 @@ -#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 -{ - /// - /// Subclass of for events that need to bind to a - /// - /// - /// - /// If the . is - /// a then the default behavior of the - /// is to call the method passing the . - /// This allows the event object to capture additional data from the - /// before it is fired. - /// - /// - public interface IWmiBoundEvent : IEvent - { - /// - /// This method is called before this instance is fired - /// - /// the containing the data - /// - /// - /// The calls this method passing the - /// object. Implementors should capture any required data from the - /// and store it in their instance prior to firing to WMI. - /// - /// - void Bind(LoggingEvent loggingEvent); - } -} +#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 +{ + /// + /// Subclass of for events that need to bind to a + /// + /// + /// + /// If the . is + /// a then the default behavior of the + /// is to call the method passing the . + /// This allows the event object to capture additional data from the + /// before it is fired. + /// + /// + public interface IWmiBoundEvent : IEvent + { + /// + /// This method is called before this instance is fired + /// + /// the containing the data + /// + /// + /// The calls this method passing the + /// object. Implementors should capture any required data from the + /// and store it in their instance prior to firing to WMI. + /// + /// + 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 index 5e563b38..a2398838 100644 --- a/examples/net/2.0/Appenders/WmiAppender/cs/src/WmiAppender.cs +++ b/examples/net/2.0/Appenders/WmiAppender/cs/src/WmiAppender.cs @@ -1,255 +1,255 @@ -#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 -{ - /// - /// fires instrumented events for each - /// - /// - /// - /// This appender fires Windows Management Instrumentation (WMI) events for - /// each . - /// - /// - /// By default this appender fires objects, however - /// this can be overridden by specifying a custom or by setting - /// the . to an - /// instance. - /// - /// - /// This assembly must be registered with WMI. Use the InstallUtil tool - /// shipped with the .NET framework to install this assembly. This will register - /// the root/log4net WMI namespace. - /// - /// - public sealed class WmiAppender : IAppender, IOptionHandler - { - #region Private Instance Fields - - /// - /// The layout of this appender. - /// - /// - /// See for more information. - /// - private WmiLayout m_layout; - - /// - /// The name of this appender. - /// - /// - /// See for more information. - /// - private string m_name; - - /// - /// The level threshold of this appender. - /// - /// - /// - /// There is no level threshold filtering by default. - /// - /// - /// See for more information. - /// - /// - private Level m_threshold; - - /// - /// It is assumed and enforced that errorHandler is never null. - /// - /// - /// - /// It is assumed and enforced that errorHandler is never null. - /// - /// - /// See for more information. - /// - /// - private IErrorHandler m_errorHandler = new log4net.Util.OnlyOnceErrorHandler("WmiAppender"); - - #endregion - - #region Public Instance Properties - - /// - /// Gets or sets the name of this appender. - /// - /// The name of the appender. - /// - /// - /// The name uniquely identifies the appender. - /// - /// - public string Name - { - get { return m_name; } - set { m_name = value; } - } - - /// - /// Gets or sets the threshold of this appender. - /// - /// - /// The threshold of the appender. - /// - /// - /// - /// All log events with lower level than the threshold level are ignored - /// by the appender. - /// - /// - /// In configuration files this option is specified by setting the - /// value of the option to a level - /// string, such as "DEBUG", "INFO" and so on. - /// - /// - public Level Threshold - { - get { return m_threshold; } - set { m_threshold = value; } - } - - /// - /// Gets or sets the for this appender. - /// - /// The layout of the appender. - /// - /// - /// The to use to format the - /// as an . - /// - /// - public WmiLayout Layout - { - get { return m_layout; } - set { m_layout = value; } - } - - /// - /// Gets or sets the for this appender. - /// - /// The of the appender - /// - /// - /// The default value is a . - /// - /// - 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 - - /// - /// Activate this appender - /// - /// - /// - /// If a has not been specified then this - /// method will create a default instance. - /// - /// - public void ActivateOptions() - { - if (m_layout == null) - { - m_layout = new WmiLayout(); - } - } - - /// - /// Close this appender - /// - public void Close() - { - } - - /// - /// Process a - /// - /// the containing the data - /// - /// - /// Uses the to format the - /// as an . This is then fired. - /// - /// - 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)"); - } - } - - /// - /// Checks if the message level is below this appender's threshold. - /// - private bool IsAsSevereAsThreshold(Level level) - { - return ((m_threshold == null) || level >= m_threshold); - } - } -} +#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 +{ + /// + /// fires instrumented events for each + /// + /// + /// + /// This appender fires Windows Management Instrumentation (WMI) events for + /// each . + /// + /// + /// By default this appender fires objects, however + /// this can be overridden by specifying a custom or by setting + /// the . to an + /// instance. + /// + /// + /// This assembly must be registered with WMI. Use the InstallUtil tool + /// shipped with the .NET framework to install this assembly. This will register + /// the root/log4net WMI namespace. + /// + /// + public sealed class WmiAppender : IAppender, IOptionHandler + { + #region Private Instance Fields + + /// + /// The layout of this appender. + /// + /// + /// See for more information. + /// + private WmiLayout m_layout; + + /// + /// The name of this appender. + /// + /// + /// See for more information. + /// + private string m_name; + + /// + /// The level threshold of this appender. + /// + /// + /// + /// There is no level threshold filtering by default. + /// + /// + /// See for more information. + /// + /// + private Level m_threshold; + + /// + /// It is assumed and enforced that errorHandler is never null. + /// + /// + /// + /// It is assumed and enforced that errorHandler is never null. + /// + /// + /// See for more information. + /// + /// + private IErrorHandler m_errorHandler = new log4net.Util.OnlyOnceErrorHandler("WmiAppender"); + + #endregion + + #region Public Instance Properties + + /// + /// Gets or sets the name of this appender. + /// + /// The name of the appender. + /// + /// + /// The name uniquely identifies the appender. + /// + /// + public string Name + { + get { return m_name; } + set { m_name = value; } + } + + /// + /// Gets or sets the threshold of this appender. + /// + /// + /// The threshold of the appender. + /// + /// + /// + /// All log events with lower level than the threshold level are ignored + /// by the appender. + /// + /// + /// In configuration files this option is specified by setting the + /// value of the option to a level + /// string, such as "DEBUG", "INFO" and so on. + /// + /// + public Level Threshold + { + get { return m_threshold; } + set { m_threshold = value; } + } + + /// + /// Gets or sets the for this appender. + /// + /// The layout of the appender. + /// + /// + /// The to use to format the + /// as an . + /// + /// + public WmiLayout Layout + { + get { return m_layout; } + set { m_layout = value; } + } + + /// + /// Gets or sets the for this appender. + /// + /// The of the appender + /// + /// + /// The default value is a . + /// + /// + 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 + + /// + /// Activate this appender + /// + /// + /// + /// If a has not been specified then this + /// method will create a default instance. + /// + /// + public void ActivateOptions() + { + if (m_layout == null) + { + m_layout = new WmiLayout(); + } + } + + /// + /// Close this appender + /// + public void Close() + { + } + + /// + /// Process a + /// + /// the containing the data + /// + /// + /// Uses the to format the + /// as an . This is then fired. + /// + /// + 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)"); + } + } + + /// + /// Checks if the message level is below this appender's threshold. + /// + 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 index 036cd2b1..04b4480f 100644 --- a/examples/net/2.0/Appenders/WmiAppender/cs/src/WmiAppender.csproj +++ b/examples/net/2.0/Appenders/WmiAppender/cs/src/WmiAppender.csproj @@ -1,112 +1,134 @@ - - - Local - 8.0.50727 - 2.0 - {BE56F892-37BA-489C-A91D-F2761FDB96EF} - Debug - AnyCPU - - - - - log4net.Appender.WmiAppender - - - JScript - Grid - IE50 - false - Library - log4net.Appender.WmiAppender - - - - - - - - - ..\bin\Debug\ - false - 285212672 - false - - - DEBUG;TRACE - - - true - 4096 - false - false - false - false - 4 - full - prompt - - - ..\bin\Release\ - false - 285212672 - false - - - TRACE - - - false - 4096 - true - false - false - false - 4 - none - prompt - - - - False - ..\..\..\..\..\..\..\bin\net\2.0\debug\log4net.dll - - - System - - - System.Configuration.Install - - - System.Management - - - - - AssemblyVersionInfo.cs - - - - Code - - - Code - - - Component - - - Code - - - Code - - - - - - - - - - \ No newline at end of file + + + + + + Local + 8.0.50727 + 2.0 + {BE56F892-37BA-489C-A91D-F2761FDB96EF} + Debug + AnyCPU + + + + + log4net.Appender.WmiAppender + + + JScript + Grid + IE50 + false + Library + log4net.Appender.WmiAppender + + + + + + + + + ..\bin\Debug\ + false + 285212672 + false + + + DEBUG;TRACE + + + true + 4096 + false + false + false + false + 4 + full + prompt + + + ..\bin\Release\ + false + 285212672 + false + + + TRACE + + + false + 4096 + true + false + false + false + 4 + none + prompt + + + + False + ..\..\..\..\..\..\..\bin\net\2.0\debug\log4net.dll + + + System + + + System.Configuration.Install + + + System.Management + + + + + AssemblyVersionInfo.cs + + + + Code + + + Code + + + Component + + + Code + + + Code + + + + + + + + + + diff --git a/examples/net/2.0/Appenders/WmiAppender/cs/src/WmiInstaller.cs b/examples/net/2.0/Appenders/WmiAppender/cs/src/WmiInstaller.cs index 347ec16b..03bb8653 100644 --- a/examples/net/2.0/Appenders/WmiAppender/cs/src/WmiInstaller.cs +++ b/examples/net/2.0/Appenders/WmiAppender/cs/src/WmiInstaller.cs @@ -1,32 +1,32 @@ -#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 -{ - /// - /// Register this assembly with WMI - /// - [System.ComponentModel.RunInstaller(true)] - public class WmiInstaller : DefaultManagementProjectInstaller - { - } -} +#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 +{ + /// + /// Register this assembly with WMI + /// + [System.ComponentModel.RunInstaller(true)] + public class WmiInstaller : DefaultManagementProjectInstaller + { + } +} diff --git a/examples/net/2.0/Appenders/WmiAppender/cs/src/WmiLayout.cs b/examples/net/2.0/Appenders/WmiAppender/cs/src/WmiLayout.cs index 68e0bee5..eaf51d8c 100644 --- a/examples/net/2.0/Appenders/WmiAppender/cs/src/WmiLayout.cs +++ b/examples/net/2.0/Appenders/WmiAppender/cs/src/WmiLayout.cs @@ -1,100 +1,100 @@ -#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 - { - /// - /// Formats a for instrumentation - /// - /// the containing the data - /// an instrumentation event that can be fired - /// - /// - /// If the of the - /// is an then - /// that instance is returned. If the instance also implements the - /// interface then the - /// method will be called on the instance with the - /// parameter. - /// - /// - /// If the of the - /// is not an - /// then the method will be called - /// to create an appropriate instrumentation event object. - /// - /// - 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); - } - - /// - /// Create the instance that should be fired - /// - /// the containing the data - /// an instrumentation event that can be fired - /// - /// - /// The default implementation of this method creates a - /// instance using the data from the . - /// - /// - /// Subclasses should override this method to return their own custom - /// instrumentation event object. - /// - /// - 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; - } - } -} +#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 + { + /// + /// Formats a for instrumentation + /// + /// the containing the data + /// an instrumentation event that can be fired + /// + /// + /// If the of the + /// is an then + /// that instance is returned. If the instance also implements the + /// interface then the + /// method will be called on the instance with the + /// parameter. + /// + /// + /// If the of the + /// is not an + /// then the method will be called + /// to create an appropriate instrumentation event object. + /// + /// + 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); + } + + /// + /// Create the instance that should be fired + /// + /// the containing the data + /// an instrumentation event that can be fired + /// + /// + /// The default implementation of this method creates a + /// instance using the data from the . + /// + /// + /// Subclasses should override this method to return their own custom + /// instrumentation event object. + /// + /// + 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 index 0d4e69ae..72efdc80 100644 --- a/examples/net/2.0/Appenders/WmiAppender/cs/src/WmiLoggingEvent.cs +++ b/examples/net/2.0/Appenders/WmiAppender/cs/src/WmiLoggingEvent.cs @@ -1,47 +1,47 @@ -#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 -{ - /// - /// The default instrumented event raised by the - /// - /// - /// - /// This is the default event fired by the . - /// To fire a custom event set the to a - /// subclass of that overrides the - /// method. - /// - /// - 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; - } -} +#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 +{ + /// + /// The default instrumented event raised by the + /// + /// + /// + /// This is the default event fired by the . + /// To fire a custom event set the to a + /// subclass of that overrides the + /// method. + /// + /// + 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 index 0ad4ff5d..1088206d 100644 --- a/examples/net/2.0/Appenders/WmiAppender/nant.build +++ b/examples/net/2.0/Appenders/WmiAppender/nant.build @@ -1,29 +1,29 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/examples/net/2.0/Appenders/WmiAppender/nant.config b/examples/net/2.0/Appenders/WmiAppender/nant.config index d7014bbc..ba0a7243 100644 --- a/examples/net/2.0/Appenders/WmiAppender/nant.config +++ b/examples/net/2.0/Appenders/WmiAppender/nant.config @@ -1,21 +1,21 @@ - - - - - - + + + + + + diff --git a/examples/net/2.0/Appenders/nant.build b/examples/net/2.0/Appenders/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Appenders/nant.config b/examples/net/2.0/Appenders/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Extensibility/EventIDLogApp/cs/nant.build b/examples/net/2.0/Extensibility/EventIDLogApp/cs/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Extensibility/EventIDLogApp/cs/nant.config b/examples/net/2.0/Extensibility/EventIDLogApp/cs/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Extensibility/EventIDLogApp/cs/src/App.config b/examples/net/2.0/Extensibility/EventIDLogApp/cs/src/App.config old mode 100755 new mode 100644 index d95aae73..24d69787 --- a/examples/net/2.0/Extensibility/EventIDLogApp/cs/src/App.config +++ b/examples/net/2.0/Extensibility/EventIDLogApp/cs/src/App.config @@ -1,4 +1,25 @@ + + + + Local 8.0.50727 @@ -113,4 +135,4 @@ - \ No newline at end of file + diff --git a/examples/net/2.0/Extensibility/EventIDLogApp/nant.build b/examples/net/2.0/Extensibility/EventIDLogApp/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Extensibility/EventIDLogApp/nant.config b/examples/net/2.0/Extensibility/EventIDLogApp/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Extensibility/TraceLogApp/cs/nant.build b/examples/net/2.0/Extensibility/TraceLogApp/cs/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Extensibility/TraceLogApp/cs/nant.config b/examples/net/2.0/Extensibility/TraceLogApp/cs/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Extensibility/TraceLogApp/cs/src/AssemblyInfo.cs b/examples/net/2.0/Extensibility/TraceLogApp/cs/src/AssemblyInfo.cs old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Extensibility/TraceLogApp/cs/src/TraceLogApp.cs b/examples/net/2.0/Extensibility/TraceLogApp/cs/src/TraceLogApp.cs old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Extensibility/TraceLogApp/cs/src/TraceLogApp.csproj b/examples/net/2.0/Extensibility/TraceLogApp/cs/src/TraceLogApp.csproj old mode 100755 new mode 100644 index 5ef677e0..4648085c --- a/examples/net/2.0/Extensibility/TraceLogApp/cs/src/TraceLogApp.csproj +++ b/examples/net/2.0/Extensibility/TraceLogApp/cs/src/TraceLogApp.csproj @@ -1,4 +1,26 @@ - + + + + Local 8.0.50727 @@ -111,4 +133,4 @@ - \ No newline at end of file + 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 old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Extensibility/TraceLogApp/nant.build b/examples/net/2.0/Extensibility/TraceLogApp/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Extensibility/TraceLogApp/nant.config b/examples/net/2.0/Extensibility/TraceLogApp/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Extensibility/nant.build b/examples/net/2.0/Extensibility/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Extensibility/nant.config b/examples/net/2.0/Extensibility/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Layouts/SampleLayoutsApp/cs/nant.build b/examples/net/2.0/Layouts/SampleLayoutsApp/cs/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Layouts/SampleLayoutsApp/cs/nant.config b/examples/net/2.0/Layouts/SampleLayoutsApp/cs/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Layouts/SampleLayoutsApp/cs/src/App.config b/examples/net/2.0/Layouts/SampleLayoutsApp/cs/src/App.config old mode 100755 new mode 100644 index 89ff23f3..d5b85621 --- a/examples/net/2.0/Layouts/SampleLayoutsApp/cs/src/App.config +++ b/examples/net/2.0/Layouts/SampleLayoutsApp/cs/src/App.config @@ -1,4 +1,25 @@ + + + + Local 8.0.50727 @@ -117,4 +139,4 @@ - \ No newline at end of file + diff --git a/examples/net/2.0/Layouts/SampleLayoutsApp/nant.build b/examples/net/2.0/Layouts/SampleLayoutsApp/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Layouts/SampleLayoutsApp/nant.config b/examples/net/2.0/Layouts/SampleLayoutsApp/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Layouts/nant.build b/examples/net/2.0/Layouts/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Layouts/nant.config b/examples/net/2.0/Layouts/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Performance/NotLogging/cs/nant.build b/examples/net/2.0/Performance/NotLogging/cs/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Performance/NotLogging/cs/nant.config b/examples/net/2.0/Performance/NotLogging/cs/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Performance/NotLogging/cs/src/AssemblyInfo.cs b/examples/net/2.0/Performance/NotLogging/cs/src/AssemblyInfo.cs old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Performance/NotLogging/cs/src/NotLogging.cs b/examples/net/2.0/Performance/NotLogging/cs/src/NotLogging.cs old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Performance/NotLogging/cs/src/NotLogging.csproj b/examples/net/2.0/Performance/NotLogging/cs/src/NotLogging.csproj old mode 100755 new mode 100644 index a80b7d47..f13c2bf3 --- a/examples/net/2.0/Performance/NotLogging/cs/src/NotLogging.csproj +++ b/examples/net/2.0/Performance/NotLogging/cs/src/NotLogging.csproj @@ -1,4 +1,26 @@ - + + + + Local 8.0.50727 @@ -106,4 +128,4 @@ - \ No newline at end of file + diff --git a/examples/net/2.0/Performance/NotLogging/nant.build b/examples/net/2.0/Performance/NotLogging/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Performance/NotLogging/nant.config b/examples/net/2.0/Performance/NotLogging/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Performance/NotLogging/vb/nant.build b/examples/net/2.0/Performance/NotLogging/vb/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Performance/NotLogging/vb/nant.config b/examples/net/2.0/Performance/NotLogging/vb/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Performance/NotLogging/vb/src/AssemblyInfo.vb b/examples/net/2.0/Performance/NotLogging/vb/src/AssemblyInfo.vb old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Performance/NotLogging/vb/src/NotLogging.vb b/examples/net/2.0/Performance/NotLogging/vb/src/NotLogging.vb old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Performance/NotLogging/vb/src/NotLogging.vbproj b/examples/net/2.0/Performance/NotLogging/vb/src/NotLogging.vbproj old mode 100755 new mode 100644 index 6dd27030..8124f718 --- a/examples/net/2.0/Performance/NotLogging/vb/src/NotLogging.vbproj +++ b/examples/net/2.0/Performance/NotLogging/vb/src/NotLogging.vbproj @@ -1,3 +1,25 @@ + + + + + + + Local 8.0.50727 @@ -101,4 +123,4 @@ - \ No newline at end of file + diff --git a/examples/net/2.0/Remoting/RemotingClient/nant.build b/examples/net/2.0/Remoting/RemotingClient/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Remoting/RemotingClient/nant.config b/examples/net/2.0/Remoting/RemotingClient/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Remoting/RemotingServer/cs/nant.build b/examples/net/2.0/Remoting/RemotingServer/cs/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Remoting/RemotingServer/cs/nant.config b/examples/net/2.0/Remoting/RemotingServer/cs/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Remoting/RemotingServer/cs/src/App.config b/examples/net/2.0/Remoting/RemotingServer/cs/src/App.config old mode 100755 new mode 100644 index b49a40c4..52b699d9 --- a/examples/net/2.0/Remoting/RemotingServer/cs/src/App.config +++ b/examples/net/2.0/Remoting/RemotingServer/cs/src/App.config @@ -1,4 +1,25 @@ + + diff --git a/examples/net/2.0/Remoting/RemotingServer/cs/src/AssemblyInfo.cs b/examples/net/2.0/Remoting/RemotingServer/cs/src/AssemblyInfo.cs old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Remoting/RemotingServer/cs/src/RemotingServer.cs b/examples/net/2.0/Remoting/RemotingServer/cs/src/RemotingServer.cs old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Remoting/RemotingServer/cs/src/RemotingServer.csproj b/examples/net/2.0/Remoting/RemotingServer/cs/src/RemotingServer.csproj old mode 100755 new mode 100644 index 8179eb53..6a172cce --- a/examples/net/2.0/Remoting/RemotingServer/cs/src/RemotingServer.csproj +++ b/examples/net/2.0/Remoting/RemotingServer/cs/src/RemotingServer.csproj @@ -1,4 +1,26 @@ - + + + + Local 8.0.50727 @@ -100,4 +122,4 @@ - \ No newline at end of file + diff --git a/examples/net/2.0/Remoting/RemotingServer/nant.build b/examples/net/2.0/Remoting/RemotingServer/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Remoting/RemotingServer/nant.config b/examples/net/2.0/Remoting/RemotingServer/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Remoting/nant.build b/examples/net/2.0/Remoting/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Remoting/nant.config b/examples/net/2.0/Remoting/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Repository/SharedModule/cs/nant.build b/examples/net/2.0/Repository/SharedModule/cs/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Repository/SharedModule/cs/nant.config b/examples/net/2.0/Repository/SharedModule/cs/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Repository/SharedModule/cs/src/AssemblyInfo.cs b/examples/net/2.0/Repository/SharedModule/cs/src/AssemblyInfo.cs old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Repository/SharedModule/cs/src/Math.cs b/examples/net/2.0/Repository/SharedModule/cs/src/Math.cs old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Repository/SharedModule/cs/src/SharedModule.csproj b/examples/net/2.0/Repository/SharedModule/cs/src/SharedModule.csproj old mode 100755 new mode 100644 index 4c03b0cc..1dfb7c9c --- a/examples/net/2.0/Repository/SharedModule/cs/src/SharedModule.csproj +++ b/examples/net/2.0/Repository/SharedModule/cs/src/SharedModule.csproj @@ -1,4 +1,26 @@ - + + + + Local 8.0.50727 @@ -107,4 +129,4 @@ - \ No newline at end of file + diff --git a/examples/net/2.0/Repository/SharedModule/nant.build b/examples/net/2.0/Repository/SharedModule/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Repository/SharedModule/nant.config b/examples/net/2.0/Repository/SharedModule/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Repository/SharedModule/vb/nant.build b/examples/net/2.0/Repository/SharedModule/vb/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Repository/SharedModule/vb/nant.config b/examples/net/2.0/Repository/SharedModule/vb/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Repository/SharedModule/vb/src/AssemblyInfo.vb b/examples/net/2.0/Repository/SharedModule/vb/src/AssemblyInfo.vb old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Repository/SharedModule/vb/src/Math.vb b/examples/net/2.0/Repository/SharedModule/vb/src/Math.vb old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Repository/SharedModule/vb/src/SharedModule.vbproj b/examples/net/2.0/Repository/SharedModule/vb/src/SharedModule.vbproj old mode 100755 new mode 100644 index e1f00294..6079c28f --- a/examples/net/2.0/Repository/SharedModule/vb/src/SharedModule.vbproj +++ b/examples/net/2.0/Repository/SharedModule/vb/src/SharedModule.vbproj @@ -1,3 +1,25 @@ + + + + + - \ No newline at end of file + diff --git a/examples/net/2.0/Repository/SimpleApp/cs/src/AssemblyInfo.cs b/examples/net/2.0/Repository/SimpleApp/cs/src/AssemblyInfo.cs old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Repository/SimpleApp/cs/src/EntryPoint.cs b/examples/net/2.0/Repository/SimpleApp/cs/src/EntryPoint.cs old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Repository/SimpleApp/cs/src/SimpleApp.csproj b/examples/net/2.0/Repository/SimpleApp/cs/src/SimpleApp.csproj old mode 100755 new mode 100644 index edefbb4b..fa3a91b3 --- a/examples/net/2.0/Repository/SimpleApp/cs/src/SimpleApp.csproj +++ b/examples/net/2.0/Repository/SimpleApp/cs/src/SimpleApp.csproj @@ -1,4 +1,26 @@ - + + + + Local 8.0.50727 @@ -118,4 +140,4 @@ - \ No newline at end of file + 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 old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Repository/SimpleApp/nant.build b/examples/net/2.0/Repository/SimpleApp/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Repository/SimpleApp/nant.config b/examples/net/2.0/Repository/SimpleApp/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Repository/SimpleApp/vb/nant.build b/examples/net/2.0/Repository/SimpleApp/vb/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Repository/SimpleApp/vb/nant.config b/examples/net/2.0/Repository/SimpleApp/vb/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Repository/SimpleApp/vb/src/App.config b/examples/net/2.0/Repository/SimpleApp/vb/src/App.config old mode 100755 new mode 100644 index 4fcc7688..c37efd08 --- a/examples/net/2.0/Repository/SimpleApp/vb/src/App.config +++ b/examples/net/2.0/Repository/SimpleApp/vb/src/App.config @@ -1,8 +1,29 @@ + + - \ No newline at end of file + diff --git a/examples/net/2.0/Repository/SimpleApp/vb/src/AssemblyInfo.vb b/examples/net/2.0/Repository/SimpleApp/vb/src/AssemblyInfo.vb old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Repository/SimpleApp/vb/src/EntryPoint.vb b/examples/net/2.0/Repository/SimpleApp/vb/src/EntryPoint.vb old mode 100755 new mode 100644 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 old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Repository/SimpleApp/vb/src/SimpleApp.vbproj b/examples/net/2.0/Repository/SimpleApp/vb/src/SimpleApp.vbproj old mode 100755 new mode 100644 index 65f3888a..f1bedee3 --- a/examples/net/2.0/Repository/SimpleApp/vb/src/SimpleApp.vbproj +++ b/examples/net/2.0/Repository/SimpleApp/vb/src/SimpleApp.vbproj @@ -1,3 +1,25 @@ + + + + + + + Local 8.0.50727 @@ -108,4 +130,4 @@ - \ No newline at end of file + 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 old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Repository/SimpleModule/nant.build b/examples/net/2.0/Repository/SimpleModule/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Repository/SimpleModule/nant.config b/examples/net/2.0/Repository/SimpleModule/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Repository/SimpleModule/vb/nant.build b/examples/net/2.0/Repository/SimpleModule/vb/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Repository/SimpleModule/vb/nant.config b/examples/net/2.0/Repository/SimpleModule/vb/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Repository/SimpleModule/vb/src/AssemblyInfo.vb b/examples/net/2.0/Repository/SimpleModule/vb/src/AssemblyInfo.vb old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Repository/SimpleModule/vb/src/Math.vb b/examples/net/2.0/Repository/SimpleModule/vb/src/Math.vb old mode 100755 new mode 100644 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 old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Repository/SimpleModule/vb/src/SimpleModule.vbproj b/examples/net/2.0/Repository/SimpleModule/vb/src/SimpleModule.vbproj old mode 100755 new mode 100644 index 9a99c44b..25b33136 --- a/examples/net/2.0/Repository/SimpleModule/vb/src/SimpleModule.vbproj +++ b/examples/net/2.0/Repository/SimpleModule/vb/src/SimpleModule.vbproj @@ -1,3 +1,25 @@ + + + + + + + Local 8.0.50727 @@ -107,4 +129,4 @@ - \ No newline at end of file + diff --git a/examples/net/2.0/Tutorials/ConsoleApp/cs/src/LoggingExample.cs b/examples/net/2.0/Tutorials/ConsoleApp/cs/src/LoggingExample.cs old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Tutorials/ConsoleApp/nant.build b/examples/net/2.0/Tutorials/ConsoleApp/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Tutorials/ConsoleApp/nant.config b/examples/net/2.0/Tutorials/ConsoleApp/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Tutorials/ConsoleApp/vb/nant.build b/examples/net/2.0/Tutorials/ConsoleApp/vb/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Tutorials/ConsoleApp/vb/nant.config b/examples/net/2.0/Tutorials/ConsoleApp/vb/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Tutorials/ConsoleApp/vb/src/App.config b/examples/net/2.0/Tutorials/ConsoleApp/vb/src/App.config old mode 100755 new mode 100644 index 682eb7b9..f3d71025 --- a/examples/net/2.0/Tutorials/ConsoleApp/vb/src/App.config +++ b/examples/net/2.0/Tutorials/ConsoleApp/vb/src/App.config @@ -1,4 +1,25 @@ + + + + <%@ 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 old mode 100755 new mode 100644 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 old mode 100755 new mode 100644 index 7e323966..c8e3ce72 --- a/examples/net/2.0/Tutorials/WebApp/cs/src/Global.asax.resx +++ b/examples/net/2.0/Tutorials/WebApp/cs/src/Global.asax.resx @@ -1,4 +1,25 @@ + + 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 old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Tutorials/WebApp/cs/src/Web.config b/examples/net/2.0/Tutorials/WebApp/cs/src/Web.config old mode 100755 new mode 100644 index 84f7881b..8389366f --- a/examples/net/2.0/Tutorials/WebApp/cs/src/Web.config +++ b/examples/net/2.0/Tutorials/WebApp/cs/src/Web.config @@ -1,4 +1,25 @@ + + diff --git a/examples/net/2.0/Tutorials/WebApp/cs/src/WebApp.csproj b/examples/net/2.0/Tutorials/WebApp/cs/src/WebApp.csproj old mode 100755 new mode 100644 index 47c5a7c2..105bfdba --- a/examples/net/2.0/Tutorials/WebApp/cs/src/WebApp.csproj +++ b/examples/net/2.0/Tutorials/WebApp/cs/src/WebApp.csproj @@ -1,3 +1,25 @@ + + + + + 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 old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Tutorials/WebApp/cs/src/WebApp.vsdisco b/examples/net/2.0/Tutorials/WebApp/cs/src/WebApp.vsdisco old mode 100755 new mode 100644 index 10b0ed10..639642ee --- a/examples/net/2.0/Tutorials/WebApp/cs/src/WebApp.vsdisco +++ b/examples/net/2.0/Tutorials/WebApp/cs/src/WebApp.vsdisco @@ -1,4 +1,25 @@ + + diff --git a/examples/net/2.0/Tutorials/WebApp/cs/src/WebForm1.aspx b/examples/net/2.0/Tutorials/WebApp/cs/src/WebForm1.aspx old mode 100755 new mode 100644 index 3219c8c3..7de98908 --- a/examples/net/2.0/Tutorials/WebApp/cs/src/WebForm1.aspx +++ b/examples/net/2.0/Tutorials/WebApp/cs/src/WebForm1.aspx @@ -1,3 +1,24 @@ + + <%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApp.WebForm1" %> 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 old mode 100755 new mode 100644 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 old mode 100755 new mode 100644 index 7e323966..c8e3ce72 --- a/examples/net/2.0/Tutorials/WebApp/cs/src/WebForm1.aspx.resx +++ b/examples/net/2.0/Tutorials/WebApp/cs/src/WebForm1.aspx.resx @@ -1,4 +1,25 @@ + + diff --git a/examples/net/2.0/Tutorials/WebApp/nant.build b/examples/net/2.0/Tutorials/WebApp/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Tutorials/WebApp/nant.config b/examples/net/2.0/Tutorials/WebApp/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Tutorials/WebApp/readme.txt b/examples/net/2.0/Tutorials/WebApp/readme.txt old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Tutorials/WebApp/vb/nant.build b/examples/net/2.0/Tutorials/WebApp/vb/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Tutorials/WebApp/vb/nant.config b/examples/net/2.0/Tutorials/WebApp/vb/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Tutorials/WebApp/vb/src/AssemblyInfo.vb b/examples/net/2.0/Tutorials/WebApp/vb/src/AssemblyInfo.vb old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Tutorials/WebApp/vb/src/AssemblyVersionInfo.vb b/examples/net/2.0/Tutorials/WebApp/vb/src/AssemblyVersionInfo.vb old mode 100755 new mode 100644 index 16a5ff8e..124d1a6a --- a/examples/net/2.0/Tutorials/WebApp/vb/src/AssemblyVersionInfo.vb +++ b/examples/net/2.0/Tutorials/WebApp/vb/src/AssemblyVersionInfo.vb @@ -32,5 +32,5 @@ - - + + diff --git a/examples/net/2.0/Tutorials/WebApp/vb/src/Global.asax b/examples/net/2.0/Tutorials/WebApp/vb/src/Global.asax old mode 100755 new mode 100644 index ef097998..93c16a4e --- a/examples/net/2.0/Tutorials/WebApp/vb/src/Global.asax +++ b/examples/net/2.0/Tutorials/WebApp/vb/src/Global.asax @@ -1 +1,22 @@ + + <%@ 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 old mode 100755 new mode 100644 index 7e323966..c8e3ce72 --- a/examples/net/2.0/Tutorials/WebApp/vb/src/Global.asax.resx +++ b/examples/net/2.0/Tutorials/WebApp/vb/src/Global.asax.resx @@ -1,4 +1,25 @@ + + 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 old mode 100755 new mode 100644 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 old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Tutorials/WebApp/vb/src/Web.config b/examples/net/2.0/Tutorials/WebApp/vb/src/Web.config old mode 100755 new mode 100644 index 972e1f49..fe903043 --- a/examples/net/2.0/Tutorials/WebApp/vb/src/Web.config +++ b/examples/net/2.0/Tutorials/WebApp/vb/src/Web.config @@ -1,4 +1,25 @@ + + 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 old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Tutorials/WebApp/vb/src/WebApp.vbproj b/examples/net/2.0/Tutorials/WebApp/vb/src/WebApp.vbproj old mode 100755 new mode 100644 index 5574753d..42d33e5c --- a/examples/net/2.0/Tutorials/WebApp/vb/src/WebApp.vbproj +++ b/examples/net/2.0/Tutorials/WebApp/vb/src/WebApp.vbproj @@ -1,3 +1,25 @@ + + + + + diff --git a/examples/net/2.0/Tutorials/WebApp/vb/src/WebApp.vsdisco b/examples/net/2.0/Tutorials/WebApp/vb/src/WebApp.vsdisco old mode 100755 new mode 100644 index 10b0ed10..639642ee --- a/examples/net/2.0/Tutorials/WebApp/vb/src/WebApp.vsdisco +++ b/examples/net/2.0/Tutorials/WebApp/vb/src/WebApp.vsdisco @@ -1,4 +1,25 @@ + + diff --git a/examples/net/2.0/Tutorials/WebApp/vb/src/WebForm1.aspx b/examples/net/2.0/Tutorials/WebApp/vb/src/WebForm1.aspx old mode 100755 new mode 100644 index 34e607de..5b8c8496 --- a/examples/net/2.0/Tutorials/WebApp/vb/src/WebForm1.aspx +++ b/examples/net/2.0/Tutorials/WebApp/vb/src/WebForm1.aspx @@ -1,3 +1,24 @@ + + <%@ Page language="vb" Codebehind="WebForm1.aspx.vb" AutoEventWireup="false" Inherits="WebApp.WebForm1" %> 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 old mode 100755 new mode 100644 index 7e323966..c8e3ce72 --- a/examples/net/2.0/Tutorials/WebApp/vb/src/WebForm1.aspx.resx +++ b/examples/net/2.0/Tutorials/WebApp/vb/src/WebForm1.aspx.resx @@ -1,4 +1,25 @@ + + 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 old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Tutorials/nant.build b/examples/net/2.0/Tutorials/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/2.0/Tutorials/nant.config b/examples/net/2.0/Tutorials/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/2.0/cs-examples.sln b/examples/net/2.0/cs-examples.sln old mode 100755 new mode 100644 index 56a2a761..7b5e2b26 --- a/examples/net/2.0/cs-examples.sln +++ b/examples/net/2.0/cs-examples.sln @@ -1,5 +1,25 @@ 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" diff --git a/examples/net/2.0/nant.build b/examples/net/2.0/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/2.0/nant.config b/examples/net/2.0/nant.config old mode 100755 new mode 100644 diff --git a/examples/net/2.0/vb-examples.sln b/examples/net/2.0/vb-examples.sln old mode 100755 new mode 100644 index e7fde504..c5afc467 --- a/examples/net/2.0/vb-examples.sln +++ b/examples/net/2.0/vb-examples.sln @@ -1,4 +1,24 @@ 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}" diff --git a/examples/net/nant.build b/examples/net/nant.build old mode 100755 new mode 100644 diff --git a/examples/net/nant.config b/examples/net/nant.config old mode 100755 new mode 100644 diff --git a/examples/netcf/1.0/Tutorials/ConsoleApp/cs/nant.build b/examples/netcf/1.0/Tutorials/ConsoleApp/cs/nant.build old mode 100755 new mode 100644 diff --git a/examples/netcf/1.0/Tutorials/ConsoleApp/cs/nant.config b/examples/netcf/1.0/Tutorials/ConsoleApp/cs/nant.config old mode 100755 new mode 100644 diff --git a/examples/netcf/1.0/Tutorials/ConsoleApp/cs/src/AssemblyInfo.cs b/examples/netcf/1.0/Tutorials/ConsoleApp/cs/src/AssemblyInfo.cs old mode 100755 new mode 100644 diff --git a/examples/netcf/1.0/Tutorials/ConsoleApp/cs/src/ConsoleApp.csdproj b/examples/netcf/1.0/Tutorials/ConsoleApp/cs/src/ConsoleApp.csdproj old mode 100755 new mode 100644 index aab0f599..49693d23 --- a/examples/netcf/1.0/Tutorials/ConsoleApp/cs/src/ConsoleApp.csdproj +++ b/examples/netcf/1.0/Tutorials/ConsoleApp/cs/src/ConsoleApp.csdproj @@ -1,3 +1,25 @@ + + + + + + + + + - \ No newline at end of file + diff --git a/examples/sscli/1.0/Repository/SimpleApp/cs/src/AssemblyInfo.cs b/examples/sscli/1.0/Repository/SimpleApp/cs/src/AssemblyInfo.cs old mode 100755 new mode 100644 diff --git a/examples/sscli/1.0/Repository/SimpleApp/cs/src/EntryPoint.cs b/examples/sscli/1.0/Repository/SimpleApp/cs/src/EntryPoint.cs old mode 100755 new mode 100644 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 old mode 100755 new mode 100644 diff --git a/examples/sscli/1.0/Repository/SimpleApp/nant.build b/examples/sscli/1.0/Repository/SimpleApp/nant.build old mode 100755 new mode 100644 diff --git a/examples/sscli/1.0/Repository/SimpleApp/nant.config b/examples/sscli/1.0/Repository/SimpleApp/nant.config old mode 100755 new mode 100644 diff --git a/examples/sscli/1.0/Repository/SimpleModule/cs/nant.build b/examples/sscli/1.0/Repository/SimpleModule/cs/nant.build old mode 100755 new mode 100644 diff --git a/examples/sscli/1.0/Repository/SimpleModule/cs/nant.config b/examples/sscli/1.0/Repository/SimpleModule/cs/nant.config old mode 100755 new mode 100644 diff --git a/examples/sscli/1.0/Repository/SimpleModule/cs/src/AssemblyInfo.cs b/examples/sscli/1.0/Repository/SimpleModule/cs/src/AssemblyInfo.cs old mode 100755 new mode 100644 diff --git a/examples/sscli/1.0/Repository/SimpleModule/cs/src/Math.cs b/examples/sscli/1.0/Repository/SimpleModule/cs/src/Math.cs old mode 100755 new mode 100644 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 old mode 100755 new mode 100644 diff --git a/examples/sscli/1.0/Repository/SimpleModule/nant.build b/examples/sscli/1.0/Repository/SimpleModule/nant.build old mode 100755 new mode 100644 diff --git a/examples/sscli/1.0/Repository/SimpleModule/nant.config b/examples/sscli/1.0/Repository/SimpleModule/nant.config old mode 100755 new mode 100644 diff --git a/examples/sscli/1.0/Repository/nant.build b/examples/sscli/1.0/Repository/nant.build old mode 100755 new mode 100644 diff --git a/examples/sscli/1.0/Repository/nant.config b/examples/sscli/1.0/Repository/nant.config old mode 100755 new mode 100644 diff --git a/examples/sscli/1.0/Tutorials/ConsoleApp/js/nant.build b/examples/sscli/1.0/Tutorials/ConsoleApp/js/nant.build old mode 100755 new mode 100644 diff --git a/examples/sscli/1.0/Tutorials/ConsoleApp/js/nant.config b/examples/sscli/1.0/Tutorials/ConsoleApp/js/nant.config old mode 100755 new mode 100644 diff --git a/examples/sscli/1.0/Tutorials/ConsoleApp/js/src/App.config b/examples/sscli/1.0/Tutorials/ConsoleApp/js/src/App.config old mode 100755 new mode 100644 index 2d644aeb..12c4fef7 --- a/examples/sscli/1.0/Tutorials/ConsoleApp/js/src/App.config +++ b/examples/sscli/1.0/Tutorials/ConsoleApp/js/src/App.config @@ -1,4 +1,25 @@ + + + - /// Shorthand for . + /// Shorthand for . /// /// /// Get the logger for the fully qualified name of the type specified. @@ -218,7 +218,7 @@ public static ILog GetLogger(Type type) } /// - /// Shorthand for . + /// Shorthand for . /// /// /// Get the logger for the fully qualified name of the type specified. @@ -233,7 +233,7 @@ public static ILog GetLogger(string domain, Type type) } /// - /// Shorthand for . + /// Shorthand for . /// /// /// Get the logger for the fully qualified name of the type specified. diff --git a/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/log4net.Ext.MarshalByRef.csproj b/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/log4net.Ext.MarshalByRef.csproj old mode 100755 new mode 100644 index 7c2ebeb4..c8b8b69a --- a/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/log4net.Ext.MarshalByRef.csproj +++ b/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/log4net.Ext.MarshalByRef.csproj @@ -1,3 +1,25 @@ + + + - /// Shorthand for . + /// Shorthand for . /// /// /// Get the logger for the fully qualified name of the type specified. @@ -215,7 +215,7 @@ public static ITraceLog GetLogger(Type type) } /// - /// Shorthand for . + /// Shorthand for . /// /// /// Get the logger for the fully qualified name of the type specified. @@ -230,7 +230,7 @@ public static ITraceLog GetLogger(string domain, Type type) } /// - /// Shorthand for . + /// Shorthand for . /// /// /// Get the logger for the fully qualified name of the type specified. 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 old mode 100755 new mode 100644 index 7b9ef1e6..c3679ecf --- 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 @@ -1,3 +1,25 @@ + + + - - - - - Primary types used by calling applications to generate log messages. - Output appenders. - Configuration types and attributes. - Core framework types. - Date formatting types. - Output event filters. - Output message layouts. - Pattern handlers for the PatternLayout. - Message object to string renderer framework. - Plugin module base types. - Logger repository base types and interfaces. - Standard hierarchy repository implementation. - Utility types. - Pattern handlers for the PatternString. - Type conversion framework. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/log4net.build b/log4net.build old mode 100755 new mode 100644 index 9461a11a..c924d0bc --- a/log4net.build +++ b/log4net.build @@ -16,605 +16,892 @@ See the License for the specific language governing permissions and limitations under the License. --> - - - - - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - - + + - + - - + + @@ -626,6 +913,7 @@ limitations under the License. + @@ -634,10 +922,77 @@ limitations under the License. - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -649,8 +1004,8 @@ limitations under the License. + - @@ -658,29 +1013,74 @@ limitations under the License. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + - + - - - + + - + - - + + @@ -692,6 +1092,7 @@ limitations under the License. + @@ -699,11 +1100,81 @@ limitations under the License. - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -713,572 +1184,747 @@ limitations under the License. - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + - - + + - - - + + - - - - - - - - - - - - - - - - - - - + + + + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - diff --git a/log4net.include b/log4net.include old mode 100755 new mode 100644 index 56fa5ab3..028449c4 --- a/log4net.include +++ b/log4net.include @@ -139,6 +139,7 @@ limitations under the License. + @@ -159,6 +160,7 @@ limitations under the License. + @@ -169,7 +171,8 @@ limitations under the License. - + + @@ -193,6 +196,7 @@ limitations under the License. + @@ -205,6 +209,7 @@ limitations under the License. + @@ -217,6 +222,7 @@ limitations under the License. + @@ -226,35 +232,80 @@ limitations under the License. - - - + + + - - - - - + + + + + + - + - - + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -267,6 +318,7 @@ limitations under the License. + @@ -279,6 +331,7 @@ limitations under the License. + @@ -291,6 +344,20 @@ limitations under the License. + + + + + + + + + + + + + + @@ -300,9 +367,23 @@ limitations under the License. + + + + + + + + + + + + + + @@ -315,6 +396,7 @@ limitations under the License. + diff --git a/log4net.nuspec b/log4net.nuspec new file mode 100644 index 00000000..51d8f316 --- /dev/null +++ b/log4net.nuspec @@ -0,0 +1,93 @@ + + + + + log4net + 2.0.8 + Apache log4net + The Apache log4net library is a tool to help the programmer output log statements to a variety of output targets. + 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. + +log4net is designed with two distinct goals in mind: speed and flexibility + The Apache Software Foundation + Apache Logging Project, Jiří Činčura + http://logging.apache.org/log4net/license.html + http://logging.apache.org/log4net/ + https://www.apache.org/images/feather.png + Copyright 2004-2017 The Apache Software Foundation + false + logging log tracing logfiles + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/log4net.shfbproj b/log4net.shfbproj new file mode 100644 index 00000000..ee7a01e5 --- /dev/null +++ b/log4net.shfbproj @@ -0,0 +1,92 @@ + + + + + + Debug + AnyCPU + 2.0 + {18040100-bf45-4b3e-9265-9dc4b14c17ec} + 2015.6.5.0 + + Documentation + Documentation + Documentation + + .NET Framework 3.5 + doc\sdk\net\4.0\ + log4net-sdk-2.0.8 + en-US + Standard + Blank + False + VS2010 + False + MemberName + Apache log4net™ SDK Documentation + Copyright 2004-2017 The Apache Software Foundation + http://logging.apache.org/log4net/ + AboveNamespaces + + + + + OnlyWarningsAndErrors + HtmlHelp1, Website + False + True + False + False + True + Apache log4net, Apache and log4net are trademarks of The Apache Software Foundation. + Summary, Parameter, Returns, AutoDocumentCtors, TypeParameter, AutoDocumentDispose + http://logging.apache.org/log4net/mail-lists.html + Msdn + Msdn + False + True + 100 + 1.0.0.0 + 2 + False + + + + + + + + + + + + + + + + + + + + + diff --git a/log4net.snk b/log4net.snk new file mode 100644 index 00000000..bad5f7db Binary files /dev/null and b/log4net.snk differ diff --git a/log4net.snk.gpg b/log4net.snk.gpg deleted file mode 100644 index 626e4e1a..00000000 Binary files a/log4net.snk.gpg and /dev/null differ diff --git a/log4net.snk.readme b/log4net.snk.readme old mode 100755 new mode 100644 index 18956b01..47642869 --- a/log4net.snk.readme +++ b/log4net.snk.readme @@ -2,19 +2,27 @@ Apache log4net Strong Name Key Readme ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The log4net release builds are strongly named using the log4net.snk key -file. This file is not distributed as part of the log4net source or -binary downloads. See the log4net documentation for more details. - -Before you can build your own release builds you will need to generate -a strong name key that identifies your assemblies. - -Generating your own strong name key. - -Run the SN utility from the .NET Framework SDK as follows: - - sn -k log4net.snk - -A new strong name key pair will be created and written to the log4net.snk -file. - - +file. This key is different from the key used to sign log4net 1.2.10 +and earlier releases. + +Starting with log4net 1.2.11 we've decided to use a key that we don't +keep secret so you can build a drop-in replacement for an official +release yourself. This means that the strong name of a log4net +assembly no longer provides any means of checking its authenticity. +The only way to ensure you are using an official release by the Apache +Software Foundation is by downloading the distribution from the Apache +log4net download page and verifying the PGP signature of the ZIP +archive. + +The key used to sign those older releases is not and has never been +distributed as part of the log4net source or binary downloads. + +In order to make it easier to migrate from log4net 1.2.10 to newer +releases log4net 1.2.11 we also provide builds using the key used to +sign 1.2.10. We may stop distributing these alternative builds in the +future. + +You should use the binary builds signed with log4net.snk for new +projects and only use the ones signed with "the old key" if switching +to the newer builds is not possible because other parts of your +project depend on the old strong name. diff --git a/netstandard/global.json b/netstandard/global.json new file mode 100644 index 00000000..200ddfd6 --- /dev/null +++ b/netstandard/global.json @@ -0,0 +1,3 @@ +{ + "projects": [ "log4net", "log4net.tests" ] +} diff --git a/netstandard/log4net.netstandard.sln b/netstandard/log4net.netstandard.sln new file mode 100644 index 00000000..d436d060 --- /dev/null +++ b/netstandard/log4net.netstandard.sln @@ -0,0 +1,53 @@ + +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 new file mode 100644 index 00000000..695eeb8c --- /dev/null +++ b/netstandard/log4net.tests/ApplicationException.cs @@ -0,0 +1,27 @@ +#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 new file mode 100644 index 00000000..47ce22f8 --- /dev/null +++ b/netstandard/log4net.tests/CompatibilityExtensions.cs @@ -0,0 +1,38 @@ +#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 new file mode 100644 index 00000000..d51c05c6 --- /dev/null +++ b/netstandard/log4net.tests/ExpectedExceptionAttribute.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 + +// 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 +{ + /// + /// A simple ExpectedExceptionAttribute + /// + [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 new file mode 100644 index 00000000..00fecb38 --- /dev/null +++ b/netstandard/log4net.tests/log4net.tests.xproj @@ -0,0 +1,62 @@ + + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 6a78d53b-c864-4316-aa00-f2ebfe975223 + log4net.tests + ..\artifacts\obj\$(MSBuildProjectName) + ..\..\build\netstandard\ + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2.0 + + + True + + + diff --git a/netstandard/log4net.tests/project.json b/netstandard/log4net.tests/project.json new file mode 100644 index 00000000..1e2396d4 --- /dev/null +++ b/netstandard/log4net.tests/project.json @@ -0,0 +1,44 @@ +{ + "version": "2.0.8", + "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/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 new file mode 100644 index 00000000..c0a9076b --- /dev/null +++ b/netstandard/log4net/CompatibilityExtensions.cs @@ -0,0 +1,53 @@ +#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 new file mode 100644 index 00000000..ff371a0c --- /dev/null +++ b/netstandard/log4net/log4net.xproj @@ -0,0 +1,260 @@ + + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 00764202-b361-4bc8-a1b9-01d87f9d2d51 + log4net + ..\artifacts\obj\$(MSBuildProjectName) + ..\..\build\netstandard\ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2.0 + + + diff --git a/netstandard/log4net/project.json b/netstandard/log4net/project.json new file mode 100644 index 00000000..75978e50 --- /dev/null +++ b/netstandard/log4net/project.json @@ -0,0 +1,73 @@ +{ + "name": "log4net", + "version": "2.0.8", + "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/LogicalThreadContext.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/LogicalThreadContextProperties.cs", + "../../src/Util/LogicalThreadContextStacks.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/old-log4net.snk.gpg b/old-log4net.snk.gpg new file mode 100644 index 00000000..57126212 Binary files /dev/null and b/old-log4net.snk.gpg differ diff --git a/pom.xml b/pom.xml index 9922a8d4..a957b15b 100644 --- a/pom.xml +++ b/pom.xml @@ -20,223 +20,252 @@ log4net apache-log4net pom - 1.2.11-SNAPSHOT + 2.0.8 Apache log4net Logging framework for Microsoft .NET Framework. - http://logging.apache.org:80/log4net + http://logging.apache.org/log4net/ + 2004 JIRA - http://issues.apache.org/jira/ + https://issues.apache.org/jira/browse/LOG4NET - Gump - http://vmgump.apache.org/gump/public/logging-log4net/logging-log4net/index.html + Jenkins + https://builds.apache.org/job/log4net-trunk-build/ - - log4net-user : log4net usage - log4net-user-subscribe@logging.apache.org - log4net-user-unsubscribe@logging.apache.org - log4net-user@logging.apache.org - http://mail-archives.apache.org/mod_mbox/logging-log4net-user/ - - http://marc.info/?l=log4net-user - http://dir.gmane.org/gmane.comp.log.log4net.user - - - - log4net-dev : log4net development - log4net-dev-subscribe@logging.apache.org - log4net-dev-unsubscribe@logging.apache.org - log4net-dev@logging.apache.org - http://mail-archives.apache.org/mod_mbox/logging-log4net-dev/ - - http://marc.info/?l=log4net-dev - http://dir.gmane.org/gmane.comp.apache.logging.log4net.devel - - - - - - Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - - scm:svn:http://svn.apache.org/repos/asf/logging/log4net/trunk - scm:svn:https://svn.apache.org/repos/asf/logging/log4net/trunk - http://svn.apache.org/viewcvs.cgi/logging/log4net/trunk - - + + log4net-user : log4net usage + log4net-user-subscribe@logging.apache.org + log4net-user-unsubscribe@logging.apache.org + log4net-user@logging.apache.org + http://mail-archives.apache.org/mod_mbox/logging-log4net-user/ + + http://marc.info/?l=log4net-user + http://dir.gmane.org/gmane.comp.log.log4net.user + + + + log4net-dev : log4net development + log4net-dev-subscribe@logging.apache.org + log4net-dev-unsubscribe@logging.apache.org + log4net-dev@logging.apache.org + http://mail-archives.apache.org/mod_mbox/logging-log4net-dev/ + + http://marc.info/?l=log4net-dev + http://dir.gmane.org/gmane.comp.apache.logging.log4net.devel + + + + logging commits : all svn commits of the logging projects including log4net + commits-subscribe@logging.apache.org + commits-unsubscribe@logging.apache.org + Read-Only List + http://mail-archives.apache.org/mod_mbox/logging-commits/ + + + + + Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + scm:svn:http://svn.apache.org/repos/asf/logging/log4net/trunk + scm:svn:https://svn.apache.org/repos/asf/logging/log4net/trunk + http://svn.apache.org/viewvc/logging/log4net/trunk + + Apache Software Foundation http://www.apache.org - - + + + + org.apache.rat + apache-rat-plugin + 0.11 + + + org.apache.maven.plugins + maven-site-plugin + 3.4 + + ${basedir}/src/site/site.vm + + maven-antrun-plugin + 1.8 - compile - compile - - - - - + install run - - - test-compile - test-compile - - - - - - - - - run - - - - test - test - - - - - - - run - - - - site - site - - - - - - - + + - - run - - - - post-site - post-site - - - - - - - - - run - - - - site-deploy - site-deploy - - - - - - - - - run - - - - ant - ant-nodeps - 1.6.5 - - - - - maven-assembly-plugin - - - src/assembly/bin.xml - - false - - - - - assembly - - - - + + + org.apache.ant + ant + 1.9.4 + + + - - - + + - true + org.apache.maven.plugins + maven-site-plugin + 3.4 + + ${basedir}/src/site/site.vm + + + + + org.apache.rat + apache-rat-plugin + 0.11 + + + + **/TestResult.xml + **/*.suo + **/*.user + **/obj/** + bin/** + build/** + doc/sdk/** + src/log4net.xml + src/GeneratedAssemblyInfo.cs + tests/bin/** + netstandard/*/bin/** + + + *.snk* + tests/lib/prerequisites.txt + CONTRIBUTING.md + + + **/*.json + + + + + org.apache.maven.plugins maven-project-info-reports-plugin + ${commons.project-info.version} + + cim scm - cim dependencies + license + project-team issue-tracking mailing-list - license - - maven-release-plugin - - site-deploy - - - - maven-changes-plugin - - - - changes-report - - - - - %URL%/browse/%ISSUE% - - - + + + + Curt Arnold + carnold + + + Stefan Bodewig + bodewig + + + Nicko Cadell + nicko + + + Niall Daley + niall + + + Gert Driesen + drieseng + + + Ron Grabowski + rgrabowski + + + Dominik Psenner + dpsenner + + + + + + Julian Biddle + + + Daniel Cazzulino + + + Aspi Havewala + + + Rick Hobbs + + + Lance Nehring + + + Angelika Schnagl + + + Edward Smit + + + Douglas de la Torre + + + Pavlos Touboulidis + + + Thomas Voss + + + Jarrod Alexander + + + + + + + logging.site - file:///tmp/log4net-deploy + file:///${user.dir}/target/site-deploy diff --git a/src/Appender/AdoNetAppender.cs b/src/Appender/AdoNetAppender.cs old mode 100755 new mode 100644 index f4c6f688..061aece9 --- a/src/Appender/AdoNetAppender.cs +++ b/src/Appender/AdoNetAppender.cs @@ -134,11 +134,11 @@ public class AdoNetAppender : BufferingAppenderSkeleton /// public AdoNetAppender() { - m_connectionType = "System.Data.OleDb.OleDbConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; - m_useTransactions = true; - m_commandType = System.Data.CommandType.Text; + 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(); - m_reconnectOnError = false; + ReconnectOnError = false; } #endregion // Public Instance Constructors @@ -173,30 +173,30 @@ public string ConnectionString set { m_connectionString = value; } } - /// - /// The appSettings key from App.Config that contains the connection string. - /// - public string AppSettingsKey - { - get { return m_appSettingsKey; } - set { m_appSettingsKey = value; } - } + /// + /// The appSettings key from App.Config that contains the connection string. + /// + public string AppSettingsKey + { + get { return m_appSettingsKey; } + set { m_appSettingsKey = value; } + } #if NET_2_0 - /// - /// The connectionStrings key from App.Config that contains the connection string. - /// - /// - /// This property requires at least .NET 2.0. - /// - public string ConnectionStringName - { - get { return m_connectionStringName; } - set { m_connectionStringName = value; } - } + /// + /// The connectionStrings key from App.Config that contains the connection string. + /// + /// + /// This property requires at least .NET 2.0. + /// + public string ConnectionStringName + { + get { return m_connectionStringName; } + set { m_connectionStringName = value; } + } #endif - /// + /// /// Gets or sets the type name of the connection /// that should be created. /// @@ -252,6 +252,10 @@ public string ConnectionType /// The property determines if /// this text is a prepared statement or a stored procedure. /// + /// + /// If this property is not set, the command text is retrieved by invoking + /// . + /// /// public string CommandText { @@ -321,7 +325,7 @@ public bool UseTransactions /// of the current thread. /// /// - public SecurityContext SecurityContext + public SecurityContext SecurityContext { get { return m_securityContext; } set { m_securityContext = value; } @@ -374,7 +378,7 @@ public bool ReconnectOnError /// underlying returned from if /// you require access beyond that which provides. /// - protected IDbConnection Connection + protected IDbConnection Connection { get { return m_dbConnection; } set { m_dbConnection = value; } @@ -400,20 +404,16 @@ protected IDbConnection Connection /// must be called again. /// /// - override public void ActivateOptions() + override public void ActivateOptions() { base.ActivateOptions(); - // Are we using a command object - m_usePreparedCommand = (m_commandText != null && m_commandText.Length > 0); - - if (m_securityContext == null) + if (SecurityContext == null) { - m_securityContext = SecurityContextProvider.DefaultProvider.CreateSecurityContext(this); + SecurityContext = SecurityContextProvider.DefaultProvider.CreateSecurityContext(this); } InitializeDatabaseConnection(); - InitializeDatabaseCommand(); } #endregion @@ -428,11 +428,10 @@ override public void ActivateOptions() /// Closes the database command and database connection. /// /// - override protected void OnClose() + override protected void OnClose() { base.OnClose(); - DisposeCommand(false); - DiposeConnection(); + DiposeConnection(); } #endregion @@ -451,48 +450,44 @@ override protected void OnClose() /// override protected void SendBuffer(LoggingEvent[] events) { - if (m_reconnectOnError && (m_dbConnection == null || m_dbConnection.State != ConnectionState.Open)) + if (ReconnectOnError && (Connection == null || Connection.State != ConnectionState.Open)) { - LogLog.Debug(declaringType, "Attempting to reconnect to database. Current Connection State: " + ((m_dbConnection==null)?SystemInfo.NullText:m_dbConnection.State.ToString()) ); + LogLog.Debug(declaringType, "Attempting to reconnect to database. Current Connection State: " + ((Connection == null) ? SystemInfo.NullText : Connection.State.ToString())); InitializeDatabaseConnection(); - InitializeDatabaseCommand(); } // Check that the connection exists and is open - if (m_dbConnection != null && m_dbConnection.State == ConnectionState.Open) + if (Connection != null && Connection.State == ConnectionState.Open) { - if (m_useTransactions) + if (UseTransactions) { // Create transaction // NJC - Do this on 2 lines because it can confuse the debugger - IDbTransaction dbTran = null; - try + using (IDbTransaction dbTran = Connection.BeginTransaction()) { - dbTran = m_dbConnection.BeginTransaction(); - - SendBuffer(dbTran, events); + try + { + SendBuffer(dbTran, events); - // commit transaction - dbTran.Commit(); - } - catch(Exception ex) - { - // rollback the transaction - if (dbTran != null) + // commit transaction + dbTran.Commit(); + } + catch (Exception ex) { + // rollback the transaction try { dbTran.Rollback(); } - catch(Exception) + catch (Exception) { // Ignore exception } - } - // Can't insert into the database. That's a bad thing - ErrorHandler.Error("Exception while writing to database", ex); + // Can't insert into the database. That's a bad thing + ErrorHandler.Error("Exception while writing to database", ex); + } } } else @@ -540,48 +535,57 @@ public void AddParameter(AdoNetAppenderParameter parameter) /// virtual protected void SendBuffer(IDbTransaction dbTran, LoggingEvent[] events) { - if (m_usePreparedCommand) + // string.IsNotNullOrWhiteSpace() does not exist in ancient .NET frameworks + if (CommandText != null && CommandText.Trim() != "") { - // Send buffer using the prepared command object - - if (m_dbCommand != null) + using (IDbCommand dbCmd = Connection.CreateCommand()) { + // Set the command string + dbCmd.CommandText = CommandText; + + // Set the command type + dbCmd.CommandType = CommandType; + // Send buffer using the prepared command object if (dbTran != null) { - m_dbCommand.Transaction = dbTran; + dbCmd.Transaction = dbTran; } - + // prepare the command, which is significantly faster + dbCmd.Prepare(); // run for all events - foreach(LoggingEvent e in events) + foreach (LoggingEvent e in events) { + // clear parameters that have been set + dbCmd.Parameters.Clear(); + // Set the parameter values - foreach(AdoNetAppenderParameter param in m_parameters) + foreach (AdoNetAppenderParameter param in m_parameters) { - param.FormatValue(m_dbCommand, e); + param.Prepare(dbCmd); + param.FormatValue(dbCmd, e); } // Execute the query - m_dbCommand.ExecuteNonQuery(); + dbCmd.ExecuteNonQuery(); } } } else { // create a new command - using(IDbCommand dbCmd = m_dbConnection.CreateCommand()) + using (IDbCommand dbCmd = Connection.CreateCommand()) { if (dbTran != null) { dbCmd.Transaction = dbTran; } - // run for all events - foreach(LoggingEvent e in events) + foreach (LoggingEvent e in events) { // 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(); @@ -616,71 +620,71 @@ virtual protected string GetLogStatement(LoggingEvent logEvent) } } - /// - /// Creates an instance used to connect to the database. - /// - /// - /// This method is called whenever a new IDbConnection is needed (i.e. when a reconnect is necessary). - /// - /// The of the object. - /// The connectionString output from the ResolveConnectionString method. - /// An instance with a valid connection string. - virtual protected IDbConnection CreateConnection(Type connectionType, string connectionString) - { - IDbConnection connection = (IDbConnection)Activator.CreateInstance(connectionType); - connection.ConnectionString = connectionString; - return connection; - } - - /// - /// Resolves the connection string from the ConnectionString, ConnectionStringName, or AppSettingsKey - /// property. - /// - /// - /// ConnectiongStringName is only supported on .NET 2.0 and higher. - /// - /// Additional information describing the connection string. - /// A connection string used to connect to the database. - virtual protected string ResolveConnectionString(out string connectionStringContext) - { - if (m_connectionString != null && m_connectionString.Length > 0) - { - connectionStringContext = "ConnectionString"; - return m_connectionString; - } + /// + /// Creates an instance used to connect to the database. + /// + /// + /// This method is called whenever a new IDbConnection is needed (i.e. when a reconnect is necessary). + /// + /// The of the object. + /// The connectionString output from the ResolveConnectionString method. + /// An instance with a valid connection string. + virtual protected IDbConnection CreateConnection(Type connectionType, string connectionString) + { + IDbConnection connection = (IDbConnection)Activator.CreateInstance(connectionType); + connection.ConnectionString = connectionString; + return connection; + } + + /// + /// Resolves the connection string from the ConnectionString, ConnectionStringName, or AppSettingsKey + /// property. + /// + /// + /// ConnectiongStringName is only supported on .NET 2.0 and higher. + /// + /// Additional information describing the connection string. + /// A connection string used to connect to the database. + virtual protected string ResolveConnectionString(out string connectionStringContext) + { + if (ConnectionString != null && ConnectionString.Length > 0) + { + connectionStringContext = "ConnectionString"; + return ConnectionString; + } #if NET_2_0 - if (!String.IsNullOrEmpty(m_connectionStringName)) - { - ConnectionStringSettings settings = ConfigurationManager.ConnectionStrings[m_connectionStringName]; - if (settings != null) - { - connectionStringContext = "ConnectionStringName"; - return settings.ConnectionString; - } - else - { - throw new LogException("Unable to find [" + m_connectionStringName + "] ConfigurationManager.ConnectionStrings item"); - } - } + if (!String.IsNullOrEmpty(ConnectionStringName)) + { + ConnectionStringSettings settings = ConfigurationManager.ConnectionStrings[ConnectionStringName]; + if (settings != null) + { + connectionStringContext = "ConnectionStringName"; + return settings.ConnectionString; + } + else + { + throw new LogException("Unable to find [" + ConnectionStringName + "] ConfigurationManager.ConnectionStrings item"); + } + } #endif - if (m_appSettingsKey != null && m_appSettingsKey.Length > 0) - { - connectionStringContext = "AppSettingsKey"; - string appSettingsConnectionString = SystemInfo.GetAppSetting(m_appSettingsKey); - if (appSettingsConnectionString == null || appSettingsConnectionString.Length == 0) - { - throw new LogException("Unable to find [" + m_appSettingsKey + "] AppSettings key."); - } - return appSettingsConnectionString; - } - - connectionStringContext = "Unable to resolve connection string from ConnectionString, ConnectionStrings, or AppSettings."; - return string.Empty; - } - - /// + if (AppSettingsKey != null && AppSettingsKey.Length > 0) + { + connectionStringContext = "AppSettingsKey"; + string appSettingsConnectionString = SystemInfo.GetAppSetting(AppSettingsKey); + if (appSettingsConnectionString == null || appSettingsConnectionString.Length == 0) + { + throw new LogException("Unable to find [" + AppSettingsKey + "] AppSettings key."); + } + return appSettingsConnectionString; + } + + connectionStringContext = "Unable to resolve connection string from ConnectionString, ConnectionStrings, or AppSettings."; + return string.Empty; + } + + /// /// Retrieves the class type of the ADO.NET provider. /// /// @@ -699,181 +703,76 @@ virtual protected Type ResolveConnectionType() { try { - return SystemInfo.GetTypeFromString(m_connectionType, true, false); + return SystemInfo.GetTypeFromString(ConnectionType, true, false); } - catch(Exception ex) + catch (Exception ex) { - ErrorHandler.Error("Failed to load connection type ["+m_connectionType+"]", ex); + ErrorHandler.Error("Failed to load connection type [" + ConnectionType + "]", ex); throw; } } #endregion // Protected Instance Methods - #region Private Instance Methods - - /// - /// Prepares the database command and initialize the parameters. - /// - private void InitializeDatabaseCommand() - { - if (m_dbConnection != null && m_usePreparedCommand) - { - try - { - DisposeCommand(false); - - // Create the command object - m_dbCommand = m_dbConnection.CreateCommand(); - - // Set the command string - m_dbCommand.CommandText = m_commandText; - - // Set the command type - m_dbCommand.CommandType = m_commandType; - } - catch (Exception e) - { - ErrorHandler.Error("Could not create database command [" + m_commandText + "]", e); - - DisposeCommand(true); - } - - if (m_dbCommand != null) - { - try - { - foreach (AdoNetAppenderParameter param in m_parameters) - { - try - { - param.Prepare(m_dbCommand); - } - catch (Exception e) - { - ErrorHandler.Error("Could not add database command parameter [" + param.ParameterName + "]", e); - throw; - } - } - } - catch - { - DisposeCommand(true); - } - } - - if (m_dbCommand != null) - { - try - { - // Prepare the command statement. - m_dbCommand.Prepare(); - } - catch (Exception e) - { - ErrorHandler.Error("Could not prepare database command [" + m_commandText + "]", e); - - DisposeCommand(true); - } - } - } - } - - /// - /// Connects to the database. - /// - private void InitializeDatabaseConnection() - { - string connectionStringContext = "Unable to determine connection string context."; - string resolvedConnectionString = string.Empty; - - try - { - DisposeCommand(true); - DiposeConnection(); - - // Set the connection string - resolvedConnectionString = ResolveConnectionString(out connectionStringContext); - - m_dbConnection = CreateConnection(ResolveConnectionType(), resolvedConnectionString); - - using (SecurityContext.Impersonate(this)) - { - // Open the database connection - m_dbConnection.Open(); - } - } - catch (Exception e) - { - // Sadly, your connection string is bad. - ErrorHandler.Error("Could not open database connection [" + resolvedConnectionString + "]. Connection string context [" + connectionStringContext + "].", e); - - m_dbConnection = null; - } - } - - /// - /// Cleanup the existing command. - /// - /// - /// If true, a message will be written using LogLog.Warn if an exception is encountered when calling Dispose. - /// - private void DisposeCommand(bool ignoreException) - { - // Cleanup any existing command or connection - if (m_dbCommand != null) - { - try - { - m_dbCommand.Dispose(); - } - catch (Exception ex) - { - if (!ignoreException) - { - LogLog.Warn(declaringType, "Exception while disposing cached command object", ex); - } - } - m_dbCommand = null; - } - } - - /// - /// Cleanup the existing connection. - /// - /// - /// Calls the IDbConnection's method. - /// - private void DiposeConnection() - { - if (m_dbConnection != null) - { - try - { - m_dbConnection.Close(); - } - catch (Exception ex) - { - LogLog.Warn(declaringType, "Exception while disposing cached connection object", ex); - } - m_dbConnection = null; - } - } - - #endregion // Private Instance Methods - - #region Protected Instance Fields - - /// - /// Flag to indicate if we are using a command object + #region Private Instance Methods + + /// + /// Connects to the database. + /// + private void InitializeDatabaseConnection() + { + string connectionStringContext = "Unable to determine connection string context."; + string resolvedConnectionString = string.Empty; + + try + { + DiposeConnection(); + + // Set the connection string + resolvedConnectionString = ResolveConnectionString(out connectionStringContext); + + Connection = CreateConnection(ResolveConnectionType(), resolvedConnectionString); + + using (SecurityContext.Impersonate(this)) + { + // Open the database connection + Connection.Open(); + } + } + catch (Exception e) + { + // Sadly, your connection string is bad. + ErrorHandler.Error("Could not open database connection [" + resolvedConnectionString + "]. Connection string context [" + connectionStringContext + "].", e); + + Connection = null; + } + } + + /// + /// Cleanup the existing connection. /// /// - /// - /// Set to true when the appender is to use a prepared - /// statement or stored procedure to insert into the database. - /// + /// Calls the IDbConnection's method. /// - protected bool m_usePreparedCommand; + private void DiposeConnection() + { + if (Connection != null) + { + try + { + Connection.Close(); + } + catch (Exception ex) + { + LogLog.Warn(declaringType, "Exception while disposing cached connection object", ex); + } + Connection = null; + } + } + + #endregion // Private Instance Methods + + #region Protected Instance Fields /// /// The list of objects. @@ -900,29 +799,24 @@ private void DiposeConnection() /// private IDbConnection m_dbConnection; - /// - /// The database command. - /// - private IDbCommand m_dbCommand; - /// /// Database connection string. /// private string m_connectionString; - /// - /// The appSettings key from App.Config that contains the connection string. - /// - private string m_appSettingsKey; + /// + /// The appSettings key from App.Config that contains the connection string. + /// + private string m_appSettingsKey; #if NET_2_0 - /// - /// The connectionStrings key from App.Config that contains the connection string. - /// - private string m_connectionStringName; + /// + /// The connectionStrings key from App.Config that contains the connection string. + /// + private string m_connectionStringName; #endif - /// + /// /// String type name of the type name. /// private string m_connectionType; @@ -943,24 +837,24 @@ private void DiposeConnection() private bool m_useTransactions; /// - /// Indicates whether to use transactions when writing to the database. + /// Indicates whether to reconnect when a connection is lost. /// private bool m_reconnectOnError; #endregion // Private Instance Fields - #region Private Static Fields + #region Private Static Fields - /// - /// The fully qualified type of the AdoNetAppender class. - /// - /// - /// Used by the internal logger to record the Type of the - /// log message. - /// - private readonly static Type declaringType = typeof(AdoNetAppender); + /// + /// The fully qualified type of the AdoNetAppender class. + /// + /// + /// Used by the internal logger to record the Type of the + /// log message. + /// + private readonly static Type declaringType = typeof(AdoNetAppender); - #endregion Private Static Fields + #endregion Private Static Fields } /// @@ -988,9 +882,9 @@ public class AdoNetAppenderParameter /// public AdoNetAppenderParameter() { - m_precision = 0; - m_scale = 0; - m_size = 0; + Precision = 0; + Scale = 0; + Size = 0; } #endregion // Public Instance Constructors @@ -1037,9 +931,9 @@ public string ParameterName public DbType DbType { get { return m_dbType; } - set - { - m_dbType = value; + set + { + m_dbType = value; m_inferType = false; } } @@ -1060,9 +954,9 @@ public DbType DbType /// /// /// - public byte Precision + public byte Precision { - get { return m_precision; } + get { return m_precision; } set { m_precision = value; } } @@ -1082,7 +976,7 @@ public byte Precision /// /// /// - public byte Scale + public byte Scale { get { return m_scale; } set { m_scale = value; } @@ -1102,9 +996,12 @@ public byte Scale /// This property is optional. If not specified the ADO.NET provider /// will attempt to infer the size from the value. /// + /// + /// For BLOB data types like VARCHAR(max) it may be impossible to infer the value automatically, use -1 as the size in this case. + /// /// /// - public int Size + public int Size { get { return m_size; } set { m_size = value; } @@ -1156,23 +1053,23 @@ virtual public void Prepare(IDbCommand command) IDbDataParameter param = command.CreateParameter(); // Set the parameter properties - param.ParameterName = m_parameterName; + param.ParameterName = ParameterName; if (!m_inferType) { - param.DbType = m_dbType; + param.DbType = DbType; } - if (m_precision != 0) + if (Precision != 0) { - param.Precision = m_precision; + param.Precision = Precision; } - if (m_scale != 0) + if (Scale != 0) { - param.Scale = m_scale; + param.Scale = Scale; } - if (m_size != 0) + if (Size != 0) { - param.Size = m_size; + param.Size = Size; } // Add the parameter to the collection of params @@ -1193,7 +1090,7 @@ virtual public void Prepare(IDbCommand command) virtual public void FormatValue(IDbCommand command, LoggingEvent loggingEvent) { // Lookup the parameter - IDbDataParameter param = (IDbDataParameter)command.Parameters[m_parameterName]; + IDbDataParameter param = (IDbDataParameter)command.Parameters[ParameterName]; // Format the value object formattedValue = Layout.Format(loggingEvent); diff --git a/src/Appender/AnsiColorTerminalAppender.cs b/src/Appender/AnsiColorTerminalAppender.cs old mode 100755 new mode 100644 index 89c4511a..2f074766 --- a/src/Appender/AnsiColorTerminalAppender.cs +++ b/src/Appender/AnsiColorTerminalAppender.cs @@ -153,7 +153,12 @@ public enum AnsiAttributes : int /// /// text is displayed with a strikethrough /// - Strikethrough = 64 + Strikethrough = 64, + + /// + /// text color is light + /// + Light = 128 } /// @@ -176,7 +181,7 @@ public enum AnsiColor : int /// /// color is red /// - Red = 1, + Red = 1, /// /// color is green @@ -247,8 +252,8 @@ virtual public string Target set { string trimmedTargetName = value.Trim(); - - if (string.Compare(ConsoleError, trimmedTargetName, true, CultureInfo.InvariantCulture) == 0) + + if (SystemInfo.EqualsIgnoringCase(ConsoleError, trimmedTargetName)) { m_writeToErrorStream = true; } @@ -280,7 +285,7 @@ public void AddMapping(LevelColors mapping) #region Override implementation of AppenderSkeleton /// - /// This method is called by the method. + /// This method is called by the method. /// /// The event to log. /// @@ -510,12 +515,14 @@ public override void ActivateOptions() // Reset any existing codes buf.Append("\x1b[0;"); + int lightAdjustment = ((m_attributes & AnsiAttributes.Light) > 0) ? 60 : 0; + // set the foreground color - buf.Append(30 + (int)m_foreColor); + buf.Append(30 + lightAdjustment + (int)m_foreColor); buf.Append(';'); // set the background color - buf.Append(40 + (int)m_backColor); + buf.Append(40 + lightAdjustment + (int)m_backColor); // set the attributes if ((m_attributes & AnsiAttributes.Bright) > 0) diff --git a/src/Appender/AppenderCollection.cs b/src/Appender/AppenderCollection.cs old mode 100755 new mode 100644 index 99f94ac6..21987b84 --- a/src/Appender/AppenderCollection.cs +++ b/src/Appender/AppenderCollection.cs @@ -26,7 +26,10 @@ namespace log4net.Appender /// A strongly-typed collection of objects. /// /// Nicko Cadell - public class AppenderCollection : ICollection, IList, IEnumerable, ICloneable + public class AppenderCollection : ICollection, IList, IEnumerable +#if !NETSTANDARD1_3 + , ICloneable +#endif { #region Interfaces /// @@ -216,10 +219,10 @@ public virtual void CopyTo(IAppender[] array, int start) /// /// Gets a value indicating whether access to the collection is synchronized (thread-safe). /// - /// true if access to the ICollection is synchronized (thread-safe); otherwise, false. + /// false, because the backing type is an array, which is never thread-safe. public virtual bool IsSynchronized { - get { return m_array.IsSynchronized; } + get { return false; } } /// @@ -227,7 +230,7 @@ public virtual bool IsSynchronized /// public virtual object SyncRoot { - get { return m_array.SyncRoot; } + get { return m_array; } } #endregion @@ -566,9 +569,9 @@ public virtual IAppender[] ToArray() #region Implementation (helpers) /// - /// is less than zero + /// is less than zero /// -or- - /// is equal to or greater than . + /// is equal to or greater than . /// private void ValidateIndex(int i) { @@ -576,9 +579,9 @@ private void ValidateIndex(int i) } /// - /// is less than zero + /// is less than zero /// -or- - /// is equal to or greater than . + /// is equal to or greater than . /// private void ValidateIndex(int i, bool allowEqualEnd) { @@ -883,6 +886,16 @@ public override int AddRange(IAppender[] x) throw new NotSupportedException("This is a Read Only Collection and can not be modified"); } + public override IAppender[] ToArray() + { + return m_collection.ToArray(); + } + + public override void TrimToSize() + { + throw new NotSupportedException("This is a Read Only Collection and can not be modified"); + } + #endregion } diff --git a/src/Appender/AppenderSkeleton.cs b/src/Appender/AppenderSkeleton.cs old mode 100755 new mode 100644 index 6dc31920..6f99eda8 --- a/src/Appender/AppenderSkeleton.cs +++ b/src/Appender/AppenderSkeleton.cs @@ -38,13 +38,13 @@ namespace log4net.Appender /// /// /// Appenders can also implement the interface. Therefore - /// they would require that the method + /// they would require that the method /// be called after the appenders properties have been configured. /// /// /// Nicko Cadell /// Gert Driesen - public abstract class AppenderSkeleton : IAppender, IBulkAppender, IOptionHandler + public abstract class AppenderSkeleton : IAppender, IBulkAppender, IOptionHandler, IFlushable { #region Protected Instance Constructors @@ -249,13 +249,13 @@ public void Close() /// /// Performs threshold checks and invokes filters before /// delegating actual logging to the subclasses specific - /// method. + /// method. /// /// The event to log. /// /// /// This method cannot be overridden by derived classes. A - /// derived class should override the method + /// derived class should override the method /// which is called by this method. /// /// @@ -277,14 +277,14 @@ public void Close() /// /// /// - /// Calls and checks that + /// Calls and checks that /// it returns true. /// /// /// /// /// If all of the above steps succeed then the - /// will be passed to the abstract method. + /// will be passed to the abstract method. /// /// public void DoAppend(LoggingEvent loggingEvent) @@ -321,7 +321,7 @@ public void DoAppend(LoggingEvent loggingEvent) { ErrorHandler.Error("Failed in DoAppend", ex); } -#if !MONO && !NET_2_0 +#if !MONO && !NET_2_0 && !NETSTANDARD1_3 // 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 @@ -346,13 +346,13 @@ public void DoAppend(LoggingEvent loggingEvent) /// /// Performs threshold checks and invokes filters before /// delegating actual logging to the subclasses specific - /// method. + /// method. /// /// The array of events to log. /// /// /// This method cannot be overridden by derived classes. A - /// derived class should override the method + /// derived class should override the method /// which is called by this method. /// /// @@ -362,26 +362,26 @@ public void DoAppend(LoggingEvent loggingEvent) /// /// /// - /// Checks that the severity of the + /// Checks that the severity of the /// is greater than or equal to the of this /// appender. /// /// /// /// Checks that the chain accepts the - /// . + /// . /// /// /// /// - /// Calls and checks that + /// Calls and checks that /// it returns true. /// /// /// /// /// If all of the above steps succeed then the - /// will be passed to the method. + /// will be passed to the method. /// /// public void DoAppend(LoggingEvent[] loggingEvents) @@ -428,7 +428,7 @@ public void DoAppend(LoggingEvent[] loggingEvents) { ErrorHandler.Error("Failed in Bulk DoAppend", ex); } -#if !MONO && !NET_2_0 +#if !MONO && !NET_2_0 && !NETSTANDARD1_3 // 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 @@ -604,12 +604,12 @@ virtual protected void OnClose() /// A subclass must implement this method to perform /// logging of the . /// - /// This method will be called by + /// This method will be called by /// if all the conditions listed for that method are met. /// /// /// To restrict the logging of events in the appender - /// override the method. + /// override the method. /// /// abstract protected void Append(LoggingEvent loggingEvent); @@ -620,12 +620,12 @@ virtual protected void OnClose() /// the array of logging events /// /// - /// This base class implementation calls the + /// This base class implementation calls the /// method for each element in the bulk array. /// /// /// A sub class that can better process a bulk array of events should - /// override this method in addition to . + /// override this method in addition to . /// /// virtual protected void Append(LoggingEvent[] loggingEvents) @@ -637,23 +637,23 @@ virtual protected void Append(LoggingEvent[] loggingEvents) } /// - /// Called before as a precondition. + /// Called before as a precondition. /// /// /// - /// This method is called by - /// before the call to the abstract method. + /// This method is called by + /// before the call to the abstract method. /// /// /// This method can be overridden in a subclass to extend the checks - /// made before the event is passed to the method. + /// made before the event is passed to the method. /// /// /// A subclass should ensure that they delegate this call to /// this base class if it is overridden. /// /// - /// true if the call to should proceed. + /// true if the call to should proceed. virtual protected bool PreAppendCheck() { if ((m_layout == null) && RequiresLayout) @@ -683,7 +683,7 @@ virtual protected bool PreAppendCheck() /// /// /// Where possible use the alternative version of this method - /// . + /// . /// That method streams the rendering onto an existing Writer /// which can give better performance if the caller already has /// a open and ready for writing. @@ -697,11 +697,14 @@ protected string RenderLoggingEvent(LoggingEvent loggingEvent) m_renderWriter = new ReusableStringWriter(System.Globalization.CultureInfo.InvariantCulture); } - // Reset the writer so we can reuse it - m_renderWriter.Reset(c_renderBufferMaxCapacity, c_renderBufferSize); + lock (m_renderWriter) + { + // Reset the writer so we can reuse it + m_renderWriter.Reset(c_renderBufferMaxCapacity, c_renderBufferSize); - RenderLoggingEvent(m_renderWriter, loggingEvent); - return m_renderWriter.ToString(); + RenderLoggingEvent(m_renderWriter, loggingEvent); + return m_renderWriter.ToString(); + } } /// @@ -721,9 +724,9 @@ protected string RenderLoggingEvent(LoggingEvent loggingEvent) /// will append the exception text to the rendered string. /// /// - /// Use this method in preference to + /// Use this method in preference to /// where possible. If, however, the caller needs to render the event - /// to a string then does + /// to a string then does /// provide an efficient mechanism for doing so. /// /// @@ -766,7 +769,7 @@ protected void RenderLoggingEvent(TextWriter writer, LoggingEvent loggingEvent) /// then the appender should return true. /// /// - /// This default implementation always returns true. + /// This default implementation always returns false. /// /// /// @@ -779,6 +782,18 @@ virtual protected bool RequiresLayout #endregion + /// + /// Flushes any buffered log data. + /// + /// + /// This implementation doesn't flush anything and always returns true + /// + /// True if all logging events were flushed successfully, else false. + public virtual bool Flush(int millisecondsTimeout) + { + return true; + } + #region Private Instance Fields /// diff --git a/src/Appender/AspNetTraceAppender.cs b/src/Appender/AspNetTraceAppender.cs old mode 100755 new mode 100644 index e1bdbf44..82f9569e --- a/src/Appender/AspNetTraceAppender.cs +++ b/src/Appender/AspNetTraceAppender.cs @@ -19,7 +19,7 @@ // .NET Compact Framework 1.0 has no support for ASP.NET // SSCLI 1.0 has no support for ASP.NET -#if !NETCF && !SSCLI +#if !NETCF && !SSCLI && !CLIENT_PROFILE using System.Web; @@ -45,8 +45,8 @@ namespace log4net.Appender /// whether tracing is displayed to a page, to the trace viewer, or both. /// /// - /// The logging event is passed to the or - /// method depending on the level of the logging event. + /// The logging event is passed to the or + /// method depending on the level of the logging event. /// The event's logger name is the default value for the category parameter of the Write/Warn method. /// /// diff --git a/src/Appender/BufferingAppenderSkeleton.cs b/src/Appender/BufferingAppenderSkeleton.cs old mode 100755 new mode 100644 index 958dc0c2..343159a8 --- a/src/Appender/BufferingAppenderSkeleton.cs +++ b/src/Appender/BufferingAppenderSkeleton.cs @@ -37,7 +37,7 @@ namespace log4net.Appender /// the underlying database in one go. /// /// - /// Subclasses should override the + /// Subclasses should override the /// method to deliver the buffered events. /// /// The BufferingAppenderSkeleton maintains a fixed size cyclic @@ -47,14 +47,14 @@ namespace log4net.Appender /// A is used to inspect /// each event as it arrives in the appender. If the /// triggers, then the current buffer is sent immediately - /// (see ). Otherwise the event + /// (see ). Otherwise the event /// is stored in the buffer. For example, an evaluator can be used to /// deliver the events immediately when an ERROR event arrives. /// /// /// The buffering appender can be configured in a mode. /// By default the appender is NOT lossy. When the buffer is full all - /// the buffered events are sent with . + /// the buffered events are sent with . /// If the property is set to true then the /// buffer will not be sent when it is full, and new events arriving /// in the appender will overwrite the oldest event in the buffer. @@ -68,7 +68,7 @@ namespace log4net.Appender /// /// Nicko Cadell /// Gert Driesen - public abstract class BufferingAppenderSkeleton : AppenderSkeleton + public abstract class BufferingAppenderSkeleton : AppenderSkeleton { #region Protected Instance Constructors @@ -173,7 +173,7 @@ public int BufferSize /// /// The evaluator will be called for each event that is appended to this /// appender. If the evaluator triggers then the current buffer will - /// immediately be sent (see ). + /// immediately be sent (see ). /// /// If is set to true then an /// must be specified. @@ -194,7 +194,7 @@ public ITriggeringEventEvaluator Evaluator /// /// The evaluator will be called for each event that is discarded from this /// appender. If the evaluator triggers then the current buffer will immediately - /// be sent (see ). + /// be sent (see ). /// /// public ITriggeringEventEvaluator LossyEvaluator @@ -217,7 +217,7 @@ public ITriggeringEventEvaluator LossyEvaluator /// event data to be fixed and serialized. This will improve performance. /// /// - /// See for more information. + /// See for more information. /// /// [Obsolete("Use Fix property")] @@ -261,6 +261,17 @@ virtual public FixFlags Fix #region Public Methods + /// + /// Flushes any buffered log data. + /// + /// The maximum time to wait for logging events to be flushed. + /// True if all logging events were flushed successfully, else false. + public override bool Flush(int millisecondsTimeout) + { + Flush(); + return true; + } + /// /// Flush the currently buffered events /// @@ -412,7 +423,7 @@ override protected void OnClose() } /// - /// This method is called by the method. + /// This method is called by the method. /// /// the event to log /// @@ -436,7 +447,7 @@ override protected void OnClose() /// /// /// Before the event is stored in the buffer it is fixed - /// (see ) to ensure that + /// (see ) to ensure that /// any data referenced by the event will be valid when the buffer /// is processed. /// @@ -527,7 +538,7 @@ override protected void Append(LoggingEvent loggingEvent) /// The buffer containing the events that need to be send. /// /// - /// The subclass must override . + /// The subclass must override . /// /// virtual protected void SendFromBuffer(LoggingEvent firstLoggingEvent, CyclicBuffer buffer) diff --git a/src/Appender/BufferingForwardingAppender.cs b/src/Appender/BufferingForwardingAppender.cs old mode 100755 new mode 100644 diff --git a/src/Appender/ColoredConsoleAppender.cs b/src/Appender/ColoredConsoleAppender.cs old mode 100755 new mode 100644 index 0d587e3e..1c26a2c3 --- a/src/Appender/ColoredConsoleAppender.cs +++ b/src/Appender/ColoredConsoleAppender.cs @@ -254,7 +254,7 @@ public void AddMapping(LevelColors mapping) #region Override implementation of AppenderSkeleton /// - /// This method is called by the method. + /// This method is called by the method. /// /// The event to log. /// @@ -265,7 +265,11 @@ public void AddMapping(LevelColors mapping) /// The format of the output will depend on the appender's layout. /// /// - override protected void Append(log4net.Core.LoggingEvent loggingEvent) +#if NET_4_0 || MONO_4_0 + [System.Security.SecuritySafeCritical] +#endif + [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, UnmanagedCode = true)] + override protected void Append(log4net.Core.LoggingEvent loggingEvent) { if (m_consoleOutputWriter != null) { @@ -430,7 +434,11 @@ override protected bool RequiresLayout /// Initialize the level to color mappings set on this appender. /// /// - public override void ActivateOptions() +#if NET_4_0 || MONO_4_0 + [System.Security.SecuritySafeCritical] +#endif + [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, UnmanagedCode=true)] + public override void ActivateOptions() { base.ActivateOptions(); m_levelMapping.ActivateOptions(); diff --git a/src/Appender/ConsoleAppender.cs b/src/Appender/ConsoleAppender.cs old mode 100755 new mode 100644 index b2090d98..d5d6a702 --- a/src/Appender/ConsoleAppender.cs +++ b/src/Appender/ConsoleAppender.cs @@ -22,6 +22,7 @@ using log4net.Layout; using log4net.Core; +using log4net.Util; namespace log4net.Appender { @@ -120,8 +121,8 @@ virtual public string Target set { string v = value.Trim(); - - if (string.Compare(ConsoleError, v, true, CultureInfo.InvariantCulture) == 0) + + if (SystemInfo.EqualsIgnoringCase(ConsoleError, v)) { m_writeToErrorStream = true; } @@ -137,7 +138,7 @@ virtual public string Target #region Override implementation of AppenderSkeleton /// - /// This method is called by the method. + /// This method is called by the method. /// /// The event to log. /// diff --git a/src/Appender/DebugAppender.cs b/src/Appender/DebugAppender.cs old mode 100755 new mode 100644 index ab744706..3cc5640c --- a/src/Appender/DebugAppender.cs +++ b/src/Appender/DebugAppender.cs @@ -35,7 +35,7 @@ namespace log4net.Appender /// debug system. /// /// - /// Events are written using the + /// Events are written using the /// method. The event's logger name is passed as the value for the category name to the Write method. /// /// @@ -102,6 +102,24 @@ public bool ImmediateFlush #endregion Public Instance Properties +#if !NETSTANDARD1_3 + /// + /// Flushes any buffered log data. + /// + /// The maximum time to wait for logging events to be flushed. + /// True if all logging events were flushed successfully, else false. + public override bool Flush(int millisecondsTimeout) + { + // Nothing to do if ImmediateFlush is true + if (m_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 /// @@ -121,7 +139,7 @@ override protected void Append(LoggingEvent loggingEvent) // Write the string to the Debug system // System.Diagnostics.Debug.Write(RenderLoggingEvent(loggingEvent), loggingEvent.LoggerName); - +#if !NETSTANDARD1_3 // // Flush the Debug system if needed // @@ -129,6 +147,7 @@ override protected void Append(LoggingEvent loggingEvent) { System.Diagnostics.Debug.Flush(); } +#endif } /// diff --git a/src/Appender/EventLogAppender.cs b/src/Appender/EventLogAppender.cs old mode 100755 new mode 100644 index c17c2838..9cc031e0 --- a/src/Appender/EventLogAppender.cs +++ b/src/Appender/EventLogAppender.cs @@ -38,9 +38,18 @@ namespace log4net.Appender /// Writes events to the system event log. /// /// + /// + /// The appender will fail if you try to write using an event source that doesn't exist unless it is running with local administrator privileges. + /// See also http://logging.apache.org/log4net/release/faq.html#trouble-EventLog + /// /// /// The EventID of the event log entry can be - /// set using the EventLogEventID property () + /// set using the EventID property () + /// on the . + /// + /// + /// The Category of the event log entry can be + /// set using the Category property () /// on the . /// /// @@ -211,7 +220,40 @@ public SecurityContext SecurityContext set { m_securityContext = value; } } - #endregion // Public Instance Properties + /// + /// Gets or sets the EventId to use unless one is explicitly specified via the LoggingEvent's properties. + /// + /// + /// + /// The EventID of the event log entry will normally be + /// set using the EventID property () + /// on the . + /// This property provides the fallback value which defaults to 0. + /// + /// + public int EventId { + get { return m_eventId; } + set { m_eventId = value; } + } + + + /// + /// Gets or sets the Category to use unless one is explicitly specified via the LoggingEvent's properties. + /// + /// + /// + /// The Category of the event log entry will normally be + /// set using the Category property () + /// on the . + /// This property provides the fallback value which defaults to 0. + /// + /// + public short Category + { + get { return m_category; } + set { m_category = value; } + } + #endregion // Public Instance Properties #region Implementation of IOptionHandler @@ -233,60 +275,71 @@ public SecurityContext SecurityContext /// override public void ActivateOptions() { - base.ActivateOptions(); - - if (m_securityContext == null) - { - m_securityContext = SecurityContextProvider.DefaultProvider.CreateSecurityContext(this); - } - - bool sourceAlreadyExists = false; - string currentLogName = null; - - using(SecurityContext.Impersonate(this)) - { - sourceAlreadyExists = EventLog.SourceExists(m_applicationName); - if (sourceAlreadyExists) - { - currentLogName = EventLog.LogNameFromSourceName(m_applicationName, m_machineName); - } - } - - if (sourceAlreadyExists && currentLogName != m_logName) - { - LogLog.Debug(declaringType, "Changing event source [" + m_applicationName + "] from log [" + currentLogName + "] to log [" + m_logName + "]"); - } - else if (!sourceAlreadyExists) - { - LogLog.Debug(declaringType, "Creating event source Source [" + m_applicationName + "] in log " + m_logName + "]"); - } - - string registeredLogName = null; - - using(SecurityContext.Impersonate(this)) - { - if (sourceAlreadyExists && currentLogName != m_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); - - registeredLogName = EventLog.LogNameFromSourceName(m_applicationName, m_machineName); - } - else if (!sourceAlreadyExists) - { - CreateEventSource(m_applicationName, m_logName, m_machineName); - - registeredLogName = EventLog.LogNameFromSourceName(m_applicationName, m_machineName); - } - } - - m_levelMapping.ActivateOptions(); - - LogLog.Debug(declaringType, "Source [" + m_applicationName + "] is registered to log [" + registeredLogName + "]"); + try + { + base.ActivateOptions(); + + if (m_securityContext == null) + { + m_securityContext = SecurityContextProvider.DefaultProvider.CreateSecurityContext(this); + } + + bool sourceAlreadyExists = false; + string currentLogName = null; + + using (SecurityContext.Impersonate(this)) + { + sourceAlreadyExists = EventLog.SourceExists(m_applicationName); + if (sourceAlreadyExists) { + currentLogName = EventLog.LogNameFromSourceName(m_applicationName, m_machineName); + } + } + + if (sourceAlreadyExists && currentLogName != m_logName) + { + LogLog.Debug(declaringType, "Changing event source [" + m_applicationName + "] from log [" + currentLogName + "] to log [" + m_logName + "]"); + } + else if (!sourceAlreadyExists) + { + LogLog.Debug(declaringType, "Creating event source Source [" + m_applicationName + "] in log " + m_logName + "]"); + } + + string registeredLogName = null; + + using (SecurityContext.Impersonate(this)) + { + if (sourceAlreadyExists && currentLogName != m_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); + + registeredLogName = EventLog.LogNameFromSourceName(m_applicationName, m_machineName); + } + else if (!sourceAlreadyExists) + { + CreateEventSource(m_applicationName, m_logName, m_machineName); + + registeredLogName = EventLog.LogNameFromSourceName(m_applicationName, m_machineName); + } + } + + m_levelMapping.ActivateOptions(); + + LogLog.Debug(declaringType, "Source [" + m_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 + + " 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); + Threshold = Level.Off; + } } #endregion // Implementation of IOptionHandler @@ -311,7 +364,7 @@ private static void CreateEventSource(string source, string logName, string mach #region Override implementation of AppenderSkeleton /// - /// This method is called by the + /// This method is called by the /// method. /// /// the event to log @@ -331,9 +384,9 @@ override protected void Append(LoggingEvent loggingEvent) // // Write the resulting string to the event log system // - int eventID = 0; + int eventID = m_eventId; - // Look for the EventLogEventID property + // Look for the EventID property object eventIDPropertyObj = loggingEvent.LookupProperty("EventID"); if (eventIDPropertyObj != null) { @@ -344,6 +397,10 @@ override protected void Append(LoggingEvent loggingEvent) else { string eventIDPropertyString = eventIDPropertyObj as string; + if (eventIDPropertyString == null) + { + eventIDPropertyString = eventIDPropertyObj.ToString(); + } if (eventIDPropertyString != null && eventIDPropertyString.Length > 0) { // Read the string property into a number @@ -360,22 +417,54 @@ override protected void Append(LoggingEvent loggingEvent) } } + short category = m_category; + // Look for the Category property + object categoryPropertyObj = loggingEvent.LookupProperty("Category"); + if (categoryPropertyObj != null) + { + if (categoryPropertyObj is short) + { + category = (short) categoryPropertyObj; + } + else + { + string categoryPropertyString = categoryPropertyObj as string; + if (categoryPropertyString == null) + { + categoryPropertyString = categoryPropertyObj.ToString(); + } + if (categoryPropertyString != null && categoryPropertyString.Length > 0) + { + // Read the string property into a number + short shortVal; + if (SystemInfo.TryParse(categoryPropertyString, out shortVal)) + { + category = shortVal; + } + else + { + ErrorHandler.Error("Unable to parse event category property [" + categoryPropertyString + "]."); + } + } + } + } + // Write to the event log try { string eventTxt = RenderLoggingEvent(loggingEvent); - // There is a limit of 32K characters for an event log message - if (eventTxt.Length > 32000) + // There is a limit of about 32K characters for an event log message + if (eventTxt.Length > MAX_EVENTLOG_MESSAGE_SIZE) { - eventTxt = eventTxt.Substring(0, 32000); + eventTxt = eventTxt.Substring(0, MAX_EVENTLOG_MESSAGE_SIZE); } EventLogEntryType entryType = GetEntryType(loggingEvent.Level); using(SecurityContext.Impersonate(this)) { - EventLog.WriteEntry(m_applicationName, eventTxt, entryType, eventID); + EventLog.WriteEntry(m_applicationName, eventTxt, entryType, eventID, category); } } catch(Exception ex) @@ -403,10 +492,10 @@ override protected bool RequiresLayout #region Protected Instance Methods /// - /// Get the equivalent for a + /// Get the equivalent for a /// /// the Level to convert to an EventLogEntryType - /// The equivalent for a + /// The equivalent for a /// /// Because there are fewer applicable /// values to use in logging levels than there are in the @@ -469,7 +558,17 @@ virtual protected EventLogEntryType GetEntryType(Level level) /// private SecurityContext m_securityContext; - #endregion // Private Instance Fields + /// + /// The event ID to use unless one is explicitly specified via the LoggingEvent's properties. + /// + private int m_eventId = 0; + + /// + /// The event category to use unless one is explicitly specified via the LoggingEvent's properties. + /// + private short m_category = 0; + + #endregion // Private Instance Fields #region Level2EventLogEntryType LevelMapping Entry @@ -515,6 +614,74 @@ public EventLogEntryType EventLogEntryType /// private readonly static Type declaringType = typeof(EventLogAppender); + /// + /// The maximum size supported by default. + /// + /// + /// http://msdn.microsoft.com/en-us/library/xzwc042w(v=vs.100).aspx + /// The 32766 documented max size is two bytes shy of 32K (I'm assuming 32766 + /// may leave space for a two byte null terminator of #0#0). The 32766 max + /// length is what the .NET 4.0 source code checks for, but this is WRONG! + /// Strings with a length > 31839 on Windows Vista or higher can CORRUPT + /// the event log! See: System.Diagnostics.EventLogInternal.InternalWriteEvent() + /// for the use of the 32766 max size. + /// + private readonly static int MAX_EVENTLOG_MESSAGE_SIZE_DEFAULT = 32766; + + /// + /// The maximum size supported by a windows operating system that is vista + /// or newer. + /// + /// + /// See ReportEvent API: + /// http://msdn.microsoft.com/en-us/library/aa363679(VS.85).aspx + /// ReportEvent's lpStrings parameter: + /// "A pointer to a buffer containing an array of + /// null-terminated strings that are merged into the message before Event Viewer + /// displays the string to the user. This parameter must be a valid pointer + /// (or NULL), even if wNumStrings is zero. Each string is limited to 31,839 characters." + /// + /// Going beyond the size of 31839 will (at some point) corrupt the event log on Windows + /// Vista or higher! It may succeed for a while...but you will eventually run into the + /// error: "System.ComponentModel.Win32Exception : A device attached to the system is + /// not functioning", and the event log will then be corrupt (I was able to corrupt + /// an event log using a length of 31877 on Windows 7). + /// + /// The max size for Windows Vista or higher is documented here: + /// http://msdn.microsoft.com/en-us/library/xzwc042w(v=vs.100).aspx. + /// Going over this size may succeed a few times but the buffer will overrun and + /// eventually corrupt the log (based on testing). + /// + /// The maxEventMsgSize size is based on the max buffer size of the lpStrings parameter of the ReportEvent API. + /// The documented max size for EventLog.WriteEntry for Windows Vista and higher is 31839, but I'm leaving room for a + /// terminator of #0#0, as we cannot see the source of ReportEvent (though we could use an API monitor to examine the + /// buffer, given enough time). + /// + private readonly static int MAX_EVENTLOG_MESSAGE_SIZE_VISTA_OR_NEWER = 31839 - 2; + + /// + /// The maximum size that the operating system supports for + /// a event log message. + /// + /// + /// Used to determine the maximum string length that can be written + /// to the operating system event log and eventually truncate a string + /// that exceeds the limits. + /// + private readonly static int MAX_EVENTLOG_MESSAGE_SIZE = GetMaxEventLogMessageSize(); + + /// + /// This method determines the maximum event log message size allowed for + /// the current environment. + /// + /// + 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 } } diff --git a/src/Appender/FileAppender.cs b/src/Appender/FileAppender.cs old mode 100755 new mode 100644 index 8e3e1c57..41616b97 --- a/src/Appender/FileAppender.cs +++ b/src/Appender/FileAppender.cs @@ -24,9 +24,13 @@ using log4net.Util; using log4net.Layout; using log4net.Core; +#if NET_4_5 || NETSTANDARD1_3 +using System.Threading.Tasks; +#endif namespace log4net.Appender { +#if !NETCF /// /// Appends logging events to a file. /// @@ -61,16 +65,70 @@ namespace log4net.Appender /// the property. /// The default behavior, implemented by /// 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. + /// The alternative models only hold a + /// write lock while the appender is writing a logging event () + /// or synchronize by using a named system wide Mutex (). /// + /// + /// All locking strategies have issues and you should seriously consider using a different strategy that + /// avoids having multiple processes logging to the same file. + /// + /// + /// Nicko Cadell + /// Gert Driesen + /// Rodrigo B. de Oliveira + /// Douglas de la Torre + /// Niall Daley +#else + /// + /// Appends logging events to a file. + /// + /// + /// + /// Logging events are sent to the file specified by + /// the property. + /// + /// + /// The file can be opened in either append or overwrite mode + /// by specifying the 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 property. + /// + /// + /// The layout's and + /// values will be written each time the file is opened and closed + /// respectively. If the property is + /// then the file may contain multiple copies of the header and footer. + /// + /// + /// This appender will first try to open the file for writing when + /// 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. + /// + /// + /// The supports pluggable file locking models via + /// the property. + /// The default behavior, implemented by + /// 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 (). + /// + /// + /// All locking strategies have issues and you should seriously consider using a different strategy that + /// avoids having multiple processes logging to the same file. + /// /// /// Nicko Cadell /// Gert Driesen /// Rodrigo B. de Oliveira /// Douglas de la Torre /// Niall Daley - public class FileAppender : TextWriterAppender +#endif + public class FileAppender : TextWriterAppender { #region LockingStream Inner Class @@ -82,33 +140,44 @@ private sealed class LockingStream : Stream, IDisposable { public sealed class LockStateException : LogException { - public LockStateException(string message): base(message) + public LockStateException(string message) + : base(message) { } } - private Stream m_realStream=null; - private LockingModelBase m_lockingModel=null; - private int m_readTotal=-1; - private int m_lockLevel=0; + private Stream m_realStream = null; + private LockingModelBase m_lockingModel = null; + private int m_lockLevel = 0; - public LockingStream(LockingModelBase locking) : base() + public LockingStream(LockingModelBase locking) + : base() { - if (locking==null) + if (locking == null) { - throw new ArgumentException("Locking model may not be null","locking"); + throw new ArgumentException("Locking model may not be null", "locking"); } - m_lockingModel=locking; + m_lockingModel = locking; } #region Override Implementation of Stream +#if NETSTANDARD1_3 + 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); + IAsyncResult ret = m_realStream.BeginRead(buffer, offset, count, callback, state); + m_readTotal = EndRead(ret); return ret; } @@ -118,104 +187,124 @@ public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, Asy 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); + IAsyncResult ret = m_realStream.BeginWrite(buffer, offset, count, callback, state); EndWrite(ret); return ret; } - public override void Close() + public override void Close() { m_lockingModel.CloseFile(); } - public override int EndRead(IAsyncResult asyncResult) + public override int EndRead(IAsyncResult asyncResult) { AssertLocked(); return m_readTotal; } - public override void EndWrite(IAsyncResult asyncResult) + public override void EndWrite(IAsyncResult asyncResult) { //No-op, it has already been handled } - public override void Flush() +#endif + +#if NET_4_5 || NETSTANDARD1_3 + public override Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) + { + AssertLocked(); + return m_realStream.ReadAsync(buffer, offset, count, cancellationToken); + } + + public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) + { + AssertLocked(); + return base.WriteAsync(buffer, offset, count, cancellationToken); + } +#endif + + public override void Flush() { AssertLocked(); m_realStream.Flush(); } - public override int Read(byte[] buffer, int offset, int count) + public override int Read(byte[] buffer, int offset, int count) { - return m_realStream.Read(buffer,offset,count); + return m_realStream.Read(buffer, offset, count); } - public override int ReadByte() + public override int ReadByte() { return m_realStream.ReadByte(); } - public override long Seek(long offset, SeekOrigin origin) + public override long Seek(long offset, SeekOrigin origin) { AssertLocked(); - return m_realStream.Seek(offset,origin); + return m_realStream.Seek(offset, origin); } - public override void SetLength(long value) + public override void SetLength(long value) { AssertLocked(); m_realStream.SetLength(value); } - void IDisposable.Dispose() + void IDisposable.Dispose() { +#if NETSTANDARD1_3 + Dispose(true); +#else Close(); +#endif } - public override void Write(byte[] buffer, int offset, int count) + public override void Write(byte[] buffer, int offset, int count) { AssertLocked(); - m_realStream.Write(buffer,offset,count); + m_realStream.Write(buffer, offset, count); } - public override void WriteByte(byte value) + public override void WriteByte(byte value) { AssertLocked(); m_realStream.WriteByte(value); } // Properties - public override bool CanRead - { - get { return false; } + public override bool CanRead + { + get { return false; } } - public override bool CanSeek - { - get + public override bool CanSeek + { + get { AssertLocked(); return m_realStream.CanSeek; - } + } } - public override bool CanWrite - { - get + public override bool CanWrite + { + get { AssertLocked(); return m_realStream.CanWrite; - } + } } - public override long Length - { - get + public override long Length + { + get { AssertLocked(); return m_realStream.Length; - } + } } - public override long Position - { - get + public override long Position + { + get { AssertLocked(); return m_realStream.Position; - } - set + } + set { AssertLocked(); - m_realStream.Position=value; - } + m_realStream.Position = value; + } } #endregion Override Implementation of Stream @@ -232,18 +321,18 @@ private void AssertLocked() public bool AcquireLock() { - bool ret=false; - lock(this) + bool ret = false; + lock (this) { - if (m_lockLevel==0) + if (m_lockLevel == 0) { // If lock is already acquired, nop - m_realStream=m_lockingModel.AcquireLock(); + m_realStream = m_lockingModel.AcquireLock(); } - if (m_realStream!=null) + if (m_realStream != null) { m_lockLevel++; - ret=true; + ret = true; } } return ret; @@ -251,14 +340,14 @@ public bool AcquireLock() public void ReleaseLock() { - lock(this) + lock (this) { m_lockLevel--; - if (m_lockLevel==0) + if (m_lockLevel == 0) { // If already unlocked, nop m_lockingModel.ReleaseLock(); - m_realStream=null; + m_realStream = null; } } } @@ -280,7 +369,7 @@ public void ReleaseLock() /// public abstract class LockingModelBase { - private FileAppender m_appender=null; + private FileAppender m_appender = null; /// /// Open the output file @@ -296,7 +385,7 @@ public abstract class LockingModelBase /// and . /// /// - public abstract void OpenFile(string filename, bool append,Encoding encoding); + public abstract void OpenFile(string filename, bool append, Encoding encoding); /// /// Close the file @@ -308,6 +397,16 @@ public abstract class LockingModelBase /// public abstract void CloseFile(); + /// + /// Initializes all resources used by this locking model. + /// + public abstract void ActivateOptions(); + + /// + /// Disposes all resources that were initialized by this locking model. + /// + public abstract void OnClose(); + /// /// Acquire the lock on the file /// @@ -357,55 +456,55 @@ public FileAppender CurrentAppender set { m_appender = value; } } - /// - /// Helper method that creates a FileStream under CurrentAppender's SecurityContext. - /// - /// - /// - /// Typically called during OpenFile or AcquireLock. - /// - /// - /// If the directory portion of the does not exist, it is created - /// via Directory.CreateDirecctory. - /// - /// - /// - /// - /// - /// - protected Stream CreateStream(string filename, bool append, FileShare fileShare) - { - using (CurrentAppender.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); - } - - FileMode fileOpenMode = append ? FileMode.Append : FileMode.Create; - return new FileStream(filename, fileOpenMode, FileAccess.Write, FileShare.Read); - } - } - - /// - /// Helper method to close under CurrentAppender's SecurityContext. - /// - /// - /// Does not set to null. - /// - /// - protected void CloseStream(Stream stream) - { - using (CurrentAppender.SecurityContext.Impersonate(this)) - { - stream.Close(); - } - } + /// + /// Helper method that creates a FileStream under CurrentAppender's SecurityContext. + /// + /// + /// + /// Typically called during OpenFile or AcquireLock. + /// + /// + /// If the directory portion of the does not exist, it is created + /// via Directory.CreateDirecctory. + /// + /// + /// + /// + /// + /// + protected Stream CreateStream(string filename, bool append, FileShare fileShare) + { + using (CurrentAppender.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); + } + + FileMode fileOpenMode = append ? FileMode.Append : FileMode.Create; + return new FileStream(filename, fileOpenMode, FileAccess.Write, fileShare); + } + } + + /// + /// Helper method to close under CurrentAppender's SecurityContext. + /// + /// + /// Does not set to null. + /// + /// + protected void CloseStream(Stream stream) + { + using (CurrentAppender.SecurityContext.Impersonate(this)) + { + stream.Close(); + } + } } /// @@ -435,15 +534,15 @@ public class ExclusiveLock : LockingModelBase /// and . /// /// - public override void OpenFile(string filename, bool append,Encoding encoding) + public override void OpenFile(string filename, bool append, Encoding encoding) { try { - m_stream = CreateStream(filename, append, FileShare.Read); + m_stream = CreateStream(filename, append, FileShare.Read); } catch (Exception e1) { - CurrentAppender.ErrorHandler.Error("Unable to acquire lock on file "+filename+". "+e1.Message); + CurrentAppender.ErrorHandler.Error("Unable to acquire lock on file " + filename + ". " + e1.Message); } } @@ -457,8 +556,8 @@ public override void OpenFile(string filename, bool append,Encoding encoding) /// public override void CloseFile() { - CloseStream(m_stream); - m_stream = null; + CloseStream(m_stream); + m_stream = null; } /// @@ -487,6 +586,22 @@ public override void ReleaseLock() { //NOP } + + /// + /// Initializes all resources used by this locking model. + /// + public override void ActivateOptions() + { + //NOP + } + + /// + /// Disposes all resources that were initialized by this locking model. + /// + public override void OnClose() + { + //NOP + } } /// @@ -504,7 +619,7 @@ public class MinimalLock : LockingModelBase { private string m_filename; private bool m_append; - private Stream m_stream=null; + private Stream m_stream = null; /// /// Prepares to open the file when the first message is logged. @@ -522,8 +637,8 @@ public class MinimalLock : LockingModelBase /// public override void OpenFile(string filename, bool append, Encoding encoding) { - m_filename=filename; - m_append=append; + m_filename = filename; + m_append = append; } /// @@ -552,15 +667,16 @@ public override void CloseFile() /// public override Stream AcquireLock() { - if (m_stream==null) + if (m_stream == null) { try { - m_stream = CreateStream(m_filename, m_append, FileShare.Read); + 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); + CurrentAppender.ErrorHandler.Error("Unable to acquire lock on file " + m_filename + ". " + e1.Message); } } return m_stream; @@ -577,107 +693,188 @@ public override Stream AcquireLock() /// public override void ReleaseLock() { - CloseStream(m_stream); - m_stream = null; + CloseStream(m_stream); + m_stream = null; + } + + /// + /// Initializes all resources used by this locking model. + /// + public override void ActivateOptions() + { + //NOP + } + + /// + /// Disposes all resources that were initialized by this locking model. + /// + public override void OnClose() + { + //NOP } } - /// - /// Provides cross-process file locking. - /// - /// Ron Grabowski - /// Steve Wranovsky - public class MutexLock : LockingModelBase - { - private Mutex m_mutex = null; - private bool m_mutexClosed = false; - private Stream m_stream = null; - - /// - /// Open the file specified and prepare for logging. - /// - /// The filename to use - /// Whether to append to the file, or overwrite - /// The encoding to use - /// - /// - /// Open the file specified and prepare for logging. - /// No writes will be made until is called. - /// Must be called before any calls to , - /// - and . - /// - /// - public override void OpenFile(string filename, bool append, Encoding encoding) - { - try - { - m_stream = CreateStream(filename, append, FileShare.ReadWrite); - - string mutextFriendlyFilename = filename - .Replace("\\", "_") - .Replace(":", "_") - .Replace("/", "_"); - - m_mutex = new Mutex(false, mutextFriendlyFilename); - } - catch (Exception e1) - { - CurrentAppender.ErrorHandler.Error("Unable to acquire lock on file " + filename + ". " + e1.Message); - } - } - - /// - /// Close the file - /// - /// - /// - /// Close the file. No further writes will be made. - /// - /// - public override void CloseFile() - { - CloseStream(m_stream); - m_stream = null; - - m_mutex.ReleaseMutex(); - m_mutex.Close(); - m_mutexClosed = true; - } - - /// - /// Acquire the lock on the file - /// - /// A stream that is ready to be written to. - /// - /// - /// Does nothing. The lock is already taken - /// - /// - public override Stream AcquireLock() - { - // TODO: add timeout? - m_mutex.WaitOne(); - - // should always be true (and fast) for FileStream - if (m_stream.CanSeek) - { - m_stream.Seek(0, SeekOrigin.End); - } - - return m_stream; - } - - /// - /// - /// - public override void ReleaseLock() - { - if (m_mutexClosed == false) - { - m_mutex.ReleaseMutex(); - } - } - } +#if !NETCF + /// + /// Provides cross-process file locking. + /// + /// Ron Grabowski + /// Steve Wranovsky + public class InterProcessLock : LockingModelBase + { + private Mutex m_mutex = null; + private Stream m_stream = null; + private int m_recursiveWatch = 0; + + /// + /// Open the file specified and prepare for logging. + /// + /// The filename to use + /// Whether to append to the file, or overwrite + /// The encoding to use + /// + /// + /// Open the file specified and prepare for logging. + /// No writes will be made until is called. + /// Must be called before any calls to , + /// - and . + /// + /// +#if NET_4_0 || MONO_4_0 || NETSTANDARD1_3 + [System.Security.SecuritySafeCritical] +#endif + public override void OpenFile(string filename, bool append, Encoding encoding) + { + try + { + m_stream = CreateStream(filename, append, FileShare.ReadWrite); + } + catch (Exception e1) + { + CurrentAppender.ErrorHandler.Error("Unable to acquire lock on file " + filename + ". " + e1.Message); + } + } + + /// + /// Close the file + /// + /// + /// + /// Close the file. No further writes will be made. + /// + /// + public override void CloseFile() + { + try + { + CloseStream(m_stream); + m_stream = null; + } + finally + { + ReleaseLock(); + } + } + + /// + /// Acquire the lock on the file + /// + /// A stream that is ready to be written to. + /// + /// + /// Does nothing. The lock is already taken + /// + /// + public override Stream AcquireLock() + { + if (m_mutex != null) + { + // TODO: add timeout? + m_mutex.WaitOne(); + + // increment recursive watch + m_recursiveWatch++; + + // should always be true (and fast) for FileStream + if (m_stream != null) + { + if (m_stream.CanSeek) + { + m_stream.Seek(0, SeekOrigin.End); + } + } + else + { + // this can happen when the file appender cannot open a file for writing + } + } + else + { + CurrentAppender.ErrorHandler.Error("Programming error, no mutex available to acquire lock! From here on things will be dangerous!"); + } + return m_stream; + } + + /// + /// Releases the lock and allows others to acquire a lock. + /// + public override void ReleaseLock() + { + if (m_mutex != null) + { + if (m_recursiveWatch > 0) + { + m_recursiveWatch--; + m_mutex.ReleaseMutex(); + } + } + else + { + CurrentAppender.ErrorHandler.Error("Programming error, no mutex available to release the lock!"); + } + } + + /// + /// Initializes all resources used by this locking model. + /// + public override void ActivateOptions() + { + if (m_mutex == null) + { + string mutexFriendlyFilename = CurrentAppender.File + .Replace("\\", "_") + .Replace(":", "_") + .Replace("/", "_"); + + m_mutex = new Mutex(false, mutexFriendlyFilename); + } + else + { + CurrentAppender.ErrorHandler.Error("Programming error, mutex already initialized!"); + } + } + + /// + /// Disposes all resources that were initialized by this locking model. + /// + public override void OnClose() + { + if (m_mutex != null) + { +#if NET_4_0 || MONO_4_0 || NETSTANDARD1_3 + m_mutex.Dispose(); +#else + m_mutex.Close(); +#endif + m_mutex = null; + } + else + { + CurrentAppender.ErrorHandler.Error("Programming error, mutex not initialized!"); + } + } + } +#endif #endregion Locking Models @@ -707,7 +904,7 @@ public FileAppender() /// /// [Obsolete("Instead use the default constructor and set the Layout, File & AppendToFile properties")] - public FileAppender(ILayout layout, string filename, bool append) + public FileAppender(ILayout layout, string filename, bool append) { Layout = layout; File = filename; @@ -727,7 +924,8 @@ public FileAppender(ILayout layout, string filename, bool append) /// /// [Obsolete("Instead use the default constructor and set the Layout & File properties")] - public FileAppender(ILayout layout, string filename) : this(layout, filename, true) + public FileAppender(ILayout layout, string filename) + : this(layout, filename, true) { } @@ -805,12 +1003,13 @@ public Encoding Encoding /// of the current thread. /// /// - public SecurityContext SecurityContext + public SecurityContext SecurityContext { get { return m_securityContext; } set { m_securityContext = value; } } +#if NETCF /// /// Gets or sets the used to handle locking of the file. /// @@ -822,14 +1021,37 @@ public SecurityContext SecurityContext /// Gets or sets the used to handle locking of the file. /// /// - /// There are two built in locking models, and . - /// The former locks the file from the start of logging to the end and the - /// later lock only for the minimal amount of time when logging each message. + /// There are two built in locking models, and . + /// 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. /// /// /// The default locking model is the . /// /// +#else + /// + /// Gets or sets the used to handle locking of the file. + /// + /// + /// The used to lock the file. + /// + /// + /// + /// Gets or sets the used to handle locking of the file. + /// + /// + /// There are three built in locking models, , and . + /// 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. + /// + /// + /// The default locking model is the . + /// + /// +#endif public FileAppender.LockingModelBase LockingModel { get { return m_lockingModel; } @@ -859,8 +1081,8 @@ public FileAppender.LockingModelBase LockingModel /// This will cause the file to be opened. /// /// - override public void ActivateOptions() - { + override public void ActivateOptions() + { base.ActivateOptions(); if (m_securityContext == null) @@ -873,20 +1095,20 @@ override public void ActivateOptions() m_lockingModel = new FileAppender.ExclusiveLock(); } - m_lockingModel.CurrentAppender=this; - - using(SecurityContext.Impersonate(this)) - { - m_fileName = ConvertToFullPath(m_fileName.Trim()); - } + m_lockingModel.CurrentAppender = this; + m_lockingModel.ActivateOptions(); - if (m_fileName != null) + if (m_fileName != null) { + using (SecurityContext.Impersonate(this)) + { + m_fileName = ConvertToFullPath(m_fileName.Trim()); + } SafeOpenFile(m_fileName, m_appendToFile); - } - else + } + else { - LogLog.Warn(declaringType, "FileAppender: File option not set for appender ["+Name+"]."); + LogLog.Warn(declaringType, "FileAppender: File option not set for appender [" + Name + "]."); LogLog.Warn(declaringType, "FileAppender: Are you using FileAppender instead of ConsoleAppender?"); } } @@ -903,28 +1125,37 @@ override public void ActivateOptions() /// Resets the filename and the file stream. /// /// - override protected void Reset() + override protected void Reset() { base.Reset(); m_fileName = null; } - /// - /// Called to initialize the file writer - /// - /// - /// - /// Will be called for each logged message until the file is - /// successfully opened. - /// - /// - override protected void PrepareWriter() - { + /// + /// Close this appender instance. The underlying stream or writer is also closed. + /// + override protected void OnClose() + { + base.OnClose(); + m_lockingModel.OnClose(); + } + + /// + /// Called to initialize the file writer + /// + /// + /// + /// Will be called for each logged message until the file is + /// successfully opened. + /// + /// + override protected void PrepareWriter() + { SafeOpenFile(m_fileName, m_appendToFile); - } + } /// - /// This method is called by the + /// This method is called by the /// method. /// /// The event to log. @@ -937,7 +1168,7 @@ override protected void PrepareWriter() /// The format of the output will depend on the appender's layout. /// /// - override protected void Append(LoggingEvent loggingEvent) + override protected void Append(LoggingEvent loggingEvent) { if (m_stream.AcquireLock()) { @@ -953,7 +1184,7 @@ override protected void Append(LoggingEvent loggingEvent) } /// - /// This method is called by the + /// This method is called by the /// method. /// /// The array of events to log. @@ -963,7 +1194,7 @@ override protected void Append(LoggingEvent loggingEvent) /// the stream. /// /// - override protected void Append(LoggingEvent[] loggingEvents) + override protected void Append(LoggingEvent[] loggingEvents) { if (m_stream.AcquireLock()) { @@ -986,9 +1217,9 @@ override protected void Append(LoggingEvent[] loggingEvents) /// Writes a footer as produced by the embedded layout's property. /// /// - protected override void WriteFooter() + protected override void WriteFooter() { - if (m_stream!=null) + if (m_stream != null) { //WriteFooter can be called even before a file is opened m_stream.AcquireLock(); @@ -1011,9 +1242,9 @@ protected override void WriteFooter() /// Writes a header produced by the embedded layout's property. /// /// - protected override void WriteHeader() + protected override void WriteHeader() { - if (m_stream!=null) + if (m_stream != null) { if (m_stream.AcquireLock()) { @@ -1037,9 +1268,9 @@ protected override void WriteHeader() /// Closes the underlying . /// /// - protected override void CloseWriter() + protected override void CloseWriter() { - if (m_stream!=null) + if (m_stream != null) { m_stream.AcquireLock(); try @@ -1066,7 +1297,7 @@ protected override void CloseWriter() /// closes the file. /// /// - protected void CloseFile() + protected void CloseFile() { WriteFooterAndCloseWriter(); } @@ -1088,13 +1319,13 @@ protected void CloseFile() /// virtual protected void SafeOpenFile(string fileName, bool append) { - try + try { OpenFile(fileName, append); } - catch(Exception e) + catch (Exception e) { - ErrorHandler.Error("OpenFile("+fileName+","+append+") call failed.", e, ErrorCode.FileOpenFailure); + ErrorHandler.Error("OpenFile(" + fileName + "," + append + ") call failed.", e, ErrorCode.FileOpenFailure); } } @@ -1119,36 +1350,36 @@ virtual protected void OpenFile(string fileName, bool append) { // Internal check that the fileName passed in is a rooted path bool isPathRooted = false; - using(SecurityContext.Impersonate(this)) + using (SecurityContext.Impersonate(this)) { isPathRooted = Path.IsPathRooted(fileName); } if (!isPathRooted) { - LogLog.Error(declaringType, "INTERNAL ERROR. OpenFile("+fileName+"): File name is not fully qualified."); + LogLog.Error(declaringType, "INTERNAL ERROR. OpenFile(" + fileName + "): File name is not fully qualified."); } } - lock(this) + lock (this) { Reset(); - LogLog.Debug(declaringType, "Opening file for writing ["+fileName+"] append ["+append+"]"); + LogLog.Debug(declaringType, "Opening file for writing [" + fileName + "] append [" + append + "]"); // Save these for later, allowing retries if file open fails m_fileName = fileName; m_appendToFile = append; - LockingModel.CurrentAppender=this; - LockingModel.OpenFile(fileName,append,m_encoding); - m_stream=new LockingStream(LockingModel); + LockingModel.CurrentAppender = this; + LockingModel.OpenFile(fileName, append, m_encoding); + m_stream = new LockingStream(LockingModel); if (m_stream != null) { m_stream.AcquireLock(); try { - SetQWForFiles(new StreamWriter(m_stream, m_encoding)); + SetQWForFiles(m_stream); } finally { @@ -1166,9 +1397,9 @@ virtual protected void OpenFile(string fileName, bool append) /// the file stream that has been opened for writing /// /// - /// This implementation of creates a + /// This implementation of creates a /// over the and passes it to the - /// method. + /// method. /// /// /// This method can be overridden by sub classes that want to wrap the @@ -1176,7 +1407,7 @@ virtual protected void OpenFile(string fileName, bool append) /// data using a System.Security.Cryptography.CryptoStream. /// /// - virtual protected void SetQWForFiles(Stream fileStream) + virtual protected void SetQWForFiles(Stream fileStream) { SetQWForFiles(new StreamWriter(fileStream, m_encoding)); } @@ -1191,7 +1422,7 @@ virtual protected void SetQWForFiles(Stream fileStream) /// wrap the in some way. /// /// - virtual protected void SetQWForFiles(TextWriter writer) + virtual protected void SetQWForFiles(TextWriter writer) { QuietWriter = new QuietTextWriter(writer, ErrorHandler); } @@ -1236,7 +1467,7 @@ protected static string ConvertToFullPath(string path) /// /// The encoding to use for the file stream. /// - private Encoding m_encoding = Encoding.Default; + private Encoding m_encoding = Encoding.GetEncoding(0); /// /// The security context to use for privileged calls @@ -1255,17 +1486,17 @@ protected static string ConvertToFullPath(string path) #endregion Private Instance Fields - #region Private Static Fields + #region Private Static Fields - /// - /// The fully qualified type of the FileAppender class. - /// - /// - /// Used by the internal logger to record the Type of the - /// log message. - /// - private readonly static Type declaringType = typeof(FileAppender); + /// + /// The fully qualified type of the FileAppender class. + /// + /// + /// Used by the internal logger to record the Type of the + /// log message. + /// + private readonly static Type declaringType = typeof(FileAppender); - #endregion Private Static Fields + #endregion Private Static Fields } } diff --git a/src/Appender/ForwardingAppender.cs b/src/Appender/ForwardingAppender.cs old mode 100755 new mode 100644 diff --git a/src/Appender/IAppender.cs b/src/Appender/IAppender.cs old mode 100755 new mode 100644 index 88ec426e..a644f072 --- a/src/Appender/IAppender.cs +++ b/src/Appender/IAppender.cs @@ -33,7 +33,7 @@ namespace log4net.Appender /// /// /// Appenders can also implement the interface. Therefore - /// they would require that the method + /// they would require that the method /// be called after the appenders properties have been configured. /// /// diff --git a/src/Appender/IBulkAppender.cs b/src/Appender/IBulkAppender.cs old mode 100755 new mode 100644 diff --git a/src/Appender/IFlushable.cs b/src/Appender/IFlushable.cs new file mode 100644 index 00000000..2cb7ae3f --- /dev/null +++ b/src/Appender/IFlushable.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; + +namespace log4net.Appender +{ + /// + /// Interface that can be implemented by Appenders that buffer logging data and expose a method. + /// + public interface IFlushable + { + /// + /// Flushes any buffered log data. + /// + /// + /// Appenders that implement the method must do so in a thread-safe manner: it can be called concurrently with + /// the method. + /// + /// Typically this is done by locking on the Appender instance, e.g.: + /// + /// + /// + /// + /// + /// The parameter is only relevant for appenders that process logging events asynchronously, + /// such as . + /// + /// + /// The maximum time to wait for logging events to be flushed. + /// True if all logging events were flushed successfully, else false. + bool Flush(int millisecondsTimeout); + } +} diff --git a/src/Appender/LocalSyslogAppender.cs b/src/Appender/LocalSyslogAppender.cs old mode 100755 new mode 100644 index e5b4f4bd..a21d7ed8 --- a/src/Appender/LocalSyslogAppender.cs +++ b/src/Appender/LocalSyslogAppender.cs @@ -337,7 +337,10 @@ public void AddMapping(LevelSeverity mapping) /// must be called again. /// /// - public override void ActivateOptions() +#if NET_4_0 || MONO_4_0 || NETSTANDARD1_3 + [System.Security.SecuritySafeCritical] +#endif + public override void ActivateOptions() { base.ActivateOptions(); @@ -364,7 +367,7 @@ public override void ActivateOptions() #region AppenderSkeleton Implementation /// - /// This method is called by the method. + /// This method is called by the method. /// /// The event to log. /// @@ -375,7 +378,13 @@ public override void ActivateOptions() /// The format of the output will depend on the appender's layout. /// /// - protected override void Append(LoggingEvent loggingEvent) +#if NET_4_0 || MONO_4_0 || NETSTANDARD1_3 + [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) { int priority = GeneratePriority(m_facility, GetSeverity(loggingEvent.Level)); string message = RenderLoggingEvent(loggingEvent); @@ -393,7 +402,10 @@ protected override void Append(LoggingEvent loggingEvent) /// Close the syslog when the appender is closed /// /// - protected override void OnClose() +#if NET_4_0 || MONO_4_0 || NETSTANDARD1_3 + [System.Security.SecuritySafeCritical] +#endif + protected override void OnClose() { base.OnClose(); diff --git a/src/Appender/ManagedColoredConsoleAppender.cs b/src/Appender/ManagedColoredConsoleAppender.cs new file mode 100644 index 00000000..9efe65d0 --- /dev/null +++ b/src/Appender/ManagedColoredConsoleAppender.cs @@ -0,0 +1,346 @@ +#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 + +// 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 + +// 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 +// and works on both platforms. + +// On Mono/Linux (at least), setting the background color to 'Black' is +// not the same as the default background color, as it is after +// Console.Reset(). The difference becomes apparent while running in a +// terminal application that supports background transparency; the +// 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). + +using System; +using log4net.Util; + +namespace log4net.Appender +{ + /// + /// Appends colorful logging events to the console, using the .NET 2 + /// built-in capabilities. + /// + /// + /// + /// ManagedColoredConsoleAppender appends log events to the standard output stream + /// 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. + /// + /// + /// By default, all output is written to the console's standard output stream. + /// The property can be set to direct the output to the + /// error stream. + /// + /// + /// When configuring the colored console appender, mappings should be + /// specified to map logging levels to colors. For example: + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// The Level is the standard log4net logging level while + /// ForeColor and BackColor are the values of + /// enumeration. + /// + /// + /// Based on the ColoredConsoleAppender + /// + /// + /// Rick Hobbs + /// Nicko Cadell + /// Pavlos Touboulidis + public class ManagedColoredConsoleAppender: AppenderSkeleton + { + /// + /// Initializes a new instance of the class. + /// + /// + /// The instance of the class is set up to write + /// to the standard output stream. + /// + public ManagedColoredConsoleAppender() + { + } + + #region Public Instance Properties + /// + /// Target is the value of the console output stream. + /// This is either "Console.Out" or "Console.Error". + /// + /// + /// Target is the value of the console output stream. + /// This is either "Console.Out" or "Console.Error". + /// + /// + /// + /// Target is the value of the console output stream. + /// This is either "Console.Out" or "Console.Error". + /// + /// + virtual public 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; + } + } + } + + /// + /// Add a mapping of level to color - done by the config file + /// + /// The mapping to add + /// + /// + /// Add a mapping to this appender. + /// Each mapping defines the foreground and background colors + /// for a level. + /// + /// + public void AddMapping(LevelColors mapping) + { + m_levelMapping.Add(mapping); + } + #endregion // Public Instance Properties + + #region Override implementation of AppenderSkeleton + /// + /// This method is called by the method. + /// + /// The event to log. + /// + /// + /// Writes the event to the console. + /// + /// + /// The format of the output will depend on the appender's layout. + /// + /// + override protected void Append(log4net.Core.LoggingEvent loggingEvent) + { + System.IO.TextWriter writer; + + 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) + { + // if the backColor has been explicitly set + if (levelColors.HasBackColor) + Console.BackgroundColor = levelColors.BackColor; + // if the foreColor has been explicitly set + if (levelColors.HasForeColor) + Console.ForegroundColor = levelColors.ForeColor; + } + + // Render the event to a string + string strLoggingMessage = RenderLoggingEvent(loggingEvent); + // and write it + writer.Write(strLoggingMessage); + + // Reset color again + Console.ResetColor(); + } + + /// + /// This appender requires a to be set. + /// + /// true + /// + /// + /// This appender requires a to be set. + /// + /// + override protected bool RequiresLayout + { + get { return true; } + } + + /// + /// Initialize the options for this appender + /// + /// + /// + /// Initialize the level to color mappings set on this appender. + /// + /// + public override void ActivateOptions() + { + base.ActivateOptions(); + m_levelMapping.ActivateOptions(); + } + #endregion // Override implementation of AppenderSkeleton + + #region Public Static Fields + /// + /// The to use when writing to the Console + /// standard output stream. + /// + /// + /// + /// The to use when writing to the Console + /// standard output stream. + /// + /// + public const string ConsoleOut = "Console.Out"; + + /// + /// The to use when writing to the Console + /// standard error output stream. + /// + /// + /// + /// The to use when writing to the Console + /// standard error output stream. + /// + /// + public const string ConsoleError = "Console.Error"; + #endregion // Public Static Fields + + #region Private Instances Fields + /// + /// Flag to write output to the error stream rather than the standard output stream + /// + private bool m_writeToErrorStream = false; + + /// + /// Mapping from level object to color value + /// + private LevelMapping m_levelMapping = new LevelMapping(); + #endregion // Private Instances Fields + + #region LevelColors LevelMapping Entry + /// + /// 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. + /// + /// + /// + /// Defines the mapping between a level and the color it should be displayed in. + /// + /// + public class LevelColors : LevelMappingEntry + { + /// + /// The mapped foreground color for the specified level + /// + /// + /// + /// Required property. + /// The mapped foreground color for the specified level. + /// + /// + public ConsoleColor ForeColor + { + get { return (this.foreColor); } + // Keep a flag that the color has been set + // and is no longer the default. + set { this.foreColor = value; this.hasForeColor = true; } + } + private ConsoleColor foreColor; + private bool hasForeColor; + internal bool HasForeColor { + get { + return hasForeColor; + } + } + + /// + /// The mapped background color for the specified level + /// + /// + /// + /// Required property. + /// The mapped background color for the specified level. + /// + /// + public ConsoleColor BackColor + { + get { return (this.backColor); } + // Keep a flag that the color has been set + // and is no longer the default. + set { this.backColor = value; this.hasBackColor = true; } + } + private ConsoleColor backColor; + private bool hasBackColor; + internal bool HasBackColor { + get { + return hasBackColor; + } + } + } + #endregion // LevelColors LevelMapping Entry + } +} + +#endif +#endif +#endif // !MONO_1_0 +#endif // !CLI_1_0 +#endif // !SSCLI +#endif // !NETCF diff --git a/src/Appender/MemoryAppender.cs b/src/Appender/MemoryAppender.cs old mode 100755 new mode 100644 index 0402e8f6..e0ec7413 --- a/src/Appender/MemoryAppender.cs +++ b/src/Appender/MemoryAppender.cs @@ -33,12 +33,22 @@ namespace log4net.Appender /// that are appended in an in-memory array. /// /// - /// Use the method to get - /// the current list of events that have been appended. + /// Use the method to get + /// and clear the current list of events that have been appended. /// /// - /// Use the method to clear the - /// current list of events. + /// Use the method to get the current + /// list of events that have been appended. Note there is a + /// race-condition when calling and + /// in pairs, you better use in that case. + /// + /// + /// Use the method to clear the + /// current list of events. Note there is a + /// race-condition when calling and + /// in pairs, you better use in that case. /// /// /// Julian Biddle @@ -76,7 +86,10 @@ public MemoryAppender() : base() /// virtual public LoggingEvent[] GetEvents() { - return (LoggingEvent[])m_eventsList.ToArray(typeof(LoggingEvent)); + lock (m_eventsList.SyncRoot) + { + return (LoggingEvent[]) m_eventsList.ToArray(typeof(LoggingEvent)); + } } /// @@ -93,7 +106,7 @@ virtual public LoggingEvent[] GetEvents() /// data to be fixed and stored in the appender, hereby improving performance. /// /// - /// See for more information. + /// See for more information. /// /// [Obsolete("Use Fix property")] @@ -134,7 +147,7 @@ virtual public FixFlags Fix #region Override implementation of AppenderSkeleton /// - /// This method is called by the method. + /// This method is called by the method. /// /// the event to log /// @@ -147,7 +160,10 @@ override protected void Append(LoggingEvent loggingEvent) // volatile data in the event. loggingEvent.Fix = this.Fix; - m_eventsList.Add(loggingEvent); + lock (m_eventsList.SyncRoot) + { + m_eventsList.Add(loggingEvent); + } } #endregion Override implementation of AppenderSkeleton @@ -162,9 +178,31 @@ override protected void Append(LoggingEvent loggingEvent) /// virtual public void Clear() { - m_eventsList.Clear(); + lock (m_eventsList.SyncRoot) + { + m_eventsList.Clear(); + } } + /// + /// Gets the events that have been logged and clears the list of events. + /// + /// The events that have been logged + /// + /// + /// Gets the events that have been logged and clears the list of events. + /// + /// + virtual public LoggingEvent[] PopAllEvents() + { + lock (m_eventsList.SyncRoot) + { + LoggingEvent[] tmp = (LoggingEvent[]) m_eventsList.ToArray(typeof (LoggingEvent)); + m_eventsList.Clear(); + return tmp; + } + } + #endregion Public Instance Methods #region Protected Instance Fields diff --git a/src/Appender/NetSendAppender.cs b/src/Appender/NetSendAppender.cs old mode 100755 new mode 100644 index c0e0369f..ae8b7a9f --- a/src/Appender/NetSendAppender.cs +++ b/src/Appender/NetSendAppender.cs @@ -68,10 +68,10 @@ namespace log4net.Appender /// Send a message to a user account on the local machine /// /// - /// = <name of the local machine> + /// = <name of the local machine> /// /// - /// = <user name> + /// = <user name> /// /// /// @@ -79,10 +79,10 @@ namespace log4net.Appender /// Send a message to a user account on a remote machine /// /// - /// = <name of the remote machine> + /// = <name of the remote machine> /// /// - /// = <user name> + /// = <user name> /// /// /// @@ -90,10 +90,10 @@ namespace log4net.Appender /// Send a message to a domain user account /// /// - /// = <name of a domain controller | uninitialized> + /// = <name of a domain controller | uninitialized> /// /// - /// = <user name> + /// = <user name> /// /// /// @@ -101,7 +101,7 @@ namespace log4net.Appender /// Send a message to all the names in a workgroup or domain /// /// - /// = <workgroup name | domain name>* + /// = <workgroup name | domain name>* /// /// /// @@ -109,10 +109,10 @@ namespace log4net.Appender /// Send a message from the local machine to a remote machine /// /// - /// = <name of the local machine | uninitialized> + /// = <name of the local machine | uninitialized> /// /// - /// = <name of the remote machine> + /// = <name of the remote machine> /// /// /// @@ -296,7 +296,7 @@ public override void ActivateOptions() #region Override implementation of AppenderSkeleton /// - /// This method is called by the method. + /// This method is called by the method. /// /// The event to log. /// @@ -304,7 +304,13 @@ public override void ActivateOptions() /// Sends the event using a network message. /// /// - protected override void Append(LoggingEvent loggingEvent) +#if NET_4_0 || MONO_4_0 || NETSTANDARD1_3 + [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; diff --git a/src/Appender/OutputDebugStringAppender.cs b/src/Appender/OutputDebugStringAppender.cs old mode 100755 new mode 100644 index c9c20f30..cd48689f --- a/src/Appender/OutputDebugStringAppender.cs +++ b/src/Appender/OutputDebugStringAppender.cs @@ -75,8 +75,20 @@ public OutputDebugStringAppender() /// Write the logging event to the output debug string API /// /// - override protected void Append(LoggingEvent loggingEvent) +#if NET_4_0 || MONO_4_0 || NETSTANDARD1_3 + [System.Security.SecuritySafeCritical] +#elif !NETCF + [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, UnmanagedCode = true)] +#endif + override protected void Append(LoggingEvent loggingEvent) { +#if NETSTANDARD1_3 + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + throw new System.PlatformNotSupportedException("OutputDebugString is only available on Windows"); + } +#endif + OutputDebugString(RenderLoggingEvent(loggingEvent)); } diff --git a/src/Appender/RemoteSyslogAppender.cs b/src/Appender/RemoteSyslogAppender.cs old mode 100755 new mode 100644 index 018cbd0e..b7a8c66d --- a/src/Appender/RemoteSyslogAppender.cs +++ b/src/Appender/RemoteSyslogAppender.cs @@ -23,8 +23,9 @@ using log4net.Appender; using log4net.Util; using log4net.Layout; +using System.Text; -namespace log4net.Appender +namespace log4net.Appender { /// /// Logs events to a remote syslog daemon. @@ -66,7 +67,7 @@ namespace log4net.Appender /// /// Rob Lyon /// Nicko Cadell - public class RemoteSyslogAppender : UdpAppender + public class RemoteSyslogAppender : UdpAppender { /// /// Syslog port 514 @@ -268,7 +269,7 @@ public enum SyslogFacility /// This instance of the class is set up to write /// to a remote syslog daemon. /// - public RemoteSyslogAppender() + public RemoteSyslogAppender() { // syslog udp defaults this.RemotePort = DefaultSyslogPort; @@ -279,7 +280,7 @@ public RemoteSyslogAppender() #endregion Public Instance Constructors #region Public Instance Properties - + /// /// Message identity /// @@ -310,7 +311,7 @@ public SyslogFacility Facility get { return m_facility; } set { m_facility = value; } } - + #endregion Public Instance Properties /// @@ -330,7 +331,7 @@ public void AddMapping(LevelSeverity mapping) #region AppenderSkeleton Implementation /// - /// This method is called by the method. + /// This method is called by the method. /// /// The event to log. /// @@ -341,48 +342,90 @@ public void AddMapping(LevelSeverity mapping) /// The format of the output will depend on the appender's layout. /// /// - protected override void Append(LoggingEvent loggingEvent) + protected override void Append(LoggingEvent loggingEvent) { - try - { - System.IO.StringWriter writer = new System.IO.StringWriter(System.Globalization.CultureInfo.InvariantCulture); - - // Priority - int priority = GeneratePriority(m_facility, GetSeverity(loggingEvent.Level)); - writer.Write('<'); - writer.Write(priority); - writer.Write('>'); - - // Identity - if (m_identity != null) - { - m_identity.Format(writer, loggingEvent); - } - else - { - writer.Write(loggingEvent.Domain); - } - writer.Write(": "); - - // Message. The message goes after the tag/identity - RenderLoggingEvent(writer, loggingEvent); - - // Grab as a byte array - string fullMessage = writer.ToString(); - Byte [] buffer = this.Encoding.GetBytes(fullMessage.ToCharArray()); - - this.Client.Send(buffer, buffer.Length, this.RemoteEndPoint); - } - catch (Exception e) - { - ErrorHandler.Error( - "Unable to send logging event to remote syslog " + - this.RemoteAddress.ToString() + - " on port " + - this.RemotePort + ".", - e, - ErrorCode.WriteFailure); - } + try + { + // Priority + int priority = GeneratePriority(m_facility, GetSeverity(loggingEvent.Level)); + + // Identity + string identity; + + if (m_identity != null) + { + identity = m_identity.Format(loggingEvent); + } + else + { + identity = loggingEvent.Domain; + } + + // Message. The message goes after the tag/identity + string message = RenderLoggingEvent(loggingEvent); + + Byte[] buffer; + int i = 0; + char c; + + StringBuilder builder = new StringBuilder(); + + while (i < message.Length) + { + // Clear StringBuilder + builder.Length = 0; + + // Write priority + builder.Append('<'); + builder.Append(priority); + builder.Append('>'); + + // Write identity + builder.Append(identity); + builder.Append(": "); + + for (; i < message.Length; i++) + { + c = message[i]; + + // Accept only visible ASCII characters and space. See RFC 3164 section 4.1.3 + if (((int)c >= 32) && ((int)c <= 126)) + { + builder.Append(c); + } + // If character is newline, break and send the current line + else if ((c == '\r') || (c == '\n')) + { + // Check the next character to handle \r\n or \n\r + if ((message.Length > i + 1) && ((message[i + 1] == '\r') || (message[i + 1] == '\n'))) + { + i++; + } + i++; + break; + } + } + + // Grab as a byte array + buffer = this.Encoding.GetBytes(builder.ToString()); + +#if NETSTANDARD1_3 + 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 + ".", + e, + ErrorCode.WriteFailure); + } } /// @@ -425,30 +468,30 @@ virtual protected SyslogSeverity GetSeverity(Level level) // Fallback 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; } @@ -505,10 +548,19 @@ public static int GeneratePriority(SyslogFacility facility, SyslogSeverity sever /// private LevelMapping m_levelMapping = new LevelMapping(); + /// + /// Initial buffer size + /// + private const int c_renderBufferSize = 256; + + /// + /// Maximum buffer size before it is recycled + /// + private const int c_renderBufferMaxCapacity = 1024; + #endregion Private Instances Fields #region LevelSeverity LevelMapping Entry - /// /// 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. diff --git a/src/Appender/RemotingAppender.cs b/src/Appender/RemotingAppender.cs old mode 100755 new mode 100644 index d1834e7d..b3349200 --- a/src/Appender/RemotingAppender.cs +++ b/src/Appender/RemotingAppender.cs @@ -138,7 +138,10 @@ public string Sink /// must be called again. /// /// - override public void ActivateOptions() +#if NET_4_0 || MONO_4_0 + [System.Security.SecuritySafeCritical] +#endif + override public void ActivateOptions() { base.ActivateOptions(); @@ -215,6 +218,17 @@ override protected void OnClose() } } + /// + /// Flushes any buffered log data. + /// + /// The maximum time to wait for logging events to be flushed. + /// True if all logging events were flushed successfully, else false. + public override bool Flush(int millisecondsTimeout) + { + base.Flush(); + return m_workQueueEmptyEvent.WaitOne(millisecondsTimeout, false); + } + #endregion /// diff --git a/src/Appender/RollingFileAppender.cs b/src/Appender/RollingFileAppender.cs old mode 100755 new mode 100644 index 0f636c75..63ffaeb1 --- a/src/Appender/RollingFileAppender.cs +++ b/src/Appender/RollingFileAppender.cs @@ -24,6 +24,7 @@ using log4net.Util; using log4net.Core; +using System.Threading; namespace log4net.Appender { @@ -235,14 +236,33 @@ public RollingFileAppender() { } + /// + /// Cleans up all resources used by this appender. + /// + ~RollingFileAppender() + { +#if !NETCF + if (m_mutexForRolling != null) + { +#if NET_4_0 || MONO_4_0 || NETSTANDARD1_3 + m_mutexForRolling.Dispose(); +#else + m_mutexForRolling.Close(); +#endif + m_mutexForRolling = null; + } +#endif + } + #endregion Public Instance Constructors #region Public Instance Properties - /// +#if !NET_1_0 && !CLI_1_0 && !NETCF + /// /// 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 by specifying + /// DateTime.UtcNow may be used on frameworks newer than .NET 1.0 by specifying /// . /// /// @@ -252,15 +272,33 @@ public RollingFileAppender() /// /// Gets or sets the used to return the current date and time. /// - /// - /// There are two built strategies for determining the current date and time, - /// and . + /// + /// There are two built strategies for determining the current date and time, + /// + /// and . + /// + /// + /// The default strategy is . /// + /// +#else + /// + /// 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. + /// + /// + /// An implementation of the interface which returns the current date and time. + /// + /// /// + /// Gets or sets the used to return the current date and time. + /// + /// /// The default strategy is . /// /// - public IDateTime DateTimeStrategy +#endif + public IDateTime DateTimeStrategy { get { return m_dateTime; } set { m_dateTime = value; } @@ -573,25 +611,46 @@ override protected void Append(LoggingEvent[] loggingEvents) /// virtual protected void AdjustFileBeforeAppend() { - if (m_rollDate) + // reuse the file appenders locking model to lock the rolling +#if !NETCF + try { - DateTime n = m_dateTime.Now; - if (n >= m_nextCheck) + // if rolling should be locked, acquire the lock + if (m_mutexForRolling != null) { - m_now = n; - m_nextCheck = NextCheckDate(m_now, m_rollPoint); - - RollOverTime(true); + m_mutexForRolling.WaitOne(); } +#endif + if (m_rollDate) + { + DateTime n = m_dateTime.Now; + if (n >= m_nextCheck) + { + m_now = n; + m_nextCheck = NextCheckDate(m_now, m_rollPoint); + + RollOverTime(true); + } + } + + if (m_rollSize) + { + if ((File != null) && ((CountingQuietTextWriter)QuietWriter).Count >= m_maxFileSize) + { + RollOverSize(); + } + } +#if !NETCF } - - if (m_rollSize) + finally { - if ((File != null) && ((CountingQuietTextWriter)QuietWriter).Count >= m_maxFileSize) + // if rolling should be locked, release the lock + if (m_mutexForRolling != null) { - RollOverSize(); + m_mutexForRolling.ReleaseMutex(); } } +#endif } /// @@ -718,7 +777,7 @@ private string GetWildcardPatternForFile(string baseFileName) { if (m_preserveLogFileNameExtension) { - return Path.GetFileNameWithoutExtension(baseFileName) + ".*" + Path.GetExtension(baseFileName); + return Path.GetFileNameWithoutExtension(baseFileName) + "*" + Path.GetExtension(baseFileName); } else { @@ -776,15 +835,25 @@ private void RollOverIfDateBoundaryCrossing() if (FileExists(m_baseFileName)) { DateTime last; - using(SecurityContext.Impersonate(this)) - { - last = System.IO.File.GetLastWriteTime(m_baseFileName); - } + 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,System.Globalization.DateTimeFormatInfo.InvariantInfo)+"] vs. ["+m_now.ToString(m_datePattern,System.Globalization.DateTimeFormatInfo.InvariantInfo)+"]"); if (!(last.ToString(m_datePattern,System.Globalization.DateTimeFormatInfo.InvariantInfo).Equals(m_now.ToString(m_datePattern, System.Globalization.DateTimeFormatInfo.InvariantInfo)))) { - m_scheduledFilename = m_baseFileName + last.ToString(m_datePattern, System.Globalization.DateTimeFormatInfo.InvariantInfo); + m_scheduledFilename = CombinePath(m_baseFileName, last.ToString(m_datePattern, System.Globalization.DateTimeFormatInfo.InvariantInfo)); LogLog.Debug(declaringType, "Initial roll over to ["+m_scheduledFilename+"]"); RollOverTime(false); LogLog.Debug(declaringType, "curSizeRollBackups after rollOver at ["+m_curSizeRollBackups+"]"); @@ -875,7 +944,10 @@ private void InitializeFromOneFile(string baseFile, string curFileName) // Only look for files in the current roll point if (m_rollDate && !m_staticLogFileName) { - if (! curFileName.StartsWith(CombinePath(baseFile, m_dateTime.Now.ToString(m_datePattern, System.Globalization.DateTimeFormatInfo.InvariantInfo)))) + string date = m_dateTime.Now.ToString(m_datePattern, System.Globalization.DateTimeFormatInfo.InvariantInfo); + string prefix = m_preserveLogFileNameExtension ? Path.GetFileNameWithoutExtension(baseFile) + date : baseFile + date; + string suffix = m_preserveLogFileNameExtension ? Path.GetExtension(baseFile) : ""; + if (!curFileName.StartsWith(prefix) || !curFileName.EndsWith(suffix)) { LogLog.Debug(declaringType, "Ignoring file ["+curFileName+"] because it is from a different date period"); return; @@ -1086,6 +1158,11 @@ override public void ActivateOptions() 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("/", "_")); +#endif + if (m_rollDate && File != null && m_scheduledFilename == null) { m_scheduledFilename = CombinePath(File, m_now.ToString(m_datePattern, System.Globalization.DateTimeFormatInfo.InvariantInfo)); @@ -1611,7 +1688,14 @@ protected DateTime NextCheckDate(DateTime currentDateTime, RollPoint rollPoint) /// FileName provided in configuration. Used for rolling properly /// private string m_baseFileName; - + +#if !NETCF + /// + /// A mutex that is used to lock rolling of files. + /// + private Mutex m_mutexForRolling; +#endif + #endregion Private Instance Fields #region Static Members @@ -1667,7 +1751,8 @@ public DateTime Now } } - /// +#if !NET_1_0 && !CLI_1_0 && !NETCF + /// /// Implementation of that returns the current time as the coordinated universal time (UTC). /// private class UniversalDateTime : IDateTime @@ -1686,7 +1771,8 @@ public DateTime Now get { return DateTime.UtcNow; } } } +#endif - #endregion DateTime + #endregion DateTime } } diff --git a/src/Appender/SmtpAppender.cs b/src/Appender/SmtpAppender.cs old mode 100755 new mode 100644 index 3ef90d73..491807c1 --- a/src/Appender/SmtpAppender.cs +++ b/src/Appender/SmtpAppender.cs @@ -23,8 +23,9 @@ using System; using System.IO; +using System.Text; -#if NET_2_0 +#if NET_2_0 || MONO_2_0 using System.Net.Mail; #else using System.Web.Mail; @@ -89,7 +90,7 @@ public SmtpAppender() #region Public Instance Properties /// - /// Gets or sets a semicolon-delimited list of recipient e-mail addresses. + /// 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). /// /// /// @@ -110,12 +111,12 @@ public SmtpAppender() public string To { get { return m_to; } - set { m_to = value; } + set { m_to = MaybeTrimSeparators(value); } } /// - /// Gets or sets a semicolon-delimited list of recipient e-mail addresses - /// that will be carbon copied. + /// 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). /// /// /// @@ -136,7 +137,7 @@ public string To public string Cc { get { return m_cc; } - set { m_cc = value; } + set { m_cc = MaybeTrimSeparators(value); } } /// @@ -154,7 +155,7 @@ public string Cc public string Bcc { get { return m_bcc; } - set { m_bcc = value; } + set { m_bcc = MaybeTrimSeparators(value); } } /// @@ -323,7 +324,7 @@ public MailPriority Priority set { m_mailPriority = value; } } -#if NET_2_0 +#if NET_2_0 || MONO_2_0 /// /// Enable or disable use of SSL when sending e-mail message /// @@ -349,6 +350,30 @@ public string ReplyTo } #endif + /// + /// Gets or sets the subject encoding to be used. + /// + /// + /// The default encoding is the operating system's current ANSI codepage. + /// + public Encoding SubjectEncoding + { + get { return m_subjectEncoding; } + set { m_subjectEncoding = value; } + } + + /// + /// Gets or sets the body encoding to be used. + /// + /// + /// The default encoding is the operating system's current ANSI codepage. + /// + public Encoding BodyEncoding + { + get { return m_bodyEncoding; } + set { m_bodyEncoding = value; } + } + #endregion // Public Instance Properties #region Override implementation of BufferingAppenderSkeleton @@ -419,7 +444,7 @@ override protected bool RequiresLayout /// the body text to include in the mail virtual protected void SendEmail(string messageBody) { -#if NET_2_0 +#if NET_2_0 || MONO_2_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. @@ -448,6 +473,7 @@ virtual protected void SendEmail(string messageBody) using (MailMessage mailMessage = new MailMessage()) { mailMessage.Body = messageBody; + mailMessage.BodyEncoding = m_bodyEncoding; mailMessage.From = new MailAddress(m_from); mailMessage.To.Add(m_to); if (!String.IsNullOrEmpty(m_cc)) @@ -460,9 +486,16 @@ virtual protected void SendEmail(string messageBody) } if (!String.IsNullOrEmpty(m_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 mailMessage.ReplyTo = new MailAddress(m_replyTo); +#else + mailMessage.ReplyToList.Add(new MailAddress(m_replyTo)); +#endif } mailMessage.Subject = m_subject; + mailMessage.SubjectEncoding = m_subjectEncoding; mailMessage.Priority = m_mailPriority; // TODO: Consider using SendAsync to send the message without blocking. This would be a change in @@ -474,6 +507,7 @@ virtual protected void SendEmail(string messageBody) 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) @@ -485,6 +519,9 @@ virtual protected void SendEmail(string messageBody) 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 @@ -542,7 +579,7 @@ virtual protected void SendEmail(string messageBody) SmtpMail.Send(mailMessage); #endif // if NET_2_0 - } + } #endregion // Protected Methods @@ -554,6 +591,8 @@ virtual protected void SendEmail(string messageBody) private string m_from; private string m_subject; private string m_smtpHost; + private Encoding m_subjectEncoding = Encoding.UTF8; + private Encoding m_bodyEncoding = Encoding.UTF8; // authentication fields private SmtpAuthentication m_authentication = SmtpAuthentication.None; @@ -565,7 +604,7 @@ virtual protected void SendEmail(string messageBody) private MailPriority m_mailPriority = MailPriority.Normal; -#if NET_2_0 +#if NET_2_0 || MONO_2_0 private bool m_enableSsl = false; private string m_replyTo; #endif @@ -607,7 +646,20 @@ public enum SmtpAuthentication } #endregion // SmtpAuthentication Enum - } + + private static readonly char[] ADDRESS_DELIMITERS = new char[] { ',', ';' }; + + /// + /// trims leading and trailing commas or semicolons + /// + private static string MaybeTrimSeparators(string s) { +#if NET_2_0 || MONO_2_0 + return string.IsNullOrEmpty(s) ? s : s.Trim(ADDRESS_DELIMITERS); +#else + return s != null && s.Length > 0 ? s : s.Trim(ADDRESS_DELIMITERS); +#endif + } + } } #endif // !NETCF && !SSCLI diff --git a/src/Appender/SmtpPickupDirAppender.cs b/src/Appender/SmtpPickupDirAppender.cs old mode 100755 new mode 100644 index 288d5b23..6d8efa63 --- a/src/Appender/SmtpPickupDirAppender.cs +++ b/src/Appender/SmtpPickupDirAppender.cs @@ -64,6 +64,7 @@ public class SmtpPickupDirAppender : BufferingAppenderSkeleton /// public SmtpPickupDirAppender() { + m_fileExtension = string.Empty; // Default to empty string, not null } #endregion Public Instance Constructors @@ -136,6 +137,39 @@ public string PickupDir set { m_pickupDir = value; } } + /// + /// Gets or sets the file extension for the generated files + /// + /// + /// The file extension for the generated files + /// + /// + /// + /// The file extension for the generated files + /// + /// + public string FileExtension + { + get { return 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 + 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; + } + } + } + /// /// Gets or sets the used to write to the pickup directory. /// @@ -181,7 +215,7 @@ override protected void SendBuffer(LoggingEvent[] events) // Impersonate to open the file using(SecurityContext.Impersonate(this)) { - filePath = Path.Combine(m_pickupDir, SystemInfo.NewGuid().ToString("N")); + filePath = Path.Combine(m_pickupDir, SystemInfo.NewGuid().ToString("N") + m_fileExtension); writer = File.CreateText(filePath); } @@ -196,6 +230,7 @@ override protected void SendBuffer(LoggingEvent[] events) 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; @@ -306,6 +341,7 @@ protected static string ConvertToFullPath(string path) private string m_from; private string m_subject; private string m_pickupDir; + private string m_fileExtension; /// /// The security context to use for privileged calls diff --git a/src/Appender/TelnetAppender.cs b/src/Appender/TelnetAppender.cs old mode 100755 new mode 100644 index fc028016..4d768a2b --- a/src/Appender/TelnetAppender.cs +++ b/src/Appender/TelnetAppender.cs @@ -25,7 +25,9 @@ using System.Text; using System.IO; using System.Threading; - +#if NETSTANDARD1_3 +using System.Threading.Tasks; +#endif using log4net.Layout; using log4net.Core; using log4net.Util; @@ -336,8 +338,17 @@ 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); + m_serverSocket.Listen(5); + AcceptConnection(); + } + + private void AcceptConnection() + { +#if NETSTANDARD1_3 + m_serverSocket.AcceptAsync().ContinueWith(OnConnect, TaskScheduler.Default); +#else m_serverSocket.BeginAccept(new AsyncCallback(OnConnect), null); +#endif } /// @@ -419,6 +430,10 @@ public bool HasConnections } } + +#if NETSTANDARD1_3 + private void OnConnect(Task acceptTask) +#else /// /// Callback used to accept a connection on the server socket /// @@ -430,12 +445,16 @@ public bool HasConnections /// /// private void OnConnect(IAsyncResult asyncResult) +#endif { try { +#if NETSTANDARD1_3 + 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); @@ -465,7 +484,7 @@ private void OnConnect(IAsyncResult asyncResult) { if (m_serverSocket != null) { - m_serverSocket.BeginAccept(new AsyncCallback(OnConnect), null); + AcceptConnection(); } } } diff --git a/src/Appender/TextWriterAppender.cs b/src/Appender/TextWriterAppender.cs old mode 100755 new mode 100644 index 9f303cb0..94826073 --- a/src/Appender/TextWriterAppender.cs +++ b/src/Appender/TextWriterAppender.cs @@ -42,7 +42,7 @@ namespace log4net.Appender /// Nicko Cadell /// Gert Driesen /// Douglas de la Torre - public class TextWriterAppender : AppenderSkeleton + public class TextWriterAppender : AppenderSkeleton { #region Public Instance Constructors @@ -203,7 +203,7 @@ override protected bool PreAppendCheck() } /// - /// This method is called by the + /// This method is called by the /// method. /// /// The event to log. @@ -227,7 +227,7 @@ override protected void Append(LoggingEvent loggingEvent) } /// - /// This method is called by the + /// This method is called by the /// method. /// /// The array of events to log. @@ -481,5 +481,24 @@ protected QuietTextWriter QuietWriter private readonly static Type declaringType = typeof(TextWriterAppender); #endregion Private Static Fields + + /// + /// Flushes any buffered log data. + /// + /// The maximum time to wait for logging events to be flushed. + /// True if all logging events were flushed successfully, else false. + public override bool Flush(int millisecondsTimeout) + { + // Nothing to do if ImmediateFlush is true + if (m_immediateFlush) return true; + + // lock(this) will block any Appends while the buffer is flushed. + lock (this) + { + m_qtw.Flush(); + } + + return true; + } } } diff --git a/src/Appender/TraceAppender.cs b/src/Appender/TraceAppender.cs old mode 100755 new mode 100644 index 2aacb862..18dd480b --- a/src/Appender/TraceAppender.cs +++ b/src/Appender/TraceAppender.cs @@ -206,5 +206,24 @@ override protected bool RequiresLayout private PatternLayout m_category = new PatternLayout("%logger"); #endregion Private Instance Fields - } + + /// + /// Flushes any buffered log data. + /// + /// The maximum time to wait for logging events to be flushed. + /// True if all logging events were flushed successfully, else false. + public override bool Flush(int millisecondsTimeout) + { + // Nothing to do if ImmediateFlush is true + if (m_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.Flush(); +#endif + return true; + } + } } diff --git a/src/Appender/UdpAppender.cs b/src/Appender/UdpAppender.cs old mode 100755 new mode 100644 index e01b2356..55770ff1 --- a/src/Appender/UdpAppender.cs +++ b/src/Appender/UdpAppender.cs @@ -387,7 +387,7 @@ public override void ActivateOptions() #region Override implementation of AppenderSkeleton /// - /// This method is called by the method. + /// This method is called by the method. /// /// The event to log. /// @@ -403,7 +403,11 @@ protected override void Append(LoggingEvent loggingEvent) try { Byte [] buffer = m_encoding.GetBytes(RenderLoggingEvent(loggingEvent).ToCharArray()); +#if NETSTANDARD1_3 + Client.SendAsync(buffer, buffer.Length, RemoteEndPoint).Wait(); +#else this.Client.Send(buffer, buffer.Length, this.RemoteEndPoint); +#endif } catch (Exception ex) { @@ -536,7 +540,11 @@ protected virtual void InitializeClientConnection() /// /// The encoding to use for the packet. /// +#if NETSTANDARD1_3 + private Encoding m_encoding = Encoding.Unicode; +#else private Encoding m_encoding = Encoding.Default; +#endif #endregion Private Instance Fields } diff --git a/src/AssemblyInfo.cs b/src/AssemblyInfo.cs old mode 100755 new mode 100644 index 89e04cd9..04049d8c --- a/src/AssemblyInfo.cs +++ b/src/AssemblyInfo.cs @@ -39,6 +39,14 @@ [assembly: System.Security.AllowPartiallyTrustedCallers] #endif +#if (NET_4_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 @@ -46,35 +54,72 @@ // #if (CLI_1_0) -[assembly: AssemblyTitle("log4net for CLI 1.0 Compatible Frameworks")] +[assembly: AssemblyInformationalVersionAttribute("2.0.6.0-.CLI 1.0")] +[assembly: AssemblyTitle("Apache log4net for CLI 1.0 Compatible Frameworks")] #elif (NET_1_0) -[assembly: AssemblyTitle("log4net for .NET Framework 1.0")] +[assembly: AssemblyInformationalVersionAttribute("2.0.6.0-.NET 1.0")] +[assembly: AssemblyTitle("Apache log4net for .NET Framework 1.0")] #elif (NET_1_1) -[assembly: AssemblyTitle("log4net for .NET Framework 1.1")] +[assembly: AssemblyInformationalVersionAttribute("2.0.6.0-.NET 1.1")] +[assembly: AssemblyTitle("Apache log4net for .NET Framework 1.1")] +#elif (NET_4_5) +[assembly: AssemblyInformationalVersionAttribute("2.0.6.0-.NET 4.5")] +[assembly: AssemblyTitle("Apache log4net for .NET Framework 4.5")] +#elif (NET_4_0) +#if CLIENT_PROFILE +[assembly: AssemblyInformationalVersionAttribute("2.0.6.0-.NET 4.0 CP")] +[assembly: AssemblyTitle("Apache log4net for .NET Framework 4.0 Client Profile")] +#else +[assembly: AssemblyInformationalVersionAttribute("2.0.6.0-.NET 4.0")] +[assembly: AssemblyTitle("Apache log4net for .NET Framework 4.0")] +#endif // Client Profile #elif (NET_2_0) -[assembly: AssemblyTitle("log4net for .NET Framework 2.0")] +#if CLIENT_PROFILE +[assembly: AssemblyInformationalVersionAttribute("2.0.6.0-.NET 3.5 CP")] +[assembly: AssemblyTitle("Apache log4net for .NET Framework 3.5 Client Profile")] +#else +[assembly: AssemblyInformationalVersionAttribute("2.0.6.0-.NET 2.0")] +[assembly: AssemblyTitle("Apache log4net for .NET Framework 2.0")] +#endif // Client Profile #elif (NETCF_1_0) -[assembly: AssemblyTitle("log4net for .NET Compact Framework 1.0")] +[assembly: AssemblyInformationalVersionAttribute("2.0.6.0-.NETCF 1.0")] +[assembly: AssemblyTitle("Apache log4net for .NET Compact Framework 1.0")] #elif (NETCF_2_0) -[assembly: AssemblyTitle("log4net for .NET Compact Framework 2.0")] +[assembly: AssemblyInformationalVersionAttribute("2.0.6.0-.NETCF 2.0")] +[assembly: AssemblyTitle("Apache log4net for .NET Compact Framework 2.0")] #elif (MONO_1_0) -[assembly: AssemblyTitle("log4net for Mono 1.0")] +[assembly: AssemblyInformationalVersionAttribute("2.0.6.0-Mono 1.0")] +[assembly: AssemblyTitle("Apache log4net for Mono 1.0")] #elif (MONO_2_0) -[assembly: AssemblyTitle("log4net for Mono 2.0")] +[assembly: AssemblyInformationalVersionAttribute("2.0.6.0-Mono 2.0")] +[assembly: AssemblyTitle("Apache log4net for Mono 2.0")] +#elif (MONO_3_5) +[assembly: AssemblyInformationalVersionAttribute("2.0.6.0-Mono 3.5")] +[assembly: AssemblyTitle("Apache log4net for Mono 3.5")] +#elif (MONO_4_0) +[assembly: AssemblyInformationalVersionAttribute("2.0.6.0-Mono 4.0")] +[assembly: AssemblyTitle("Apache log4net for Mono 4.0")] #elif (SSCLI_1_0) -[assembly: AssemblyTitle("log4net for Shared Source CLI 1.0")] -#elif (CLI_1_0) -[assembly: AssemblyTitle("log4net for CLI Compatible Frameworks")] +[assembly: AssemblyInformationalVersionAttribute("2.0.6.0-SSCLI 1.0")] +[assembly: AssemblyTitle("Apache log4net for Shared Source CLI 1.0")] #elif (NET) -[assembly: AssemblyTitle("log4net for .NET Framework")] +[assembly: AssemblyInformationalVersionAttribute("2.0.6.0-.NET")] +[assembly: AssemblyTitle("Apache log4net for .NET Framework")] +#elif (NETSTANDARD1_3) +[assembly: AssemblyInformationalVersionAttribute("2.0.6.0-.NET Core 1.0")] +[assembly: AssemblyTitle("Apache log4net for .NET Core 1.0")] #elif (NETCF) -[assembly: AssemblyTitle("log4net for .NET Compact Framework")] +[assembly: AssemblyInformationalVersionAttribute("2.0.6.0-.NETCF")] +[assembly: AssemblyTitle("Apache log4net for .NET Compact Framework")] #elif (MONO) -[assembly: AssemblyTitle("log4net for Mono")] +[assembly: AssemblyInformationalVersionAttribute("2.0.6.0-Mono")] +[assembly: AssemblyTitle("Apache log4net for Mono")] #elif (SSCLI) -[assembly: AssemblyTitle("log4net for Shared Source CLI")] +[assembly: AssemblyInformationalVersionAttribute("2.0.6.0-SSCLI")] +[assembly: AssemblyTitle("Apache log4net for Shared Source CLI")] #else -[assembly: AssemblyTitle("log4net")] +[assembly: AssemblyInformationalVersionAttribute("2.0.6.0")] +[assembly: AssemblyTitle("Apache log4net")] #endif #if DEBUG @@ -83,7 +128,6 @@ [assembly: AssemblyConfiguration("Retail")] #endif -[assembly: AssemblyDescription("The Apache Software Foundation log4net Logging Framework")] [assembly: AssemblyProduct("log4net")] [assembly: AssemblyDefaultAlias("log4net")] [assembly: AssemblyCulture("")] diff --git a/src/AssemblyVersionInfo.cpp b/src/AssemblyVersionInfo.cpp old mode 100755 new mode 100644 index 0bd84df3..ad93b2ef --- a/src/AssemblyVersionInfo.cpp +++ b/src/AssemblyVersionInfo.cpp @@ -31,12 +31,12 @@ using namespace System::Runtime::CompilerServices; // You can specify all the value or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersionAttribute("1.2.10.0")]; +[assembly: AssemblyVersionAttribute("2.0.8.0")]; [assembly: AssemblyInformationalVersionAttribute("1.2")]; #if !NETCF #if !SSCLI -[assembly: AssemblyFileVersionAttribute("1.2.10.0")] +[assembly: AssemblyFileVersionAttribute("2.0.8.0")] #endif #endif @@ -45,5 +45,5 @@ using namespace System::Runtime::CompilerServices; // [assembly: AssemblyCompany("The Apache Software Foundation")]; -[assembly: AssemblyCopyright("Copyright 2001-2007 The Apache Software Foundation.")]; -[assembly: AssemblyTrademark("Copyright 2001-2007 The Apache Software Foundation.")]; +[assembly: AssemblyCopyright("Copyright 2004-2017 The Apache Software Foundation.")]; +[assembly: AssemblyTrademark("Apache and Apache log4net are trademarks of The Apache Software Foundation")]; diff --git a/src/AssemblyVersionInfo.cs b/src/AssemblyVersionInfo.cs old mode 100755 new mode 100644 index 86db947f..a7ee3a74 --- a/src/AssemblyVersionInfo.cs +++ b/src/AssemblyVersionInfo.cs @@ -28,12 +28,11 @@ // 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.10.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.2")] +[assembly: System.Reflection.AssemblyVersion("2.0.8.0")] #if !NETCF #if !SSCLI -[assembly: System.Reflection.AssemblyFileVersion("1.2.10.0")] +[assembly: System.Reflection.AssemblyFileVersion("2.0.8.0")] #endif #endif @@ -42,5 +41,5 @@ // [assembly: System.Reflection.AssemblyCompany("The Apache Software Foundation")] -[assembly: System.Reflection.AssemblyCopyright("Copyright 2001-2007 The Apache Software Foundation.")] -[assembly: System.Reflection.AssemblyTrademark("Copyright 2001-2007 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")] diff --git a/src/AssemblyVersionInfo.js b/src/AssemblyVersionInfo.js old mode 100755 new mode 100644 index f4ab3b2d..da91f981 --- a/src/AssemblyVersionInfo.js +++ b/src/AssemblyVersionInfo.js @@ -31,12 +31,12 @@ // an import functions as a workaround for this issue. import System.Reflection; -[assembly: AssemblyVersion("1.2.10.0")] +[assembly: AssemblyVersion("2.0.8.0")] [assembly: AssemblyInformationalVersionAttribute("1.2")] @if (!@NETCF) @if (!@SSCLI) -[assembly: AssemblyFileVersion("1.2.10.0")] +[assembly: AssemblyFileVersion("2.0.8.0")] @end @end @@ -45,5 +45,5 @@ import System.Reflection; // [assembly: AssemblyCompany("The Apache Software Foundation")] -[assembly: AssemblyCopyright("Copyright 2001-2007 The Apache Software Foundation.")] -[assembly: AssemblyTrademark("Copyright 2001-2007 The Apache Software Foundation.")] +[assembly: AssemblyCopyright("Copyright 2004-2017 The Apache Software Foundation.")] +[assembly: AssemblyTrademark("Apache and Apache log4net are trademarks of The Apache Software Foundation")] diff --git a/src/AssemblyVersionInfo.vb b/src/AssemblyVersionInfo.vb old mode 100755 new mode 100644 index 60746364..65579d1c --- a/src/AssemblyVersionInfo.vb +++ b/src/AssemblyVersionInfo.vb @@ -28,12 +28,12 @@ ' You can specify all the values or you can default the Revision and Build Numbers ' by using the '*' as shown below: - + #If NOT NETCF Then #If NOT SSCLI Then - + #End If #End If @@ -42,5 +42,5 @@ ' - - + + diff --git a/src/Config/AliasDomainAttribute.cs b/src/Config/AliasDomainAttribute.cs old mode 100755 new mode 100644 diff --git a/src/Config/AliasRepositoryAttribute.cs b/src/Config/AliasRepositoryAttribute.cs old mode 100755 new mode 100644 diff --git a/src/Config/BasicConfigurator.cs b/src/Config/BasicConfigurator.cs old mode 100755 new mode 100644 index 5e97a0a9..1f89ad2d --- a/src/Config/BasicConfigurator.cs +++ b/src/Config/BasicConfigurator.cs @@ -43,7 +43,7 @@ namespace log4net.Config /// /// /// Appenders can also implement the interface. Therefore - /// they would require that the method + /// they would require that the method /// be called after the appenders properties have been configured. /// /// @@ -82,6 +82,7 @@ private BasicConfigurator() #region Public Static Methods +#if !NETSTANDARD1_3 /// /// Initializes the log4net system with a default configuration. /// @@ -96,22 +97,8 @@ private BasicConfigurator() /// static public ICollection Configure() { - return BasicConfigurator.Configure(LogManager.GetRepository(Assembly.GetCallingAssembly())); - } - - /// - /// Initializes the log4net system using the specified appender. - /// - /// The appender to use to log all logging events. - /// - /// - /// Initializes the log4net system using the specified appender. - /// - /// - static public ICollection Configure(IAppender appender) - { - return Configure(new IAppender[] { appender }); - } + return BasicConfigurator.Configure(LogManager.GetRepository(Assembly.GetCallingAssembly())); + } /// /// Initializes the log4net system using the specified appenders. @@ -138,6 +125,21 @@ static public ICollection Configure(params IAppender[] appenders) return configurationMessages; } + /// + /// Initializes the log4net system using the specified appender. + /// + /// The appender to use to log all logging events. + /// + /// + /// Initializes the log4net system using the specified appender. + /// + /// + static public ICollection Configure(IAppender appender) + { + return Configure(new IAppender[] { appender }); + } +#endif // !NETSTANDARD1_3 + /// /// Initializes the with a default configuration. /// diff --git a/src/Config/ConfiguratorAttribute.cs b/src/Config/ConfiguratorAttribute.cs old mode 100755 new mode 100644 diff --git a/src/Config/DOMConfigurator.cs b/src/Config/DOMConfigurator.cs old mode 100755 new mode 100644 index eab029bb..54551af1 --- a/src/Config/DOMConfigurator.cs +++ b/src/Config/DOMConfigurator.cs @@ -309,10 +309,10 @@ static public void Configure(ILoggerRepository repository, Stream configStream) /// /// /// For more information on how to configure log4net using - /// a separate configuration file, see . + /// a separate configuration file, see . /// /// - /// + /// [Obsolete("Use XmlConfigurator.ConfigureAndWatch instead of DOMConfigurator.ConfigureAndWatch")] static public void ConfigureAndWatch(FileInfo configFile) { @@ -341,10 +341,10 @@ static public void ConfigureAndWatch(FileInfo configFile) /// /// /// For more information on how to configure log4net using - /// a separate configuration file, see . + /// a separate configuration file, see . /// /// - /// + /// [Obsolete("Use XmlConfigurator.ConfigureAndWatch instead of DOMConfigurator.ConfigureAndWatch")] static public void ConfigureAndWatch(ILoggerRepository repository, FileInfo configFile) { diff --git a/src/Config/DOMConfiguratorAttribute.cs b/src/Config/DOMConfiguratorAttribute.cs old mode 100755 new mode 100644 index beef7e16..e996b0e0 --- a/src/Config/DOMConfiguratorAttribute.cs +++ b/src/Config/DOMConfiguratorAttribute.cs @@ -43,7 +43,7 @@ namespace log4net.Config /// /// /// Use this attribute to configure the - /// without calling one of the + /// without calling one of the /// methods. /// /// diff --git a/src/Config/DomainAttribute.cs b/src/Config/DomainAttribute.cs old mode 100755 new mode 100644 diff --git a/src/Config/Log4NetConfigurationSectionHandler.cs b/src/Config/Log4NetConfigurationSectionHandler.cs old mode 100755 new mode 100644 diff --git a/src/Config/PluginAttribute.cs b/src/Config/PluginAttribute.cs old mode 100755 new mode 100644 index 302a83a6..eb919068 --- a/src/Config/PluginAttribute.cs +++ b/src/Config/PluginAttribute.cs @@ -49,6 +49,7 @@ 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). /// /// Initializes a new instance of the class /// with the specified type. @@ -66,6 +67,7 @@ public PluginAttribute(string typeName) { m_typeName = typeName; } +#endif /// /// Initializes a new instance of the class @@ -140,12 +142,13 @@ public string TypeName 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 // Check that the type is a plugin if (!(typeof(IPlugin).IsAssignableFrom(pluginType))) { @@ -167,7 +170,7 @@ public IPlugin CreatePlugin() /// /// /// - /// Overrides base class method to + /// Overrides base class method to /// return a representation of the properties of this object. /// /// diff --git a/src/Config/RepositoryAttribute.cs b/src/Config/RepositoryAttribute.cs old mode 100755 new mode 100644 diff --git a/src/Config/SecurityContextProviderAttribute.cs b/src/Config/SecurityContextProviderAttribute.cs old mode 100755 new mode 100644 index fd790c5b..c6f85572 --- a/src/Config/SecurityContextProviderAttribute.cs +++ b/src/Config/SecurityContextProviderAttribute.cs @@ -39,7 +39,7 @@ namespace log4net.Config /// /// /// Use this attribute to configure the - /// without calling one of the + /// without calling one of the /// methods. /// /// diff --git a/src/Config/XmlConfigurator.cs b/src/Config/XmlConfigurator.cs old mode 100755 new mode 100644 index c7192bc3..5b11d98d --- a/src/Config/XmlConfigurator.cs +++ b/src/Config/XmlConfigurator.cs @@ -56,47 +56,6 @@ private XmlConfigurator() #region Configure static methods -#if !NETCF - /// - /// Automatically configures the log4net system based on the - /// application's configuration settings. - /// - /// - /// - /// 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 - /// log4net that contains the configuration data. - /// - /// - /// To use this method to configure log4net you must specify - /// the section - /// handler for the log4net configuration section. See the - /// for an example. - /// - /// - /// -#else - /// - /// Automatically configures the log4net system based on the - /// application's configuration settings. - /// - /// - /// - /// 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 - /// log4net that contains the configuration data. - /// - /// -#endif - static public ICollection Configure() - { - return Configure(LogManager.GetRepository(Assembly.GetCallingAssembly())); - } - #if !NETCF /// /// Automatically configures the using settings @@ -162,7 +121,7 @@ static private void InternalConfigure(ILoggerRepository repository) LogLog.Debug(declaringType, "Application config file location unknown"); } -#if NETCF +#if NETCF || NETSTANDARD1_3 // No config file reading stuff. Just go straight for the file Configure(repository, new FileInfo(SystemInfo.ConfigurationFileLocation)); #else @@ -202,50 +161,66 @@ static private void InternalConfigure(ILoggerRepository repository) #endif } +#if !NETSTANDARD1_3 // Excluded because GetCallingAssembly() is not available in CoreFX (https://github.com/dotnet/corefx/issues/2221). +#if !NETCF /// - /// Configures log4net using a log4net element + /// Automatically configures the log4net system based on the + /// application's configuration settings. /// /// /// - /// Loads the log4net configuration from the XML element - /// supplied as . + /// 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 + /// log4net that contains the configuration data. + /// + /// + /// To use this method to configure log4net you must specify + /// the section + /// handler for the log4net configuration section. See the + /// for an example. /// /// - /// The element to parse. - static public ICollection Configure(XmlElement element) - { - ArrayList configurationMessages = new ArrayList(); - - ILoggerRepository repository = LogManager.GetRepository(Assembly.GetCallingAssembly()); - - using (new LogLog.LogReceivedAdapter(configurationMessages)) - { - InternalConfigureFromXml(repository, element); - } - - repository.ConfigurationMessages = configurationMessages; - - return configurationMessages; - } + /// +#else + /// + /// Automatically configures the log4net system based on the + /// application's configuration settings. + /// + /// + /// + /// 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 + /// log4net that contains the configuration data. + /// + /// +#endif + static public ICollection Configure() + { + return Configure(LogManager.GetRepository(Assembly.GetCallingAssembly())); + } /// - /// Configures the using the specified XML - /// element. + /// Configures log4net using a log4net element /// /// + /// /// Loads the log4net configuration from the XML element /// supplied as . + /// /// - /// The repository to configure. /// The element to parse. - static public ICollection Configure(ILoggerRepository repository, XmlElement element) + static public ICollection Configure(XmlElement element) { ArrayList configurationMessages = new ArrayList(); + ILoggerRepository repository = LogManager.GetRepository(Assembly.GetCallingAssembly()); + using (new LogLog.LogReceivedAdapter(configurationMessages)) { - LogLog.Debug(declaringType, "configuring repository [" + repository.Name + "] using XML element"); - InternalConfigureFromXml(repository, element); } @@ -372,7 +347,6 @@ static public ICollection Configure(Uri configUri) ArrayList configurationMessages = new ArrayList(); ILoggerRepository repository = LogManager.GetRepository(Assembly.GetCallingAssembly()); - using (new LogLog.LogReceivedAdapter(configurationMessages)) { InternalConfigure(repository, configUri); @@ -402,7 +376,6 @@ static public ICollection Configure(Stream configStream) ArrayList configurationMessages = new ArrayList(); ILoggerRepository repository = LogManager.GetRepository(Assembly.GetCallingAssembly()); - using (new LogLog.LogReceivedAdapter(configurationMessages)) { InternalConfigure(repository, configStream); @@ -412,9 +385,35 @@ static public ICollection Configure(Stream configStream) return configurationMessages; } +#endif // !NETSTANDARD1_3 -#if !NETCF + /// + /// Configures the using the specified XML + /// element. + /// + /// + /// Loads the log4net configuration from the XML element + /// supplied as . + /// + /// The repository to configure. + /// The element to parse. + static public ICollection Configure(ILoggerRepository repository, XmlElement element) + { + ArrayList configurationMessages = new ArrayList(); + + using (new LogLog.LogReceivedAdapter(configurationMessages)) + { + LogLog.Debug(declaringType, "configuring repository [" + repository.Name + "] using XML element"); + InternalConfigureFromXml(repository, element); + } + + repository.ConfigurationMessages = configurationMessages; + + return configurationMessages; + } + +#if !NETCF /// /// Configures the using the specified configuration /// file. @@ -652,7 +651,11 @@ static private void InternalConfigure(ILoggerRepository repository, Uri configUr #endif try { +#if NETSTANDARD1_3 + WebResponse response = configRequest.GetResponseAsync().GetAwaiter().GetResult(); +#else WebResponse response = configRequest.GetResponse(); +#endif if (response != null) { try @@ -725,10 +728,18 @@ static private void InternalConfigure(ILoggerRepository repository, Stream confi #if (NETCF) // Create a text reader for the file stream XmlTextReader xmlReader = new XmlTextReader(configStream); -#elif NET_2_0 +#elif NET_2_0 || NETSTANDARD1_3 // Allow the DTD to specify entity includes XmlReaderSettings 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 settings.ProhibitDtd = false; +#else + settings.DtdProcessing = DtdProcessing.Parse; +#endif // Create a reader over the input stream XmlReader xmlReader = XmlReader.Create(configStream, settings); @@ -780,7 +791,7 @@ static private void InternalConfigure(ILoggerRepository repository, Stream confi #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). /// /// Configures log4net using the file specified, monitors the file for changes /// and reloads the configuration if a change is detected. @@ -798,10 +809,10 @@ static private void InternalConfigure(ILoggerRepository repository, Stream confi /// /// /// For more information on how to configure log4net using - /// a separate configuration file, see . + /// a separate configuration file, see . /// /// - /// + /// static public ICollection ConfigureAndWatch(FileInfo configFile) { ArrayList configurationMessages = new ArrayList(); @@ -817,6 +828,7 @@ static public ICollection ConfigureAndWatch(FileInfo configFile) return configurationMessages; } +#endif // !NETSTANDARD1_3 /// /// Configures the using the file specified, @@ -837,10 +849,10 @@ static public ICollection ConfigureAndWatch(FileInfo configFile) /// /// /// For more information on how to configure log4net using - /// a separate configuration file, see . + /// a separate configuration file, see . /// /// - /// + /// static public ICollection ConfigureAndWatch(ILoggerRepository repository, FileInfo configFile) { ArrayList configurationMessages = new ArrayList(); @@ -874,18 +886,18 @@ static private void InternalConfigureAndWatch(ILoggerRepository repository, File { // support multiple repositories each having their own watcher ConfigureAndWatchHandler handler = - (ConfigureAndWatchHandler)m_repositoryName2ConfigAndWatchHandler[repository.Name]; + (ConfigureAndWatchHandler)m_repositoryName2ConfigAndWatchHandler[configFile.FullName]; if (handler != null) { - m_repositoryName2ConfigAndWatchHandler.Remove(repository.Name); + m_repositoryName2ConfigAndWatchHandler.Remove(configFile.FullName); 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[repository.Name] = handler; + m_repositoryName2ConfigAndWatchHandler[configFile.FullName] = handler; } } catch(Exception ex) @@ -957,7 +969,10 @@ private sealed class ConfigureAndWatchHandler : IDisposable /// Initializes a new instance of the class. /// /// - public ConfigureAndWatchHandler(ILoggerRepository repository, FileInfo configFile) +#if NET_4_0 || MONO_4_0 || NETSTANDARD1_3 + [System.Security.SecuritySafeCritical] +#endif + public ConfigureAndWatchHandler(ILoggerRepository repository, FileInfo configFile) { m_repository = repository; m_configFile = configFile; @@ -1034,6 +1049,9 @@ private void OnWatchedFileChange(object state) /// /// Release the handles held by the watcher and timer. /// +#if NET_4_0 || MONO_4_0 || NETSTANDARD1_3 + [System.Security.SecuritySafeCritical] +#endif public void Dispose() { m_watcher.EnableRaisingEvents = false; diff --git a/src/Config/XmlConfiguratorAttribute.cs b/src/Config/XmlConfiguratorAttribute.cs old mode 100755 new mode 100644 index 830610ba..6c3ea3e3 --- a/src/Config/XmlConfiguratorAttribute.cs +++ b/src/Config/XmlConfiguratorAttribute.cs @@ -41,7 +41,7 @@ namespace log4net.Config /// /// /// Use this attribute to configure the - /// without calling one of the + /// without calling one of the /// methods. /// /// @@ -72,7 +72,7 @@ namespace log4net.Config /// /// If you cannot guarantee the order in which log4net calls will be made from /// different assemblies you must use programmatic configuration instead, i.e. - /// call the method directly. + /// call the method directly. /// /// /// diff --git a/src/Core/CompactRepositorySelector.cs b/src/Core/CompactRepositorySelector.cs old mode 100755 new mode 100644 index cd0486c0..dd46f6d5 --- a/src/Core/CompactRepositorySelector.cs +++ b/src/Core/CompactRepositorySelector.cs @@ -124,7 +124,7 @@ public ILoggerRepository GetRepository(Assembly assembly) /// /// Get the named . The default /// repository is log4net-default-repository. Other repositories - /// must be created using the . + /// must be created using the . /// If the named repository does not exist an exception is thrown. /// /// @@ -203,7 +203,7 @@ public ILoggerRepository CreateRepository(Assembly assembly, Type repositoryType /// /// /// The created will be associated with the repository - /// specified such that a call to with the + /// specified such that a call to with the /// same repository specified will return the same repository instance. /// /// @@ -267,8 +267,8 @@ public ILoggerRepository CreateRepository(string repositoryName, Type repository /// true if the repository exists /// /// - /// Test if a named repository exists. Use - /// to create a new repository and to retrieve + /// Test if a named repository exists. Use + /// to create a new repository and to retrieve /// a repository. /// /// diff --git a/src/Core/DefaultRepositorySelector.cs b/src/Core/DefaultRepositorySelector.cs old mode 100755 new mode 100644 index c0abf21c..970f296e --- a/src/Core/DefaultRepositorySelector.cs +++ b/src/Core/DefaultRepositorySelector.cs @@ -23,7 +23,12 @@ using System; using System.Collections; +#if !NETSTANDARD1_3 using System.Configuration; +#else +using System.Linq; +#endif +using System.IO; using System.Reflection; using log4net.Config; @@ -150,7 +155,7 @@ public ILoggerRepository GetRepository(Assembly repositoryAssembly) /// does not exist a is thrown. /// /// - /// Use to create a repository. + /// Use to create a repository. /// /// /// is . @@ -183,7 +188,7 @@ public ILoggerRepository GetRepository(string repositoryName) /// /// /// The created will be associated with the repository - /// specified such that a call to with the + /// specified such that a call to with the /// same assembly specified will return the same repository instance. /// /// @@ -226,7 +231,7 @@ public ILoggerRepository CreateRepository(Assembly repositoryAssembly, Type repo /// /// /// The created will be associated with the repository - /// specified such that a call to with the + /// specified such that a call to with the /// same assembly specified will return the same repository instance. /// /// @@ -346,7 +351,7 @@ public ILoggerRepository CreateRepository(Assembly repositoryAssembly, Type repo /// /// /// The created will be associated with the repository - /// specified such that a call to with the + /// specified such that a call to with the /// same repository specified will return the same repository instance. /// /// @@ -432,8 +437,8 @@ public ILoggerRepository CreateRepository(string repositoryName, Type repository /// true if the repository exists /// /// - /// Test if a named repository exists. Use - /// to create a new repository and to retrieve + /// Test if a named repository exists. Use + /// to create a new repository and to retrieve /// a repository. /// /// @@ -582,7 +587,11 @@ private void GetInfoForAssembly(Assembly assembly, ref string repositoryName, re try { // Look for the RepositoryAttribute on the assembly +#if NETSTANDARD1_3 + 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) { // This is not a problem, but its nice to know what is going on. @@ -654,7 +663,11 @@ private void ConfigureRepository(Assembly assembly, ILoggerRepository repository } // Look for the Configurator attributes (e.g. XmlConfiguratorAttribute) on the assembly +#if NETSTANDARD1_3 + 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) { // Sort the ConfiguratorAttributes in priority order @@ -696,21 +709,66 @@ private void ConfigureRepository(Assembly assembly, ILoggerRepository repository LogLog.Warn(declaringType, "Exception getting ApplicationBaseDirectory. appSettings log4net.Config path ["+repositoryConfigFile+"] will be treated as an absolute URI", ex); } - // 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; - try + string repositoryConfigFilePath = repositoryConfigFile; + if (applicationBaseDirectory != 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 || NETSTANDARD1_3 + 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 + + if (watchRepositoryConfigFile) { - if (applicationBaseDirectory != null) + // 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; + try { - // Resolve the config path relative to the application base directory URI - repositoryConfigUri = new Uri(new Uri(applicationBaseDirectory), repositoryConfigFile); + repositoryConfigFileInfo = new FileInfo(repositoryConfigFilePath); } - else + catch (Exception 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) { - repositoryConfigUri = new Uri(repositoryConfigFile); + 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; + try + { + repositoryConfigUri = new Uri(repositoryConfigFilePath); + } catch(Exception ex) { LogLog.Error(declaringType, "Exception while parsing log4net.Config file path ["+repositoryConfigFile+"]", ex); @@ -730,6 +788,7 @@ private void ConfigureRepository(Assembly assembly, ILoggerRepository repository LogLog.Error(declaringType, "Exception calling XmlConfigurator.Configure method with ConfigUri ["+repositoryConfigUri+"]", ex); } } + } } } } @@ -756,7 +815,11 @@ private void LoadPlugins(Assembly assembly, ILoggerRepository repository) } // Look for the PluginAttribute on the assembly +#if NETSTANDARD1_3 + 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) { foreach(log4net.Plugin.IPluginFactory configAttr in configAttributes) @@ -796,7 +859,11 @@ private void LoadAliases(Assembly assembly, ILoggerRepository repository) } // Look for the AliasRepositoryAttribute on the assembly +#if NETSTANDARD1_3 + 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) { foreach(log4net.Config.AliasRepositoryAttribute configAttr in configAttributes) diff --git a/src/Core/ErrorCode.cs b/src/Core/ErrorCode.cs old mode 100755 new mode 100644 index 22e0458c..9107a249 --- a/src/Core/ErrorCode.cs +++ b/src/Core/ErrorCode.cs @@ -22,11 +22,11 @@ namespace log4net.Core { /// - /// Defined error codes that can be passed to the method. + /// Defined error codes that can be passed to the method. /// /// /// - /// Values passed to the method. + /// Values passed to the method. /// /// /// Nicko Cadell diff --git a/src/Core/ExceptionEvaluator.cs b/src/Core/ExceptionEvaluator.cs index 106e453d..967c37e5 100644 --- a/src/Core/ExceptionEvaluator.cs +++ b/src/Core/ExceptionEvaluator.cs @@ -1,130 +1,133 @@ -#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 -{ - /// - /// An evaluator that triggers on an Exception type - /// - /// - /// - /// This evaluator will trigger if the type of the Exception - /// passed to - /// is equal to a Type in . /// - /// - /// - /// Drew Schaeffer - public class ExceptionEvaluator : ITriggeringEventEvaluator - { - /// - /// The type that causes the trigger to fire. - /// - private Type m_type; - - /// - /// Causes subclasses of to cause the trigger to fire. - /// - private bool m_triggerOnSubclass; - - /// - /// Default ctor to allow dynamic creation through a configurator. - /// - public ExceptionEvaluator() - { - // empty - } - - /// - /// Constructs an evaluator and initializes to trigger on - /// - /// the type that triggers this evaluator. - /// If true, this evaluator will trigger on subclasses of . - public ExceptionEvaluator(Type exType, bool triggerOnSubClass) - { - if (exType == null) - { - throw new ArgumentNullException("exType"); - } - - m_type = exType; - m_triggerOnSubclass = triggerOnSubClass; - } - - /// - /// The type that triggers this evaluator. - /// - public Type ExceptionType - { - get { return m_type; } - set { m_type = value; } - } - - /// - /// If true, this evaluator will trigger on subclasses of . - /// - public bool TriggerOnSubclass - { - get { return m_triggerOnSubclass; } - set { m_triggerOnSubclass = value; } - } - - #region ITriggeringEventEvaluator Members - - /// - /// Is this the triggering event? - /// - /// The event to check - /// This method returns true, if the logging event Exception - /// Type is . - /// Otherwise it returns false - /// - /// - /// This evaluator will trigger if the Exception Type of the event - /// passed to - /// is . - /// - /// - public bool IsTriggeringEvent(LoggingEvent loggingEvent) - { - if (loggingEvent == null) - { - throw new ArgumentNullException("loggingEvent"); - } - - if (m_triggerOnSubclass && loggingEvent.ExceptionObject != null) - { - // check if loggingEvent.ExceptionObject is of type ExceptionType or subclass of ExceptionType - Type exceptionObjectType = loggingEvent.ExceptionObject.GetType(); - return exceptionObjectType == m_type || exceptionObjectType.IsSubclassOf(m_type); - } - else if (!m_triggerOnSubclass && loggingEvent.ExceptionObject != null) - { // check if loggingEvent.ExceptionObject is of type ExceptionType - return loggingEvent.ExceptionObject.GetType() == m_type; - } - else - { // loggingEvent.ExceptionObject is null - return false; - } - } - - #endregion - } -} +#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; +#if NETSTANDARD1_3 +using System.Reflection; +#endif + +namespace log4net.Core +{ + /// + /// An evaluator that triggers on an Exception type + /// + /// + /// + /// This evaluator will trigger if the type of the Exception + /// passed to + /// is equal to a Type in . /// + /// + /// + /// Drew Schaeffer + public class ExceptionEvaluator : ITriggeringEventEvaluator + { + /// + /// The type that causes the trigger to fire. + /// + private Type m_type; + + /// + /// Causes subclasses of to cause the trigger to fire. + /// + private bool m_triggerOnSubclass; + + /// + /// Default ctor to allow dynamic creation through a configurator. + /// + public ExceptionEvaluator() + { + // empty + } + + /// + /// Constructs an evaluator and initializes to trigger on + /// + /// the type that triggers this evaluator. + /// If true, this evaluator will trigger on subclasses of . + public ExceptionEvaluator(Type exType, bool triggerOnSubClass) + { + if (exType == null) + { + throw new ArgumentNullException("exType"); + } + + m_type = exType; + m_triggerOnSubclass = triggerOnSubClass; + } + + /// + /// The type that triggers this evaluator. + /// + public Type ExceptionType + { + get { return m_type; } + set { m_type = value; } + } + + /// + /// If true, this evaluator will trigger on subclasses of . + /// + public bool TriggerOnSubclass + { + get { return m_triggerOnSubclass; } + set { m_triggerOnSubclass = value; } + } + + #region ITriggeringEventEvaluator Members + + /// + /// Is this the triggering event? + /// + /// The event to check + /// This method returns true, if the logging event Exception + /// Type is . + /// Otherwise it returns false + /// + /// + /// This evaluator will trigger if the Exception Type of the event + /// passed to + /// is . + /// + /// + public bool IsTriggeringEvent(LoggingEvent loggingEvent) + { + if (loggingEvent == null) + { + throw new ArgumentNullException("loggingEvent"); + } + + if (m_triggerOnSubclass && loggingEvent.ExceptionObject != null) + { + // check if loggingEvent.ExceptionObject is of type ExceptionType or subclass of ExceptionType + Type exceptionObjectType = loggingEvent.ExceptionObject.GetType(); + return exceptionObjectType == m_type || exceptionObjectType.IsSubclassOf(m_type); + } + else if (!m_triggerOnSubclass && loggingEvent.ExceptionObject != null) + { // check if loggingEvent.ExceptionObject is of type ExceptionType + return loggingEvent.ExceptionObject.GetType() == m_type; + } + else + { // loggingEvent.ExceptionObject is null + return false; + } + } + + #endregion + } +} diff --git a/src/Core/IAppenderAttachable.cs b/src/Core/IAppenderAttachable.cs old mode 100755 new mode 100644 diff --git a/src/Core/IErrorHandler.cs b/src/Core/IErrorHandler.cs old mode 100755 new mode 100644 index 9378f5fc..763e5186 --- a/src/Core/IErrorHandler.cs +++ b/src/Core/IErrorHandler.cs @@ -56,7 +56,7 @@ public interface IErrorHandler /// The that was thrown when the error occurred. /// /// - /// See . + /// See . /// /// void Error(string message, Exception e); @@ -67,7 +67,7 @@ public interface IErrorHandler /// The message associated with the error. /// /// - /// See . + /// See . /// /// void Error(string message); diff --git a/src/Core/IFixingRequired.cs b/src/Core/IFixingRequired.cs old mode 100755 new mode 100644 diff --git a/src/Core/ILogger.cs b/src/Core/ILogger.cs old mode 100755 new mode 100644 diff --git a/src/Core/ILoggerWrapper.cs b/src/Core/ILoggerWrapper.cs old mode 100755 new mode 100644 diff --git a/src/Core/IOptionHandler.cs b/src/Core/IOptionHandler.cs old mode 100755 new mode 100644 diff --git a/src/Core/IRepositorySelector.cs b/src/Core/IRepositorySelector.cs old mode 100755 new mode 100644 index 22ebfdaa..55e393a3 --- a/src/Core/IRepositorySelector.cs +++ b/src/Core/IRepositorySelector.cs @@ -128,7 +128,7 @@ public interface IRepositorySelector /// The named /// /// Lookup a named . This is the repository created by - /// calling . + /// calling . /// ILoggerRepository GetRepository(string repositoryName); @@ -141,7 +141,7 @@ public interface IRepositorySelector /// /// /// The created will be associated with the domain - /// specified such that a call to with the + /// specified such that a call to with the /// same assembly specified will return the same repository instance. /// /// @@ -161,7 +161,7 @@ public interface IRepositorySelector /// /// /// The created will be associated with the name - /// specified such that a call to with the + /// specified such that a call to with the /// same name will return the same repository instance. /// /// @@ -174,8 +174,8 @@ public interface IRepositorySelector /// true if the repository exists /// /// - /// Test if a named repository exists. Use - /// to create a new repository and to retrieve + /// Test if a named repository exists. Use + /// to create a new repository and to retrieve /// a repository. /// /// diff --git a/src/Core/ITriggeringEventEvaluator.cs b/src/Core/ITriggeringEventEvaluator.cs old mode 100755 new mode 100644 diff --git a/src/Core/Level.cs b/src/Core/Level.cs old mode 100755 new mode 100644 index 40a6ad22..713918dd --- a/src/Core/Level.cs +++ b/src/Core/Level.cs @@ -111,7 +111,11 @@ public Level(int level, string levelName, string displayName) } m_levelValue = level; +#if NETSTANDARD1_3 + m_levelName = levelName; +#else m_levelName = string.Intern(levelName); +#endif m_levelDisplayName = displayName; } diff --git a/src/Core/LevelCollection.cs b/src/Core/LevelCollection.cs old mode 100755 new mode 100644 index 1428c67c..d51bd0d9 --- a/src/Core/LevelCollection.cs +++ b/src/Core/LevelCollection.cs @@ -26,7 +26,10 @@ namespace log4net.Core /// A strongly-typed collection of objects. /// /// Nicko Cadell - public class LevelCollection : ICollection, IList, IEnumerable, ICloneable + public class LevelCollection : ICollection, IList, IEnumerable +#if !NETSTANDARD1_3 + , ICloneable +#endif { #region Interfaces @@ -205,10 +208,10 @@ public virtual void CopyTo(Level[] array, int start) /// /// Gets a value indicating whether access to the collection is synchronized (thread-safe). /// - /// true if access to the ICollection is synchronized (thread-safe); otherwise, false. + /// false, because the backing type is an array, which is never thread-safe. public virtual bool IsSynchronized { - get { return m_array.IsSynchronized; } + get { return false; } } /// @@ -216,7 +219,7 @@ public virtual bool IsSynchronized /// public virtual object SyncRoot { - get { return m_array.SyncRoot; } + get { return m_array; } } #endregion @@ -541,9 +544,9 @@ public virtual void TrimToSize() #region Implementation (helpers) /// - /// is less than zero + /// is less than zero /// -or- - /// is equal to or greater than . + /// is equal to or greater than . /// private void ValidateIndex(int i) { @@ -551,9 +554,9 @@ private void ValidateIndex(int i) } /// - /// is less than zero + /// is less than zero /// -or- - /// is equal to or greater than . + /// is equal to or greater than . /// private void ValidateIndex(int i, bool allowEqualEnd) { diff --git a/src/Core/LevelEvaluator.cs b/src/Core/LevelEvaluator.cs old mode 100755 new mode 100644 index ec35ea71..35706df8 --- a/src/Core/LevelEvaluator.cs +++ b/src/Core/LevelEvaluator.cs @@ -29,7 +29,7 @@ namespace log4net.Core /// /// /// This evaluator will trigger if the level of the event - /// passed to + /// passed to /// is equal to or greater than the /// level. /// @@ -51,7 +51,7 @@ public class LevelEvaluator : ITriggeringEventEvaluator /// /// /// This evaluator will trigger if the level of the event - /// passed to + /// passed to /// is equal to or greater than the /// level. /// @@ -70,7 +70,7 @@ public LevelEvaluator() : this(Level.Off) /// /// /// This evaluator will trigger if the level of the event - /// passed to + /// passed to /// is equal to or greater than the /// level. /// @@ -94,7 +94,7 @@ public LevelEvaluator(Level threshold) /// /// /// This evaluator will trigger if the level of the event - /// passed to + /// passed to /// is equal to or greater than the /// level. /// @@ -115,7 +115,7 @@ public Level Threshold /// /// /// This evaluator will trigger if the level of the event - /// passed to + /// passed to /// is equal to or greater than the /// level. /// diff --git a/src/Core/LevelMap.cs b/src/Core/LevelMap.cs old mode 100755 new mode 100644 index c48b28c3..d458533a --- a/src/Core/LevelMap.cs +++ b/src/Core/LevelMap.cs @@ -112,7 +112,7 @@ public Level this[string name] /// Create a new Level and add it to the map /// /// - /// + /// public void Add(string name, int value) { Add(name, value, null); diff --git a/src/Core/LocationInfo.cs b/src/Core/LocationInfo.cs old mode 100755 new mode 100644 index 7afc02fc..55fd8ade --- a/src/Core/LocationInfo.cs +++ b/src/Core/LocationInfo.cs @@ -83,7 +83,7 @@ public LocationInfo(Type callerStackBoundaryDeclaringType) m_methodName = NA; m_fullInfo = NA; -#if !NETCF +#if !(NETCF || NETSTANDARD1_3) // StackTrace isn't fully implemented for NETSTANDARD1_3 https://github.com/dotnet/corefx/issues/1797 if (callerStackBoundaryDeclaringType != null) { try @@ -118,10 +118,10 @@ public LocationInfo(Type callerStackBoundaryDeclaringType) // take into account the frames we skip above int adjustedFrameCount = st.FrameCount - frameIndex; ArrayList stackFramesList = new ArrayList(adjustedFrameCount); - m_stackFrames = new StackFrame[adjustedFrameCount]; + m_stackFrames = new StackFrameItem[adjustedFrameCount]; for (int i=frameIndex; i < st.FrameCount; i++) { - stackFramesList.Add(st.GetFrame(i)); + stackFramesList.Add(new StackFrameItem(st.GetFrame(i))); } stackFramesList.CopyTo(m_stackFrames, 0); @@ -271,13 +271,15 @@ public string FullInfo get { return m_fullInfo; } } +#if !(NETCF || NETSTANDARD1_3) /// /// Gets the stack frames from the stack trace of the caller making the log request /// - public StackFrame[] StackFrames + public StackFrameItem[] StackFrames { get { return m_stackFrames; } } +#endif #endregion Public Instance Properties @@ -288,7 +290,9 @@ public StackFrame[] StackFrames private readonly string m_lineNumber; private readonly string m_methodName; private readonly string m_fullInfo; - private readonly StackFrame[] m_stackFrames; +#if !(NETCF || NETSTANDARD1_3) + private readonly StackFrameItem[] m_stackFrames; +#endif #endregion Private Instance Fields diff --git a/src/Core/LogException.cs b/src/Core/LogException.cs old mode 100755 new mode 100644 index 499979c1..e7f243df --- a/src/Core/LogException.cs +++ b/src/Core/LogException.cs @@ -39,7 +39,11 @@ namespace log4net.Core #if !NETCF [Serializable] #endif +#if NETSTANDARD1_3 + public class LogException : Exception +#else public class LogException : ApplicationException +#endif { #region Public Instance Constructors @@ -88,7 +92,7 @@ public LogException(String message, Exception innerException) : base(message, in #region Protected Instance Constructors -#if !NETCF +#if !(NETCF || NETSTANDARD1_3) /// /// Serialization constructor /// diff --git a/src/Core/LogImpl.cs b/src/Core/LogImpl.cs old mode 100755 new mode 100644 index 36427dcf..64c2edf9 --- a/src/Core/LogImpl.cs +++ b/src/Core/LogImpl.cs @@ -41,7 +41,7 @@ namespace log4net.Core /// /// DEBUG /// - /// The and methods log messages + /// The and methods log messages /// at the DEBUG level. That is the level with that name defined in the /// repositories . The default value /// for this level is . The @@ -51,7 +51,7 @@ namespace log4net.Core /// /// INFO /// - /// The and methods log messages + /// The and methods log messages /// at the INFO level. That is the level with that name defined in the /// repositories . The default value /// for this level is . The @@ -61,7 +61,7 @@ namespace log4net.Core /// /// WARN /// - /// The and methods log messages + /// The and methods log messages /// at the WARN level. That is the level with that name defined in the /// repositories . The default value /// for this level is . The @@ -71,7 +71,7 @@ namespace log4net.Core /// /// ERROR /// - /// The and methods log messages + /// The and methods log messages /// at the ERROR level. That is the level with that name defined in the /// repositories . The default value /// for this level is . The @@ -81,7 +81,7 @@ namespace log4net.Core /// /// FATAL /// - /// The and methods log messages + /// The and methods log messages /// at the FATAL level. That is the level with that name defined in the /// repositories . The default value /// for this level is . The @@ -162,7 +162,7 @@ protected virtual void ReloadLevels(ILoggerRepository repository) /// WARNING Note that passing an /// to this method will print the name of the /// but no stack trace. To print a stack trace use the - /// form instead. + /// form instead. /// /// virtual public void Debug(object message) @@ -182,10 +182,10 @@ virtual public void Debug(object message) /// as a parameter. /// /// - /// See the form for more detailed information. + /// See the form for more detailed information. /// /// - /// + /// virtual public void Debug(object message, Exception exception) { Logger.Log(ThisDeclaringType, m_levelDebug, message, exception); @@ -198,18 +198,18 @@ virtual public void Debug(object message, Exception exception) /// An Object array containing zero or more objects to format /// /// - /// The message is formatted using the method. See + /// The message is formatted using the method. See /// String.Format for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// The string is formatted using the /// format provider. To specify a localized provider use the - /// method. + /// method. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// @@ -228,18 +228,18 @@ virtual public void DebugFormat(string format, params object[] args) /// An Object to format /// /// - /// The message is formatted using the method. See + /// The message is formatted using the method. See /// String.Format for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// The string is formatted using the /// format provider. To specify a localized provider use the - /// method. + /// method. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// @@ -259,18 +259,18 @@ virtual public void DebugFormat(string format, object arg0) /// An Object to format /// /// - /// The message is formatted using the method. See + /// The message is formatted using the method. See /// String.Format for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// The string is formatted using the /// format provider. To specify a localized provider use the - /// method. + /// method. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// @@ -291,18 +291,18 @@ virtual public void DebugFormat(string format, object arg0, object arg1) /// An Object to format /// /// - /// The message is formatted using the method. See + /// The message is formatted using the method. See /// String.Format for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// The string is formatted using the /// format provider. To specify a localized provider use the - /// method. + /// method. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// @@ -322,13 +322,13 @@ virtual public void DebugFormat(string format, object arg0, object arg1, object /// An Object array containing zero or more objects to format /// /// - /// The message is formatted using the method. See + /// The message is formatted using the method. See /// String.Format for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// @@ -360,7 +360,7 @@ virtual public void DebugFormat(IFormatProvider provider, string format, params /// WARNING Note that passing an /// to this method will print the name of the /// but no stack trace. To print a stack trace use the - /// form instead. + /// form instead. /// /// virtual public void Info(object message) @@ -380,10 +380,10 @@ virtual public void Info(object message) /// passed as a parameter. /// /// - /// See the form for more detailed information. + /// See the form for more detailed information. /// /// - /// + /// virtual public void Info(object message, Exception exception) { Logger.Log(ThisDeclaringType, m_levelInfo, message, exception); @@ -396,18 +396,18 @@ virtual public void Info(object message, Exception exception) /// An Object array containing zero or more objects to format /// /// - /// The message is formatted using the method. See + /// The message is formatted using the method. See /// String.Format for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// The string is formatted using the /// format provider. To specify a localized provider use the - /// method. + /// method. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// @@ -426,18 +426,18 @@ virtual public void InfoFormat(string format, params object[] args) /// An Object to format /// /// - /// The message is formatted using the method. See + /// The message is formatted using the method. See /// String.Format for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// The string is formatted using the /// format provider. To specify a localized provider use the - /// method. + /// method. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// @@ -457,18 +457,18 @@ virtual public void InfoFormat(string format, object arg0) /// An Object to format /// /// - /// The message is formatted using the method. See + /// The message is formatted using the method. See /// String.Format for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// The string is formatted using the /// format provider. To specify a localized provider use the - /// method. + /// method. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// @@ -489,18 +489,18 @@ virtual public void InfoFormat(string format, object arg0, object arg1) /// An Object to format /// /// - /// The message is formatted using the method. See + /// The message is formatted using the method. See /// String.Format for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// The string is formatted using the /// format provider. To specify a localized provider use the - /// method. + /// method. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// @@ -520,13 +520,13 @@ virtual public void InfoFormat(string format, object arg0, object arg1, object a /// An Object array containing zero or more objects to format /// /// - /// The message is formatted using the method. See + /// The message is formatted using the method. See /// String.Format for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// @@ -558,7 +558,7 @@ virtual public void InfoFormat(IFormatProvider provider, string format, params o /// WARNING Note that passing an to this /// method will print the name of the but no /// stack trace. To print a stack trace use the - /// form instead. + /// form instead. /// /// virtual public void Warn(object message) @@ -578,10 +578,10 @@ virtual public void Warn(object message) /// passed as a parameter. /// /// - /// See the form for more detailed information. + /// See the form for more detailed information. /// /// - /// + /// virtual public void Warn(object message, Exception exception) { Logger.Log(ThisDeclaringType, m_levelWarn, message, exception); @@ -594,18 +594,18 @@ virtual public void Warn(object message, Exception exception) /// An Object array containing zero or more objects to format /// /// - /// The message is formatted using the method. See + /// The message is formatted using the method. See /// String.Format for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// The string is formatted using the /// format provider. To specify a localized provider use the - /// method. + /// method. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// @@ -624,18 +624,18 @@ virtual public void WarnFormat(string format, params object[] args) /// An Object to format /// /// - /// The message is formatted using the method. See + /// The message is formatted using the method. See /// String.Format for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// The string is formatted using the /// format provider. To specify a localized provider use the - /// method. + /// method. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// @@ -655,18 +655,18 @@ virtual public void WarnFormat(string format, object arg0) /// An Object to format /// /// - /// The message is formatted using the method. See + /// The message is formatted using the method. See /// String.Format for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// The string is formatted using the /// format provider. To specify a localized provider use the - /// method. + /// method. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// @@ -687,18 +687,18 @@ virtual public void WarnFormat(string format, object arg0, object arg1) /// An Object to format /// /// - /// The message is formatted using the method. See + /// The message is formatted using the method. See /// String.Format for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// The string is formatted using the /// format provider. To specify a localized provider use the - /// method. + /// method. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// @@ -718,13 +718,13 @@ virtual public void WarnFormat(string format, object arg0, object arg1, object a /// An Object array containing zero or more objects to format /// /// - /// The message is formatted using the method. See + /// The message is formatted using the method. See /// String.Format for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// @@ -756,7 +756,7 @@ virtual public void WarnFormat(IFormatProvider provider, string format, params o /// WARNING Note that passing an to this /// method will print the name of the but no /// stack trace. To print a stack trace use the - /// form instead. + /// form instead. /// /// virtual public void Error(object message) @@ -776,10 +776,10 @@ virtual public void Error(object message) /// passed as a parameter. /// /// - /// See the form for more detailed information. + /// See the form for more detailed information. /// /// - /// + /// virtual public void Error(object message, Exception exception) { Logger.Log(ThisDeclaringType, m_levelError, message, exception); @@ -792,18 +792,18 @@ virtual public void Error(object message, Exception exception) /// An Object array containing zero or more objects to format /// /// - /// The message is formatted using the method. See + /// The message is formatted using the method. See /// String.Format for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// The string is formatted using the /// format provider. To specify a localized provider use the - /// method. + /// method. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// @@ -822,18 +822,18 @@ virtual public void ErrorFormat(string format, params object[] args) /// An Object to format /// /// - /// The message is formatted using the method. See + /// The message is formatted using the method. See /// String.Format for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// The string is formatted using the /// format provider. To specify a localized provider use the - /// method. + /// method. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// @@ -853,18 +853,18 @@ virtual public void ErrorFormat(string format, object arg0) /// An Object to format /// /// - /// The message is formatted using the method. See + /// The message is formatted using the method. See /// String.Format for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// The string is formatted using the /// format provider. To specify a localized provider use the - /// method. + /// method. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// @@ -885,18 +885,18 @@ virtual public void ErrorFormat(string format, object arg0, object arg1) /// An Object to format /// /// - /// The message is formatted using the method. See + /// The message is formatted using the method. See /// String.Format for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// The string is formatted using the /// format provider. To specify a localized provider use the - /// method. + /// method. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// @@ -916,13 +916,13 @@ virtual public void ErrorFormat(string format, object arg0, object arg1, object /// An Object array containing zero or more objects to format /// /// - /// The message is formatted using the method. See + /// The message is formatted using the method. See /// String.Format for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// @@ -954,7 +954,7 @@ virtual public void ErrorFormat(IFormatProvider provider, string format, params /// WARNING Note that passing an to this /// method will print the name of the but no /// stack trace. To print a stack trace use the - /// form instead. + /// form instead. /// /// virtual public void Fatal(object message) @@ -974,10 +974,10 @@ virtual public void Fatal(object message) /// passed as a parameter. /// /// - /// See the form for more detailed information. + /// See the form for more detailed information. /// /// - /// + /// virtual public void Fatal(object message, Exception exception) { Logger.Log(ThisDeclaringType, m_levelFatal, message, exception); @@ -990,18 +990,18 @@ virtual public void Fatal(object message, Exception exception) /// An Object array containing zero or more objects to format /// /// - /// The message is formatted using the method. See + /// The message is formatted using the method. See /// String.Format for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// The string is formatted using the /// format provider. To specify a localized provider use the - /// method. + /// method. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// @@ -1020,18 +1020,18 @@ virtual public void FatalFormat(string format, params object[] args) /// An Object to format /// /// - /// The message is formatted using the method. See + /// The message is formatted using the method. See /// String.Format for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// The string is formatted using the /// format provider. To specify a localized provider use the - /// method. + /// method. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// @@ -1051,18 +1051,18 @@ virtual public void FatalFormat(string format, object arg0) /// An Object to format /// /// - /// The message is formatted using the method. See + /// The message is formatted using the method. See /// String.Format for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// The string is formatted using the /// format provider. To specify a localized provider use the - /// method. + /// method. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// @@ -1083,18 +1083,18 @@ virtual public void FatalFormat(string format, object arg0, object arg1) /// An Object to format /// /// - /// The message is formatted using the method. See + /// The message is formatted using the method. See /// String.Format for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// The string is formatted using the /// format provider. To specify a localized provider use the - /// method. + /// method. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// @@ -1114,13 +1114,13 @@ virtual public void FatalFormat(string format, object arg0, object arg1, object /// An Object array containing zero or more objects to format /// /// - /// The message is formatted using the method. See + /// The message is formatted using the method. See /// String.Format for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// diff --git a/src/Core/LoggerManager.cs b/src/Core/LoggerManager.cs old mode 100755 new mode 100644 index 678666de..8ffaad2f --- a/src/Core/LoggerManager.cs +++ b/src/Core/LoggerManager.cs @@ -18,7 +18,11 @@ #endregion using System; +#if NETSTANDARD1_3 +using System.Runtime.InteropServices; +#else using System.Configuration; +#endif using System.Reflection; using log4net.Util; @@ -100,8 +104,8 @@ static LoggerManager() // Set the default repository selector #if NETCF s_repositorySelector = new CompactRepositorySelector(typeof(log4net.Repository.Hierarchy.Hierarchy)); -#else - + 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) @@ -140,13 +144,12 @@ static LoggerManager() } } } - +#endif // Create the DefaultRepositorySelector if not configured above if (s_repositorySelector == null) { s_repositorySelector = new DefaultRepositorySelector(typeof(log4net.Repository.Hierarchy.Hierarchy)); } -#endif } /// @@ -163,7 +166,7 @@ static LoggerManager() /// private static void RegisterAppDomainEvents() { -#if !NETCF +#if !(NETCF || NETSTANDARD1_3) // ProcessExit seems to be fired if we are part of the default domain AppDomain.CurrentDomain.ProcessExit += new EventHandler(OnProcessExit); @@ -404,7 +407,7 @@ public static ILogger GetLogger(Assembly repositoryAssembly, string name) } /// - /// Shorthand for . + /// Shorthand for . /// /// The repository to lookup in. /// The of which the fullname will be used as the name of the logger to retrieve. @@ -428,7 +431,7 @@ public static ILogger GetLogger(string repository, Type type) } /// - /// Shorthand for . + /// Shorthand for . /// /// the assembly to use to lookup the repository /// The of which the fullname will be used as the name of the logger to retrieve. @@ -702,7 +705,7 @@ public static ILoggerRepository CreateRepository(string repository, Type reposit /// /// /// The created will be associated with the repository - /// specified such that a call to with the + /// specified such that a call to with the /// same assembly specified will return the same repository instance. /// /// @@ -723,7 +726,7 @@ public static ILoggerRepository CreateDomain(Assembly repositoryAssembly, Type r /// /// /// The created will be associated with the repository - /// specified such that a call to with the + /// specified such that a call to with the /// same assembly specified will return the same repository instance. /// /// @@ -769,7 +772,7 @@ public static ILoggerRepository[] GetAllRepositories() /// /// The caller to supplies either a string name /// or an assembly (if not supplied the assembly is inferred using - /// ). + /// ). /// /// /// This context is used by the selector to lookup a specific repository. @@ -798,17 +801,21 @@ private static string GetVersionInfo() { System.Text.StringBuilder sb = new System.Text.StringBuilder(); - // Grab the currently executing assembly +#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(); - - // Build Up message 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 - sb.Append(")"); +#endif // NETSTANDARD1_3 + sb.Append(")"); return sb.ToString(); } @@ -823,7 +830,7 @@ private static string GetVersionInfo() /// Called when the event fires. /// /// - /// When the event is triggered the log4net system is . + /// When the event is triggered the log4net system is . /// /// private static void OnDomainUnload(object sender, EventArgs e) @@ -841,7 +848,7 @@ private static void OnDomainUnload(object sender, EventArgs e) /// Called when the event fires. /// /// - /// When the event is triggered the log4net system is . + /// When the event is triggered the log4net system is . /// /// private static void OnProcessExit(object sender, EventArgs e) diff --git a/src/Core/LoggerWrapperImpl.cs b/src/Core/LoggerWrapperImpl.cs old mode 100755 new mode 100644 diff --git a/src/Core/LoggingEvent.cs b/src/Core/LoggingEvent.cs old mode 100755 new mode 100644 index 0cbc025b..fb9a5065 --- a/src/Core/LoggingEvent.cs +++ b/src/Core/LoggingEvent.cs @@ -22,8 +22,10 @@ using System.IO; #if (!NETCF) using System.Runtime.Serialization; +#if !NETSTANDARD1_3 using System.Security.Principal; #endif +#endif using log4net.Util; using log4net.Repository; @@ -86,16 +88,49 @@ public struct LoggingEventData public string ThreadName; /// - /// The time the event was logged + /// Gets or sets the local time the event was logged /// /// - /// - /// The TimeStamp is stored in the local time zone for this computer. + /// + /// Prefer using the setter, since local time can be ambiguous. /// /// - public DateTime TimeStamp; - - /// + [Obsolete("Prefer using TimeStampUtc, since local time can be ambiguous in time zones with daylight savings time.")] + public DateTime TimeStamp; + + /// + /// Gets or sets the UTC time the event was logged + /// + /// + /// + /// The TimeStamp is stored in the UTC time zone. + /// + /// +#pragma warning disable 618 // Suppress warnings that TimeStamp field is obsolete + public DateTime TimeStampUtc + { + get + { + if (TimeStamp != default(DateTime) && + _timeStampUtc == default(DateTime)) + { + // TimeStamp field has been set explicitly but TimeStampUtc hasn't + // => use TimeStamp + return TimeStamp.ToUniversalTime(); + } + return _timeStampUtc; + } + set + { + _timeStampUtc = value; + // For backwards compatibility + TimeStamp = _timeStampUtc.ToLocalTime(); + } + } + private DateTime _timeStampUtc; +#pragma warning restore 618 + + /// /// Location information for the caller. /// /// @@ -278,8 +313,8 @@ [Flags] public enum FixFlags /// 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 a later time these volatile values must be fixed by calling - /// . There is a performance penalty - /// for incurred by calling but it + /// . There is a performance penalty + /// for incurred by calling but it /// is essential to maintaining data consistency. /// /// @@ -314,7 +349,7 @@ public class LoggingEvent /// /// Except , and , /// all fields of LoggingEvent are filled when actually needed. Call - /// to cache all data locally + /// to cache all data locally /// to prevent inconsistencies. /// /// This method is called by the log4net framework @@ -332,7 +367,7 @@ public LoggingEvent(Type callerStackBoundaryDeclaringType, log4net.Repository.IL m_data.Level = level; // Store the event creation time - m_data.TimeStamp = DateTime.Now; + m_data.TimeStampUtc = DateTime.UtcNow; } /// @@ -351,7 +386,7 @@ public LoggingEvent(Type callerStackBoundaryDeclaringType, log4net.Repository.IL /// be useful if you require a custom serialization scheme. /// /// - /// Use the method to obtain an + /// Use the method to obtain an /// instance of the class. /// /// @@ -384,7 +419,7 @@ public LoggingEvent(Type callerStackBoundaryDeclaringType, log4net.Repository.IL /// be useful if you require a custom serialization scheme. /// /// - /// Use the method to obtain an + /// Use the method to obtain an /// instance of the class. /// /// @@ -409,7 +444,7 @@ public LoggingEvent(Type callerStackBoundaryDeclaringType, log4net.Repository.IL /// be useful if you require a custom serialization scheme. /// /// - /// Use the method to obtain an + /// Use the method to obtain an /// instance of the class. /// /// @@ -426,7 +461,7 @@ public LoggingEvent(LoggingEventData data) : this(null, null, data) #region Protected Instance Constructors -#if !NETCF +#if !(NETCF || NETSTANDARD1_3) /// /// Serialization constructor @@ -452,7 +487,7 @@ protected LoggingEvent(SerializationInfo info, StreamingContext context) m_data.Message = info.GetString("Message"); m_data.ThreadName = info.GetString("ThreadName"); - m_data.TimeStamp = info.GetDateTime("TimeStamp"); + m_data.TimeStampUtc = info.GetDateTime("TimeStamp").ToUniversalTime(); m_data.LocationInfo = (LocationInfo) info.GetValue("LocationInfo", typeof(LocationInfo)); m_data.UserName = info.GetString("UserName"); m_data.ExceptionString = info.GetString("ExceptionString"); @@ -479,7 +514,7 @@ protected LoggingEvent(SerializationInfo info, StreamingContext context) /// /// /// - /// The TimeStamp is stored in the local time zone for this computer. + /// The TimeStamp is stored internally in UTC and converted to the local time zone for this computer. /// /// /// Tries to get the start time for the current process. @@ -494,7 +529,30 @@ protected LoggingEvent(SerializationInfo info, StreamingContext context) /// public static DateTime StartTime { - get { return SystemInfo.ProcessStartTime; } + get { return SystemInfo.ProcessStartTimeUtc.ToLocalTime(); } + } + + /// + /// Gets the UTC time when the current process started. + /// + /// + /// This is the UTC time when this process started. + /// + /// + /// + /// Tries to get the start time for the current process. + /// Failing that it returns the time of the first call to + /// this property. + /// + /// + /// Note that AppDomains may be loaded and unloaded within the + /// same process without the process terminating and therefore + /// without the process start time being reset. + /// + /// + public static DateTime StartTimeUtc + { + get { return SystemInfo.ProcessStartTimeUtc; } } /// @@ -521,12 +579,23 @@ public Level Level /// /// /// - /// The TimeStamp is stored in the local time zone for this computer. + /// The TimeStamp is stored in UTC and converted to the local time zone for this computer. /// /// public DateTime TimeStamp { - get { return m_data.TimeStamp; } + get { return m_data.TimeStampUtc.ToLocalTime(); } + } + + /// + /// Gets UTC the time of the logging event. + /// + /// + /// The UTC time of the logging event. + /// + public DateTime TimeStampUtc + { + get { return m_data.TimeStampUtc; } } /// @@ -745,7 +814,7 @@ public string ThreadName { if (m_data.ThreadName == null && this.m_cacheUpdatable) { -#if NETCF +#if NETCF || NETSTANDARD1_3 // Get thread ID only m_data.ThreadName = SystemInfo.CurrentThreadId.ToString(System.Globalization.NumberFormatInfo.InvariantInfo); #else @@ -828,7 +897,7 @@ public string UserName { if (m_data.UserName == null && this.m_cacheUpdatable) { -#if (NETCF || SSCLI) +#if (NETCF || SSCLI || NETSTANDARD1_3) // NETSTANDARD1_3 TODO requires platform-specific code // On compact framework there's no notion of current Windows user m_data.UserName = SystemInfo.NotAvailableText; #else @@ -876,7 +945,7 @@ public string Identity { if (m_data.Identity == null && this.m_cacheUpdatable) { -#if (NETCF || SSCLI) +#if (NETCF || SSCLI || NETSTANDARD1_3) // On compact framework there's no notion of current thread principals m_data.Identity = SystemInfo.NotAvailableText; #else @@ -893,7 +962,16 @@ public string Identity m_data.Identity = ""; } } - catch(System.Security.SecurityException) + catch (ObjectDisposedException) + { + // This exception will occur if System.Threading.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 = ""; + } + catch (System.Security.SecurityException) { // This security exception will occur if the caller does not have // some undefined set of SecurityPermission flags. @@ -1008,12 +1086,16 @@ public FixFlags Fix /// The data in this event must be fixed before it can be serialized. /// /// - /// The method must be called during the + /// The method must be called during the /// method call if this event /// is to be used outside that method. /// /// +#if NET_4_0 || MONO_4_0 || NETSTANDARD1_3 + [System.Security.SecurityCritical] +#else [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter=true)] +#endif public virtual void GetObjectData(SerializationInfo info, StreamingContext context) { // The caller must call FixVolatileData before this object @@ -1023,8 +1105,13 @@ public virtual void GetObjectData(SerializationInfo info, StreamingContext conte info.AddValue("Level", m_data.Level); info.AddValue("Message", m_data.Message); info.AddValue("ThreadName", m_data.ThreadName); + // TODO: consider serializing UTC rather than local time. Not implemented here because it + // would give an unexpected result if client and server have different versions of this class. + // info.AddValue("TimeStamp", m_data.TimeStampUtc); +#pragma warning disable 618 info.AddValue("TimeStamp", m_data.TimeStamp); - info.AddValue("LocationInfo", m_data.LocationInfo); +#pragma warning restore 618 + info.AddValue("LocationInfo", m_data.LocationInfo); info.AddValue("UserName", m_data.UserName); info.AddValue("ExceptionString", m_data.ExceptionString); info.AddValue("Properties", m_data.Properties); @@ -1140,17 +1227,17 @@ public string GetExceptionString() /// 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 a later time these volatile values must be fixed by calling - /// . There is a performance penalty - /// incurred by calling but it + /// . There is a performance penalty + /// incurred by calling but it /// is essential to maintaining data consistency. /// /// - /// Calling is equivalent to - /// calling passing the parameter + /// Calling is equivalent to + /// calling passing the parameter /// false. /// /// - /// See for more + /// See for more /// information. /// /// @@ -1171,8 +1258,8 @@ public void FixVolatileData() /// 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 a later time these volatile values must be fixed by calling - /// . There is a performance penalty - /// for incurred by calling but it + /// . There is a performance penalty + /// for incurred by calling but it /// is essential to maintaining data consistency. /// /// @@ -1301,28 +1388,35 @@ protected void FixVolatileData(FixFlags flags) private void CreateCompositeProperties() { - m_compositeProperties = new CompositeProperties(); + CompositeProperties compositeProperties = new CompositeProperties(); if (m_eventProperties != null) { - m_compositeProperties.Add(m_eventProperties); + compositeProperties.Add(m_eventProperties); } -#if !NETCF +#if !(NETCF || NETSTANDARD1_3) PropertiesDictionary logicalThreadProperties = LogicalThreadContext.Properties.GetProperties(false); if (logicalThreadProperties != null) { - m_compositeProperties.Add(logicalThreadProperties); + compositeProperties.Add(logicalThreadProperties); } #endif PropertiesDictionary threadProperties = ThreadContext.Properties.GetProperties(false); if (threadProperties != null) { - m_compositeProperties.Add(threadProperties); + compositeProperties.Add(threadProperties); } // TODO: Add Repository Properties - m_compositeProperties.Add(GlobalContext.Properties.GetReadOnlyProperties()); + // event properties + PropertiesDictionary eventProperties = new PropertiesDictionary(); + eventProperties[UserNameProperty] = UserName; + eventProperties[IdentityProperty] = Identity; + compositeProperties.Add(eventProperties); + + compositeProperties.Add(GlobalContext.Properties.GetReadOnlyProperties()); + m_compositeProperties = compositeProperties; } private void CacheProperties() diff --git a/src/Core/MethodItem.cs b/src/Core/MethodItem.cs new file mode 100644 index 00000000..b03b7221 --- /dev/null +++ b/src/Core/MethodItem.cs @@ -0,0 +1,171 @@ +#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.Text; +using System.Collections; + +using log4net.Util; + +namespace log4net.Core +{ + /// + /// provides method information without actually referencing a System.Reflection.MethodBase + /// as that would require that the containing assembly is loaded. + /// + /// +#if !NETCF + [Serializable] +#endif + public class MethodItem + { + #region Public Instance Constructors + + /// + /// constructs a method item for an unknown method. + /// + public MethodItem() + { + m_name = NA; + m_parameters = new string[0]; + } + + /// + /// constructs a method item from the name of the method. + /// + /// + public MethodItem(string name) + : this() + { + m_name = name; + } + + /// + /// constructs a method item from the name of the method and its parameters. + /// + /// + /// + public MethodItem(string name, string[] parameters) + : this(name) + { + m_parameters = parameters; + } + + /// + /// constructs a method item from a method base by determining the method name and its parameters. + /// + /// + public MethodItem(System.Reflection.MethodBase methodBase) + : this(methodBase.Name, GetMethodParameterNames(methodBase)) + { + } + + #endregion + + private static string[] GetMethodParameterNames(System.Reflection.MethodBase methodBase) + { + ArrayList methodParameterNames = new ArrayList(); + try + { + System.Reflection.ParameterInfo[] methodBaseGetParameters = methodBase.GetParameters(); + + int methodBaseGetParametersCount = methodBaseGetParameters.GetUpperBound(0); + + for (int i = 0; i <= methodBaseGetParametersCount; i++) + { + methodParameterNames.Add(methodBaseGetParameters[i].ParameterType + " " + methodBaseGetParameters[i].Name); + } + } + catch (Exception ex) + { + LogLog.Error(declaringType, "An exception ocurred while retreiving method parameters.", ex); + } + + return (string[])methodParameterNames.ToArray(typeof(string)); + } + + #region Public Instance Properties + + /// + /// Gets the method name of the caller making the logging + /// request. + /// + /// + /// The method name of the caller making the logging + /// request. + /// + /// + /// + /// Gets the method name of the caller making the logging + /// request. + /// + /// + public string Name + { + get { return m_name; } + } + + /// + /// Gets the method parameters of the caller making + /// the logging request. + /// + /// + /// The method parameters of the caller making + /// the logging request + /// + /// + /// + /// Gets the method parameters of the caller making + /// the logging request. + /// + /// + 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 + + /// + /// The fully qualified type of the StackFrameItem class. + /// + /// + /// Used by the internal logger to record the Type of the + /// log message. + /// + private readonly static Type declaringType = typeof(MethodItem); + + /// + /// When location information is not available the constant + /// NA is returned. Current value of this string + /// constant is ?. + /// + private const string NA = "?"; + + #endregion Private Static Fields + } +} diff --git a/src/Core/SecurityContext.cs b/src/Core/SecurityContext.cs old mode 100755 new mode 100644 diff --git a/src/Core/SecurityContextProvider.cs b/src/Core/SecurityContextProvider.cs old mode 100755 new mode 100644 diff --git a/src/Core/StackFrameItem.cs b/src/Core/StackFrameItem.cs new file mode 100644 index 00000000..3f6c16b9 --- /dev/null +++ b/src/Core/StackFrameItem.cs @@ -0,0 +1,196 @@ +#if !NETCF +#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.Text; +using System.Diagnostics; +using System.Reflection; +using log4net.Util; + +namespace log4net.Core +{ + /// + /// provides stack frame information without actually referencing a System.Diagnostics.StackFrame + /// as that would require that the containing assembly is loaded. + /// + /// + [Serializable] + public class StackFrameItem + { + #region Public Instance Constructors + + /// + /// returns a stack frame item from a stack frame. This + /// + /// + /// + public StackFrameItem(StackFrame frame) + { + // set default values + m_lineNumber = NA; + m_fileName = NA; + m_method = new MethodItem(); + m_className = NA; + + try + { + // get frame values + m_lineNumber = frame.GetFileLineNumber().ToString(System.Globalization.NumberFormatInfo.InvariantInfo); + m_fileName = frame.GetFileName(); + // get method values + MethodBase method = frame.GetMethod(); + if (method != null) + { + if(method.DeclaringType != null) + m_className = method.DeclaringType.FullName; + m_method = new MethodItem(method); + } + } + catch (Exception ex) + { + LogLog.Error(declaringType, "An exception ocurred while retreiving stack frame information.", ex); + } + + // set full info + m_fullInfo = m_className + '.' + m_method.Name + '(' + m_fileName + ':' + m_lineNumber + ')'; + } + + #endregion + + #region Public Instance Properties + + /// + /// Gets the fully qualified class name of the caller making the logging + /// request. + /// + /// + /// The fully qualified class name of the caller making the logging + /// request. + /// + /// + /// + /// Gets the fully qualified class name of the caller making the logging + /// request. + /// + /// + public string ClassName + { + get { return m_className; } + } + + /// + /// Gets the file name of the caller. + /// + /// + /// The file name of the caller. + /// + /// + /// + /// Gets the file name of the caller. + /// + /// + public string FileName + { + get { return m_fileName; } + } + + /// + /// Gets the line number of the caller. + /// + /// + /// The line number of the caller. + /// + /// + /// + /// Gets the line number of the caller. + /// + /// + public string LineNumber + { + get { return m_lineNumber; } + } + + /// + /// Gets the method name of the caller. + /// + /// + /// The method name of the caller. + /// + /// + /// + /// Gets the method name of the caller. + /// + /// + public MethodItem Method + { + get { return m_method; } + } + + /// + /// Gets all available caller information + /// + /// + /// All available caller information, in the format + /// fully.qualified.classname.of.caller.methodName(Filename:line) + /// + /// + /// + /// Gets all available caller information, in the format + /// fully.qualified.classname.of.caller.methodName(Filename:line) + /// + /// + 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 + + /// + /// The fully qualified type of the StackFrameItem class. + /// + /// + /// Used by the internal logger to record the Type of the + /// log message. + /// + private readonly static Type declaringType = typeof(StackFrameItem); + + /// + /// When location information is not available the constant + /// NA is returned. Current value of this string + /// constant is ?. + /// + private const string NA = "?"; + + #endregion Private Static Fields + } +} +#endif diff --git a/src/Core/TimeEvaluator.cs b/src/Core/TimeEvaluator.cs index bfa60dd8..3067f56c 100644 --- a/src/Core/TimeEvaluator.cs +++ b/src/Core/TimeEvaluator.cs @@ -1,147 +1,148 @@ -#region Copyright & License -// -// Copyright 2001-2005 The Apache Software Foundation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -#endregion - -using System; - -namespace log4net.Core -{ - /// - /// An evaluator that triggers after specified number of seconds. - /// - /// - /// - /// This evaluator will trigger if the specified time period - /// has passed since last check. - /// - /// - /// Robert Sevcik - public class TimeEvaluator : ITriggeringEventEvaluator - { - /// - /// The time threshold for triggering in seconds. Zero means it won't trigger at all. - /// - private int m_interval; - - /// - /// The time of last check. This gets updated when the object is created and when the evaluator triggers. - /// - private DateTime m_lasttime; - - /// - /// The default time threshold for triggering in seconds. Zero means it won't trigger at all. - /// - const int DEFAULT_INTERVAL = 0; - - /// - /// Create a new evaluator using the time threshold in seconds. - /// - /// - /// - /// Create a new evaluator using the time threshold in seconds. - /// - /// - /// This evaluator will trigger if the specified time period - /// has passed since last check. - /// - /// - public TimeEvaluator() - : this(DEFAULT_INTERVAL) - { - } - - /// - /// Create a new evaluator using the specified time threshold in seconds. - /// - /// - /// The time threshold in seconds to trigger after. - /// Zero means it won't trigger at all. - /// - /// - /// - /// Create a new evaluator using the specified time threshold in seconds. - /// - /// - /// This evaluator will trigger if the specified time period - /// has passed since last check. - /// - /// - public TimeEvaluator(int interval) - { - m_interval = interval; - m_lasttime = DateTime.Now; - } - - /// - /// The time threshold in seconds to trigger after - /// - /// - /// The time threshold in seconds to trigger after. - /// Zero means it won't trigger at all. - /// - /// - /// - /// This evaluator will trigger if the specified time period - /// has passed since last check. - /// - /// - public int Interval - { - get { return m_interval; } - set { m_interval = value; } - } - - /// - /// Is this the triggering event? - /// - /// The event to check - /// This method returns true, if the specified time period - /// has passed since last check.. - /// Otherwise it returns false - /// - /// - /// This evaluator will trigger if the specified time period - /// has passed since last check. - /// - /// - public bool IsTriggeringEvent(LoggingEvent loggingEvent) - { - if (loggingEvent == null) - { - throw new ArgumentNullException("loggingEvent"); - } - - // disable the evaluator if threshold is zero - if (m_interval == 0) return false; - - lock (this) // avoid triggering multiple times - { - TimeSpan passed = DateTime.Now.Subtract(m_lasttime); - - if (passed.TotalSeconds > m_interval) - { - m_lasttime = DateTime.Now; - return true; - } - else - { - return false; - } - } - } - } -} +#region Copyright & 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 +{ + /// + /// An evaluator that triggers after specified number of seconds. + /// + /// + /// + /// This evaluator will trigger if the specified time period + /// has passed since last check. + /// + /// + /// Robert Sevcik + public class TimeEvaluator : ITriggeringEventEvaluator + { + /// + /// The time threshold for triggering in seconds. Zero means it won't trigger at all. + /// + private int m_interval; + + /// + /// The UTC time of last check. This gets updated when the object is created and when the evaluator triggers. + /// + private DateTime m_lastTimeUtc; + + /// + /// The default time threshold for triggering in seconds. Zero means it won't trigger at all. + /// + const int DEFAULT_INTERVAL = 0; + + /// + /// Create a new evaluator using the time threshold in seconds. + /// + /// + /// + /// Create a new evaluator using the time threshold in seconds. + /// + /// + /// This evaluator will trigger if the specified time period + /// has passed since last check. + /// + /// + public TimeEvaluator() + : this(DEFAULT_INTERVAL) + { + } + + /// + /// Create a new evaluator using the specified time threshold in seconds. + /// + /// + /// The time threshold in seconds to trigger after. + /// Zero means it won't trigger at all. + /// + /// + /// + /// Create a new evaluator using the specified time threshold in seconds. + /// + /// + /// This evaluator will trigger if the specified time period + /// has passed since last check. + /// + /// + public TimeEvaluator(int interval) + { + m_interval = interval; + m_lastTimeUtc = DateTime.UtcNow; + } + + /// + /// The time threshold in seconds to trigger after + /// + /// + /// The time threshold in seconds to trigger after. + /// Zero means it won't trigger at all. + /// + /// + /// + /// This evaluator will trigger if the specified time period + /// has passed since last check. + /// + /// + public int Interval + { + get { return m_interval; } + set { m_interval = value; } + } + + /// + /// Is this the triggering event? + /// + /// The event to check + /// This method returns true, if the specified time period + /// has passed since last check.. + /// Otherwise it returns false + /// + /// + /// This evaluator will trigger if the specified time period + /// has passed since last check. + /// + /// + public bool IsTriggeringEvent(LoggingEvent loggingEvent) + { + if (loggingEvent == null) + { + throw new ArgumentNullException("loggingEvent"); + } + + // disable the evaluator if threshold is zero + if (m_interval == 0) return false; + + lock (this) // avoid triggering multiple times + { + TimeSpan passed = DateTime.UtcNow.Subtract(m_lastTimeUtc); + + if (passed.TotalSeconds > m_interval) + { + m_lastTimeUtc = DateTime.UtcNow; + return true; + } + else + { + return false; + } + } + } + } +} diff --git a/src/Core/WrapperMap.cs b/src/Core/WrapperMap.cs old mode 100755 new mode 100644 diff --git a/src/DateFormatter/AbsoluteTimeDateFormatter.cs b/src/DateFormatter/AbsoluteTimeDateFormatter.cs old mode 100755 new mode 100644 index 460aa6d8..11741073 --- a/src/DateFormatter/AbsoluteTimeDateFormatter.cs +++ b/src/DateFormatter/AbsoluteTimeDateFormatter.cs @@ -18,6 +18,7 @@ #endregion using System; +using System.Collections; using System.IO; using System.Text; @@ -100,22 +101,36 @@ virtual protected void FormatDateWithoutMillis(DateTime dateToFormat, StringBuil /// virtual public 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) - { + if (s_lastTimeToTheSecond != currentTimeToTheSecond) + { + s_lastTimeStrings.Clear(); + } + else + { + timeString = (string) s_lastTimeStrings[GetType()]; + } + + if (timeString == null) + { // lock so that only one thread can use the buffer and - // update the s_lastTimeToTheSecond and s_lastTimeString + // update the s_lastTimeToTheSecond and s_lastTimeStrings // PERF: Try removing this lock and using a new StringBuilder each time lock(s_lastTimeBuf) { - if (s_lastTimeToTheSecond != currentTimeToTheSecond) - { + timeString = (string) s_lastTimeStrings[GetType()]; + + if (timeString == null) + { // We are in a new second. s_lastTimeBuf.Length = 0; @@ -123,7 +138,7 @@ virtual public void FormatDate(DateTime dateToFormat, TextWriter writer) FormatDateWithoutMillis(dateToFormat, s_lastTimeBuf); // Render the string buffer to a string - string currentDateWithoutMillis = s_lastTimeBuf.ToString(); + timeString = s_lastTimeBuf.ToString(); #if NET_1_1 // Ensure that the above string is written into the variable NOW on all threads. @@ -131,12 +146,12 @@ virtual public void FormatDate(DateTime dateToFormat, TextWriter writer) System.Threading.Thread.MemoryBarrier(); #endif // Store the time as a string (we only have to do this once per second) - s_lastTimeString = currentDateWithoutMillis; + s_lastTimeStrings[GetType()] = timeString; s_lastTimeToTheSecond = currentTimeToTheSecond; } } } - writer.Write(s_lastTimeString); + writer.Write(timeString); // Append the current millisecond info writer.Write(','); @@ -150,6 +165,7 @@ virtual public void FormatDate(DateTime dateToFormat, TextWriter writer) writer.Write('0'); } writer.Write(millis); + } } #endregion Implementation of IDateFormatter @@ -190,7 +206,7 @@ virtual public void FormatDate(DateTime dateToFormat, TextWriter writer) /// Last stored time with precision up to the second, formatted /// as a string. /// - private static string s_lastTimeString; + private static Hashtable s_lastTimeStrings = new Hashtable(); #endregion Private Static Fields } diff --git a/src/DateFormatter/DateTimeDateFormatter.cs b/src/DateFormatter/DateTimeDateFormatter.cs old mode 100755 new mode 100644 diff --git a/src/DateFormatter/IDateFormatter.cs b/src/DateFormatter/IDateFormatter.cs old mode 100755 new mode 100644 diff --git a/src/DateFormatter/Iso8601DateFormatter.cs b/src/DateFormatter/Iso8601DateFormatter.cs old mode 100755 new mode 100644 diff --git a/src/DateFormatter/SimpleDateFormatter.cs b/src/DateFormatter/SimpleDateFormatter.cs old mode 100755 new mode 100644 index 79f5318e..c112ca1a --- a/src/DateFormatter/SimpleDateFormatter.cs +++ b/src/DateFormatter/SimpleDateFormatter.cs @@ -23,11 +23,11 @@ namespace log4net.DateFormatter { /// - /// Formats the using the method. + /// Formats the using the method. /// /// /// - /// Formats the using the method. + /// Formats the using the method. /// /// /// Nicko Cadell @@ -47,7 +47,7 @@ public class SimpleDateFormatter : IDateFormatter /// /// /// The format string must be compatible with the options - /// that can be supplied to . + /// that can be supplied to . /// /// public SimpleDateFormatter(string format) @@ -60,14 +60,14 @@ public SimpleDateFormatter(string format) #region Implementation of IDateFormatter /// - /// Formats the date using . + /// Formats the date using . /// /// The date to convert to a string. /// The writer to write to. /// /// /// Uses the date format string supplied to the constructor to call - /// the method to format the date. + /// the method to format the date. /// /// virtual public void FormatDate(DateTime dateToFormat, TextWriter writer) @@ -85,7 +85,7 @@ virtual public void FormatDate(DateTime dateToFormat, TextWriter writer) /// /// /// The format string must be compatible with the options - /// that can be supplied to . + /// that can be supplied to . /// /// private readonly string m_formatString; diff --git a/src/Filter/DenyAllFilter.cs b/src/Filter/DenyAllFilter.cs old mode 100755 new mode 100644 diff --git a/src/Filter/FilterDecision.cs b/src/Filter/FilterDecision.cs old mode 100755 new mode 100644 diff --git a/src/Filter/FilterSkeleton.cs b/src/Filter/FilterSkeleton.cs old mode 100755 new mode 100644 diff --git a/src/Filter/IFilter.cs b/src/Filter/IFilter.cs old mode 100755 new mode 100644 diff --git a/src/Filter/LevelMatchFilter.cs b/src/Filter/LevelMatchFilter.cs old mode 100755 new mode 100644 diff --git a/src/Filter/LevelRangeFilter.cs b/src/Filter/LevelRangeFilter.cs old mode 100755 new mode 100644 diff --git a/src/Filter/LoggerMatchFilter.cs b/src/Filter/LoggerMatchFilter.cs old mode 100755 new mode 100644 index 247a9772..828a304e --- a/src/Filter/LoggerMatchFilter.cs +++ b/src/Filter/LoggerMatchFilter.cs @@ -96,7 +96,7 @@ public bool AcceptOnMatch /// /// This filter will attempt to match this value against logger name in /// the following way. The match will be done against the beginning of the - /// logger name (using ). The match is + /// logger name (using ). The match is /// case sensitive. If a match is found then /// the result depends on the value of . /// @@ -120,7 +120,7 @@ public string LoggerToMatch /// /// The rendered message is matched against the . /// If the equals the beginning of - /// the incoming () + /// the incoming () /// then a match will have occurred. If no match occurs /// this function will return /// allowing other filters to check the event. If a match occurs then diff --git a/src/Filter/MdcFilter.cs b/src/Filter/MdcFilter.cs old mode 100755 new mode 100644 diff --git a/src/Filter/NdcFilter.cs b/src/Filter/NdcFilter.cs old mode 100755 new mode 100644 diff --git a/src/Filter/PropertyFilter.cs b/src/Filter/PropertyFilter.cs old mode 100755 new mode 100644 diff --git a/src/Filter/StringMatchFilter.cs b/src/Filter/StringMatchFilter.cs old mode 100755 new mode 100644 index 00a3626c..38fa49d4 --- a/src/Filter/StringMatchFilter.cs +++ b/src/Filter/StringMatchFilter.cs @@ -95,7 +95,11 @@ override public void ActivateOptions() { if (m_stringRegexToMatch != null) { +#if NETSTANDARD1_3 + m_regexToMatch = new Regex(m_stringRegexToMatch); +#else m_regexToMatch = new Regex(m_stringRegexToMatch, RegexOptions.Compiled); +#endif } } diff --git a/src/GlobalContext.cs b/src/GlobalContext.cs old mode 100755 new mode 100644 diff --git a/src/ILog.cs b/src/ILog.cs old mode 100755 new mode 100644 index 2e81e85b..89d01c75 --- a/src/ILog.cs +++ b/src/ILog.cs @@ -31,7 +31,7 @@ namespace log4net /// /// /// Use the to obtain logger instances - /// that implement this interface. The + /// that implement this interface. The /// static method is used to get logger instances. /// /// @@ -60,7 +60,7 @@ namespace log4net /// /// /// - /// + /// /// Nicko Cadell /// Gert Driesen public interface ILog : ILoggerWrapper @@ -85,10 +85,10 @@ public interface ILog : ILoggerWrapper /// WARNING Note that passing an /// to this method will print the name of the /// but no stack trace. To print a stack trace use the - /// form instead. + /// form instead. /// /// - /// + /// /// void Debug(object message); @@ -101,10 +101,10 @@ public interface ILog : ILoggerWrapper /// The exception to log, including its stack trace. /// /// - /// See the form for more detailed information. + /// See the form for more detailed information. /// /// - /// + /// /// void Debug(object message, Exception exception); @@ -117,16 +117,16 @@ public interface ILog : ILoggerWrapper /// /// /// The message is formatted using the String.Format method. See - /// for details of the syntax of the format string and the behavior + /// for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// - /// + /// /// void DebugFormat(string format, params object[] args); @@ -138,16 +138,16 @@ public interface ILog : ILoggerWrapper /// /// /// The message is formatted using the String.Format method. See - /// for details of the syntax of the format string and the behavior + /// for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// - /// + /// /// void DebugFormat(string format, object arg0); @@ -160,16 +160,16 @@ public interface ILog : ILoggerWrapper /// /// /// The message is formatted using the String.Format method. See - /// for details of the syntax of the format string and the behavior + /// for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// - /// + /// /// void DebugFormat(string format, object arg0, object arg1); @@ -183,16 +183,16 @@ public interface ILog : ILoggerWrapper /// /// /// The message is formatted using the String.Format method. See - /// for details of the syntax of the format string and the behavior + /// for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// - /// + /// /// void DebugFormat(string format, object arg0, object arg1, object arg2); @@ -205,16 +205,16 @@ public interface ILog : ILoggerWrapper /// /// /// The message is formatted using the String.Format method. See - /// for details of the syntax of the format string and the behavior + /// for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// - /// + /// /// void DebugFormat(IFormatProvider provider, string format, params object[] args); @@ -237,11 +237,11 @@ public interface ILog : ILoggerWrapper /// WARNING Note that passing an /// to this method will print the name of the /// but no stack trace. To print a stack trace use the - /// form instead. + /// form instead. /// /// /// The message object to log. - /// + /// /// void Info(object message); @@ -254,10 +254,10 @@ public interface ILog : ILoggerWrapper /// The exception to log, including its stack trace. /// /// - /// See the form for more detailed information. + /// See the form for more detailed information. /// /// - /// + /// /// void Info(object message, Exception exception); @@ -270,16 +270,16 @@ public interface ILog : ILoggerWrapper /// /// /// The message is formatted using the String.Format method. See - /// for details of the syntax of the format string and the behavior + /// for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// - /// + /// /// void InfoFormat(string format, params object[] args); @@ -291,16 +291,16 @@ public interface ILog : ILoggerWrapper /// /// /// The message is formatted using the String.Format method. See - /// for details of the syntax of the format string and the behavior + /// for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// - /// + /// /// void InfoFormat(string format, object arg0); @@ -313,16 +313,16 @@ public interface ILog : ILoggerWrapper /// /// /// The message is formatted using the String.Format method. See - /// for details of the syntax of the format string and the behavior + /// for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// - /// + /// /// void InfoFormat(string format, object arg0, object arg1); @@ -336,16 +336,16 @@ public interface ILog : ILoggerWrapper /// /// /// The message is formatted using the String.Format method. See - /// for details of the syntax of the format string and the behavior + /// for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// - /// + /// /// void InfoFormat(string format, object arg0, object arg1, object arg2); @@ -358,16 +358,16 @@ public interface ILog : ILoggerWrapper /// /// /// The message is formatted using the String.Format method. See - /// for details of the syntax of the format string and the behavior + /// for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// - /// + /// /// void InfoFormat(IFormatProvider provider, string format, params object[] args); @@ -390,11 +390,11 @@ public interface ILog : ILoggerWrapper /// WARNING Note that passing an /// to this method will print the name of the /// but no stack trace. To print a stack trace use the - /// form instead. + /// form instead. /// /// /// The message object to log. - /// + /// /// void Warn(object message); @@ -407,10 +407,10 @@ public interface ILog : ILoggerWrapper /// The exception to log, including its stack trace. /// /// - /// See the form for more detailed information. + /// See the form for more detailed information. /// /// - /// + /// /// void Warn(object message, Exception exception); @@ -423,16 +423,16 @@ public interface ILog : ILoggerWrapper /// /// /// The message is formatted using the String.Format method. See - /// for details of the syntax of the format string and the behavior + /// for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// - /// + /// /// void WarnFormat(string format, params object[] args); @@ -444,16 +444,16 @@ public interface ILog : ILoggerWrapper /// /// /// The message is formatted using the String.Format method. See - /// for details of the syntax of the format string and the behavior + /// for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// - /// + /// /// void WarnFormat(string format, object arg0); @@ -466,16 +466,16 @@ public interface ILog : ILoggerWrapper /// /// /// The message is formatted using the String.Format method. See - /// for details of the syntax of the format string and the behavior + /// for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// - /// + /// /// void WarnFormat(string format, object arg0, object arg1); @@ -489,16 +489,16 @@ public interface ILog : ILoggerWrapper /// /// /// The message is formatted using the String.Format method. See - /// for details of the syntax of the format string and the behavior + /// for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// - /// + /// /// void WarnFormat(string format, object arg0, object arg1, object arg2); @@ -511,16 +511,16 @@ public interface ILog : ILoggerWrapper /// /// /// The message is formatted using the String.Format method. See - /// for details of the syntax of the format string and the behavior + /// for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// - /// + /// /// void WarnFormat(IFormatProvider provider, string format, params object[] args); @@ -544,10 +544,10 @@ public interface ILog : ILoggerWrapper /// WARNING Note that passing an /// to this method will print the name of the /// but no stack trace. To print a stack trace use the - /// form instead. + /// form instead. /// /// - /// + /// /// void Error(object message); @@ -560,10 +560,10 @@ public interface ILog : ILoggerWrapper /// The exception to log, including its stack trace. /// /// - /// See the form for more detailed information. + /// See the form for more detailed information. /// /// - /// + /// /// void Error(object message, Exception exception); @@ -576,16 +576,16 @@ public interface ILog : ILoggerWrapper /// /// /// The message is formatted using the String.Format method. See - /// for details of the syntax of the format string and the behavior + /// for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// - /// + /// /// void ErrorFormat(string format, params object[] args); @@ -597,16 +597,16 @@ public interface ILog : ILoggerWrapper /// /// /// The message is formatted using the String.Format method. See - /// for details of the syntax of the format string and the behavior + /// for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// - /// + /// /// void ErrorFormat(string format, object arg0); @@ -619,16 +619,16 @@ public interface ILog : ILoggerWrapper /// /// /// The message is formatted using the String.Format method. See - /// for details of the syntax of the format string and the behavior + /// for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// - /// + /// /// void ErrorFormat(string format, object arg0, object arg1); @@ -642,16 +642,16 @@ public interface ILog : ILoggerWrapper /// /// /// The message is formatted using the String.Format method. See - /// for details of the syntax of the format string and the behavior + /// for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// - /// + /// /// void ErrorFormat(string format, object arg0, object arg1, object arg2); @@ -664,16 +664,16 @@ public interface ILog : ILoggerWrapper /// /// /// The message is formatted using the String.Format method. See - /// for details of the syntax of the format string and the behavior + /// for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// - /// + /// /// void ErrorFormat(IFormatProvider provider, string format, params object[] args); @@ -696,11 +696,11 @@ public interface ILog : ILoggerWrapper /// WARNING Note that passing an /// to this method will print the name of the /// but no stack trace. To print a stack trace use the - /// form instead. + /// form instead. /// /// /// The message object to log. - /// + /// /// void Fatal(object message); @@ -713,10 +713,10 @@ public interface ILog : ILoggerWrapper /// The exception to log, including its stack trace. /// /// - /// See the form for more detailed information. + /// See the form for more detailed information. /// /// - /// + /// /// void Fatal(object message, Exception exception); @@ -729,16 +729,16 @@ public interface ILog : ILoggerWrapper /// /// /// The message is formatted using the String.Format method. See - /// for details of the syntax of the format string and the behavior + /// for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// - /// + /// /// void FatalFormat(string format, params object[] args); @@ -750,16 +750,16 @@ public interface ILog : ILoggerWrapper /// /// /// The message is formatted using the String.Format method. See - /// for details of the syntax of the format string and the behavior + /// for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// - /// + /// /// void FatalFormat(string format, object arg0); @@ -772,16 +772,16 @@ public interface ILog : ILoggerWrapper /// /// /// The message is formatted using the String.Format method. See - /// for details of the syntax of the format string and the behavior + /// for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// - /// + /// /// void FatalFormat(string format, object arg0, object arg1); @@ -795,16 +795,16 @@ public interface ILog : ILoggerWrapper /// /// /// The message is formatted using the String.Format method. See - /// for details of the syntax of the format string and the behavior + /// for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// - /// + /// /// void FatalFormat(string format, object arg0, object arg1, object arg2); @@ -817,16 +817,16 @@ public interface ILog : ILoggerWrapper /// /// /// The message is formatted using the String.Format method. See - /// for details of the syntax of the format string and the behavior + /// for details of the syntax of the format string and the behavior /// of the formatting. /// /// /// This method does not take an object to include in the - /// log event. To pass an use one of the + /// log event. To pass an use one of the /// methods instead. /// /// - /// + /// /// void FatalFormat(IFormatProvider provider, string format, params object[] args); @@ -864,7 +864,7 @@ public interface ILog : ILoggerWrapper /// the other hand, if the log is debug enabled, you /// will incur the cost of evaluating whether the logger is debug /// enabled twice. Once in and once in - /// the . This is an insignificant overhead + /// the . This is an insignificant overhead /// since evaluating a logger takes about 1% of the time it /// takes to actually log. This is the preferred style of logging. /// @@ -897,8 +897,8 @@ public interface ILog : ILoggerWrapper /// speed or runtime flexibility. /// /// - /// - /// + /// + /// bool IsDebugEnabled { get; } /// @@ -910,8 +910,8 @@ public interface ILog : ILoggerWrapper /// /// For more information see . /// - /// - /// + /// + /// /// bool IsInfoEnabled { get; } @@ -924,8 +924,8 @@ public interface ILog : ILoggerWrapper /// /// For more information see . /// - /// - /// + /// + /// /// bool IsWarnEnabled { get; } @@ -938,8 +938,8 @@ public interface ILog : ILoggerWrapper /// /// For more information see . /// - /// - /// + /// + /// /// bool IsErrorEnabled { get; } @@ -952,8 +952,8 @@ public interface ILog : ILoggerWrapper /// /// For more information see . /// - /// - /// + /// + /// /// bool IsFatalEnabled { get; } } diff --git a/src/Layout/DynamicPatternLayout.cs b/src/Layout/DynamicPatternLayout.cs new file mode 100644 index 00000000..28174be1 --- /dev/null +++ b/src/Layout/DynamicPatternLayout.cs @@ -0,0 +1,143 @@ +#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.Pattern; +using log4net.Util; + +namespace log4net.Layout +{ + /// + /// A flexible layout configurable with pattern string that re-evaluates on each call. + /// + /// + /// This class is built on and provides all the + /// features and capabilities of PatternLayout. PatternLayout is a 'static' class + /// in that its layout is done once at configuration time. This class will recreate + /// the layout on each reference. + /// One important difference between PatternLayout and DynamicPatternLayout is the + /// treatment of the Header and Footer parameters in the configuration. The Header and Footer + /// parameters for DynamicPatternLayout must be syntactically in the form of a PatternString, + /// but should not be marked as type log4net.Util.PatternString. Doing so causes the + /// pattern to be statically converted at configuration time and causes DynamicPatternLayout + /// to perform the same as PatternLayout. + /// Please see for complete documentation. + /// + /// <layout type="log4net.Layout.DynamicPatternLayout"> + /// <param name="Header" value="%newline**** Trace Opened Local: %date{yyyy-MM-dd HH:mm:ss.fff} UTC: %utcdate{yyyy-MM-dd HH:mm:ss.fff} ****%newline" /> + /// <param name="Footer" value="**** Trace Closed %date{yyyy-MM-dd HH:mm:ss.fff} ****%newline" /> + /// </layout> + /// + /// + public class DynamicPatternLayout: PatternLayout + { + #region Member Variables + /// + /// The header PatternString + /// + private PatternString m_headerPatternString = new PatternString(""); + + /// + /// The footer PatternString + /// + private PatternString m_footerPatternString = new PatternString(""); + #endregion + + #region Constructors + /// + /// Constructs a DynamicPatternLayout using the DefaultConversionPattern + /// + /// + /// + /// The default pattern just produces the application supplied message. + /// + /// + public DynamicPatternLayout() + : base() + { + } + + /// + /// Constructs a DynamicPatternLayout using the supplied conversion pattern + /// + /// the pattern to use + /// + /// + public DynamicPatternLayout (string pattern) + : base(pattern) + { + } + #endregion + + #region Override implementation of LayoutSkeleton + /// + /// The header for the layout format. + /// + /// the layout header + /// + /// + /// The Header text will be appended before any logging events + /// are formatted and appended. + /// + /// The pattern will be formatted on each get operation. + /// + public override string Header + { + get + { + return m_headerPatternString.Format(); + } + set + { + base.Header = value; + m_headerPatternString = new PatternString(value); + } + } /* property DynamicPatternLayout Header */ + + /// + /// The footer for the layout format. + /// + /// the layout footer + /// + /// + /// The Footer text will be appended after all the logging events + /// have been formatted and appended. + /// + /// The pattern will be formatted on each get operation. + /// + public override string Footer + { + get + { + return m_footerPatternString.Format(); + } + set + { + base.Footer = value; + m_footerPatternString = new PatternString(value); + } + } /* property DynamicPatternLayout Footer */ + #endregion + } /* class DynamicPatternLayout */ +} /* namespace log4net.Layout */ diff --git a/src/Layout/ExceptionLayout.cs b/src/Layout/ExceptionLayout.cs old mode 100755 new mode 100644 index b64b34dd..06c4509b --- a/src/Layout/ExceptionLayout.cs +++ b/src/Layout/ExceptionLayout.cs @@ -90,7 +90,7 @@ override public void ActivateOptions() /// /// /// Write the exception string to the . - /// The exception string is retrieved from . + /// The exception string is retrieved from . /// /// override public void Format(TextWriter writer, LoggingEvent loggingEvent) diff --git a/src/Layout/ILayout.cs b/src/Layout/ILayout.cs old mode 100755 new mode 100644 index 88c758a9..2bb6aef4 --- a/src/Layout/ILayout.cs +++ b/src/Layout/ILayout.cs @@ -31,7 +31,7 @@ namespace log4net.Layout /// /// /// An object is used to format a - /// as text. The method is called by an + /// as text. The method is called by an /// appender to transform the into a string. /// /// diff --git a/src/Layout/IRawLayout.cs b/src/Layout/IRawLayout.cs old mode 100755 new mode 100644 diff --git a/src/Layout/Layout2RawLayoutAdapter.cs b/src/Layout/Layout2RawLayoutAdapter.cs old mode 100755 new mode 100644 diff --git a/src/Layout/LayoutSkeleton.cs b/src/Layout/LayoutSkeleton.cs old mode 100755 new mode 100644 index da68b9b8..b373ee14 --- a/src/Layout/LayoutSkeleton.cs +++ b/src/Layout/LayoutSkeleton.cs @@ -37,7 +37,7 @@ namespace log4net.Layout /// /// /// - /// Subclasses must implement the + /// Subclasses must implement the /// method. /// /// diff --git a/src/Layout/Pattern/AppDomainPatternConverter.cs b/src/Layout/Pattern/AppDomainPatternConverter.cs old mode 100755 new mode 100644 diff --git a/src/Layout/Pattern/AspNetCachePatternConverter.cs b/src/Layout/Pattern/AspNetCachePatternConverter.cs index a8905fc8..4452a5b9 100644 --- a/src/Layout/Pattern/AspNetCachePatternConverter.cs +++ b/src/Layout/Pattern/AspNetCachePatternConverter.cs @@ -1,77 +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 - -// .NET Compact Framework 1.0 has no support for ASP.NET -// SSCLI 1.0 has no support for ASP.NET -#if !NETCF && !SSCLI - -using System.IO; -using System.Web; -using log4net.Core; -using log4net.Util; - -namespace log4net.Layout.Pattern -{ - /// - /// Converter for items in the ASP.Net Cache. - /// - /// - /// - /// Outputs an item from the . - /// - /// - /// Ron Grabowski - internal sealed class AspNetCachePatternConverter : AspNetPatternLayoutConverter - { - /// - /// Write the ASP.Net Cache item to the output - /// - /// that will receive the formatted result. - /// The on which the pattern converter should be executed. - /// The under which the ASP.Net request is running. - /// - /// - /// Writes out the value of a named property. The property name - /// should be set in the - /// property. If no property has been set, all key value pairs from the Cache will - /// be written to the output. - /// - /// - protected override void Convert(TextWriter writer, LoggingEvent loggingEvent, HttpContext httpContext) - { - if (HttpRuntime.Cache != null) - { - if (Option != null) - { - WriteObject(writer, loggingEvent.Repository, HttpRuntime.Cache[Option]); - } - else - { - WriteObject(writer, loggingEvent.Repository, HttpRuntime.Cache.GetEnumerator()); - } - } - else - { - writer.Write(SystemInfo.NotAvailableText); - } - } - } -} - +#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 + +// .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; +using log4net.Util; + +namespace log4net.Layout.Pattern +{ + /// + /// Converter for items in the ASP.Net Cache. + /// + /// + /// + /// Outputs an item from the . + /// + /// + /// Ron Grabowski + internal sealed class AspNetCachePatternConverter : AspNetPatternLayoutConverter + { + /// + /// Write the ASP.Net Cache item to the output + /// + /// that will receive the formatted result. + /// The on which the pattern converter should be executed. + /// The under which the ASP.Net request is running. + /// + /// + /// Writes out the value of a named property. The property name + /// should be set in the + /// property. If no property has been set, all key value pairs from the Cache will + /// be written to the output. + /// + /// + protected override void Convert(TextWriter writer, LoggingEvent loggingEvent, HttpContext httpContext) + { + if (HttpRuntime.Cache != null) + { + if (Option != null) + { + WriteObject(writer, loggingEvent.Repository, HttpRuntime.Cache[Option]); + } + else + { + WriteObject(writer, loggingEvent.Repository, HttpRuntime.Cache.GetEnumerator()); + } + } + else + { + writer.Write(SystemInfo.NotAvailableText); + } + } + } +} + #endif \ No newline at end of file diff --git a/src/Layout/Pattern/AspNetContextPatternConverter.cs b/src/Layout/Pattern/AspNetContextPatternConverter.cs index 0075f357..61a9e179 100644 --- a/src/Layout/Pattern/AspNetContextPatternConverter.cs +++ b/src/Layout/Pattern/AspNetContextPatternConverter.cs @@ -1,68 +1,68 @@ -#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 - -// .NET Compact Framework 1.0 has no support for ASP.NET -// SSCLI 1.0 has no support for ASP.NET -#if !NETCF && !SSCLI - -using System.IO; -using System.Web; -using log4net.Core; - -namespace log4net.Layout.Pattern -{ - /// - /// Converter for items in the . - /// - /// - /// - /// Outputs an item from the . - /// - /// - /// Ron Grabowski - internal sealed class AspNetContextPatternConverter : AspNetPatternLayoutConverter - { - /// - /// Write the ASP.Net HttpContext item to the output - /// - /// that will receive the formatted result. - /// The on which the pattern converter should be executed. - /// The under which the ASP.Net request is running. - /// - /// - /// Writes out the value of a named property. The property name - /// should be set in the - /// property. - /// - /// - protected override void Convert(TextWriter writer, LoggingEvent loggingEvent, HttpContext httpContext) - { - if (Option != null) - { - WriteObject(writer, loggingEvent.Repository, httpContext.Items[Option]); - } - else - { - WriteObject(writer, loggingEvent.Repository, httpContext.Items); - } - } - } -} - +#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 + +// .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; + +namespace log4net.Layout.Pattern +{ + /// + /// Converter for items in the . + /// + /// + /// + /// Outputs an item from the . + /// + /// + /// Ron Grabowski + internal sealed class AspNetContextPatternConverter : AspNetPatternLayoutConverter + { + /// + /// Write the ASP.Net HttpContext item to the output + /// + /// that will receive the formatted result. + /// The on which the pattern converter should be executed. + /// The under which the ASP.Net request is running. + /// + /// + /// Writes out the value of a named property. The property name + /// should be set in the + /// property. + /// + /// + protected override void Convert(TextWriter writer, LoggingEvent loggingEvent, HttpContext httpContext) + { + if (Option != null) + { + WriteObject(writer, loggingEvent.Repository, httpContext.Items[Option]); + } + else + { + WriteObject(writer, loggingEvent.Repository, httpContext.Items); + } + } + } +} + #endif \ No newline at end of file diff --git a/src/Layout/Pattern/AspNetPatternConverter.cs b/src/Layout/Pattern/AspNetPatternConverter.cs index 9499ef1f..7201ecd4 100644 --- a/src/Layout/Pattern/AspNetPatternConverter.cs +++ b/src/Layout/Pattern/AspNetPatternConverter.cs @@ -1,65 +1,65 @@ -#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 - -// .NET Compact Framework 1.0 has no support for ASP.NET -// SSCLI 1.0 has no support for ASP.NET -#if !NETCF && !SSCLI - -using System.IO; -using System.Web; -using log4net.Core; -using log4net.Util; - -namespace log4net.Layout.Pattern -{ - /// - /// Abstract class that provides access to the current HttpContext () that - /// derived classes need. - /// - /// - /// This class handles the case when HttpContext.Current is null by writing - /// to the writer. - /// - /// Ron Grabowski - internal abstract class AspNetPatternLayoutConverter : PatternLayoutConverter - { - protected override void Convert(TextWriter writer, LoggingEvent loggingEvent) - { - if (HttpContext.Current == null) - { - writer.Write(SystemInfo.NotAvailableText); - } - else - { - Convert(writer, loggingEvent, HttpContext.Current); - } - } - - /// - /// Derived pattern converters must override this method in order to - /// convert conversion specifiers in the correct way. - /// - /// that will receive the formatted result. - /// The on which the pattern converter should be executed. - /// The under which the ASP.Net request is running. - protected abstract void Convert(TextWriter writer, LoggingEvent loggingEvent, HttpContext httpContext); - } -} - +#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 + +// .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; +using log4net.Util; + +namespace log4net.Layout.Pattern +{ + /// + /// Abstract class that provides access to the current HttpContext () that + /// derived classes need. + /// + /// + /// This class handles the case when HttpContext.Current is null by writing + /// to the writer. + /// + /// Ron Grabowski + internal abstract class AspNetPatternLayoutConverter : PatternLayoutConverter + { + protected override void Convert(TextWriter writer, LoggingEvent loggingEvent) + { + if (HttpContext.Current == null) + { + writer.Write(SystemInfo.NotAvailableText); + } + else + { + Convert(writer, loggingEvent, HttpContext.Current); + } + } + + /// + /// Derived pattern converters must override this method in order to + /// convert conversion specifiers in the correct way. + /// + /// that will receive the formatted result. + /// The on which the pattern converter should be executed. + /// The under which the ASP.Net request is running. + protected abstract void Convert(TextWriter writer, LoggingEvent loggingEvent, HttpContext httpContext); + } +} + #endif \ No newline at end of file diff --git a/src/Layout/Pattern/AspNetRequestPatternConverter.cs b/src/Layout/Pattern/AspNetRequestPatternConverter.cs index 912ab545..ca810f60 100644 --- a/src/Layout/Pattern/AspNetRequestPatternConverter.cs +++ b/src/Layout/Pattern/AspNetRequestPatternConverter.cs @@ -1,76 +1,86 @@ -#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 - -// .NET Compact Framework 1.0 has no support for ASP.NET -// SSCLI 1.0 has no support for ASP.NET -#if !NETCF && !SSCLI - -using System.IO; -using System.Web; -using log4net.Core; -using log4net.Util; - -namespace log4net.Layout.Pattern -{ - /// - /// Converter for items in the ASP.Net Cache. - /// - /// - /// - /// Outputs an item from the . - /// - /// - /// Ron Grabowski - internal sealed class AspNetRequestPatternConverter : AspNetPatternLayoutConverter - { - /// - /// Write the ASP.Net Cache item to the output - /// - /// that will receive the formatted result. - /// The on which the pattern converter should be executed. - /// The under which the ASP.Net request is running. - /// - /// - /// Writes out the value of a named property. The property name - /// should be set in the - /// property. - /// - /// - protected override void Convert(TextWriter writer, LoggingEvent loggingEvent, HttpContext httpContext) - { - if (httpContext.Request != null) - { - if (Option != null) - { - WriteObject(writer, loggingEvent.Repository, httpContext.Request.Params[Option]); - } - else - { - WriteObject(writer, loggingEvent.Repository, httpContext.Request.Params); - } - } - else - { - writer.Write(SystemInfo.NotAvailableText); - } - } - } -} - +#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 + +// .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; +using log4net.Util; + +namespace log4net.Layout.Pattern +{ + /// + /// Converter for items in the ASP.Net Cache. + /// + /// + /// + /// Outputs an item from the . + /// + /// + /// Ron Grabowski + internal sealed class AspNetRequestPatternConverter : AspNetPatternLayoutConverter + { + /// + /// Write the ASP.Net Cache item to the output + /// + /// that will receive the formatted result. + /// The on which the pattern converter should be executed. + /// The under which the ASP.Net request is running. + /// + /// + /// Writes out the value of a named property. The property name + /// should be set in the + /// property. + /// + /// + protected override void Convert(TextWriter writer, LoggingEvent loggingEvent, HttpContext httpContext) + { + HttpRequest request = null; + try { + request = httpContext.Request; + } catch (HttpException) { + // likely a case of running in IIS integrated mode + // when inside an Application_Start event. + // treat it like a case of the Request + // property returning null + } + + if (request != null) + { + if (Option != null) + { + WriteObject(writer, loggingEvent.Repository, httpContext.Request.Params[Option]); + } + else + { + WriteObject(writer, loggingEvent.Repository, httpContext.Request.Params); + } + } + else + { + writer.Write(SystemInfo.NotAvailableText); + } + } + } +} + #endif \ No newline at end of file diff --git a/src/Layout/Pattern/AspNetSessionPatternConverter.cs b/src/Layout/Pattern/AspNetSessionPatternConverter.cs index 52fb2d0e..f50ad8a5 100644 --- a/src/Layout/Pattern/AspNetSessionPatternConverter.cs +++ b/src/Layout/Pattern/AspNetSessionPatternConverter.cs @@ -1,77 +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 - -// .NET Compact Framework 1.0 has no support for ASP.NET -// SSCLI 1.0 has no support for ASP.NET -#if !NETCF && !SSCLI - -using System.IO; -using System.Web; -using log4net.Core; -using log4net.Util; - -namespace log4net.Layout.Pattern -{ - /// - /// Converter for items in the ASP.Net Cache. - /// - /// - /// - /// Outputs an item from the . - /// - /// - /// Ron Grabowski - internal sealed class AspNetSessionPatternConverter : AspNetPatternLayoutConverter - { - /// - /// Write the ASP.Net Cache item to the output - /// - /// that will receive the formatted result. - /// The on which the pattern converter should be executed. - /// The under which the ASP.Net request is running. - /// - /// - /// Writes out the value of a named property. The property name - /// should be set in the - /// property. If no property has been set, all key value pairs from the Session will - /// be written to the output. - /// - /// - protected override void Convert(TextWriter writer, LoggingEvent loggingEvent, HttpContext httpContext) - { - if (httpContext.Session != null) - { - if (Option != null) - { - WriteObject(writer, loggingEvent.Repository, httpContext.Session.Contents[Option]); - } - else - { - WriteObject(writer, loggingEvent.Repository, httpContext.Session); - } - } - else - { - writer.Write(SystemInfo.NotAvailableText); - } - } - } -} - +#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 + +// .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; +using log4net.Util; + +namespace log4net.Layout.Pattern +{ + /// + /// Converter for items in the ASP.Net Cache. + /// + /// + /// + /// Outputs an item from the . + /// + /// + /// Ron Grabowski + internal sealed class AspNetSessionPatternConverter : AspNetPatternLayoutConverter + { + /// + /// Write the ASP.Net Cache item to the output + /// + /// that will receive the formatted result. + /// The on which the pattern converter should be executed. + /// The under which the ASP.Net request is running. + /// + /// + /// Writes out the value of a named property. The property name + /// should be set in the + /// property. If no property has been set, all key value pairs from the Session will + /// be written to the output. + /// + /// + protected override void Convert(TextWriter writer, LoggingEvent loggingEvent, HttpContext httpContext) + { + if (httpContext.Session != null) + { + if (Option != null) + { + WriteObject(writer, loggingEvent.Repository, httpContext.Session.Contents[Option]); + } + else + { + WriteObject(writer, loggingEvent.Repository, httpContext.Session); + } + } + else + { + writer.Write(SystemInfo.NotAvailableText); + } + } + } +} + #endif \ No newline at end of file diff --git a/src/Layout/Pattern/DatePatternConverter.cs b/src/Layout/Pattern/DatePatternConverter.cs old mode 100755 new mode 100644 index a56c694d..72d3df1a --- a/src/Layout/Pattern/DatePatternConverter.cs +++ b/src/Layout/Pattern/DatePatternConverter.cs @@ -18,7 +18,6 @@ #endregion using System; -using System.Text; using System.IO; using log4net.Core; @@ -69,7 +68,7 @@ namespace log4net.Layout.Pattern /// /// Any other pattern string uses the formatter. /// This formatter passes the pattern string to the - /// method. + /// method. /// For details on valid patterns see /// DateTimeFormatInfo Class. /// @@ -119,20 +118,20 @@ public void ActivateOptions() { dateFormatStr = AbsoluteTimeDateFormatter.Iso8601TimeDateFormat; } - - if (string.Compare(dateFormatStr, AbsoluteTimeDateFormatter.Iso8601TimeDateFormat, true, System.Globalization.CultureInfo.InvariantCulture) == 0) + + if (SystemInfo.EqualsIgnoringCase(dateFormatStr, AbsoluteTimeDateFormatter.Iso8601TimeDateFormat)) { m_dateFormatter = new Iso8601DateFormatter(); } - else if (string.Compare(dateFormatStr, AbsoluteTimeDateFormatter.AbsoluteTimeDateFormat, true, System.Globalization.CultureInfo.InvariantCulture) == 0) + else if (SystemInfo.EqualsIgnoringCase(dateFormatStr, AbsoluteTimeDateFormatter.AbsoluteTimeDateFormat)) { m_dateFormatter = new AbsoluteTimeDateFormatter(); } - else if (string.Compare(dateFormatStr, AbsoluteTimeDateFormatter.DateAndTimeDateFormat, true, System.Globalization.CultureInfo.InvariantCulture) == 0) + else if (SystemInfo.EqualsIgnoringCase(dateFormatStr, AbsoluteTimeDateFormatter.DateAndTimeDateFormat)) { m_dateFormatter = new DateTimeDateFormatter(); } - else + else { try { diff --git a/src/Layout/Pattern/ExceptionPatternConverter.cs b/src/Layout/Pattern/ExceptionPatternConverter.cs old mode 100755 new mode 100644 index f522d87d..06d3928f --- a/src/Layout/Pattern/ExceptionPatternConverter.cs +++ b/src/Layout/Pattern/ExceptionPatternConverter.cs @@ -106,9 +106,11 @@ override protected void Convert(TextWriter writer, LoggingEvent loggingEvent) case "stacktrace": WriteObject(writer, loggingEvent.Repository, loggingEvent.ExceptionObject.StackTrace); break; +#if !NETSTANDARD1_3 case "targetsite": WriteObject(writer, loggingEvent.Repository, loggingEvent.ExceptionObject.TargetSite); break; +#endif case "helplink": WriteObject(writer, loggingEvent.Repository, loggingEvent.ExceptionObject.HelpLink); break; diff --git a/src/Layout/Pattern/FileLocationPatternConverter.cs b/src/Layout/Pattern/FileLocationPatternConverter.cs old mode 100755 new mode 100644 diff --git a/src/Layout/Pattern/FullLocationPatternConverter.cs b/src/Layout/Pattern/FullLocationPatternConverter.cs old mode 100755 new mode 100644 diff --git a/src/Layout/Pattern/IdentityPatternConverter.cs b/src/Layout/Pattern/IdentityPatternConverter.cs old mode 100755 new mode 100644 diff --git a/src/Layout/Pattern/LevelPatternConverter.cs b/src/Layout/Pattern/LevelPatternConverter.cs old mode 100755 new mode 100644 diff --git a/src/Layout/Pattern/LineLocationPatternConverter.cs b/src/Layout/Pattern/LineLocationPatternConverter.cs old mode 100755 new mode 100644 diff --git a/src/Layout/Pattern/LoggerPatternConverter.cs b/src/Layout/Pattern/LoggerPatternConverter.cs old mode 100755 new mode 100644 diff --git a/src/Layout/Pattern/MessagePatternConverter.cs b/src/Layout/Pattern/MessagePatternConverter.cs old mode 100755 new mode 100644 diff --git a/src/Layout/Pattern/MethodLocationPatternConverter.cs b/src/Layout/Pattern/MethodLocationPatternConverter.cs old mode 100755 new mode 100644 diff --git a/src/Layout/Pattern/NamedPatternConverter.cs b/src/Layout/Pattern/NamedPatternConverter.cs old mode 100755 new mode 100644 index 9d973261..8338706e --- a/src/Layout/Pattern/NamedPatternConverter.cs +++ b/src/Layout/Pattern/NamedPatternConverter.cs @@ -42,9 +42,9 @@ namespace log4net.Layout.Pattern /// /// /// Nicko Cadell - internal abstract class NamedPatternConverter : PatternLayoutConverter, IOptionHandler + public abstract class NamedPatternConverter : PatternLayoutConverter, IOptionHandler { - protected int m_precision = 0; + private int m_precision = 0; #region Implementation of IOptionHandler @@ -120,31 +120,37 @@ public void ActivateOptions() /// Render the to the precision /// specified by the property. /// - override protected void Convert(TextWriter writer, LoggingEvent loggingEvent) + sealed override protected void Convert(TextWriter writer, LoggingEvent loggingEvent) { string name = GetFullyQualifiedName(loggingEvent); - if (m_precision <= 0) + if (m_precision <= 0 || name == null || name.Length < 2) { writer.Write(name); } else { int len = name.Length; + string trailingDot = string.Empty; + if (name.EndsWith(DOT)) + { + trailingDot = DOT; + name = name.Substring(0, len - 1); + len--; + } - // We subtract 1 from 'len' when assigning to 'end' to avoid out of - // bounds exception in return name.Substring(end+1, len). This can happen if - // precision is 1 and the logger name ends with a dot. - int end = len - 1; - for(int i=m_precision; i>0; i--) - { - end = name.LastIndexOf('.', end-1); - if (end == -1) - { - writer.Write(name); - return; - } - } - writer.Write(name.Substring(end+1, len-end-1)); + int end = name.LastIndexOf(DOT); + for(int i = 1; end > 0 && i < m_precision; i++) + { + end = name.LastIndexOf('.', end - 1); + } + if (end == -1) + { + writer.Write(name + trailingDot); + } + else + { + writer.Write(name.Substring(end + 1, len - end - 1) + trailingDot); + } } } @@ -159,6 +165,7 @@ override protected void Convert(TextWriter writer, LoggingEvent loggingEvent) /// private readonly static Type declaringType = typeof(NamedPatternConverter); + private const string DOT = "."; #endregion Private Static Fields } } diff --git a/src/Layout/Pattern/NdcPatternConverter.cs b/src/Layout/Pattern/NdcPatternConverter.cs old mode 100755 new mode 100644 diff --git a/src/Layout/Pattern/PatternLayoutConverter.cs b/src/Layout/Pattern/PatternLayoutConverter.cs old mode 100755 new mode 100644 diff --git a/src/Layout/Pattern/PropertyPatternConverter.cs b/src/Layout/Pattern/PropertyPatternConverter.cs old mode 100755 new mode 100644 diff --git a/src/Layout/Pattern/RelativeTimePatternConverter.cs b/src/Layout/Pattern/RelativeTimePatternConverter.cs old mode 100755 new mode 100644 index aa1cf276..a5d3495b --- a/src/Layout/Pattern/RelativeTimePatternConverter.cs +++ b/src/Layout/Pattern/RelativeTimePatternConverter.cs @@ -50,7 +50,7 @@ internal sealed class RelativeTimePatternConverter : PatternLayoutConverter /// override protected void Convert(TextWriter writer, LoggingEvent loggingEvent) { - writer.Write( TimeDifferenceInMillis(LoggingEvent.StartTime, loggingEvent.TimeStamp).ToString(System.Globalization.NumberFormatInfo.InvariantInfo) ); + writer.Write( TimeDifferenceInMillis(LoggingEvent.StartTimeUtc, loggingEvent.TimeStampUtc).ToString(System.Globalization.NumberFormatInfo.InvariantInfo) ); } /// diff --git a/src/Layout/Pattern/StackTraceDetailPatternConverter.cs b/src/Layout/Pattern/StackTraceDetailPatternConverter.cs index 6fec5f20..2bc54934 100644 --- a/src/Layout/Pattern/StackTraceDetailPatternConverter.cs +++ b/src/Layout/Pattern/StackTraceDetailPatternConverter.cs @@ -1,90 +1,91 @@ -using System; -using System.Collections; -using System.Text; - -using log4net.Util; -using log4net.Core; - -namespace log4net.Layout.Pattern -{ - /// - /// Write the caller stack frames to the output - /// - /// - /// - /// Writes the to the output writer, using format: - /// type3.MethodCall3(type param,...) > type2.MethodCall2(type param,...) > type1.MethodCall1(type param,...) - /// - /// - /// Adam Davies - internal class StackTraceDetailPatternConverter : StackTracePatternConverter - { - internal override string GetMethodInformation(System.Reflection.MethodBase method) - { - string returnValue=""; - - try - { - string param = ""; - string[] names = GetMethodParameterNames(method); - StringBuilder sb = new StringBuilder(); - if (names != null && names.GetUpperBound(0) > 0) - { - for (int i = 0; i <= names.GetUpperBound(0); i++) - { - sb.AppendFormat("{0}, ", names[i]); - } - } - - if (sb.Length > 0) - { - sb.Remove(sb.Length - 2, 2); - param = sb.ToString(); - } - - returnValue=base.GetMethodInformation(method) + "(" + param + ")"; - } - catch (Exception ex) - { - LogLog.Error(declaringType, "An exception ocurred while retreiving method information.", ex); - } - - return returnValue; - } - - private string[] GetMethodParameterNames(System.Reflection.MethodBase methodBase) - { - ArrayList methodParameterNames = new ArrayList(); - try - { - System.Reflection.ParameterInfo[] methodBaseGetParameters = methodBase.GetParameters(); - - int methodBaseGetParametersCount = methodBaseGetParameters.GetUpperBound(0); - - for (int i = 0; i <= methodBaseGetParametersCount; i++) - { - methodParameterNames.Add(methodBaseGetParameters[i].ParameterType + " " + methodBaseGetParameters[i].Name); - } - } - catch (Exception ex) - { - LogLog.Error(declaringType, "An exception ocurred while retreiving method parameters.", ex); - } - - return (string[])methodParameterNames.ToArray(typeof (string)); - } - - #region Private Static Fields - - /// - /// The fully qualified type of the StackTraceDetailPatternConverter class. - /// - /// - /// Used by the internal logger to record the Type of the - /// log message. - /// - private readonly static Type declaringType = typeof(StackTracePatternConverter); - - #endregion Private Static Fields - } -} +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ +#if !NETCF + +using System; +using System.Collections; +using System.Text; + +using log4net.Util; +using log4net.Core; + +namespace log4net.Layout.Pattern +{ + /// + /// Write the caller stack frames to the output + /// + /// + /// + /// Writes the to the output writer, using format: + /// type3.MethodCall3(type param,...) > type2.MethodCall2(type param,...) > type1.MethodCall1(type param,...) + /// + /// + /// Adam Davies + internal class StackTraceDetailPatternConverter : StackTracePatternConverter + { + internal override string GetMethodInformation(MethodItem method) + { + string returnValue=""; + + try + { + string param = ""; + string[] names = method.Parameters; + StringBuilder sb = new StringBuilder(); + if (names != null && names.GetUpperBound(0) > 0) + { + for (int i = 0; i <= names.GetUpperBound(0); i++) + { + sb.AppendFormat("{0}, ", names[i]); + } + } + + if (sb.Length > 0) + { + sb.Remove(sb.Length - 2, 2); + param = sb.ToString(); + } + + returnValue=base.GetMethodInformation(method) + "(" + param + ")"; + } + catch (Exception ex) + { + LogLog.Error(declaringType, "An exception ocurred while retreiving method information.", ex); + } + + return returnValue; + } + + #region Private Static Fields + + /// + /// The fully qualified type of the StackTraceDetailPatternConverter class. + /// + /// + /// Used by the internal logger to record the Type of the + /// log message. + /// + private readonly static Type declaringType = typeof(StackTracePatternConverter); + + #endregion Private Static Fields + } +} +#endif \ No newline at end of file diff --git a/src/Layout/Pattern/StackTracePatternConverter.cs b/src/Layout/Pattern/StackTracePatternConverter.cs index 6e57242a..747b6628 100644 --- a/src/Layout/Pattern/StackTracePatternConverter.cs +++ b/src/Layout/Pattern/StackTracePatternConverter.cs @@ -1,149 +1,150 @@ -#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.Diagnostics; - -using log4net.Util; -using log4net.Core; - -namespace log4net.Layout.Pattern -{ - /// - /// Write the caller stack frames to the output - /// - /// - /// - /// Writes the to the output writer, using format: - /// type3.MethodCall3 > type2.MethodCall2 > type1.MethodCall1 - /// - /// - /// Michael Cromwell - internal class StackTracePatternConverter : PatternLayoutConverter, IOptionHandler - { - private int m_stackFrameLevel = 1; - - /// - /// Initialize the converter - /// - /// - /// - /// This is part of the delayed object - /// activation scheme. The method must - /// be called on this object after the configuration properties have - /// been set. Until is called this - /// object is in an undefined state and must not be used. - /// - /// - /// If any of the configuration properties are modified then - /// must be called again. - /// - /// - public void ActivateOptions() - { - if (Option == null) - return; - - string optStr = Option.Trim(); - if (optStr.Length != 0) - { - int stackLevelVal; - if (SystemInfo.TryParse(optStr, out stackLevelVal)) - { - if (stackLevelVal <= 0) - { - LogLog.Error(declaringType, "StackTracePatternConverter: StackeFrameLevel option (" + optStr + ") isn't a positive integer."); - } - else - { - m_stackFrameLevel = stackLevelVal; - } - } - else - { - LogLog.Error(declaringType, "StackTracePatternConverter: StackFrameLevel option \"" + optStr + "\" not a decimal integer."); - } - } - } - - /// - /// Write the strack frames to the output - /// - /// that will receive the formatted result. - /// the event being logged - /// - /// - /// Writes the to the output writer. - /// - /// - override protected void Convert(TextWriter writer, LoggingEvent loggingEvent) - { - StackFrame[] stackframes = loggingEvent.LocationInformation.StackFrames; - if ((stackframes == null) || (stackframes.Length <= 0)) - { - LogLog.Error(declaringType, "loggingEvent.LocationInformation.StackFrames was null or empty."); - return; - } - - int stackFrameIndex = m_stackFrameLevel - 1; - while (stackFrameIndex >= 0) - { - if (stackFrameIndex > stackframes.Length) - { - stackFrameIndex--; - continue; - } - - StackFrame stackFrame = stackframes[stackFrameIndex]; - writer.Write("{0}.{1}", stackFrame.GetMethod().DeclaringType.Name, GetMethodInformation(stackFrame.GetMethod())); - if (stackFrameIndex > 0) - { - // TODO: make this user settable? - writer.Write(" > "); - } - stackFrameIndex--; - } - } - - /// - /// Returns the Name of the method - /// - /// - /// This method was created, so this class could be used as a base class for StackTraceDetailPatternConverter - /// string - internal virtual string GetMethodInformation(System.Reflection.MethodBase method) - { - return method.Name; - } - - #region Private Static Fields - - /// - /// The fully qualified type of the StackTracePatternConverter class. - /// - /// - /// Used by the internal logger to record the Type of the - /// log message. - /// - private readonly static Type declaringType = typeof(StackTracePatternConverter); - - #endregion Private Static Fields - } -} +#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 !NETCF +using System; +using System.IO; +using System.Diagnostics; + +using log4net.Util; +using log4net.Core; + +namespace log4net.Layout.Pattern +{ + /// + /// Write the caller stack frames to the output + /// + /// + /// + /// Writes the to the output writer, using format: + /// type3.MethodCall3 > type2.MethodCall2 > type1.MethodCall1 + /// + /// + /// Michael Cromwell + internal class StackTracePatternConverter : PatternLayoutConverter, IOptionHandler + { + private int m_stackFrameLevel = 1; + + /// + /// Initialize the converter + /// + /// + /// + /// This is part of the delayed object + /// activation scheme. The method must + /// be called on this object after the configuration properties have + /// been set. Until is called this + /// object is in an undefined state and must not be used. + /// + /// + /// If any of the configuration properties are modified then + /// must be called again. + /// + /// + public void ActivateOptions() + { + if (Option == null) + return; + + string optStr = Option.Trim(); + if (optStr.Length != 0) + { + int stackLevelVal; + if (SystemInfo.TryParse(optStr, out stackLevelVal)) + { + if (stackLevelVal <= 0) + { + LogLog.Error(declaringType, "StackTracePatternConverter: StackeFrameLevel option (" + optStr + ") isn't a positive integer."); + } + else + { + m_stackFrameLevel = stackLevelVal; + } + } + else + { + LogLog.Error(declaringType, "StackTracePatternConverter: StackFrameLevel option \"" + optStr + "\" not a decimal integer."); + } + } + } + + /// + /// Write the strack frames to the output + /// + /// that will receive the formatted result. + /// the event being logged + /// + /// + /// Writes the to the output writer. + /// + /// + override protected void Convert(TextWriter writer, LoggingEvent loggingEvent) + { + StackFrameItem[] stackframes = loggingEvent.LocationInformation.StackFrames; + if ((stackframes == null) || (stackframes.Length <= 0)) + { + LogLog.Error(declaringType, "loggingEvent.LocationInformation.StackFrames was null or empty."); + return; + } + + int stackFrameIndex = m_stackFrameLevel - 1; + while (stackFrameIndex >= 0) + { + if (stackFrameIndex >= stackframes.Length) + { + stackFrameIndex--; + continue; + } + + StackFrameItem stackFrame = stackframes[stackFrameIndex]; + writer.Write("{0}.{1}", stackFrame.ClassName, GetMethodInformation(stackFrame.Method)); + if (stackFrameIndex > 0) + { + // TODO: make this user settable? + writer.Write(" > "); + } + stackFrameIndex--; + } + } + + /// + /// Returns the Name of the method + /// + /// + /// This method was created, so this class could be used as a base class for StackTraceDetailPatternConverter + /// string + internal virtual string GetMethodInformation(MethodItem method) + { + return method.Name; + } + + #region Private Static Fields + + /// + /// The fully qualified type of the StackTracePatternConverter class. + /// + /// + /// Used by the internal logger to record the Type of the + /// log message. + /// + private readonly static Type declaringType = typeof(StackTracePatternConverter); + + #endregion Private Static Fields + } +} +#endif diff --git a/src/Layout/Pattern/ThreadPatternConverter.cs b/src/Layout/Pattern/ThreadPatternConverter.cs old mode 100755 new mode 100644 diff --git a/src/Layout/Pattern/TypeNamePatternConverter.cs b/src/Layout/Pattern/TypeNamePatternConverter.cs old mode 100755 new mode 100644 diff --git a/src/Layout/Pattern/UserNamePatternConverter.cs b/src/Layout/Pattern/UserNamePatternConverter.cs old mode 100755 new mode 100644 diff --git a/src/Layout/Pattern/UtcDatePatternConverter.cs b/src/Layout/Pattern/UtcDatePatternConverter.cs old mode 100755 new mode 100644 index ea691f63..41caf288 --- a/src/Layout/Pattern/UtcDatePatternConverter.cs +++ b/src/Layout/Pattern/UtcDatePatternConverter.cs @@ -67,7 +67,7 @@ override protected void Convert(TextWriter writer, LoggingEvent loggingEvent) { try { - m_dateFormatter.FormatDate(loggingEvent.TimeStamp.ToUniversalTime(), writer); + m_dateFormatter.FormatDate(loggingEvent.TimeStampUtc, writer); } catch (Exception ex) { diff --git a/src/Layout/PatternLayout.cs b/src/Layout/PatternLayout.cs old mode 100755 new mode 100644 index 863087be..31a56443 --- a/src/Layout/PatternLayout.cs +++ b/src/Layout/PatternLayout.cs @@ -20,6 +20,9 @@ using System; using System.Collections; using System.IO; +#if NETSTANDARD1_3 +using System.Reflection; +#endif using log4net.Core; using log4net.Layout.Pattern; @@ -39,7 +42,7 @@ namespace log4net.Layout /// /// /// - /// The goal of this class is to a + /// The goal of this class is to a /// as a string. The results /// depend on the conversion pattern. /// @@ -106,26 +109,46 @@ namespace log4net.Layout /// /// aspnet-cache /// - /// TODO + /// + /// Used to output all cache items in the case of %aspnet-cache or just one named item if used as %aspnet-cache{key} + /// + /// + /// This pattern is not available for Compact Framework or Client Profile assemblies. + /// /// /// /// /// aspnet-context /// - /// TODO - /// + /// + /// Used to output all context items in the case of %aspnet-context or just one named item if used as %aspnet-context{key} + /// + /// + /// This pattern is not available for Compact Framework or Client Profile assemblies. + /// + /// /// /// /// aspnet-request /// - /// TODO - /// + /// + /// Used to output all request parameters in the case of %aspnet-request or just one named param if used as %aspnet-request{key} + /// + /// + /// This pattern is not available for Compact Framework or Client Profile assemblies. + /// + /// /// /// /// aspnet-session /// - /// TODO - /// + /// + /// Used to output all session items in the case of %aspnet-session or just one named item if used as %aspnet-session{key} + /// + /// + /// This pattern is not available for Compact Framework or Client Profile assemblies. + /// + /// /// /// /// c @@ -158,7 +181,7 @@ namespace log4net.Layout /// /// /// The date format specifier admits the same syntax as the - /// time pattern string of the . + /// time pattern string of the . /// /// /// For better results it is recommended to use the log4net date @@ -171,7 +194,7 @@ namespace log4net.Layout /// /// /// These dedicated date formatters perform significantly - /// better than . + /// better than . /// /// /// @@ -446,9 +469,34 @@ namespace log4net.Layout /// between braces. For example, %stacktrace{level}. /// If no stack trace level specifier is given then 1 is assumed /// - /// + /// + /// Output uses the format: + /// type3.MethodCall3 > type2.MethodCall2 > type1.MethodCall1 + /// + /// + /// This pattern is not available for Compact Framework assemblies. + /// + /// /// - /// + /// + /// stacktracedetail + /// + /// + /// Used to output the stack trace of the logging event + /// The stack trace level specifier may be enclosed + /// between braces. For example, %stacktracedetail{level}. + /// If no stack trace level specifier is given then 1 is assumed + /// + /// + /// Output uses the format: + /// type3.MethodCall3(type param,...) > type2.MethodCall2(type param,...) > type1.MethodCall1(type param,...) + /// + /// + /// This pattern is not available for Compact Framework assemblies. + /// + /// + /// + /// /// t /// Equivalent to thread /// @@ -530,7 +578,7 @@ namespace log4net.Layout /// /// /// The date format specifier admits the same syntax as the - /// time pattern string of the . + /// time pattern string of the . /// /// /// For better results it is recommended to use the log4net date @@ -543,7 +591,7 @@ namespace log4net.Layout /// /// /// These dedicated date formatters perform significantly - /// better than . + /// better than . /// /// /// @@ -715,7 +763,7 @@ namespace log4net.Layout /// /// /// Additional pattern converters may be registered with a specific - /// instance using the method. + /// instance using the method. /// /// /// @@ -816,7 +864,7 @@ static PatternLayout() // .NET Compact Framework 1.0 has no support for ASP.NET // SSCLI 1.0 has no support for ASP.NET -#if !NETCF && !SSCLI +#if !NETCF && !SSCLI && !CLIENT_PROFILE && !NETSTANDARD1_3 s_globalRulesRegistry.Add("aspnet-cache", typeof(AspNetCachePatternConverter)); s_globalRulesRegistry.Add("aspnet-context", typeof(AspNetContextPatternConverter)); s_globalRulesRegistry.Add("aspnet-request", typeof(AspNetRequestPatternConverter)); @@ -860,8 +908,10 @@ static PatternLayout() 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)); @@ -1078,7 +1128,7 @@ override public void Format(TextWriter writer, LoggingEvent loggingEvent) /// /// /// This version of the method is used by the configurator. - /// Programmatic users should use the alternative method. + /// Programmatic users should use the alternative method. /// /// public void AddConverter(ConverterInfo converterInfo) diff --git a/src/Layout/RawLayoutConverter.cs b/src/Layout/RawLayoutConverter.cs old mode 100755 new mode 100644 index d287d7d9..7ccfe77a --- a/src/Layout/RawLayoutConverter.cs +++ b/src/Layout/RawLayoutConverter.cs @@ -18,6 +18,9 @@ #endregion using System; +#if NETSTANDARD1_3 +using System.Reflection; +#endif using log4net; using log4net.Core; diff --git a/src/Layout/RawPropertyLayout.cs b/src/Layout/RawPropertyLayout.cs old mode 100755 new mode 100644 diff --git a/src/Layout/RawTimeStampLayout.cs b/src/Layout/RawTimeStampLayout.cs old mode 100755 new mode 100644 diff --git a/src/Layout/RawUtcTimeStampLayout.cs b/src/Layout/RawUtcTimeStampLayout.cs old mode 100755 new mode 100644 index 4a06329f..2c232ae4 --- a/src/Layout/RawUtcTimeStampLayout.cs +++ b/src/Layout/RawUtcTimeStampLayout.cs @@ -66,7 +66,7 @@ public RawUtcTimeStampLayout() /// public virtual object Format(LoggingEvent loggingEvent) { - return loggingEvent.TimeStamp.ToUniversalTime(); + return loggingEvent.TimeStampUtc; } #endregion diff --git a/src/Layout/SimpleLayout.cs b/src/Layout/SimpleLayout.cs old mode 100755 new mode 100644 diff --git a/src/Layout/XMLLayout.cs b/src/Layout/XmlLayout.cs old mode 100755 new mode 100644 similarity index 99% rename from src/Layout/XMLLayout.cs rename to src/Layout/XmlLayout.cs index 6d8e4326..34f9750a --- a/src/Layout/XMLLayout.cs +++ b/src/Layout/XmlLayout.cs @@ -220,7 +220,7 @@ override protected void FormatXml(XmlWriter writer, LoggingEvent loggingEvent) writer.WriteStartElement(m_elmEvent); writer.WriteAttributeString(ATTR_LOGGER, loggingEvent.LoggerName); -#if NET_2_0 || NETCF_2_0 || MONO_2_0 +#if NET_2_0 || NETCF_2_0 || MONO_2_0 || NETSTANDARD1_3 writer.WriteAttributeString(ATTR_TIMESTAMP, XmlConvert.ToString(loggingEvent.TimeStamp, XmlDateTimeSerializationMode.Local)); #else writer.WriteAttributeString(ATTR_TIMESTAMP, XmlConvert.ToString(loggingEvent.TimeStamp)); diff --git a/src/Layout/XMLLayoutBase.cs b/src/Layout/XmlLayoutBase.cs old mode 100755 new mode 100644 similarity index 94% rename from src/Layout/XMLLayoutBase.cs rename to src/Layout/XmlLayoutBase.cs index 4a5cebcf..9b51653d --- a/src/Layout/XMLLayoutBase.cs +++ b/src/Layout/XmlLayoutBase.cs @@ -196,14 +196,18 @@ override public void Format(TextWriter writer, LoggingEvent loggingEvent) { throw new ArgumentNullException("loggingEvent"); } - - // Attach the protected writer to the TextWriter passed in - m_protectCloseTextWriter.Attach(writer); - - XmlTextWriter xmlWriter = new XmlTextWriter(m_protectCloseTextWriter); +#if NETSTANDARD1_3 + var settings = new XmlWriterSettings + { + Indent = false, + OmitXmlDeclaration = true + }; + var xmlWriter = XmlWriter.Create(new ProtectCloseTextWriter(writer), settings); +#else + XmlTextWriter xmlWriter = new XmlTextWriter(new ProtectCloseTextWriter(writer)); xmlWriter.Formatting = Formatting.None; xmlWriter.Namespaces = false; - +#endif // Write the event to the writer FormatXml(xmlWriter, loggingEvent); @@ -212,9 +216,6 @@ override public void Format(TextWriter writer, LoggingEvent loggingEvent) // Close on xmlWriter will ensure xml is flushed // the protected writer will ignore the actual close xmlWriter.Close(); - - // detach from the writer - m_protectCloseTextWriter.Attach(null); } #endregion Override implementation of LayoutSkeleton @@ -244,11 +245,6 @@ override public void Format(TextWriter writer, LoggingEvent loggingEvent) /// private bool m_locationInfo = false; - /// - /// Writer adapter that ignores Close - /// - private readonly ProtectCloseTextWriter m_protectCloseTextWriter = new ProtectCloseTextWriter(null); - /// /// The string to replace invalid chars with /// diff --git a/src/Layout/XmlLayoutSchemaLog4j.cs b/src/Layout/XmlLayoutSchemaLog4j.cs old mode 100755 new mode 100644 index a6598367..b4791022 --- a/src/Layout/XmlLayoutSchemaLog4j.cs +++ b/src/Layout/XmlLayoutSchemaLog4j.cs @@ -180,7 +180,7 @@ override protected void FormatXml(XmlWriter writer, LoggingEvent loggingEvent) // We must convert the TimeStamp to UTC before performing any mathematical // operations. This allows use to take into account discontinuities // caused by daylight savings time transitions. - TimeSpan timeSince1970 = loggingEvent.TimeStamp.ToUniversalTime() - s_date1970; + TimeSpan timeSince1970 = loggingEvent.TimeStampUtc - s_date1970; writer.WriteAttributeString("timestamp", XmlConvert.ToString((long)timeSince1970.TotalMilliseconds)); writer.WriteAttributeString("level", loggingEvent.Level.DisplayName); diff --git a/src/Log4netAssemblyInfo.cs b/src/Log4netAssemblyInfo.cs new file mode 100644 index 00000000..60337cc8 --- /dev/null +++ b/src/Log4netAssemblyInfo.cs @@ -0,0 +1,94 @@ +#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 { + + /// + /// Provides information about the environment the assembly has + /// been built for. + /// + public sealed class AssemblyInfo { + /// Version of the assembly + public const string Version = "2.0.8"; + + /// Version of the framework targeted +#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 + + /// Type of framework targeted +#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"; +#else + public const string TargetFramework = "Unknown"; +#endif + + /// Does it target a client profile? +#if !CLIENT_PROFILE + public const bool ClientProfile = false; +#else + public const bool ClientProfile = true; +#endif + + /// + /// Identifies the version and target for this assembly. + /// + 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/LogManager.cs b/src/LogManager.cs old mode 100755 new mode 100644 index b1c399d2..59f6b533 --- a/src/LogManager.cs +++ b/src/LogManager.cs @@ -31,7 +31,7 @@ namespace log4net /// /// /// This class has static methods that are used by a client to request - /// a logger instance. The method is + /// a logger instance. The method is /// used to retrieve a logger. /// /// @@ -73,6 +73,7 @@ private LogManager() #region Type Specific Manager Methods +#if !NETSTANDARD1_3 // Excluded because GetCallingAssembly() is not available in CoreFX (https://github.com/dotnet/corefx/issues/2221). /// Returns the named logger if it exists. /// /// Returns the named logger if it exists. @@ -89,24 +90,61 @@ public static ILog Exists(string name) { return Exists(Assembly.GetCallingAssembly(), name); } - + + /// Get the currently defined loggers. /// - /// Returns the named logger if it exists. + /// Returns all the currently defined loggers in the default repository. + /// + /// + /// The root logger is not included in the returned array. + /// + /// All the defined loggers. + public static ILog[] GetCurrentLoggers() + { + return GetCurrentLoggers(Assembly.GetCallingAssembly()); + } + + /// Get or create a logger. + /// + /// Retrieves or creates a named logger. /// /// /// - /// If the named logger exists (in the specified repository) then it - /// returns a reference to the logger, otherwise it returns - /// null. + /// Retrieves a logger named as the + /// parameter. If the named logger already exists, then the + /// existing instance will be returned. Otherwise, a new instance is + /// created. + /// + /// By default, loggers do not have a set level but inherit + /// it from the hierarchy. This is one of the central features of + /// log4net. /// /// - /// The repository to lookup in. - /// The fully qualified logger name to look for. - /// - /// The logger found, or null if the logger doesn't exist in the specified - /// repository. - /// - public static ILog Exists(string repository, string name) + /// The name of the logger to retrieve. + /// The logger with the name specified. + public static ILog GetLogger(string name) + { + return GetLogger(Assembly.GetCallingAssembly(), name); + } +#endif // !NETSTANDARD1_3 + + /// + /// Returns the named logger if it exists. + /// + /// + /// + /// If the named logger exists (in the specified repository) then it + /// returns a reference to the logger, otherwise it returns + /// null. + /// + /// + /// The repository to lookup in. + /// The fully qualified logger name to look for. + /// + /// The logger found, or null if the logger doesn't exist in the specified + /// repository. + /// + public static ILog Exists(string repository, string name) { return WrapLogger(LoggerManager.Exists(repository, name)); } @@ -132,19 +170,6 @@ public static ILog Exists(Assembly repositoryAssembly, string name) return WrapLogger(LoggerManager.Exists(repositoryAssembly, name)); } - /// Get the currently defined loggers. - /// - /// Returns all the currently defined loggers in the default repository. - /// - /// - /// The root logger is not included in the returned array. - /// - /// All the defined loggers. - public static ILog[] GetCurrentLoggers() - { - return GetCurrentLoggers(Assembly.GetCallingAssembly()); - } - /// /// Returns all the currently defined loggers in the specified repository. /// @@ -171,29 +196,6 @@ public static ILog[] GetCurrentLoggers(Assembly repositoryAssembly) return WrapLoggers(LoggerManager.GetCurrentLoggers(repositoryAssembly)); } - /// Get or create a logger. - /// - /// Retrieves or creates a named logger. - /// - /// - /// - /// Retrieves a logger named as the - /// parameter. If the named logger already exists, then the - /// existing instance will be returned. Otherwise, a new instance is - /// created. - /// - /// By default, loggers do not have a set level but inherit - /// it from the hierarchy. This is one of the central features of - /// log4net. - /// - /// - /// The name of the logger to retrieve. - /// The logger with the name specified. - public static ILog GetLogger(string name) - { - return GetLogger(Assembly.GetCallingAssembly(), name); - } - /// /// Retrieves or creates a named logger. /// @@ -243,7 +245,7 @@ public static ILog GetLogger(Assembly repositoryAssembly, string name) } /// - /// Shorthand for . + /// Shorthand for . /// /// /// Get the logger for the fully qualified name of the type specified. @@ -252,11 +254,15 @@ public static ILog GetLogger(Assembly repositoryAssembly, string name) /// The logger with the name specified. public static ILog GetLogger(Type type) { +#if NETSTANDARD1_3 + return GetLogger(type.GetTypeInfo().Assembly, type.FullName); +#else return GetLogger(Assembly.GetCallingAssembly(), type.FullName); +#endif } /// - /// Shorthand for . + /// Shorthand for . /// /// /// Gets the logger for the fully qualified name of the type specified. @@ -270,7 +276,7 @@ public static ILog GetLogger(string repository, Type type) } /// - /// Shorthand for . + /// Shorthand for . /// /// /// Gets the logger for the fully qualified name of the type specified. @@ -311,6 +317,7 @@ public static void Shutdown() LoggerManager.Shutdown(); } +#if !NETSTANDARD1_3 /// Shutdown a logger repository. /// /// Shuts down the default repository. @@ -335,6 +342,7 @@ public static void ShutdownRepository() ShutdownRepository(Assembly.GetCallingAssembly()); } +#endif /// /// Shuts down the repository for the repository specified. /// @@ -387,6 +395,7 @@ public static void ShutdownRepository(Assembly repositoryAssembly) LoggerManager.ShutdownRepository(repositoryAssembly); } +#if !NETSTANDARD1_3 /// Reset the configuration of a repository /// /// Resets all values contained in this repository instance to their defaults. @@ -405,6 +414,7 @@ public static void ResetConfiguration() { ResetConfiguration(Assembly.GetCallingAssembly()); } +#endif /// /// Resets all values contained in this repository instance to their defaults. @@ -444,6 +454,7 @@ public static void ResetConfiguration(Assembly repositoryAssembly) LoggerManager.ResetConfiguration(repositoryAssembly); } +#if !NETSTANDARD1_3 /// Get the logger repository. /// /// Returns the default instance. @@ -451,7 +462,7 @@ public static void ResetConfiguration(Assembly repositoryAssembly) /// /// /// Gets the for the repository specified - /// by the callers assembly (). + /// by the callers assembly (). /// /// /// The instance for the default repository. @@ -460,6 +471,7 @@ public static ILoggerRepository GetLoggerRepository() { return GetRepository(Assembly.GetCallingAssembly()); } +#endif /// /// Returns the default instance. @@ -495,6 +507,7 @@ public static ILoggerRepository GetLoggerRepository(Assembly repositoryAssembly) return GetRepository(repositoryAssembly); } +#if !NETSTANDARD1_3 /// Get a logger repository. /// /// Returns the default instance. @@ -502,7 +515,7 @@ public static ILoggerRepository GetLoggerRepository(Assembly repositoryAssembly) /// /// /// Gets the for the repository specified - /// by the callers assembly (). + /// by the callers assembly (). /// /// /// The instance for the default repository. @@ -510,6 +523,7 @@ public static ILoggerRepository GetRepository() { return GetRepository(Assembly.GetCallingAssembly()); } +#endif /// /// Returns the default instance. @@ -543,6 +557,7 @@ public static ILoggerRepository GetRepository(Assembly repositoryAssembly) return LoggerManager.GetRepository(repositoryAssembly); } +#if !NETSTANDARD1_3 /// Create a domain /// /// Creates a repository with the specified repository type. @@ -553,7 +568,7 @@ public static ILoggerRepository GetRepository(Assembly repositoryAssembly) /// /// /// The created will be associated with the repository - /// specified such that a call to will return + /// specified such that a call to will return /// the same repository instance. /// /// @@ -578,7 +593,7 @@ public static ILoggerRepository CreateDomain(Type repositoryType) /// /// /// The created will be associated with the repository - /// specified such that a call to will return + /// specified such that a call to will return /// the same repository instance. /// /// @@ -586,6 +601,7 @@ public static ILoggerRepository CreateRepository(Type repositoryType) { return CreateRepository(Assembly.GetCallingAssembly(), repositoryType); } +#endif /// /// Creates a repository with the specified name. @@ -686,7 +702,7 @@ public static ILoggerRepository CreateRepository(string repository, Type reposit /// /// /// The created will be associated with the repository - /// specified such that a call to with the + /// specified such that a call to with the /// same assembly specified will return the same repository instance. /// /// @@ -707,7 +723,7 @@ public static ILoggerRepository CreateDomain(Assembly repositoryAssembly, Type r /// /// /// The created will be associated with the repository - /// specified such that a call to with the + /// specified such that a call to with the /// same assembly specified will return the same repository instance. /// /// @@ -735,6 +751,28 @@ public static ILoggerRepository[] GetAllRepositories() return LoggerManager.GetAllRepositories(); } + /// + /// Flushes logging events buffered in all configured appenders in the default repository. + /// + /// The maximum time in milliseconds to wait for logging events from asycnhronous appenders to be flushed. + /// True if all logging events were flushed successfully, else false. + 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) + { + return false; + } + else + { + return flushableRepository.Flush(millisecondsTimeout); + } +#else + return false; +#endif + } + #endregion Domain & Repository Manager Methods #region Extension Handlers diff --git a/src/LogicalThreadContext.cs b/src/LogicalThreadContext.cs old mode 100755 new mode 100644 index d23e4fa0..40357c46 --- a/src/LogicalThreadContext.cs +++ b/src/LogicalThreadContext.cs @@ -125,7 +125,7 @@ public static LogicalThreadContextProperties Properties /// The logical thread stacks. /// /// - public static ThreadContextStacks Stacks + public static LogicalThreadContextStacks Stacks { get { return s_stacks; } } @@ -142,7 +142,7 @@ public static ThreadContextStacks Stacks /// /// The thread context stacks instance /// - private readonly static ThreadContextStacks s_stacks = new ThreadContextStacks(s_properties); + private readonly static LogicalThreadContextStacks s_stacks = new LogicalThreadContextStacks(s_properties); #endregion Private Static Fields } diff --git a/src/MDC.cs b/src/MDC.cs old mode 100755 new mode 100644 index 2baef8dd..06e1b1db --- a/src/MDC.cs +++ b/src/MDC.cs @@ -107,13 +107,13 @@ public static string Get(string key) /// /// /// - /// Puts a context value (the parameter) as identified + /// Puts a context value (the parameter) as identified /// with the parameter into the current thread's /// context map. /// /// /// If a value is already defined for the - /// specified then the value will be replaced. If the + /// specified then the value will be replaced. If the /// is specified as null then the key value mapping will be removed. /// /// diff --git a/src/NDC.cs b/src/NDC.cs old mode 100755 new mode 100644 index 8fd3d928..6b79619e --- a/src/NDC.cs +++ b/src/NDC.cs @@ -246,6 +246,44 @@ public static IDisposable Push(string message) return ThreadContext.Stacks["NDC"].Push(message); } + /// + /// Pushes a new context message. + /// + /// The new context message string format. + /// Arguments to be passed into messageFormat. + /// + /// An that can be used to clean up + /// the context stack. + /// + /// + /// + /// + /// The NDC is deprecated and has been replaced by the . + /// The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. + /// + /// + /// + /// Pushes a new context onto the context stack. An + /// is returned that can be used to clean up the context stack. This + /// can be easily combined with the using keyword to scope the + /// context. + /// + /// + /// Simple example of using the Push method with the using keyword. + /// + /// var someValue = "ExampleContext" + /// using(log4net.NDC.PushFormat("NDC_Message {0}", someValue)) + /// { + /// log.Warn("This should have an NDC message"); + /// } + /// + /// + /*[Obsolete("NDC has been replaced by ThreadContext.Stacks")]*/ + public static IDisposable PushFormat(string messageFormat, params object[] args) + { + return Push(string.Format(messageFormat, args)); + } + /// /// Removes the context information for this thread. It is /// not required to call this method. diff --git a/src/ObjectRenderer/DefaultRenderer.cs b/src/ObjectRenderer/DefaultRenderer.cs old mode 100755 new mode 100644 index f0ed54a9..8dc603df --- a/src/ObjectRenderer/DefaultRenderer.cs +++ b/src/ObjectRenderer/DefaultRenderer.cs @@ -73,7 +73,7 @@ public DefaultRenderer() /// The parameter is /// provided to lookup and render other objects. This is /// very useful where contains - /// nested objects of unknown type. The + /// nested objects of unknown type. The /// method can be used to render these objects. /// /// diff --git a/src/ObjectRenderer/IObjectRenderer.cs b/src/ObjectRenderer/IObjectRenderer.cs old mode 100755 new mode 100644 index eabfd4e0..3a79d1e1 --- a/src/ObjectRenderer/IObjectRenderer.cs +++ b/src/ObjectRenderer/IObjectRenderer.cs @@ -52,7 +52,7 @@ public interface IObjectRenderer /// The parameter is /// provided to lookup and render other objects. This is /// very useful where contains - /// nested objects of unknown type. The + /// nested objects of unknown type. The /// method can be used to render these objects. /// /// diff --git a/src/ObjectRenderer/RendererMap.cs b/src/ObjectRenderer/RendererMap.cs old mode 100755 new mode 100644 index fa6236a9..7f4db96c --- a/src/ObjectRenderer/RendererMap.cs +++ b/src/ObjectRenderer/RendererMap.cs @@ -19,6 +19,10 @@ using System; using System.IO; +#if NETSTANDARD1_3 +using System.Reflection; +#endif + using log4net.Util; namespace log4net.ObjectRenderer @@ -33,7 +37,7 @@ namespace log4net.ObjectRenderer /// is used to render them. /// /// - /// The method is used to render an + /// The method is used to render an /// object using the appropriate renderers defined in this map. /// /// @@ -77,7 +81,7 @@ public RendererMap() /// /// /// This is a convenience method used to render an object to a string. - /// The alternative method + /// The alternative method /// should be used when streaming output to a . /// /// @@ -104,7 +108,7 @@ public string FindAndRender(object obj) /// /// Find the appropriate renderer for the type of the /// parameter. This is accomplished by calling the - /// method. Once a renderer is found, it is + /// method. Once a renderer is found, it is /// applied on the object and the result is returned /// as a . /// @@ -174,7 +178,7 @@ public void FindAndRender(object obj, TextWriter writer) /// Gets the renderer for the specified object type. /// /// - /// Syntactic sugar method that calls + /// Syntactic sugar method that calls /// with the type of the object parameter. /// /// @@ -216,7 +220,11 @@ public IObjectRenderer Get(Type type) if (result == null) { +#if NETSTANDARD1_3 + for (Type cur = type; cur != null; cur = cur.GetTypeInfo().BaseType) +#else for(Type cur = type; cur != null; cur = cur.BaseType) +#endif { // Search the type's interfaces result = SearchTypeAndInterfaces(cur); @@ -303,7 +311,7 @@ public void Clear() /// /// /// Register an object renderer for a specific source type. - /// This renderer will be returned from a call to + /// This renderer will be returned from a call to /// specifying the same as an argument. /// /// diff --git a/src/Plugin/IPlugin.cs b/src/Plugin/IPlugin.cs old mode 100755 new mode 100644 diff --git a/src/Plugin/IPluginFactory.cs b/src/Plugin/IPluginFactory.cs old mode 100755 new mode 100644 diff --git a/src/Plugin/PluginCollection.cs b/src/Plugin/PluginCollection.cs old mode 100755 new mode 100644 index 56cc3f5c..7e7d4e24 --- a/src/Plugin/PluginCollection.cs +++ b/src/Plugin/PluginCollection.cs @@ -26,7 +26,10 @@ namespace log4net.Plugin /// A strongly-typed collection of objects. /// /// Nicko Cadell - public class PluginCollection : ICollection, IList, IEnumerable, ICloneable + public class PluginCollection : ICollection, IList, IEnumerable +#if !NETSTANDARD1_3 + , ICloneable +#endif { #region Interfaces @@ -209,10 +212,10 @@ public virtual void CopyTo(IPlugin[] array, int start) /// /// Gets a value indicating whether access to the collection is synchronized (thread-safe). /// - /// true if access to the ICollection is synchronized (thread-safe); otherwise, false. + /// false, because the backing type is an array, which is never thread-safe. public virtual bool IsSynchronized { - get { return m_array.IsSynchronized; } + get { return false; } } /// @@ -223,7 +226,7 @@ public virtual bool IsSynchronized /// public virtual object SyncRoot { - get { return m_array.SyncRoot; } + get { return m_array; } } #endregion @@ -553,9 +556,9 @@ public virtual void TrimToSize() #region Implementation (helpers) /// - /// is less than zero. + /// is less than zero. /// -or- - /// is equal to or greater than . + /// is equal to or greater than . /// private void ValidateIndex(int i) { @@ -563,9 +566,9 @@ private void ValidateIndex(int i) } /// - /// is less than zero. + /// is less than zero. /// -or- - /// is equal to or greater than . + /// is equal to or greater than . /// private void ValidateIndex(int i, bool allowEqualEnd) { diff --git a/src/Plugin/PluginMap.cs b/src/Plugin/PluginMap.cs old mode 100755 new mode 100644 diff --git a/src/Plugin/PluginSkeleton.cs b/src/Plugin/PluginSkeleton.cs old mode 100755 new mode 100644 diff --git a/src/Plugin/RemoteLoggingServerPlugin.cs b/src/Plugin/RemoteLoggingServerPlugin.cs old mode 100755 new mode 100644 index d24cc814..dfe24e23 --- a/src/Plugin/RemoteLoggingServerPlugin.cs +++ b/src/Plugin/RemoteLoggingServerPlugin.cs @@ -94,7 +94,7 @@ public RemoteLoggingServerPlugin(string sinkUri) : base("RemoteLoggingServerPlug /// /// /// This is the name under which the object is marshaled. - /// + /// /// /// public virtual string SinkUri @@ -119,6 +119,9 @@ public virtual string SinkUri /// This method is called when the plugin is attached to the repository. /// /// +#if NET_4_0 || MONO_4_0 + [System.Security.SecuritySafeCritical] +#endif override public void Attach(ILoggerRepository repository) { base.Attach(repository); @@ -145,7 +148,10 @@ override public void Attach(ILoggerRepository repository) /// sink is disconnected. /// /// - override public void Shutdown() +#if NET_4_0 || MONO_4_0 + [System.Security.SecuritySafeCritical] +#endif + override public void Shutdown() { // Stops the sink from receiving messages RemotingServices.Disconnect(m_sink); @@ -247,7 +253,10 @@ public void LogEvents(LoggingEvent[] events) /// therefore this implementation returns null. /// /// - public override object InitializeLifetimeService() +#if NET_4_0 || MONO_4_0 + [System.Security.SecurityCritical] +#endif + public override object InitializeLifetimeService() { return null; } diff --git a/src/Repository/ConfigurationChangedEventArgs.cs b/src/Repository/ConfigurationChangedEventArgs.cs index 47bf36fb..77df7d41 100644 --- a/src/Repository/ConfigurationChangedEventArgs.cs +++ b/src/Repository/ConfigurationChangedEventArgs.cs @@ -1,30 +1,51 @@ -using System; -using System.Collections; - -namespace log4net.Repository -{ - /// - /// - /// - public class ConfigurationChangedEventArgs : EventArgs - { - private readonly ICollection configurationMessages; - - /// - /// - /// - /// - public ConfigurationChangedEventArgs(ICollection configurationMessages) - { - this.configurationMessages = configurationMessages; - } - - /// - /// - /// - public ICollection ConfigurationMessages - { - get { return configurationMessages; } - } - } -} \ No newline at end of file +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 System; +using System.Collections; + +namespace log4net.Repository +{ + /// + /// + /// + public class ConfigurationChangedEventArgs : EventArgs + { + private readonly ICollection configurationMessages; + + /// + /// + /// + /// + public ConfigurationChangedEventArgs(ICollection configurationMessages) + { + this.configurationMessages = configurationMessages; + } + + /// + /// + /// + public ICollection ConfigurationMessages + { + get { return configurationMessages; } + } + } +} diff --git a/src/Repository/Hierarchy/DefaultLoggerFactory.cs b/src/Repository/Hierarchy/DefaultLoggerFactory.cs old mode 100755 new mode 100644 diff --git a/src/Repository/Hierarchy/Hierarchy.cs b/src/Repository/Hierarchy/Hierarchy.cs old mode 100755 new mode 100644 index ff4a21db..0f4138f1 --- a/src/Repository/Hierarchy/Hierarchy.cs +++ b/src/Repository/Hierarchy/Hierarchy.cs @@ -105,7 +105,7 @@ public Logger Logger /// /// /// The structure of the logger hierarchy is maintained by the - /// method. The hierarchy is such that children + /// method. The hierarchy is such that children /// link to their parent but parents do not have any references to their /// children. Moreover, loggers can be instantiated in any order, in /// particular descendant before ancestor. @@ -297,7 +297,10 @@ override public ILogger Exists(string name) throw new ArgumentNullException("name"); } - return m_ht[new LoggerKey(name)] as Logger; + lock(m_ht) + { + return m_ht[new LoggerKey(name)] as Logger; + } } /// @@ -316,17 +319,20 @@ override public ILogger[] GetCurrentLoggers() // The accumulation in loggers is necessary because not all elements in // ht are Logger objects as there might be some ProvisionNodes // as well. - System.Collections.ArrayList loggers = new System.Collections.ArrayList(m_ht.Count); - - // Iterate through m_ht values - foreach(object node in m_ht.Values) + lock(m_ht) { - if (node is Logger) + System.Collections.ArrayList loggers = new System.Collections.ArrayList(m_ht.Count); + + // Iterate through m_ht values + foreach(object node in m_ht.Values) { - loggers.Add(node); + if (node is Logger) + { + loggers.Add(node); + } } + return (Logger[])loggers.ToArray(typeof(Logger)); } - return (Logger[])loggers.ToArray(typeof(Logger)); } /// @@ -457,7 +463,7 @@ override public void ResetConfiguration() /// This method should not normally be used to log. /// The interface should be used /// for routine logging. This interface can be obtained - /// using the method. + /// using the method. /// /// /// The logEvent is delivered to the appropriate logger and @@ -568,7 +574,7 @@ void IBasicRepositoryConfigurator.Configure(params IAppender[] appenders) /// /// /// This method provides the same functionality as the - /// method implemented + /// method implemented /// on this object, but it is protected and therefore can be called by subclasses. /// /// @@ -612,7 +618,7 @@ void IXmlRepositoryConfigurator.Configure(System.Xml.XmlElement element) /// /// /// This method provides the same functionality as the - /// method implemented + /// method implemented /// on this object, but it is protected and therefore can be called by subclasses. /// /// @@ -694,7 +700,10 @@ public bool IsDisabled(Level level) /// public void Clear() { - m_ht.Clear(); + lock(m_ht) + { + m_ht.Clear(); + } } /// @@ -866,7 +875,12 @@ private void UpdateParents(Logger log) 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 + break; + } } // If we could not find any existing parents, then link with root. diff --git a/src/Repository/Hierarchy/ILoggerFactory.cs b/src/Repository/Hierarchy/ILoggerFactory.cs old mode 100755 new mode 100644 diff --git a/src/Repository/Hierarchy/Logger.cs b/src/Repository/Hierarchy/Logger.cs old mode 100755 new mode 100644 index 3b49b3fa..34735a73 --- a/src/Repository/Hierarchy/Logger.cs +++ b/src/Repository/Hierarchy/Logger.cs @@ -73,7 +73,7 @@ public abstract class Logger : IAppenderAttachable, ILogger /// protected Logger(string name) { -#if NETCF +#if NETCF || NETSTANDARD1_3 // NETCF: String.Intern causes Native Exception m_name = name; #else @@ -432,10 +432,12 @@ virtual public void Log(Type callerStackBoundaryDeclaringType, Level level, obje { log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); } +#if !NET_2_0 && !MONO_2_0 && !MONO_3_5 && !MONO_4_0 && !NETSTANDARD1_3 catch { log4net.Util.LogLog.Error(declaringType, "Exception while logging"); } +#endif } /// @@ -467,10 +469,12 @@ virtual public void Log(LoggingEvent logEvent) { log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); } +#if !NET_2_0 && !MONO_2_0 && !MONO_3_5 && !MONO_4_0 && !NETSTANDARD1_3 catch { log4net.Util.LogLog.Error(declaringType, "Exception while logging"); } +#endif } /// @@ -505,10 +509,12 @@ virtual public bool IsEnabledFor(Level level) { log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); } +#if !NET_2_0 && !MONO_2_0 && !MONO_3_5 && !MONO_4_0 && !NETSTANDARD1_3 catch { log4net.Util.LogLog.Error(declaringType, "Exception while logging"); } +#endif return false; } @@ -593,13 +599,14 @@ virtual protected void CallAppenders(LoggingEvent loggingEvent) // if (!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, "Please initialize the log4net system properly."); try { LogLog.Debug(declaringType, " Current AppDomain context information: "); LogLog.Debug(declaringType, " BaseDirectory : " + SystemInfo.ApplicationBaseDirectory); -#if !NETCF +#if !(NETCF || NETSTANDARD1_3) LogLog.Debug(declaringType, " FriendlyName : " + AppDomain.CurrentDomain.FriendlyName); LogLog.Debug(declaringType, " DynamicDirectory: " + AppDomain.CurrentDomain.DynamicDirectory); #endif @@ -608,7 +615,6 @@ virtual protected void CallAppenders(LoggingEvent loggingEvent) { // Insufficient permissions to display info from the AppDomain } - m_hierarchy.EmittedNoAppenderWarning = true; } } diff --git a/src/Repository/Hierarchy/LoggerKey.cs b/src/Repository/Hierarchy/LoggerKey.cs old mode 100755 new mode 100644 index 1ea90048..ccc566b1 --- a/src/Repository/Hierarchy/LoggerKey.cs +++ b/src/Repository/Hierarchy/LoggerKey.cs @@ -64,7 +64,7 @@ internal sealed class LoggerKey /// The name of the logger. internal LoggerKey(string name) { -#if NETCF +#if NETCF || NETSTANDARD1_3 // NETCF: String.Intern causes Native Exception m_name = name; #else @@ -115,7 +115,7 @@ override public bool Equals(object obj) LoggerKey objKey = obj as LoggerKey; if (objKey != null) { -#if NETCF +#if NETCF || NETSTANDARD1_3 return ( m_name == objKey.m_name ); #else // Compare reference types rather than string's overloaded == diff --git a/src/Repository/Hierarchy/ProvisionNode.cs b/src/Repository/Hierarchy/ProvisionNode.cs old mode 100755 new mode 100644 diff --git a/src/Repository/Hierarchy/RootLogger.cs b/src/Repository/Hierarchy/RootLogger.cs old mode 100755 new mode 100644 diff --git a/src/Repository/Hierarchy/XmlHierarchyConfigurator.cs b/src/Repository/Hierarchy/XmlHierarchyConfigurator.cs old mode 100755 new mode 100644 index d4563a4b..f5021c10 --- a/src/Repository/Hierarchy/XmlHierarchyConfigurator.cs +++ b/src/Repository/Hierarchy/XmlHierarchyConfigurator.cs @@ -300,7 +300,11 @@ protected IAppender ParseAppender(XmlElement appenderElement) 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 appender.Name = appenderName; foreach (XmlNode currentNode in appenderElement.ChildNodes) @@ -345,7 +349,7 @@ protected IAppender ParseAppender(XmlElement appenderElement) optionHandler.ActivateOptions(); } - LogLog.Debug(declaringType, "reated Appender [" + appenderName + "]"); + LogLog.Debug(declaringType, "Created Appender [" + appenderName + "]"); return appender; } catch (Exception ex) @@ -486,7 +490,11 @@ protected void ParseRenderer(XmlElement element) { 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) { @@ -630,11 +638,15 @@ protected void SetParameter(XmlElement element, object target) if(propertyValue != null) { -#if !NETCF +#if !(NETCF || NETSTANDARD1_3) // NETSTANDARD1_3: System.Runtime.InteropServices.RuntimeInformation not available on desktop 4.6 try { // Expand environment variables in the string. - propertyValue = OptionConverter.SubstituteVariables(propertyValue, Environment.GetEnvironmentVariables()); + IDictionary environmentVariables = Environment.GetEnvironmentVariables(); + if (HasCaseInsensitiveEnvironment) { + environmentVariables = CreateCaseInsensitiveWrapper(environmentVariables); + } + propertyValue = OptionConverter.SubstituteVariables(propertyValue, environmentVariables); } catch(System.Security.SecurityException) { @@ -654,7 +666,11 @@ protected void SetParameter(XmlElement element, object target) // 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 LogLog.Debug(declaringType, "Parameter ["+name+"] specified subtype ["+subType.FullName+"]"); @@ -709,7 +725,11 @@ protected void SetParameter(XmlElement element, object target) 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) { @@ -724,7 +744,11 @@ protected void SetParameter(XmlElement element, object target) 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 } catch(TargetInvocationException targetInvocationEx) { @@ -776,7 +800,11 @@ protected void SetParameter(XmlElement element, object target) 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) { @@ -791,7 +819,11 @@ protected void SetParameter(XmlElement element, object target) 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 } catch(TargetInvocationException targetInvocationEx) { @@ -827,7 +859,12 @@ private bool HasAttributesOrElements(XmlElement element) /// true if the type is creatable using a default constructor, false otherwise 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) @@ -862,8 +899,10 @@ private MethodInfo FindMethodInfo(Type targetType, string name) { if (!methInfo.IsStatic) { - if (string.Compare(methInfo.Name, requiredMethodNameA, true, System.Globalization.CultureInfo.InvariantCulture) == 0 || - string.Compare(methInfo.Name, requiredMethodNameB, true, System.Globalization.CultureInfo.InvariantCulture) == 0) + string methodInfoName = methInfo.Name; + + if (SystemInfo.EqualsIgnoringCase(methodInfoName, requiredMethodNameA) || + SystemInfo.EqualsIgnoringCase(methodInfoName, requiredMethodNameB)) { // Found matching method name @@ -951,7 +990,11 @@ protected object CreateObjectFromXml(XmlElement element, Type defaultTargetType, // 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) { @@ -1023,6 +1066,38 @@ protected object CreateObjectFromXml(XmlElement element, Type defaultTargetType, #endregion Protected Instance Methods +#if !(NETCF || NETSTANDARD1_3) // NETSTANDARD1_3: System.Runtime.InteropServices.RuntimeInformation not available on desktop 4.6 + private 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) + { + if (dict == null) + { + return dict; + } + Hashtable hash = SystemInfo.CreateCaseInsensitiveHashtable(); + foreach (DictionaryEntry entry in dict) { + hash[entry.Key] = entry.Value; + } + return hash; + } +#endif + #region Private Constants // String constants used while parsing the XML data diff --git a/src/Repository/IBasicRepositoryConfigurator.cs b/src/Repository/IBasicRepositoryConfigurator.cs old mode 100755 new mode 100644 diff --git a/src/Repository/ILoggerRepository.cs b/src/Repository/ILoggerRepository.cs old mode 100755 new mode 100644 index becbd051..30ef5b33 --- a/src/Repository/ILoggerRepository.cs +++ b/src/Repository/ILoggerRepository.cs @@ -219,7 +219,7 @@ public interface ILoggerRepository /// lost. /// /// - /// The method is careful to close nested + /// The method is careful to close nested /// appenders before closing regular appenders. This is allows /// configurations where a regular appender is attached to a logger /// and again to a nested appender. @@ -254,7 +254,7 @@ public interface ILoggerRepository /// This method should not normally be used to log. /// The interface should be used /// for routine logging. This interface can be obtained - /// using the method. + /// using the method. /// /// /// The logEvent is delivered to the appropriate logger and diff --git a/src/Repository/IXmlRepositoryConfigurator.cs b/src/Repository/IXmlRepositoryConfigurator.cs old mode 100755 new mode 100644 diff --git a/src/Repository/LoggerRepositorySkeleton.cs b/src/Repository/LoggerRepositorySkeleton.cs old mode 100755 new mode 100644 index 0b3fa333..e4f06f85 --- a/src/Repository/LoggerRepositorySkeleton.cs +++ b/src/Repository/LoggerRepositorySkeleton.cs @@ -23,6 +23,7 @@ using log4net.Core; using log4net.Util; using log4net.Plugin; +using System.Threading; namespace log4net.Repository { @@ -40,7 +41,7 @@ namespace log4net.Repository /// /// Nicko Cadell /// Gert Driesen - public abstract class LoggerRepositorySkeleton : ILoggerRepository + public abstract class LoggerRepositorySkeleton : ILoggerRepository, Appender.IFlushable { #region Member Variables @@ -307,7 +308,7 @@ virtual public void ResetConfiguration() /// This method should not normally be used to log. /// The interface should be used /// for routine logging. This interface can be obtained - /// using the method. + /// using the method. /// /// /// The logEvent is delivered to the appropriate logger and @@ -573,5 +574,59 @@ public void RaiseConfigurationChanged(EventArgs e) { OnConfigurationChanged(e); } + + private static int GetWaitTime(DateTime startTimeUtc, int millisecondsTimeout) + { + if (millisecondsTimeout == Timeout.Infinite) return Timeout.Infinite; + if (millisecondsTimeout == 0) return 0; + + int elapsedMilliseconds = (int)(DateTime.UtcNow - startTimeUtc).TotalMilliseconds; + int timeout = millisecondsTimeout - elapsedMilliseconds; + if (timeout < 0) timeout = 0; + return timeout; + } + + /// + /// Flushes all configured Appenders that implement . + /// + /// The maximum time in milliseconds to wait for logging events from asycnhronous appenders to be flushed, + /// or to wait indefinitely. + /// True if all logging events were flushed successfully, else false. + public bool Flush(int millisecondsTimeout) + { + if (millisecondsTimeout < -1) throw new ArgumentOutOfRangeException("millisecondsTimeout", "Timeout must be -1 (Timeout.Infinite) or non-negative"); + + // Assume success until one of the appenders fails + bool result = true; + + // Use DateTime.UtcNow rather than a System.Diagnostics.Stopwatch for compatibility with .NET 1.x + DateTime startTimeUtc = DateTime.UtcNow; + + // Do buffering appenders first. These may be forwarding to other appenders + foreach(log4net.Appender.IAppender appender in GetAppenders()) + { + log4net.Appender.IFlushable flushable = appender as log4net.Appender.IFlushable; + if (flushable == null) continue; + if (appender is Appender.BufferingAppenderSkeleton) + { + int timeout = GetWaitTime(startTimeUtc, millisecondsTimeout); + if (!flushable.Flush(timeout)) result = false; + } + } + + // Do non-buffering appenders. + foreach (log4net.Appender.IAppender appender in GetAppenders()) + { + log4net.Appender.IFlushable flushable = appender as log4net.Appender.IFlushable; + if (flushable == null) continue; + if (!(appender is Appender.BufferingAppenderSkeleton)) + { + int timeout = GetWaitTime(startTimeUtc, millisecondsTimeout); + if (!flushable.Flush(timeout)) result = false; + } + } + + return result; + } } } diff --git a/src/ThreadContext.cs b/src/ThreadContext.cs old mode 100755 new mode 100644 diff --git a/src/Util/AppenderAttachedImpl.cs b/src/Util/AppenderAttachedImpl.cs old mode 100755 new mode 100644 diff --git a/src/Util/CompositeProperties.cs b/src/Util/CompositeProperties.cs old mode 100755 new mode 100644 diff --git a/src/Util/ContextPropertiesBase.cs b/src/Util/ContextPropertiesBase.cs old mode 100755 new mode 100644 diff --git a/src/Util/ConverterInfo.cs b/src/Util/ConverterInfo.cs index f2919d59..b64edc9d 100644 --- a/src/Util/ConverterInfo.cs +++ b/src/Util/ConverterInfo.cs @@ -1,73 +1,94 @@ -using System; - -namespace log4net.Util -{ - /// - /// Wrapper class used to map converter names to converter types - /// - /// - /// - /// Pattern converter info class used during configuration by custom - /// PatternString and PatternLayer converters. - /// - /// - public sealed class ConverterInfo - { - private string m_name; - private Type m_type; - private readonly PropertiesDictionary properties = new PropertiesDictionary(); - - /// - /// default constructor - /// - public ConverterInfo() - { - } - - /// - /// Gets or sets the name of the conversion pattern - /// - /// - /// - /// The name of the pattern in the format string - /// - /// - public string Name - { - get { return m_name; } - set { m_name = value; } - } - - /// - /// Gets or sets the type of the converter - /// - /// - /// - /// The value specified must extend the - /// type. - /// - /// - public Type Type - { - get { return m_type; } - set { m_type = value; } - } - - /// - /// - /// - /// - public void AddProperty(PropertyEntry entry) - { - properties[entry.Key] = entry.Value; - } - - /// - /// - /// - public PropertiesDictionary Properties - { - get { return properties; } - } - } -} +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 System; + +namespace log4net.Util +{ + /// + /// Wrapper class used to map converter names to converter types + /// + /// + /// + /// Pattern converter info class used during configuration by custom + /// PatternString and PatternLayer converters. + /// + /// + public sealed class ConverterInfo + { + private string m_name; + private Type m_type; + private readonly PropertiesDictionary properties = new PropertiesDictionary(); + + /// + /// default constructor + /// + public ConverterInfo() + { + } + + /// + /// Gets or sets the name of the conversion pattern + /// + /// + /// + /// The name of the pattern in the format string + /// + /// + public string Name + { + get { return m_name; } + set { m_name = value; } + } + + /// + /// Gets or sets the type of the converter + /// + /// + /// + /// The value specified must extend the + /// type. + /// + /// + public Type Type + { + get { return m_type; } + set { m_type = value; } + } + + /// + /// + /// + /// + public void AddProperty(PropertyEntry entry) + { + properties[entry.Key] = entry.Value; + } + + /// + /// + /// + public PropertiesDictionary Properties + { + get { return properties; } + } + } +} diff --git a/src/Util/CountingQuietTextWriter.cs b/src/Util/CountingQuietTextWriter.cs old mode 100755 new mode 100644 diff --git a/src/Util/CyclicBuffer.cs b/src/Util/CyclicBuffer.cs old mode 100755 new mode 100644 diff --git a/src/Util/EmptyCollection.cs b/src/Util/EmptyCollection.cs old mode 100755 new mode 100644 diff --git a/src/Util/EmptyDictionary.cs b/src/Util/EmptyDictionary.cs old mode 100755 new mode 100644 diff --git a/src/Util/FormattingInfo.cs b/src/Util/FormattingInfo.cs old mode 100755 new mode 100644 diff --git a/src/Util/GlobalContextProperties.cs b/src/Util/GlobalContextProperties.cs old mode 100755 new mode 100644 diff --git a/src/Util/ILogExtensions.cs b/src/Util/ILogExtensions.cs new file mode 100644 index 00000000..608d05d3 --- /dev/null +++ b/src/Util/ILogExtensions.cs @@ -0,0 +1,1741 @@ +#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 NET_3_5 || NET_4_0 || MONO_3_5 || MONO_4_0 || NETSTANDARD1_3 + +using System; + +using log4net.Core; + +namespace log4net.Util +{ + /// + /// The static class ILogExtensions contains a set of widely used + /// methods that ease the interaction with the ILog interface implementations. + /// + /// + /// + /// This class contains methods for logging at different levels and checks the + /// properties for determining if those logging levels are enabled in the current + /// configuration. + /// + /// + /// Simple example of logging messages + /// + /// using log4net.Util; + /// + /// ILog log = LogManager.GetLogger("application-log"); + /// + /// log.InfoExt("Application Start"); + /// log.DebugExt("This is a debug message"); + /// + /// + public static class ILogExtensions + { + #region Private Static Fields + + /// + /// The fully qualified type of the Logger class. + /// + private readonly static Type declaringType = typeof(ILogExtensions); + + #endregion //Private Static Fields + + #region debug extensions + + #region debug extensions that uses log message lambda expression + + /// + /// Log a message object with the level. + /// + /// The logger on which the message is logged. + /// The lambda expression that gets the object to log. + /// + /// + /// This method first checks if this logger is INFO + /// enabled by reading the value property. + /// This check happens always and does not depend on the + /// implementation. If this logger is INFO enabled, then it converts + /// the message object (retrieved by invocation of the provided callback) to a + /// string by invoking the appropriate . + /// It then proceeds to call all the registered appenders in this logger + /// and also higher in the hierarchy depending on the value of + /// the additivity flag. + /// + /// WARNING Note that passing an + /// to this method will print the name of the + /// but no stack trace. To print a stack trace use the + /// form instead. + /// + /// + /// + /// + public static void DebugExt(this ILog logger, Func callback) + { + try + { + if (!logger.IsDebugEnabled) + return; + + logger.Debug(callback()); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + /// + /// Log a message object with the level including + /// the stack trace of the passed + /// as a parameter. + /// + /// The logger on which the message is logged. + /// The lambda expression that gets the object to log. + /// The exception to log, including its stack trace. + /// + /// + /// See the form for more detailed information. + /// + /// + /// + /// + public static void DebugExt(this ILog logger, Func callback, Exception exception) + { + try + { + if (!logger.IsDebugEnabled) + return; + + logger.Debug(callback(), exception); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + #endregion + + #region debug extension that use the formatter + + /// Log a message object with the level. //TODO + /// + /// Log a message object with the level. + /// + /// The logger on which the message is logged. + /// The message object to log. + /// + /// + /// This method first checks if this logger is INFO + /// enabled by reading the value property. + /// This check happens always and does not depend on the + /// implementation. If this logger is INFO enabled, then it converts + /// the message object (passed as parameter) to a string by invoking the appropriate + /// . It then + /// proceeds to call all the registered appenders in this logger + /// and also higher in the hierarchy depending on the value of + /// the additivity flag. + /// + /// WARNING Note that passing an + /// to this method will print the name of the + /// but no stack trace. To print a stack trace use the + /// form instead. + /// + /// + /// + /// + public static void DebugExt(this ILog logger, object message) + { + try + { + if (!logger.IsDebugEnabled) + return; + + logger.Debug(message); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + /// + /// Log a message object with the level including + /// the stack trace of the passed + /// as a parameter. + /// + /// The logger on which the message is logged. + /// The message object to log. + /// The exception to log, including its stack trace. + /// + /// + /// See the form for more detailed information. + /// + /// + /// + /// + public static void DebugExt(this ILog logger, object message, Exception exception) + { + try + { + if (!logger.IsDebugEnabled) + return; + + logger.Debug(message, exception); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + #endregion + + #region debug extension that use string format + + /// + /// Logs a formatted message string with the level. + /// + /// The logger on which the message is logged. + /// A String containing zero or more format items + /// An Object to format + /// + /// + /// The message is formatted using the String.Format method. See + /// for details of the syntax of the format string and the behavior + /// of the formatting. + /// + /// + /// This method does not take an object to include in the + /// log event. To pass an use one of the + /// methods instead. + /// + /// + /// + /// + public static void DebugFormatExt(this ILog logger, string format, object arg0) + { + try + { + if (!logger.IsDebugEnabled) + return; + + logger.DebugFormat(format, arg0); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + /// + /// Logs a formatted message string with the level. + /// + /// The logger on which the message is logged. + /// A String containing zero or more format items + /// An Object array containing zero or more objects to format + /// + /// + /// The message is formatted using the String.Format method. See + /// for details of the syntax of the format string and the behavior + /// of the formatting. + /// + /// + /// This method does not take an object to include in the + /// log event. To pass an use one of the + /// methods instead. + /// + /// + /// + /// + public static void DebugFormatExt(this ILog logger, string format, params object[] args) + { + try + { + if (!logger.IsDebugEnabled) + return; + + logger.DebugFormat(format, args); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + /// + /// Logs a formatted message string with the level. + /// + /// An that supplies culture-specific formatting information + /// The logger on which the message is logged. + /// A String containing zero or more format items + /// An Object array containing zero or more objects to format + /// + /// + /// The message is formatted using the String.Format method. See + /// for details of the syntax of the format string and the behavior + /// of the formatting. + /// + /// + /// This method does not take an object to include in the + /// log event. To pass an use one of the + /// methods instead. + /// + /// + /// + /// + public static void DebugFormatExt(this ILog logger, IFormatProvider provider, string format, params object[] args) + { + try + { + if (!logger.IsDebugEnabled) + return; + + logger.DebugFormat(provider, format, args); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + /// + /// Logs a formatted message string with the level. + /// + /// The logger on which the message is logged. + /// A String containing zero or more format items + /// An Object to format + /// An Object to format + /// + /// + /// The message is formatted using the String.Format method. See + /// for details of the syntax of the format string and the behavior + /// of the formatting. + /// + /// + /// This method does not take an object to include in the + /// log event. To pass an use one of the + /// methods instead. + /// + /// + /// + /// + public static void DebugFormatExt(this ILog logger, string format, object arg0, object arg1) + { + try + { + if (!logger.IsDebugEnabled) + return; + + logger.DebugFormat(format, arg0, arg1); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + /// + /// Logs a formatted message string with the level. + /// + /// The logger on which the message is logged. + /// A String containing zero or more format items + /// An Object to format + /// An Object to format + /// An Object to format + /// + /// + /// The message is formatted using the String.Format method. See + /// for details of the syntax of the format string and the behavior + /// of the formatting. + /// + /// + /// This method does not take an object to include in the + /// log event. To pass an use one of the + /// methods instead. + /// + /// + /// + /// + public static void DebugFormatExt(this ILog logger, string format, object arg0, object arg1, object arg2) + { + try + { + if (!logger.IsDebugEnabled) + return; + + logger.DebugFormat(format, arg0, arg1, arg2); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + #endregion + + #endregion + + #region info extensions + + #region info extensions that uses log message lambda expression + + /// + /// Log a message object with the level. + /// + /// The logger on which the message is logged. + /// The lambda expression that gets the object to log. + /// + /// + /// This method first checks if this logger is INFO + /// enabled by reading the value property. + /// This check happens always and does not depend on the + /// implementation. If this logger is INFO enabled, then it converts + /// the message object (retrieved by invocation of the provided callback) to a + /// string by invoking the appropriate . + /// It then proceeds to call all the registered appenders in this logger + /// and also higher in the hierarchy depending on the value of + /// the additivity flag. + /// + /// WARNING Note that passing an + /// to this method will print the name of the + /// but no stack trace. To print a stack trace use the + /// form instead. + /// + /// + /// + /// + public static void InfoExt(this ILog logger, Func callback) + { + try + { + if (!logger.IsInfoEnabled) + return; + + logger.Info(callback()); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + /// + /// Log a message object with the level including + /// the stack trace of the passed + /// as a parameter. + /// + /// The logger on which the message is logged. + /// The lambda expression that gets the object to log. + /// The exception to log, including its stack trace. + /// + /// + /// See the form for more detailed information. + /// + /// + /// + /// + public static void InfoExt(this ILog logger, Func callback, Exception exception) + { + try + { + if (!logger.IsInfoEnabled) + return; + + logger.Info(callback(), exception); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + #endregion + + #region info extension that use the formatter + + /// Log a message object with the level. //TODO + /// + /// Log a message object with the level. + /// + /// The logger on which the message is logged. + /// The message object to log. + /// + /// + /// This method first checks if this logger is INFO + /// enabled by reading the value property. + /// This check happens always and does not depend on the + /// implementation. If this logger is INFO enabled, then it converts + /// the message object (passed as parameter) to a string by invoking the appropriate + /// . It then + /// proceeds to call all the registered appenders in this logger + /// and also higher in the hierarchy depending on the value of + /// the additivity flag. + /// + /// WARNING Note that passing an + /// to this method will print the name of the + /// but no stack trace. To print a stack trace use the + /// form instead. + /// + /// + /// + /// + public static void InfoExt(this ILog logger, object message) + { + try + { + if (!logger.IsInfoEnabled) + return; + + logger.Info(message); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + /// + /// Log a message object with the level including + /// the stack trace of the passed + /// as a parameter. + /// + /// The logger on which the message is logged. + /// The message object to log. + /// The exception to log, including its stack trace. + /// + /// + /// See the form for more detailed information. + /// + /// + /// + /// + public static void InfoExt(this ILog logger, object message, Exception exception) + { + try + { + if (!logger.IsInfoEnabled) + return; + + logger.Info(message, exception); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + #endregion + + #region info extension that use string format + + /// + /// Logs a formatted message string with the level. + /// + /// The logger on which the message is logged. + /// A String containing zero or more format items + /// An Object to format + /// + /// + /// The message is formatted using the String.Format method. See + /// for details of the syntax of the format string and the behavior + /// of the formatting. + /// + /// + /// This method does not take an object to include in the + /// log event. To pass an use one of the + /// methods instead. + /// + /// + /// + /// + public static void InfoFormatExt(this ILog logger, string format, object arg0) + { + try + { + if (!logger.IsInfoEnabled) + return; + + logger.InfoFormat(format, arg0); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + /// + /// Logs a formatted message string with the level. + /// + /// The logger on which the message is logged. + /// A String containing zero or more format items + /// An Object array containing zero or more objects to format + /// + /// + /// The message is formatted using the String.Format method. See + /// for details of the syntax of the format string and the behavior + /// of the formatting. + /// + /// + /// This method does not take an object to include in the + /// log event. To pass an use one of the + /// methods instead. + /// + /// + /// + /// + public static void InfoFormatExt(this ILog logger, string format, params object[] args) + { + try + { + if (!logger.IsInfoEnabled) + return; + + logger.InfoFormat(format, args); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + /// + /// Logs a formatted message string with the level. + /// + /// An that supplies culture-specific formatting information + /// The logger on which the message is logged. + /// A String containing zero or more format items + /// An Object array containing zero or more objects to format + /// + /// + /// The message is formatted using the String.Format method. See + /// for details of the syntax of the format string and the behavior + /// of the formatting. + /// + /// + /// This method does not take an object to include in the + /// log event. To pass an use one of the + /// methods instead. + /// + /// + /// + /// + public static void InfoFormatExt(this ILog logger, IFormatProvider provider, string format, params object[] args) + { + try + { + if (!logger.IsInfoEnabled) + return; + + logger.InfoFormat(provider, format, args); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + /// + /// Logs a formatted message string with the level. + /// + /// The logger on which the message is logged. + /// A String containing zero or more format items + /// An Object to format + /// An Object to format + /// + /// + /// The message is formatted using the String.Format method. See + /// for details of the syntax of the format string and the behavior + /// of the formatting. + /// + /// + /// This method does not take an object to include in the + /// log event. To pass an use one of the + /// methods instead. + /// + /// + /// + /// + public static void InfoFormatExt(this ILog logger, string format, object arg0, object arg1) + { + try + { + if (!logger.IsInfoEnabled) + return; + + logger.InfoFormat(format, arg0, arg1); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + /// + /// Logs a formatted message string with the level. + /// + /// The logger on which the message is logged. + /// A String containing zero or more format items + /// An Object to format + /// An Object to format + /// An Object to format + /// + /// + /// The message is formatted using the String.Format method. See + /// for details of the syntax of the format string and the behavior + /// of the formatting. + /// + /// + /// This method does not take an object to include in the + /// log event. To pass an use one of the + /// methods instead. + /// + /// + /// + /// + public static void InfoFormatExt(this ILog logger, string format, object arg0, object arg1, object arg2) + { + try + { + if (!logger.IsInfoEnabled) + return; + + logger.InfoFormat(format, arg0, arg1, arg2); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + #endregion + + #endregion + + #region warn extensions + + #region warn extensions that uses log message lambda expression + + /// + /// Log a message object with the level. + /// + /// The logger on which the message is logged. + /// The lambda expression that gets the object to log. + /// + /// + /// This method first checks if this logger is WARN + /// enabled by reading the value property. + /// This check happens always and does not depend on the + /// implementation. If this logger is WARN enabled, then it converts + /// the message object (retrieved by invocation of the provided callback) to a + /// string by invoking the appropriate . + /// It then proceeds to call all the registered appenders in this logger + /// and also higher in the hierarchy depending on the value of + /// the additivity flag. + /// + /// WARNING Note that passing an + /// to this method will print the name of the + /// but no stack trace. To print a stack trace use the + /// form instead. + /// + /// + /// + /// + public static void WarnExt(this ILog logger, Func callback) + { + try + { + if (!logger.IsWarnEnabled) + return; + + logger.Warn(callback()); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + /// + /// Log a message object with the level including + /// the stack trace of the passed + /// as a parameter. + /// + /// The logger on which the message is logged. + /// The lambda expression that gets the object to log. + /// The exception to log, including its stack trace. + /// + /// + /// See the form for more detailed information. + /// + /// + /// + /// + public static void WarnExt(this ILog logger, Func callback, Exception exception) + { + try + { + if (!logger.IsWarnEnabled) + return; + + logger.Warn(callback(), exception); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + #endregion + + #region warn extension that use the formatter + + /// Log a message object with the level. //TODO + /// + /// Log a message object with the level. + /// + /// The logger on which the message is logged. + /// The message object to log. + /// + /// + /// This method first checks if this logger is WARN + /// enabled by reading the value property. + /// This check happens always and does not depend on the + /// implementation. If this logger is WARN enabled, then it converts + /// the message object (passed as parameter) to a string by invoking the appropriate + /// . It then + /// proceeds to call all the registered appenders in this logger + /// and also higher in the hierarchy depending on the value of + /// the additivity flag. + /// + /// WARNING Note that passing an + /// to this method will print the name of the + /// but no stack trace. To print a stack trace use the + /// form instead. + /// + /// + /// + /// + public static void WarnExt(this ILog logger, object message) + { + try + { + if (!logger.IsWarnEnabled) + return; + + logger.Warn(message); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + /// + /// Log a message object with the level including + /// the stack trace of the passed + /// as a parameter. + /// + /// The logger on which the message is logged. + /// The message object to log. + /// The exception to log, including its stack trace. + /// + /// + /// See the form for more detailed information. + /// + /// + /// + /// + public static void WarnExt(this ILog logger, object message, Exception exception) + { + try + { + if (!logger.IsWarnEnabled) + return; + + logger.Warn(message, exception); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + #endregion + + #region warn extension that use string format + + /// + /// Logs a formatted message string with the level. + /// + /// The logger on which the message is logged. + /// A String containing zero or more format items + /// An Object to format + /// + /// + /// The message is formatted using the String.Format method. See + /// for details of the syntax of the format string and the behavior + /// of the formatting. + /// + /// + /// This method does not take an object to include in the + /// log event. To pass an use one of the + /// methods instead. + /// + /// + /// + /// + public static void WarnFormatExt(this ILog logger, string format, object arg0) + { + try + { + if (!logger.IsWarnEnabled) + return; + + logger.WarnFormat(format, arg0); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + /// + /// Logs a formatted message string with the level. + /// + /// The logger on which the message is logged. + /// A String containing zero or more format items + /// An Object array containing zero or more objects to format + /// + /// + /// The message is formatted using the String.Format method. See + /// for details of the syntax of the format string and the behavior + /// of the formatting. + /// + /// + /// This method does not take an object to include in the + /// log event. To pass an use one of the + /// methods instead. + /// + /// + /// + /// + public static void WarnFormatExt(this ILog logger, string format, params object[] args) + { + try + { + if (!logger.IsWarnEnabled) + return; + + logger.WarnFormat(format, args); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + /// + /// Logs a formatted message string with the level. + /// + /// An that supplies culture-specific formatting information + /// The logger on which the message is logged. + /// A String containing zero or more format items + /// An Object array containing zero or more objects to format + /// + /// + /// The message is formatted using the String.Format method. See + /// for details of the syntax of the format string and the behavior + /// of the formatting. + /// + /// + /// This method does not take an object to include in the + /// log event. To pass an use one of the + /// methods instead. + /// + /// + /// + /// + public static void WarnFormatExt(this ILog logger, IFormatProvider provider, string format, params object[] args) + { + try + { + if (!logger.IsWarnEnabled) + return; + + logger.WarnFormat(provider, format, args); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + /// + /// Logs a formatted message string with the level. + /// + /// The logger on which the message is logged. + /// A String containing zero or more format items + /// An Object to format + /// An Object to format + /// + /// + /// The message is formatted using the String.Format method. See + /// for details of the syntax of the format string and the behavior + /// of the formatting. + /// + /// + /// This method does not take an object to include in the + /// log event. To pass an use one of the + /// methods instead. + /// + /// + /// + /// + public static void WarnFormatExt(this ILog logger, string format, object arg0, object arg1) + { + try + { + if (!logger.IsWarnEnabled) + return; + + logger.WarnFormat(format, arg0, arg1); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + /// + /// Logs a formatted message string with the level. + /// + /// The logger on which the message is logged. + /// A String containing zero or more format items + /// An Object to format + /// An Object to format + /// An Object to format + /// + /// + /// The message is formatted using the String.Format method. See + /// for details of the syntax of the format string and the behavior + /// of the formatting. + /// + /// + /// This method does not take an object to include in the + /// log event. To pass an use one of the + /// methods instead. + /// + /// + /// + /// + public static void WarnFormatExt(this ILog logger, string format, object arg0, object arg1, object arg2) + { + try + { + if (!logger.IsWarnEnabled) + return; + + logger.WarnFormat(format, arg0, arg1, arg2); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + #endregion + + #endregion + + #region error extensions + + #region error extensions that uses log message lambda expression + + /// + /// Log a message object with the level. + /// + /// The logger on which the message is logged. + /// The lambda expression that gets the object to log. + /// + /// + /// This method first checks if this logger is ERROR + /// enabled by reading the value property. + /// This check happens always and does not depend on the + /// implementation. If this logger is ERROR enabled, then it converts + /// the message object (retrieved by invocation of the provided callback) to a + /// string by invoking the appropriate . + /// It then proceeds to call all the registered appenders in this logger + /// and also higher in the hierarchy depending on the value of + /// the additivity flag. + /// + /// WARNING Note that passing an + /// to this method will print the name of the + /// but no stack trace. To print a stack trace use the + /// form instead. + /// + /// + /// + /// + public static void ErrorExt(this ILog logger, Func callback) + { + try + { + if (!logger.IsErrorEnabled) + return; + + logger.Error(callback()); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + /// + /// Log a message object with the level including + /// the stack trace of the passed + /// as a parameter. + /// + /// The logger on which the message is logged. + /// The lambda expression that gets the object to log. + /// The exception to log, including its stack trace. + /// + /// + /// See the form for more detailed information. + /// + /// + /// + /// + public static void ErrorExt(this ILog logger, Func callback, Exception exception) + { + try + { + if (!logger.IsErrorEnabled) + return; + + logger.Error(callback(), exception); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + #endregion + + #region error extension that use the formatter + + /// Log a message object with the level. //TODO + /// + /// Log a message object with the level. + /// + /// The logger on which the message is logged. + /// The message object to log. + /// + /// + /// This method first checks if this logger is ERROR + /// enabled by reading the value property. + /// This check happens always and does not depend on the + /// implementation. If this logger is ERROR enabled, then it converts + /// the message object (passed as parameter) to a string by invoking the appropriate + /// . It then + /// proceeds to call all the registered appenders in this logger + /// and also higher in the hierarchy depending on the value of + /// the additivity flag. + /// + /// WARNING Note that passing an + /// to this method will print the name of the + /// but no stack trace. To print a stack trace use the + /// form instead. + /// + /// + /// + /// + public static void ErrorExt(this ILog logger, object message) + { + try + { + if (!logger.IsErrorEnabled) + return; + + logger.Error(message); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + /// + /// Log a message object with the level including + /// the stack trace of the passed + /// as a parameter. + /// + /// The logger on which the message is logged. + /// The message object to log. + /// The exception to log, including its stack trace. + /// + /// + /// See the form for more detailed information. + /// + /// + /// + /// + public static void ErrorExt(this ILog logger, object message, Exception exception) + { + try + { + if (!logger.IsErrorEnabled) + return; + + logger.Error(message, exception); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + #endregion + + #region error extension that use string format + + /// + /// Logs a formatted message string with the level. + /// + /// The logger on which the message is logged. + /// A String containing zero or more format items + /// An Object to format + /// + /// + /// The message is formatted using the String.Format method. See + /// for details of the syntax of the format string and the behavior + /// of the formatting. + /// + /// + /// This method does not take an object to include in the + /// log event. To pass an use one of the + /// methods instead. + /// + /// + /// + /// + public static void ErrorFormatExt(this ILog logger, string format, object arg0) + { + try + { + if (!logger.IsErrorEnabled) + return; + + logger.ErrorFormat(format, arg0); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + /// + /// Logs a formatted message string with the level. + /// + /// The logger on which the message is logged. + /// A String containing zero or more format items + /// An Object array containing zero or more objects to format + /// + /// + /// The message is formatted using the String.Format method. See + /// for details of the syntax of the format string and the behavior + /// of the formatting. + /// + /// + /// This method does not take an object to include in the + /// log event. To pass an use one of the + /// methods instead. + /// + /// + /// + /// + public static void ErrorFormatExt(this ILog logger, string format, params object[] args) + { + try + { + if (!logger.IsErrorEnabled) + return; + + logger.ErrorFormat(format, args); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + /// + /// Logs a formatted message string with the level. + /// + /// An that supplies culture-specific formatting information + /// The logger on which the message is logged. + /// A String containing zero or more format items + /// An Object array containing zero or more objects to format + /// + /// + /// The message is formatted using the String.Format method. See + /// for details of the syntax of the format string and the behavior + /// of the formatting. + /// + /// + /// This method does not take an object to include in the + /// log event. To pass an use one of the + /// methods instead. + /// + /// + /// + /// + public static void ErrorFormatExt(this ILog logger, IFormatProvider provider, string format, params object[] args) + { + try + { + if (!logger.IsErrorEnabled) + return; + + logger.ErrorFormat(provider, format, args); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + /// + /// Logs a formatted message string with the level. + /// + /// The logger on which the message is logged. + /// A String containing zero or more format items + /// An Object to format + /// An Object to format + /// + /// + /// The message is formatted using the String.Format method. See + /// for details of the syntax of the format string and the behavior + /// of the formatting. + /// + /// + /// This method does not take an object to include in the + /// log event. To pass an use one of the + /// methods instead. + /// + /// + /// + /// + public static void ErrorFormatExt(this ILog logger, string format, object arg0, object arg1) + { + try + { + if (!logger.IsErrorEnabled) + return; + + logger.ErrorFormat(format, arg0, arg1); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + /// + /// Logs a formatted message string with the level. + /// + /// The logger on which the message is logged. + /// A String containing zero or more format items + /// An Object to format + /// An Object to format + /// An Object to format + /// + /// + /// The message is formatted using the String.Format method. See + /// for details of the syntax of the format string and the behavior + /// of the formatting. + /// + /// + /// This method does not take an object to include in the + /// log event. To pass an use one of the + /// methods instead. + /// + /// + /// + /// + public static void ErrorFormatExt(this ILog logger, string format, object arg0, object arg1, object arg2) + { + try + { + if (!logger.IsErrorEnabled) + return; + + logger.ErrorFormat(format, arg0, arg1, arg2); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + #endregion + + #endregion + + #region fatal extensions + + #region fatal extensions that uses log message lambda expression + + /// + /// Log a message object with the level. + /// + /// The logger on which the message is logged. + /// The lambda expression that gets the object to log. + /// + /// + /// This method first checks if this logger is FATAL + /// enabled by reading the value property. + /// This check happens always and does not depend on the + /// implementation. If this logger is FATAL enabled, then it converts + /// the message object (retrieved by invocation of the provided callback) to a + /// string by invoking the appropriate . + /// It then proceeds to call all the registered appenders in this logger + /// and also higher in the hierarchy depending on the value of + /// the additivity flag. + /// + /// WARNING Note that passing an + /// to this method will print the name of the + /// but no stack trace. To print a stack trace use the + /// form instead. + /// + /// + /// + /// + public static void FatalExt(this ILog logger, Func callback) + { + try + { + if (!logger.IsFatalEnabled) + return; + + logger.Fatal(callback()); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + /// + /// Log a message object with the level including + /// the stack trace of the passed + /// as a parameter. + /// + /// The logger on which the message is logged. + /// The lambda expression that gets the object to log. + /// The exception to log, including its stack trace. + /// + /// + /// See the form for more detailed information. + /// + /// + /// + /// + public static void FatalExt(this ILog logger, Func callback, Exception exception) + { + try + { + if (!logger.IsFatalEnabled) + return; + + logger.Fatal(callback(), exception); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + #endregion + + #region fatal extension that use the formatter + + /// Log a message object with the level. //TODO + /// + /// Log a message object with the level. + /// + /// The logger on which the message is logged. + /// The message object to log. + /// + /// + /// This method first checks if this logger is FATAL + /// enabled by reading the value property. + /// This check happens always and does not depend on the + /// implementation. If this logger is FATAL enabled, then it converts + /// the message object (passed as parameter) to a string by invoking the appropriate + /// . It then + /// proceeds to call all the registered appenders in this logger + /// and also higher in the hierarchy depending on the value of + /// the additivity flag. + /// + /// WARNING Note that passing an + /// to this method will print the name of the + /// but no stack trace. To print a stack trace use the + /// form instead. + /// + /// + /// + /// + public static void FatalExt(this ILog logger, object message) + { + try + { + if (!logger.IsFatalEnabled) + return; + + logger.Fatal(message); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + /// + /// Log a message object with the level including + /// the stack trace of the passed + /// as a parameter. + /// + /// The logger on which the message is logged. + /// The message object to log. + /// The exception to log, including its stack trace. + /// + /// + /// See the form for more detailed information. + /// + /// + /// + /// + public static void FatalExt(this ILog logger, object message, Exception exception) + { + try + { + if (!logger.IsFatalEnabled) + return; + + logger.Fatal(message, exception); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + #endregion + + #region fatal extension that use string format + + /// + /// Logs a formatted message string with the level. + /// + /// The logger on which the message is logged. + /// A String containing zero or more format items + /// An Object to format + /// + /// + /// The message is formatted using the String.Format method. See + /// for details of the syntax of the format string and the behavior + /// of the formatting. + /// + /// + /// This method does not take an object to include in the + /// log event. To pass an use one of the + /// methods instead. + /// + /// + /// + /// + public static void FatalFormatExt(this ILog logger, string format, object arg0) + { + try + { + if (!logger.IsFatalEnabled) + return; + + logger.FatalFormat(format, arg0); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + /// + /// Logs a formatted message string with the level. + /// + /// The logger on which the message is logged. + /// A String containing zero or more format items + /// An Object array containing zero or more objects to format + /// + /// + /// The message is formatted using the String.Format method. See + /// for details of the syntax of the format string and the behavior + /// of the formatting. + /// + /// + /// This method does not take an object to include in the + /// log event. To pass an use one of the + /// methods instead. + /// + /// + /// + /// + public static void FatalFormatExt(this ILog logger, string format, params object[] args) + { + try + { + if (!logger.IsFatalEnabled) + return; + + logger.FatalFormat(format, args); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + /// + /// Logs a formatted message string with the level. + /// + /// An that supplies culture-specific formatting information + /// The logger on which the message is logged. + /// A String containing zero or more format items + /// An Object array containing zero or more objects to format + /// + /// + /// The message is formatted using the String.Format method. See + /// for details of the syntax of the format string and the behavior + /// of the formatting. + /// + /// + /// This method does not take an object to include in the + /// log event. To pass an use one of the + /// methods instead. + /// + /// + /// + /// + public static void FatalFormatExt(this ILog logger, IFormatProvider provider, string format, params object[] args) + { + try + { + if (!logger.IsFatalEnabled) + return; + + logger.FatalFormat(provider, format, args); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + /// + /// Logs a formatted message string with the level. + /// + /// The logger on which the message is logged. + /// A String containing zero or more format items + /// An Object to format + /// An Object to format + /// + /// + /// The message is formatted using the String.Format method. See + /// for details of the syntax of the format string and the behavior + /// of the formatting. + /// + /// + /// This method does not take an object to include in the + /// log event. To pass an use one of the + /// methods instead. + /// + /// + /// + /// + public static void FatalFormatExt(this ILog logger, string format, object arg0, object arg1) + { + try + { + if (!logger.IsFatalEnabled) + return; + + logger.FatalFormat(format, arg0, arg1); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + /// + /// Logs a formatted message string with the level. + /// + /// The logger on which the message is logged. + /// A String containing zero or more format items + /// An Object to format + /// An Object to format + /// An Object to format + /// + /// + /// The message is formatted using the String.Format method. See + /// for details of the syntax of the format string and the behavior + /// of the formatting. + /// + /// + /// This method does not take an object to include in the + /// log event. To pass an use one of the + /// methods instead. + /// + /// + /// + /// + public static void FatalFormatExt(this ILog logger, string format, object arg0, object arg1, object arg2) + { + try + { + if (!logger.IsFatalEnabled) + return; + + logger.FatalFormat(format, arg0, arg1, arg2); + } + catch (Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex); + } + } + + #endregion + + #endregion + } +} +#endif diff --git a/src/Util/LevelMapping.cs b/src/Util/LevelMapping.cs old mode 100755 new mode 100644 diff --git a/src/Util/LevelMappingEntry.cs b/src/Util/LevelMappingEntry.cs old mode 100755 new mode 100644 diff --git a/src/Util/LogLog.cs b/src/Util/LogLog.cs old mode 100755 new mode 100644 index 4d6b1dd9..9a9b4dad --- a/src/Util/LogLog.cs +++ b/src/Util/LogLog.cs @@ -19,7 +19,9 @@ using System; using System.Collections; +#if !NETSTANDARD1_3 using System.Configuration; +#endif using System.Diagnostics; namespace log4net.Util @@ -56,7 +58,7 @@ public sealed class LogLog public static event LogReceivedEventHandler LogReceived; private readonly Type source; - private readonly DateTime timeStamp; + private readonly DateTime timeStampUtc; private readonly string prefix; private readonly string message; private readonly Exception exception; @@ -74,7 +76,15 @@ public Type Source /// public DateTime TimeStamp { - get { return timeStamp; } + get { return timeStampUtc.ToLocalTime(); } + } + + /// + /// The UTC DateTime stamp of when the internal message was received. + /// + public DateTime TimeStampUtc + { + get { return timeStampUtc; } } /// @@ -130,7 +140,7 @@ public override string ToString() /// public LogLog(Type source, string prefix, string message, Exception exception) { - timeStamp = DateTime.Now; + timeStampUtc = DateTime.UtcNow; this.source = source; this.prefix = prefix; diff --git a/src/Util/LogicalThreadContextProperties.cs b/src/Util/LogicalThreadContextProperties.cs old mode 100755 new mode 100644 index a83fa2a0..fb9684fd --- a/src/Util/LogicalThreadContextProperties.cs +++ b/src/Util/LogicalThreadContextProperties.cs @@ -98,9 +98,14 @@ override public object this[string key] return null; } set - { + { // Force the dictionary to be created - GetProperties(true)[key] = value; + 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); + immutableProps[key] = value; + SetCallContextData(immutableProps); } } @@ -122,7 +127,9 @@ public void Remove(string key) PropertiesDictionary dictionary = GetProperties(false); if (dictionary != null) { - dictionary.Remove(key); + PropertiesDictionary immutableProps = new PropertiesDictionary(dictionary); + immutableProps.Remove(key); + SetCallContextData(immutableProps); } } @@ -139,7 +146,8 @@ public void Clear() PropertiesDictionary dictionary = GetProperties(false); if (dictionary != null) { - dictionary.Clear(); + PropertiesDictionary immutableProps = new PropertiesDictionary(); + SetCallContextData(immutableProps); } } @@ -203,9 +211,16 @@ internal PropertiesDictionary GetProperties(bool create) /// security link demand, therfore we must put the method call in a seperate method /// that we can wrap in an exception handler. /// - private static PropertiesDictionary GetCallContextData() +#if NET_4_0 || MONO_4_0 + [System.Security.SecuritySafeCritical] +#endif + private static PropertiesDictionary GetCallContextData() { +#if NET_2_0 || MONO_2_0 || MONO_3_5 || MONO_4_0 + return CallContext.LogicalGetData(c_SlotName) as PropertiesDictionary; +#else return CallContext.GetData(c_SlotName) as PropertiesDictionary; +#endif } /// @@ -217,9 +232,16 @@ private static PropertiesDictionary GetCallContextData() /// security link demand, therfore we must put the method call in a seperate method /// that we can wrap in an exception handler. /// - private static void SetCallContextData(PropertiesDictionary properties) +#if NET_4_0 || MONO_4_0 + [System.Security.SecuritySafeCritical] +#endif + private static void SetCallContextData(PropertiesDictionary properties) { +#if NET_2_0 || MONO_2_0 || MONO_3_5 || MONO_4_0 + CallContext.LogicalSetData(c_SlotName, properties); +#else CallContext.SetData(c_SlotName, properties); +#endif } #endregion diff --git a/src/Util/LogicalThreadContextStack.cs b/src/Util/LogicalThreadContextStack.cs new file mode 100644 index 00000000..d251f757 --- /dev/null +++ b/src/Util/LogicalThreadContextStack.cs @@ -0,0 +1,429 @@ +#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 !NETCF +using System; +using System.Collections; + +using log4net.Core; + +namespace log4net.Util +{ + + /// + /// Delegate type used for LogicalThreadContextStack's callbacks. + /// + #if NET_2_0 || MONO_2_0 + public delegate void TwoArgAction(T1 t1, T2 t2); + #else + public delegate void TwoArgAction(string t1, LogicalThreadContextStack t2); + #endif + + /// + /// Implementation of Stack for the + /// + /// + /// + /// Implementation of Stack for the + /// + /// + /// Nicko Cadell + public sealed class LogicalThreadContextStack : IFixingRequired + { + #region Private Instance Fields + + /// + /// The stack store. + /// + private Stack m_stack = new Stack(); + + /// + /// The name of this within the + /// . + /// + private string m_propertyKey; + + /// + /// The callback used to let the register a + /// new instance of a . + /// + #if NET_2_0 || MONO_2_0 + private TwoArgAction m_registerNew; + #else + private TwoArgAction m_registerNew; + #endif + + #endregion Private Instance Fields + + #region Public Instance Constructors + + /// + /// Internal constructor + /// + /// + /// + /// Initializes a new instance of the class. + /// + /// + #if NET_2_0 || MONO_2_0 + internal LogicalThreadContextStack(string propertyKey, TwoArgAction registerNew) + #else + internal LogicalThreadContextStack(string propertyKey, TwoArgAction registerNew) + #endif + { + m_propertyKey = propertyKey; + m_registerNew = registerNew; + } + + #endregion Public Instance Constructors + + #region Public Properties + + /// + /// The number of messages in the stack + /// + /// + /// The current number of messages in the stack + /// + /// + /// + /// The current number of messages in the stack. That is + /// the number of times has been called + /// minus the number of times has been called. + /// + /// + public int Count + { + get { return m_stack.Count; } + } + + #endregion // Public Properties + + #region Public Methods + + /// + /// Clears all the contextual information held in this stack. + /// + /// + /// + /// Clears all the contextual information held in this stack. + /// Only call this if you think that this thread is being reused after + /// a previous call execution which may not have completed correctly. + /// You do not need to use this method if you always guarantee to call + /// the method of the + /// returned from even in exceptional circumstances, + /// for example by using the using(log4net.LogicalThreadContext.Stacks["NDC"].Push("Stack_Message")) + /// syntax. + /// + /// + public void Clear() + { + m_registerNew(m_propertyKey, new LogicalThreadContextStack(m_propertyKey, m_registerNew)); + } + + /// + /// Removes the top context from this stack. + /// + /// The message in the context that was removed from the top of this stack. + /// + /// + /// Remove the top context from this stack, and return + /// it to the caller. If this stack is empty then an + /// empty string (not ) is returned. + /// + /// + public string Pop() + { + // copy current stack + Stack stack = new Stack(new Stack(m_stack)); + string result = ""; + if (stack.Count > 0) + { + result = ((StackFrame)(stack.Pop())).Message; + } + LogicalThreadContextStack ltcs = new LogicalThreadContextStack(m_propertyKey, m_registerNew); + ltcs.m_stack = stack; + m_registerNew(m_propertyKey, ltcs); + return result; + } + + /// + /// Pushes a new context message into this stack. + /// + /// The new context message. + /// + /// An that can be used to clean up the context stack. + /// + /// + /// + /// Pushes a new context onto this stack. An + /// is returned that can be used to clean up this stack. This + /// can be easily combined with the using keyword to scope the + /// context. + /// + /// + /// Simple example of using the Push method with the using keyword. + /// + /// using(log4net.LogicalThreadContext.Stacks["NDC"].Push("Stack_Message")) + /// { + /// log.Warn("This should have an ThreadContext Stack 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)); + + LogicalThreadContextStack contextStack = new LogicalThreadContextStack(m_propertyKey, m_registerNew); + contextStack.m_stack = stack; + m_registerNew(m_propertyKey, contextStack); + return new AutoPopStackFrame(contextStack, stack.Count - 1); + } + + #endregion Public Methods + + #region Internal Methods + + /// + /// Gets the current context information for this stack. + /// + /// The current context information. + internal string GetFullMessage() + { + Stack stack = m_stack; + if (stack.Count > 0) + { + return ((StackFrame)(stack.Peek())).FullMessage; + } + return null; + } + + /// + /// Gets and sets the internal stack used by this + /// + /// The internal storage stack + /// + /// + /// This property is provided only to support backward compatability + /// of the . Tytpically the internal stack should not + /// be modified. + /// + /// + internal Stack InternalStack + { + get { return m_stack; } + set { m_stack = value; } + } + + #endregion Internal Methods + + /// + /// Gets the current context information for this stack. + /// + /// Gets the current context information + /// + /// + /// Gets the current context information for this stack. + /// + /// + public override string ToString() + { + return GetFullMessage(); + } + + /// + /// Get a portable version of this object + /// + /// the portable instance of this object + /// + /// + /// Get a cross thread portable version of this object + /// + /// + object IFixingRequired.GetFixedObject() + { + return GetFullMessage(); + } + + /// + /// Inner class used to represent a single context frame in the stack. + /// + /// + /// + /// Inner class used to represent a single context frame in the stack. + /// + /// + private 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 + + /// + /// Constructor + /// + /// The message for this context. + /// The parent context in the chain. + /// + /// + /// Initializes a new instance of the class + /// with the specified message and parent context. + /// + /// + internal StackFrame(string message, StackFrame parent) + { + m_message = message; + m_parent = parent; + + if (parent == null) + { + m_fullMessage = message; + } + } + + #endregion Internal Instance Constructors + + #region Internal Instance Properties + + /// + /// Get the message. + /// + /// The message. + /// + /// + /// Get the message. + /// + /// + internal string Message + { + get { return m_message; } + } + + /// + /// Gets the full text of the context down to the root level. + /// + /// + /// The full text of the context down to the root level. + /// + /// + /// + /// Gets the full text of the context down to the root level. + /// + /// + internal string FullMessage + { + get + { + if (m_fullMessage == null && m_parent != null) + { + m_fullMessage = string.Concat(m_parent.FullMessage, " ", m_message); + } + return m_fullMessage; + } + } + + #endregion Internal Instance Properties + } + + /// + /// Struct returned from the method. + /// + /// + /// + /// This struct implements the and is designed to be used + /// with the pattern to remove the stack frame at the end of the scope. + /// + /// + private struct AutoPopStackFrame : IDisposable + { + #region Private Instance Fields + + /// + /// The depth to trim the stack to when this instance is disposed + /// + private int m_frameDepth; + + /// + /// The outer LogicalThreadContextStack. + /// + private LogicalThreadContextStack m_logicalThreadContextStack; + + #endregion Private Instance Fields + + #region Internal Instance Constructors + + /// + /// Constructor + /// + /// The internal stack used by the ThreadContextStack. + /// The depth to return the stack to when this object is disposed. + /// + /// + /// Initializes a new instance of the class with + /// the specified stack and return depth. + /// + /// + internal AutoPopStackFrame(LogicalThreadContextStack logicalThreadContextStack, int frameDepth) + { + m_frameDepth = frameDepth; + m_logicalThreadContextStack = logicalThreadContextStack; + } + + #endregion Internal Instance Constructors + + #region Implementation of IDisposable + + /// + /// Returns the stack to the correct depth. + /// + /// + /// + /// Returns the stack to the correct depth. + /// + /// + public void Dispose() + { + if (m_frameDepth >= 0 && m_logicalThreadContextStack.m_stack != null) + { + Stack stack = new Stack(new Stack(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); + } + } + + #endregion Implementation of IDisposable + } + + } +} +#endif \ No newline at end of file diff --git a/src/Util/LogicalThreadContextStacks.cs b/src/Util/LogicalThreadContextStacks.cs new file mode 100644 index 00000000..3554cf37 --- /dev/null +++ b/src/Util/LogicalThreadContextStacks.cs @@ -0,0 +1,143 @@ +#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 !NETCF +using System; +using System.Collections; + +namespace log4net.Util +{ + /// + /// Implementation of Stacks collection for the + /// + /// + /// + /// Implementation of Stacks collection for the + /// + /// + /// Nicko Cadell + public sealed class LogicalThreadContextStacks + { + private readonly LogicalThreadContextProperties m_properties; + + #region Public Instance Constructors + + /// + /// Internal constructor + /// + /// + /// + /// Initializes a new instance of the class. + /// + /// + internal LogicalThreadContextStacks(LogicalThreadContextProperties properties) + { + m_properties = properties; + } + + #endregion Public Instance Constructors + + #region Public Instance Properties + + /// + /// Gets the named thread context stack + /// + /// + /// The named stack + /// + /// + /// + /// Gets the named thread context stack + /// + /// + public LogicalThreadContextStack this[string key] + { + get + { + LogicalThreadContextStack stack = null; + + object propertyValue = m_properties[key]; + if (propertyValue == null) + { + // Stack does not exist, create +#if NET_2_0 || MONO_2_0 + stack = new LogicalThreadContextStack(key, registerNew); +#else + stack = new LogicalThreadContextStack(key, new TwoArgAction(registerNew)); +#endif + m_properties[key] = stack; + } + else + { + // Look for existing stack + stack = propertyValue as LogicalThreadContextStack; + if (stack == null) + { + // Property is not set to a stack! + string propertyValueString = SystemInfo.NullText; + + try + { + propertyValueString = propertyValue.ToString(); + } + catch + { + } + + 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 + stack = new LogicalThreadContextStack(key, registerNew); +#else + stack = new LogicalThreadContextStack(key, new TwoArgAction(registerNew)); +#endif + } + } + + return stack; + } + } + + #endregion Public Instance Properties + + #region Private Instance Fields + + private void registerNew(string stackName, LogicalThreadContextStack stack) + { + m_properties[stackName] = stack; + } + + #endregion Private Instance Fields + + #region Private Static Fields + + /// + /// The fully qualified type of the ThreadContextStacks class. + /// + /// + /// Used by the internal logger to record the Type of the + /// log message. + /// + private readonly static Type declaringType = typeof(LogicalThreadContextStacks); + + #endregion Private Static Fields + } +} + +#endif diff --git a/src/Util/NativeError.cs b/src/Util/NativeError.cs old mode 100755 new mode 100644 index f889d9e5..1aeab0be --- a/src/Util/NativeError.cs +++ b/src/Util/NativeError.cs @@ -114,7 +114,12 @@ public string Message /// native Win32 FormatMessage function. /// /// - public static NativeError GetLastError() +#if NET_4_0 || MONO_4_0 || NETSTANDARD1_3 + [System.Security.SecuritySafeCritical] +#elif !NETCF + [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, UnmanagedCode=true)] +#endif + public static NativeError GetLastError() { int number = Marshal.GetLastWin32Error(); return new NativeError(number, NativeError.GetErrorMessage(number)); @@ -152,7 +157,12 @@ public static NativeError GetError(int number) /// using the native FormatMessage function. /// /// - public static string GetErrorMessage(int messageId) +#if NET_4_0 || MONO_4_0 || NETSTANDARD1_3 + [System.Security.SecuritySafeCritical] +#elif !NETCF + [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, UnmanagedCode = true)] +#endif + public static string GetErrorMessage(int messageId) { // Win32 constants int FORMAT_MESSAGE_ALLOCATE_BUFFER = 0x00000100; // The function should allocates a buffer large enough to hold the formatted message @@ -247,7 +257,7 @@ public override string ToString() /// /// /// If the function fails, the return value is zero. To get extended error information, - /// call . + /// call . /// /// #if NETCF diff --git a/src/Util/NullDictionaryEnumerator.cs b/src/Util/NullDictionaryEnumerator.cs old mode 100755 new mode 100644 diff --git a/src/Util/NullEnumerator.cs b/src/Util/NullEnumerator.cs old mode 100755 new mode 100644 diff --git a/src/Util/NullSecurityContext.cs b/src/Util/NullSecurityContext.cs old mode 100755 new mode 100644 diff --git a/src/Util/OnlyOnceErrorHandler.cs b/src/Util/OnlyOnceErrorHandler.cs old mode 100755 new mode 100644 index cc08d2d8..80629629 --- a/src/Util/OnlyOnceErrorHandler.cs +++ b/src/Util/OnlyOnceErrorHandler.cs @@ -30,7 +30,7 @@ namespace log4net.Util /// /// /// - /// The error message is processed using the LogLog sub-system. + /// The error message is processed using the LogLog sub-system by default. /// /// /// This policy aims at protecting an otherwise working application @@ -81,7 +81,7 @@ public OnlyOnceErrorHandler(string prefix) /// public void Reset() { - m_enabledDate = DateTime.MinValue; + m_enabledDateUtc = DateTime.MinValue; m_errorCode = ErrorCode.GenericFailure; m_exception = null; m_message = null; @@ -98,37 +98,50 @@ public void Reset() /// The internal error code. /// /// - /// Sends the error information to 's Error method. + /// Invokes if and only if this is the first error or the first error after has been called. /// /// public void Error(string message, Exception e, ErrorCode errorCode) { if (m_firstTime) { - m_enabledDate = DateTime.Now; - m_errorCode = errorCode; - m_exception = e; - m_message = message; - m_firstTime = false; - - if (LogLog.InternalDebugging && !LogLog.QuietMode) - { - LogLog.Error(declaringType, "[" + m_prefix + "] ErrorCode: " + errorCode.ToString() + ". " + message, e); - } + FirstError(message, e, errorCode); } } - /// + /// + /// Log the very first error + /// + /// The error message. + /// The exception. + /// The internal error code. + /// + /// + /// Sends the error information to 's Error method. + /// + /// + 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; + + if (LogLog.InternalDebugging && !LogLog.QuietMode) { + LogLog.Error(declaringType, "[" + m_prefix + "] ErrorCode: " + errorCode.ToString() + ". " + message, e); + } + } + + /// /// Log an Error /// /// The error message. /// The exception. /// - /// - /// Prints the message and the stack trace of the exception on the standard - /// error output stream. - /// - /// + /// + /// Invokes if and only if this is the first error or the first error after has been called. + /// + /// public void Error(string message, Exception e) { Error(message, e, ErrorCode.GenericFailure); @@ -139,11 +152,10 @@ public void Error(string message, Exception e) /// /// The error message. /// - /// - /// Print a the error message passed as parameter on the standard - /// error output stream. - /// - /// + /// + /// Invokes if and only if this is the first error or the first error after has been called. + /// + /// public void Error(string message) { Error(message, null, ErrorCode.GenericFailure); @@ -170,13 +182,25 @@ public bool IsEnabled } /// - /// The date the first error that trigged this error handler occured. + /// The date the first error that trigged this error handler occurred, or if it has not been triggered. /// public DateTime EnabledDate { - get { return m_enabledDate; } + get + { + if (m_enabledDateUtc == DateTime.MinValue) return DateTime.MinValue; + return m_enabledDateUtc.ToLocalTime(); + } } + /// + /// The UTC date the first error that trigged this error handler occured, or if it has not been triggered. + /// + public DateTime EnabledDateUtc + { + get { return m_enabledDateUtc; } + } + /// /// The message from the first error that trigged this error handler. /// @@ -212,9 +236,9 @@ public ErrorCode ErrorCode #region Private Instance Fields /// - /// The date the error was recorded. + /// The UTC date the error was recorded. /// - private DateTime m_enabledDate; + private DateTime m_enabledDateUtc; /// /// Flag to indicate if it is the first error diff --git a/src/Util/OptionConverter.cs b/src/Util/OptionConverter.cs old mode 100755 new mode 100644 index d509e73f..cc791dc8 --- a/src/Util/OptionConverter.cs +++ b/src/Util/OptionConverter.cs @@ -286,7 +286,11 @@ public static object ConvertStringTo(Type target, string txt) } else { +#if NETSTANDARD1_3 + if (target.GetTypeInfo().IsEnum) +#else if (target.IsEnum) +#endif { // Target type is an enum. @@ -303,7 +307,11 @@ public static object ConvertStringTo(Type target, string txt) if (meth != null) { // 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 { @@ -475,7 +483,11 @@ public static object InstantiateByClassName(string className, Type superClass, o { 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)) { LogLog.Error(declaringType, "OptionConverter: A [" + className + "] object is not assignable to a [" + superClass.FullName + "] variable."); @@ -492,7 +504,7 @@ public static object InstantiateByClassName(string className, Type superClass, o } /// - /// Performs variable substitution in string from the + /// Performs variable substitution in string from the /// values of keys found in . /// /// The string on which variable substitution is performed. diff --git a/src/Util/PatternConverter.cs b/src/Util/PatternConverter.cs old mode 100755 new mode 100644 index ba4c0188..7b333957 --- a/src/Util/PatternConverter.cs +++ b/src/Util/PatternConverter.cs @@ -174,33 +174,43 @@ virtual public void Format(TextWriter writer, object state) } else { - m_formatWriter.Reset(c_renderBufferMaxCapacity, c_renderBufferSize); - - Convert(m_formatWriter, state); - - StringBuilder buf = m_formatWriter.GetStringBuilder(); - int len = buf.Length; - - if (len > m_max) - { - writer.Write(buf.ToString(len - m_max, m_max)); - } - else if (len < m_min) + string msg = null; + int len; + lock (m_formatWriter) + { + m_formatWriter.Reset(c_renderBufferMaxCapacity, c_renderBufferSize); + + Convert(m_formatWriter, state); + + StringBuilder buf = m_formatWriter.GetStringBuilder(); + len = buf.Length; + if (len > m_max) + { + msg = buf.ToString(len - m_max, m_max); + len = m_max; + } + else + { + msg = buf.ToString(); + } + } + + if (len < m_min) { if (m_leftAlign) { - writer.Write(buf.ToString()); + writer.Write(msg); SpacePad(writer, m_min - len); } else { SpacePad(writer, m_min - len); - writer.Write(buf.ToString()); + writer.Write(msg); } } else { - writer.Write(buf.ToString()); + writer.Write(msg); } } } diff --git a/src/Util/PatternParser.cs b/src/Util/PatternParser.cs old mode 100755 new mode 100644 index 863f5572..bfe44526 --- a/src/Util/PatternParser.cs +++ b/src/Util/PatternParser.cs @@ -20,15 +20,9 @@ using System; using System.Collections; using System.Globalization; -using System.IO; -using System.Reflection; -using System.Text; -using log4net.Layout; using log4net.Core; -using log4net.DateFormatter; -using log4net.Layout.Pattern; -using log4net.Util; +using log4net.Layout; namespace log4net.Util { @@ -232,7 +226,9 @@ private void ParseInternal(string pattern, string[] matches) { formattingInfo.Min = 0; } - formattingInfo.Min = (formattingInfo.Min * 10) + int.Parse(pattern[offset].ToString(CultureInfo.InvariantCulture), System.Globalization.NumberFormatInfo.InvariantInfo); + + formattingInfo.Min = (formattingInfo.Min * 10) + int.Parse(pattern[offset].ToString(), NumberFormatInfo.InvariantInfo); + offset++; } // Look for the separator between min and max @@ -252,7 +248,9 @@ private void ParseInternal(string pattern, string[] matches) { formattingInfo.Max = 0; } - formattingInfo.Max = (formattingInfo.Max * 10) + int.Parse(pattern[offset].ToString(CultureInfo.InvariantCulture), System.Globalization.NumberFormatInfo.InvariantInfo); + + formattingInfo.Max = (formattingInfo.Max * 10) + int.Parse(pattern[offset].ToString(), NumberFormatInfo.InvariantInfo); + offset++; } @@ -261,9 +259,11 @@ private void ParseInternal(string pattern, string[] matches) // Look for pattern for(int m=0; m /// /// + /// appsetting + /// + /// + /// Used to output the value of a specific appSetting key in the application + /// configuration file. + /// + /// + /// + /// /// date /// /// @@ -73,7 +85,7 @@ namespace log4net.Util /// /// /// The date format specifier admits the same syntax as the - /// time pattern string of the . + /// time pattern string of the . /// /// /// For better results it is recommended to use the log4net date @@ -86,7 +98,7 @@ namespace log4net.Util /// /// /// These dedicated date formatters perform significantly - /// better than . + /// better than . /// /// /// @@ -208,7 +220,7 @@ namespace log4net.Util /// /// /// The date format specifier admits the same syntax as the - /// time pattern string of the . + /// time pattern string of the . /// /// /// For better results it is recommended to use the log4net date @@ -221,7 +233,7 @@ namespace log4net.Util /// /// /// These dedicated date formatters perform significantly - /// better than . + /// better than . /// /// /// @@ -236,8 +248,8 @@ namespace log4net.Util /// /// /// Additional pattern converters may be registered with a specific - /// instance using or - /// . + /// instance using or + /// . /// /// /// See the for details on the @@ -282,13 +294,15 @@ public class PatternString : IOptionHandler /// static PatternString() { - s_globalRulesRegistry = new Hashtable(15); + s_globalRulesRegistry = new Hashtable(18); s_globalRulesRegistry.Add("appdomain", typeof(AppDomainPatternConverter)); s_globalRulesRegistry.Add("date", typeof(DatePatternConverter)); #if !NETCF s_globalRulesRegistry.Add("env", typeof(EnvironmentPatternConverter)); - s_globalRulesRegistry.Add("envFolderPath", typeof(EnvironmentFolderPathPatternConverter)); +#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)); @@ -301,6 +315,13 @@ static PatternString() 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 @@ -462,7 +483,7 @@ public string Format() /// /// /// This version of the method is used by the configurator. - /// Programmatic users should use the alternative method. + /// Programmatic users should use the alternative method. /// /// public void AddConverter(ConverterInfo converterInfo) diff --git a/src/Util/PatternStringConverters/AppDomainPatternConverter.cs b/src/Util/PatternStringConverters/AppDomainPatternConverter.cs old mode 100755 new mode 100644 diff --git a/src/Util/PatternStringConverters/AppSettingPatternConverter.cs b/src/Util/PatternStringConverters/AppSettingPatternConverter.cs new file mode 100644 index 00000000..ce3bba48 --- /dev/null +++ b/src/Util/PatternStringConverters/AppSettingPatternConverter.cs @@ -0,0 +1,113 @@ +#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 + +// .NET Compact Framework 1.0 has no support for application .config files +#if !NETCF + +using System; +using System.Text; +using System.IO; +using System.Collections; + +using log4net.Core; +using log4net.Util; +using log4net.Repository; + +namespace log4net.Util.PatternStringConverters +{ + /// + /// AppSetting pattern converter + /// + /// + /// + /// This pattern converter reads appSettings from the application configuration file. + /// + /// + /// If the is specified then that will be used to + /// lookup a single appSettings value. If no is specified + /// then all appSettings will be dumped as a list of key value pairs. + /// + /// + /// A typical use is to specify a base directory for log files, e.g. + /// + /// + /// + /// + /// ... + /// + /// + /// ]]> + /// + /// + /// + internal sealed class AppSettingPatternConverter : PatternConverter + { + private static IDictionary AppSettingsDictionary + { + get + { + if (_appSettingsHashTable == null) + { + Hashtable h = new Hashtable(); + foreach(string key in System.Configuration.ConfigurationManager.AppSettings) + { + h.Add(key, System.Configuration.ConfigurationManager.AppSettings[key]); + } + _appSettingsHashTable = h; + } + return _appSettingsHashTable; + } + + } + private static Hashtable _appSettingsHashTable; + + /// + /// Write the property value to the output + /// + /// that will receive the formatted result. + /// null, state is not set + /// + /// + /// Writes out the value of a named property. The property name + /// should be set in the + /// property. + /// + /// + /// If the is set to null + /// then all the properties are written as key value pairs. + /// + /// + override protected void Convert(TextWriter writer, object state) + { + + if (Option != null) + { + // Write the value for the specified key + WriteObject(writer, null, System.Configuration.ConfigurationManager.AppSettings[Option]); + } + else + { + // Write all the key value pairs + WriteDictionary(writer, null, AppSettingsDictionary); + } + } + } +} +#endif diff --git a/src/Util/PatternStringConverters/DatePatternConverter.cs b/src/Util/PatternStringConverters/DatePatternConverter.cs old mode 100755 new mode 100644 index 8dec5d8b..6def66f2 --- a/src/Util/PatternStringConverters/DatePatternConverter.cs +++ b/src/Util/PatternStringConverters/DatePatternConverter.cs @@ -18,10 +18,8 @@ #endregion using System; -using System.Text; using System.IO; -using log4net.Util; using log4net.DateFormatter; using log4net.Core; @@ -69,7 +67,7 @@ namespace log4net.Util.PatternStringConverters /// /// Any other pattern string uses the formatter. /// This formatter passes the pattern string to the - /// method. + /// method. /// For details on valid patterns see /// DateTimeFormatInfo Class. /// @@ -115,24 +113,25 @@ internal class DatePatternConverter : PatternConverter, IOptionHandler public void ActivateOptions() { string dateFormatStr = Option; + if (dateFormatStr == null) { dateFormatStr = AbsoluteTimeDateFormatter.Iso8601TimeDateFormat; } - if (string.Compare(dateFormatStr, AbsoluteTimeDateFormatter.Iso8601TimeDateFormat, true, System.Globalization.CultureInfo.InvariantCulture) == 0) + if (SystemInfo.EqualsIgnoringCase(dateFormatStr, AbsoluteTimeDateFormatter.Iso8601TimeDateFormat)) { m_dateFormatter = new Iso8601DateFormatter(); } - else if (string.Compare(dateFormatStr, AbsoluteTimeDateFormatter.AbsoluteTimeDateFormat, true, System.Globalization.CultureInfo.InvariantCulture) == 0) + else if (SystemInfo.EqualsIgnoringCase(dateFormatStr, AbsoluteTimeDateFormatter.AbsoluteTimeDateFormat)) { m_dateFormatter = new AbsoluteTimeDateFormatter(); } - else if (string.Compare(dateFormatStr, AbsoluteTimeDateFormatter.DateAndTimeDateFormat, true, System.Globalization.CultureInfo.InvariantCulture) == 0) + else if (SystemInfo.EqualsIgnoringCase(dateFormatStr, AbsoluteTimeDateFormatter.DateAndTimeDateFormat)) { m_dateFormatter = new DateTimeDateFormatter(); } - else + else { try { diff --git a/src/Util/PatternStringConverters/EnvironmentFolderPathPatternConverter.cs b/src/Util/PatternStringConverters/EnvironmentFolderPathPatternConverter.cs index d23b8a14..a6dd2216 100644 --- a/src/Util/PatternStringConverters/EnvironmentFolderPathPatternConverter.cs +++ b/src/Util/PatternStringConverters/EnvironmentFolderPathPatternConverter.cs @@ -1,98 +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 - -#if !NETCF - -using System; -using System.IO; - -namespace log4net.Util.PatternStringConverters -{ - /// - /// Write an folder path to the output - /// - /// - /// - /// Write an special path environment folder path to the output writer. - /// The value of the determines - /// the name of the variable to output. - /// should be a value in the enumeration. - /// - /// - /// Ron Grabowski - internal sealed class EnvironmentFolderPathPatternConverter : PatternConverter - { - /// - /// Write an special path environment folder path to the output - /// - /// the writer to write to - /// null, state is not set - /// - /// - /// Writes the special path environment folder path to the output . - /// The name of the special path environment folder path to output must be set - /// using the - /// property. - /// - /// - override protected void Convert(TextWriter writer, object state) - { - try - { - if (Option != null && 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) - { - writer.Write(envFolderPathValue); - } - } - } - catch (System.Security.SecurityException secEx) - { - // This security exception will occur if the caller does not have - // unrestricted environment permission. If this occurs the expansion - // will be skipped with the following warning message. - LogLog.Debug(declaringType, "Security exception while trying to expand environment variables. Error Ignored. No Expansion.", secEx); - } - catch (Exception ex) - { - LogLog.Error(declaringType, "Error occurred while converting environment variable.", ex); - } - } - - #region Private Static Fields - - /// - /// The fully qualified type of the EnvironmentFolderPathPatternConverter class. - /// - /// - /// Used by the internal logger to record the Type of the - /// log message. - /// - private readonly static Type declaringType = typeof(EnvironmentFolderPathPatternConverter); - - #endregion Private Static Fields - } -} - +#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 !NETCF + +using System; +using System.IO; + +namespace log4net.Util.PatternStringConverters +{ + /// + /// Write an folder path to the output + /// + /// + /// + /// Write an special path environment folder path to the output writer. + /// The value of the determines + /// the name of the variable to output. + /// should be a value in the enumeration. + /// + /// + /// Ron Grabowski + internal sealed class EnvironmentFolderPathPatternConverter : PatternConverter + { + /// + /// Write an special path environment folder path to the output + /// + /// the writer to write to + /// null, state is not set + /// + /// + /// Writes the special path environment folder path to the output . + /// The name of the special path environment folder path to output must be set + /// using the + /// property. + /// + /// + override protected void Convert(TextWriter writer, object state) + { + try + { + if (Option != null && 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) + { + writer.Write(envFolderPathValue); + } + } + } + catch (System.Security.SecurityException secEx) + { + // This security exception will occur if the caller does not have + // unrestricted environment permission. If this occurs the expansion + // will be skipped with the following warning message. + LogLog.Debug(declaringType, "Security exception while trying to expand environment variables. Error Ignored. No Expansion.", secEx); + } + catch (Exception ex) + { + LogLog.Error(declaringType, "Error occurred while converting environment variable.", ex); + } + } + + #region Private Static Fields + + /// + /// The fully qualified type of the EnvironmentFolderPathPatternConverter class. + /// + /// + /// Used by the internal logger to record the Type of the + /// log message. + /// + private readonly static Type declaringType = typeof(EnvironmentFolderPathPatternConverter); + + #endregion Private Static Fields + } +} + #endif // !NETCF \ No newline at end of file diff --git a/src/Util/PatternStringConverters/EnvironmentPatternConverter.cs b/src/Util/PatternStringConverters/EnvironmentPatternConverter.cs old mode 100755 new mode 100644 diff --git a/src/Util/PatternStringConverters/IdentityPatternConverter.cs b/src/Util/PatternStringConverters/IdentityPatternConverter.cs old mode 100755 new mode 100644 index 5f83c767..d92a292b --- a/src/Util/PatternStringConverters/IdentityPatternConverter.cs +++ b/src/Util/PatternStringConverters/IdentityPatternConverter.cs @@ -48,7 +48,7 @@ internal sealed class IdentityPatternConverter : PatternConverter /// override protected void Convert(TextWriter writer, object state) { -#if (NETCF || SSCLI) +#if (NETCF || SSCLI || NETSTANDARD1_3) // On compact framework there's no notion of current thread principals writer.Write( SystemInfo.NotAvailableText ); #else diff --git a/src/Util/PatternStringConverters/LiteralPatternConverter.cs b/src/Util/PatternStringConverters/LiteralPatternConverter.cs old mode 100755 new mode 100644 diff --git a/src/Util/PatternStringConverters/NewLinePatternConverter.cs b/src/Util/PatternStringConverters/NewLinePatternConverter.cs old mode 100755 new mode 100644 index c5b4e7ac..2ba276f4 --- a/src/Util/PatternStringConverters/NewLinePatternConverter.cs +++ b/src/Util/PatternStringConverters/NewLinePatternConverter.cs @@ -17,11 +17,6 @@ // #endregion -using System; -using System.Text; -using System.IO; - -using log4net.Util; using log4net.Core; namespace log4net.Util.PatternStringConverters @@ -72,11 +67,11 @@ internal sealed class NewLinePatternConverter : LiteralPatternConverter, IOption /// public void ActivateOptions() { - if (string.Compare(Option, "DOS", true, System.Globalization.CultureInfo.InvariantCulture) == 0) + if (SystemInfo.EqualsIgnoringCase(Option, "DOS")) { Option = "\r\n"; } - else if (string.Compare(Option, "UNIX", true, System.Globalization.CultureInfo.InvariantCulture) == 0) + else if (SystemInfo.EqualsIgnoringCase(Option, "UNIX")) { Option = "\n"; } diff --git a/src/Util/PatternStringConverters/ProcessIdPatternConverter.cs b/src/Util/PatternStringConverters/ProcessIdPatternConverter.cs old mode 100755 new mode 100644 index 29a33a68..2d6a5a1e --- a/src/Util/PatternStringConverters/ProcessIdPatternConverter.cs +++ b/src/Util/PatternStringConverters/ProcessIdPatternConverter.cs @@ -46,7 +46,10 @@ internal sealed class ProcessIdPatternConverter : PatternConverter /// Write the current process ID to the output . /// /// - override protected void Convert(TextWriter writer, object state) +#if NET_4_0 || MONO_4_0 || NETSTANDARD1_3 + [System.Security.SecuritySafeCritical] +#endif + override protected void Convert(TextWriter writer, object state) { #if (NETCF || SSCLI) // On compact framework there is no System.Diagnostics.Process class diff --git a/src/Util/PatternStringConverters/PropertyPatternConverter.cs b/src/Util/PatternStringConverters/PropertyPatternConverter.cs old mode 100755 new mode 100644 index 3124b31d..9c2051e7 --- a/src/Util/PatternStringConverters/PropertyPatternConverter.cs +++ b/src/Util/PatternStringConverters/PropertyPatternConverter.cs @@ -68,7 +68,7 @@ override protected void Convert(TextWriter writer, object state) { CompositeProperties compositeProperties = new CompositeProperties(); -#if !NETCF +#if !(NETCF || NETSTANDARD1_3) PropertiesDictionary logicalThreadProperties = LogicalThreadContext.Properties.GetProperties(false); if (logicalThreadProperties != null) { diff --git a/src/Util/PatternStringConverters/RandomStringPatternConverter.cs b/src/Util/PatternStringConverters/RandomStringPatternConverter.cs old mode 100755 new mode 100644 diff --git a/src/Util/PatternStringConverters/UserNamePatternConverter.cs b/src/Util/PatternStringConverters/UserNamePatternConverter.cs old mode 100755 new mode 100644 index 921ee249..0f8dffb3 --- a/src/Util/PatternStringConverters/UserNamePatternConverter.cs +++ b/src/Util/PatternStringConverters/UserNamePatternConverter.cs @@ -48,7 +48,7 @@ internal sealed class UserNamePatternConverter : PatternConverter /// override protected void Convert(TextWriter writer, object state) { -#if (NETCF || SSCLI) +#if (NETCF || SSCLI || NETSTANDARD1_3) // On compact framework there's no notion of current Windows user writer.Write( SystemInfo.NotAvailableText ); #else diff --git a/src/Util/PatternStringConverters/UtcDatePatternConverter.cs b/src/Util/PatternStringConverters/UtcDatePatternConverter.cs old mode 100755 new mode 100644 diff --git a/src/Util/PropertiesDictionary.cs b/src/Util/PropertiesDictionary.cs old mode 100755 new mode 100644 index be511d57..d2e48d5c --- a/src/Util/PropertiesDictionary.cs +++ b/src/Util/PropertiesDictionary.cs @@ -75,7 +75,7 @@ public PropertiesDictionary(ReadOnlyPropertiesDictionary propertiesDictionary) : #region Private Instance Constructors -#if !NETCF +#if !(NETCF || NETSTANDARD1_3) /// /// Initializes a new instance of the class /// with serialized data. diff --git a/src/Util/PropertyEntry.cs b/src/Util/PropertyEntry.cs index 3ef83a1d..3357d989 100644 --- a/src/Util/PropertyEntry.cs +++ b/src/Util/PropertyEntry.cs @@ -1,59 +1,80 @@ -namespace log4net.Util -{ - /// - /// A class to hold the key and data for a property set in the config file - /// - /// - /// - /// A class to hold the key and data for a property set in the config file - /// - /// - public class PropertyEntry - { - private string m_key = null; - private object m_value = null; - - /// - /// Property Key - /// - /// - /// Property Key - /// - /// - /// - /// Property Key. - /// - /// - public string Key - { - get { return m_key; } - set { m_key = value; } - } - - /// - /// Property Value - /// - /// - /// Property Value - /// - /// - /// - /// Property Value. - /// - /// - public object Value - { - get { return m_value; } - set { m_value = value; } - } - - /// - /// Override Object.ToString to return sensible debug info - /// - /// string info about this object - public override string ToString() - { - return "PropertyEntry(Key=" + m_key + ", Value=" + m_value + ")"; - } - } -} +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +namespace log4net.Util +{ + /// + /// A class to hold the key and data for a property set in the config file + /// + /// + /// + /// A class to hold the key and data for a property set in the config file + /// + /// + public class PropertyEntry + { + private string m_key = null; + private object m_value = null; + + /// + /// Property Key + /// + /// + /// Property Key + /// + /// + /// + /// Property Key. + /// + /// + public string Key + { + get { return m_key; } + set { m_key = value; } + } + + /// + /// Property Value + /// + /// + /// Property Value + /// + /// + /// + /// Property Value. + /// + /// + public object Value + { + get { return m_value; } + set { m_value = value; } + } + + /// + /// Override Object.ToString to return sensible debug info + /// + /// string info about this object + public override string ToString() + { + return "PropertyEntry(Key=" + m_key + ", Value=" + m_value + ")"; + } + } +} diff --git a/src/Util/ProtectCloseTextWriter.cs b/src/Util/ProtectCloseTextWriter.cs old mode 100755 new mode 100644 diff --git a/src/Util/QuietTextWriter.cs b/src/Util/QuietTextWriter.cs old mode 100755 new mode 100644 diff --git a/src/Util/ReadOnlyPropertiesDictionary.cs b/src/Util/ReadOnlyPropertiesDictionary.cs old mode 100755 new mode 100644 index 407fd5c8..fba6c1ac --- a/src/Util/ReadOnlyPropertiesDictionary.cs +++ b/src/Util/ReadOnlyPropertiesDictionary.cs @@ -19,6 +19,7 @@ using System; using System.Collections; +using System.Reflection; #if !NETCF using System.Runtime.Serialization; using System.Xml; @@ -52,7 +53,7 @@ public class ReadOnlyPropertiesDictionary : IDictionary /// /// The Hashtable used to store the properties data /// - private Hashtable m_hashtable = new Hashtable(); + private readonly Hashtable m_hashtable = new Hashtable(); #endregion Private Instance Fields @@ -91,7 +92,7 @@ public ReadOnlyPropertiesDictionary(ReadOnlyPropertiesDictionary propertiesDicti #region Private Instance Constructors -#if !NETCF +#if !(NETCF || NETSTANDARD1_3) /// /// Deserialization constructor /// @@ -203,16 +204,25 @@ protected Hashtable InnerHashtable /// Serializes this object into the provided. /// /// +#if NET_4_0 || MONO_4_0 || NETSTANDARD1_3 + [System.Security.SecurityCritical] +#else [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter=true)] - public virtual void GetObjectData(SerializationInfo info, StreamingContext context) +#endif + public virtual void GetObjectData(SerializationInfo info, StreamingContext context) { - foreach(DictionaryEntry entry in InnerHashtable) + foreach(DictionaryEntry entry in InnerHashtable.Clone() as IDictionary) { string entryKey = entry.Key as string; object entryValue = entry.Value; - // If value is serializable then we add it to the list - if (entryKey != null && entryValue != null && entryValue.GetType().IsSerializable) + // If value is serializable then we add it to the list +#if NETSTANDARD1_3 + bool isSerializable = entryValue.GetType().GetTypeInfo().IsSerializable; +#else + bool isSerializable = entryValue.GetType().IsSerializable; +#endif + if (entryKey != null && entryValue != null && isSerializable) { // Store the keys as an Xml encoded local name as it may contain colons (':') // which are NOT escaped by the Xml Serialization framework. diff --git a/src/Util/ReaderWriterLock.cs b/src/Util/ReaderWriterLock.cs old mode 100755 new mode 100644 index 94597c76..5ed53c53 --- a/src/Util/ReaderWriterLock.cs +++ b/src/Util/ReaderWriterLock.cs @@ -20,6 +20,9 @@ #if (!NETCF) #define HAS_READERWRITERLOCK #endif +#if NET_4_0 || MONO_4_0 +#define HAS_READERWRITERLOCKSLIM +#endif using System; @@ -58,8 +61,13 @@ public sealed class ReaderWriterLock /// public ReaderWriterLock() { + #if HAS_READERWRITERLOCK +#if HAS_READERWRITERLOCKSLIM + m_lock = new System.Threading.ReaderWriterLockSlim(); +#else m_lock = new System.Threading.ReaderWriterLock(); +#endif #endif } @@ -79,7 +87,16 @@ public ReaderWriterLock() 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 @@ -97,7 +114,12 @@ public void AcquireReaderLock() public void ReleaseReaderLock() { #if HAS_READERWRITERLOCK +#if HAS_READERWRITERLOCKSLIM + m_lock.ExitReadLock(); +#else m_lock.ReleaseReaderLock(); + +#endif #else System.Threading.Monitor.Exit(this); #endif @@ -114,7 +136,16 @@ public void ReleaseReaderLock() 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 @@ -132,7 +163,11 @@ public void AcquireWriterLock() public void ReleaseWriterLock() { #if HAS_READERWRITERLOCK +#if HAS_READERWRITERLOCKSLIM + m_lock.ExitWriteLock(); +#else m_lock.ReleaseWriterLock(); +#endif #else System.Threading.Monitor.Exit(this); #endif @@ -143,9 +178,14 @@ public void ReleaseWriterLock() #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 } -} +} \ No newline at end of file diff --git a/src/Util/ReusableStringWriter.cs b/src/Util/ReusableStringWriter.cs old mode 100755 new mode 100644 diff --git a/src/Util/SystemInfo.cs b/src/Util/SystemInfo.cs old mode 100755 new mode 100644 index 87634cc2..c0b04f62 --- a/src/Util/SystemInfo.cs +++ b/src/Util/SystemInfo.cs @@ -18,7 +18,11 @@ #endregion using System; +#if NETSTANDARD1_3 +using System.Globalization; +#else using System.Configuration; +#endif using System.Reflection; using System.Text; using System.IO; @@ -143,7 +147,9 @@ public static string ApplicationBaseDirectory get { #if NETCF - return System.IO.Path.GetDirectoryName(SystemInfo.EntryAssemblyLocation) + System.IO.Path.DirectorySeparatorChar; +- return System.IO.Path.GetDirectoryName(SystemInfo.EntryAssemblyLocation) + System.IO.Path.DirectorySeparatorChar; +#elif NETSTANDARD1_3 + return Directory.GetCurrentDirectory(); #else return AppDomain.CurrentDomain.BaseDirectory; #endif @@ -168,7 +174,7 @@ public static string ConfigurationFileLocation { get { -#if NETCF +#if NETCF || NETSTANDARD1_3 return SystemInfo.EntryAssemblyLocation+".config"; #else return System.AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; @@ -191,6 +197,8 @@ public static string EntryAssemblyLocation { #if NETCF return SystemInfo.NativeEntryAssemblyLocation; +#elif NETSTANDARD1_3 // TODO GetEntryAssembly is available for netstandard1.5 + return AppContext.BaseDirectory; #else return System.Reflection.Assembly.GetEntryAssembly().Location; #endif @@ -225,7 +233,7 @@ public static int CurrentThreadId { #if NETCF_1_0 return System.Threading.Thread.CurrentThread.GetHashCode(); -#elif NET_2_0 || NETCF_2_0 || MONO_2_0 +#elif NET_2_0 || NETCF_2_0 || MONO_2_0 || MONO_3_5 || MONO_4_0 || NETSTANDARD1_3 return System.Threading.Thread.CurrentThread.ManagedThreadId; #else return AppDomain.GetCurrentThreadId(); @@ -263,13 +271,19 @@ public static string HostName // Lookup the host name s_hostName = System.Net.Dns.GetHostName(); } - catch(System.Net.Sockets.SocketException) + catch (System.Net.Sockets.SocketException) { + LogLog.Debug(declaringType, "Socket exception occurred while getting the dns hostname. Error Ignored."); } - catch(System.Security.SecurityException) + catch (System.Security.SecurityException) { // We may get a security exception looking up the hostname // You must have Unrestricted DnsPermission to access resource + LogLog.Debug(declaringType, "Security exception occurred while getting the dns hostname. Error Ignored."); + } + catch (Exception ex) + { + LogLog.Debug(declaringType, "Some other exception occurred while getting the dns hostname. Error Ignored.", ex); } // Get the NETBIOS machine name of the current machine @@ -277,7 +291,9 @@ public static string HostName { try { -#if (!SSCLI && !NETCF) +#if NETSTANDARD1_3 + s_hostName = Environment.GetEnvironmentVariable("COMPUTERNAME"); +#elif (!SSCLI && !NETCF) s_hostName = Environment.MachineName; #endif } @@ -295,6 +311,7 @@ public static string HostName if (s_hostName == null || s_hostName.Length == 0) { s_hostName = s_notAvailableText; + LogLog.Debug(declaringType, "Could not determine the hostname. Error Ignored. Empty host name will be used"); } } return s_hostName; @@ -324,7 +341,7 @@ public static string ApplicationFriendlyName { try { -#if !NETCF +#if !(NETCF || NETSTANDARD1_3) s_appFriendlyName = AppDomain.CurrentDomain.FriendlyName; #endif } @@ -377,9 +394,35 @@ public static string ApplicationFriendlyName /// will be set per AppDomain. /// /// + [Obsolete("Use ProcessStartTimeUtc and convert to local time if needed.")] public static DateTime ProcessStartTime { - get { return s_processStartTime; } + get { return s_processStartTimeUtc.ToLocalTime(); } + } + + /// + /// Get the UTC start time for the current process. + /// + /// + /// + /// This is the UTC time at which the log4net library was loaded into the + /// AppDomain. Due to reports of a hang in the call to System.Diagnostics.Process.StartTime + /// this is not the start time for the current process. + /// + /// + /// The log4net library should be loaded by an application early during its + /// startup, therefore this start time should be a good approximation for + /// the actual start time. + /// + /// + /// Note that AppDomains may be loaded and unloaded within the + /// same process without the process terminating, however this start time + /// will be set per AppDomain. + /// + /// + public static DateTime ProcessStartTimeUtc + { + get { return s_processStartTimeUtc; } } /// @@ -441,6 +484,8 @@ public static string AssemblyLocationInfo(Assembly myAssembly) { #if NETCF return "Not supported on Microsoft .NET Compact Framework"; +#elif NETSTANDARD1_3 // TODO Assembly.Location available in netstandard1.5 + return "Not supported on .NET Core"; #else if (myAssembly.GlobalAssemblyCache) { @@ -450,12 +495,44 @@ public static string AssemblyLocationInfo(Assembly myAssembly) { try { - // This call requires FileIOPermission for access to the path - // if we don't have permission then we just ignore it and - // carry on. - return myAssembly.Location; +#if NET_4_0 || MONO_4_0 + if (myAssembly.IsDynamic) + { + return "Dynamic Assembly"; + } +#else + if (myAssembly is System.Reflection.Emit.AssemblyBuilder) + { + return "Dynamic Assembly"; + } + else if(myAssembly.GetType().FullName == "System.Reflection.Emit.InternalAssemblyBuilder") + { + return "Dynamic Assembly"; + } +#endif + else + { + // This call requires FileIOPermission for access to the path + // if we don't have permission then we just ignore it and + // carry on. + return myAssembly.Location; + } + } + catch (NotSupportedException) + { + // The location information may be unavailable for dynamic assemblies and a NotSupportedException + // is thrown in those cases. See: http://msdn.microsoft.com/de-de/library/system.reflection.assembly.location.aspx + return "Dynamic Assembly"; } - catch(System.Security.SecurityException) + catch (TargetInvocationException ex) + { + return "Location Detect Failed (" + ex.Message + ")"; + } + catch (ArgumentException ex) + { + return "Location Detect Failed (" + ex.Message + ")"; + } + catch (System.Security.SecurityException) { return "Location Permission Denied"; } @@ -479,7 +556,12 @@ public static string AssemblyLocationInfo(Assembly myAssembly) /// public static string AssemblyQualifiedName(Type type) { - return type.FullName + ", " + type.Assembly.FullName; + return type.FullName + ", " +#if NETSTANDARD1_3 + + type.GetTypeInfo().Assembly.FullName; +#else + + type.Assembly.FullName; +#endif } /// @@ -531,7 +613,7 @@ public static string AssemblyShortName(Assembly myAssembly) /// public static string AssemblyFileName(Assembly myAssembly) { -#if NETCF +#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. @@ -566,7 +648,7 @@ public static string AssemblyFileName(Assembly myAssembly) /// /// If the type name is fully qualified, i.e. if contains an assembly name in /// the type name, the type will be loaded from the system using - /// . + /// . /// /// /// If the type name is not fully qualified, it will be loaded from the assembly @@ -576,9 +658,14 @@ public static string AssemblyFileName(Assembly myAssembly) /// 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 /// /// Loads the type specified in the type string. /// @@ -590,7 +677,7 @@ public static Type GetTypeFromString(Type relativeType, string typeName, bool th /// /// If the type name is fully qualified, i.e. if contains an assembly name in /// the type name, the type will be loaded from the system using - /// . + /// . /// /// /// If the type name is not fully qualified it will be loaded from the @@ -602,6 +689,7 @@ public static Type GetTypeFromString(string typeName, bool throwOnError, bool ig { return GetTypeFromString(Assembly.GetCallingAssembly(), typeName, throwOnError, ignoreCase); } +#endif /// /// Loads the type specified in the type string. @@ -615,7 +703,7 @@ public static Type GetTypeFromString(string typeName, bool throwOnError, bool ig /// /// If the type name is fully qualified, i.e. if contains an assembly name in /// the type name, the type will be loaded from the system using - /// . + /// . /// /// /// If the type name is not fully qualified it will be loaded from the specified @@ -629,7 +717,9 @@ public static Type GetTypeFromString(Assembly relativeAssembly, string typeName, if(typeName.IndexOf(',') == -1) { //LogLog.Debug(declaringType, "SystemInfo: Loading type ["+typeName+"] from assembly ["+relativeAssembly.FullName+"]"); -#if NETCF +#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 @@ -653,17 +743,29 @@ public static Type GetTypeFromString(Assembly relativeAssembly, string typeName, if (loadedAssemblies != null) { + Type fallback = null; // Search the loaded assemblies for the type foreach (Assembly assembly in loadedAssemblies) { - type = assembly.GetType(typeName, false, ignoreCase); - if (type != null) + Type t = assembly.GetType(typeName, false, ignoreCase); + if (t != null) { // Found type in loaded assembly LogLog.Debug(declaringType, "Loaded type ["+typeName+"] from assembly ["+assembly.FullName+"] by searching loaded assemblies."); - return type; + if (assembly.GlobalAssemblyCache) + { + fallback = t; + } + else + { + return t; + } } } + if (fallback != null) + { + return fallback; + } } // Didn't find the type @@ -835,7 +937,55 @@ public static bool TryParse(string s, out long val) #endif } - /// + /// + /// Parse a string into an value + /// + /// the string to parse + /// out param where the parsed value is placed + /// true if the string was able to be parsed into an integer + /// + /// + /// Attempts to parse the string into an integer. If the string cannot + /// be parsed then this method returns false. The method does not throw an exception. + /// + /// + 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)) + { + val = Convert.ToInt16(doubleVal); + return true; + } + } + catch + { + // Ignore exception, just return false + } + + return false; +#endif + } + + /// /// Lookup an application setting /// /// the application settings key to lookup @@ -849,7 +999,7 @@ public static string GetAppSetting(string key) { try { -#if NETCF +#if NETCF || NETSTANDARD1_3 // Configuration APIs are not suported under the Compact Framework #elif NET_2_0 return ConfigurationManager.AppSettings[key]; @@ -928,13 +1078,36 @@ 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 +#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 } + /// + /// Tests two strings for equality, the ignoring case. + /// + /// + /// If the platform permits, culture information is ignored completely (ordinal comparison). + /// The aim of this method is to provide a fast comparison that deals with null and ignores different casing. + /// It is not supposed to deal with various, culture-specific habits. + /// Use it to compare against pure ASCII constants, like keywords etc. + /// + /// The one string. + /// The other string. + /// true if the strings are equal, false otherwise. + public static Boolean 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 + } + #endregion Public Static Methods #region Private Static Methods @@ -1027,7 +1200,7 @@ private static extern Int32 GetModuleFileName( /// /// Start time for the current process. /// - private static DateTime s_processStartTime = DateTime.Now; + private static DateTime s_processStartTimeUtc = DateTime.UtcNow; #endregion diff --git a/src/Util/SystemStringFormat.cs b/src/Util/SystemStringFormat.cs index 2df2f31b..a852f399 100644 --- a/src/Util/SystemStringFormat.cs +++ b/src/Util/SystemStringFormat.cs @@ -1,231 +1,237 @@ -#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.Text; -using System.Xml; -using System.Text.RegularExpressions; - -namespace log4net.Util -{ - /// - /// Utility class that represents a format string. - /// - /// - /// - /// Utility class that represents a format string. - /// - /// - /// Nicko Cadell - public sealed class SystemStringFormat - { - private readonly IFormatProvider m_provider; - private readonly string m_format; - private readonly object[] m_args; - - #region Constructor - - /// - /// Initialise the - /// - /// An that supplies culture-specific formatting information. - /// A containing zero or more format items. - /// An array containing zero or more objects to format. - public SystemStringFormat(IFormatProvider provider, string format, params object[] args) - { - m_provider = provider; - m_format = format; - m_args = args; - } - - #endregion Constructor - - /// - /// Format the string and arguments - /// - /// the formatted string - public override string ToString() - { - return StringFormat(m_provider, m_format, m_args); - } - - #region StringFormat - - /// - /// Replaces the format item in a specified with the text equivalent - /// of the value of a corresponding instance in a specified array. - /// A specified parameter supplies culture-specific formatting information. - /// - /// An that supplies culture-specific formatting information. - /// A containing zero or more format items. - /// An array containing zero or more objects to format. - /// - /// A copy of format in which the format items have been replaced by the - /// equivalent of the corresponding instances of in args. - /// - /// - /// - /// This method does not throw exceptions. If an exception thrown while formatting the result the - /// exception and arguments are returned in the result string. - /// - /// - private static string StringFormat(IFormatProvider provider, string format, params object[] args) - { - try - { - // The format is missing, log null value - if (format == null) - { - return null; - } - - // The args are missing - should not happen unless we are called explicitly with a null array - if (args == null) - { - return format; - } - - // Try to format the string - return String.Format(provider, format, args); - } - catch(Exception ex) - { - log4net.Util.LogLog.Warn(declaringType, "Exception while rendering format ["+format+"]", ex); - return StringFormatError(ex, format, args); - } - catch - { - log4net.Util.LogLog.Warn(declaringType, "Exception while rendering format ["+format+"]"); - return StringFormatError(null, format, args); - } - } - - /// - /// Process an error during StringFormat - /// - private static string StringFormatError(Exception formatException, string format, object[] args) - { - try - { - StringBuilder buf = new StringBuilder(""); - - if (formatException != null) - { - buf.Append("Exception during StringFormat: ").Append(formatException.Message); - } - else - { - buf.Append("Exception during StringFormat"); - } - buf.Append(" ").Append(format).Append(""); - buf.Append(""); - RenderArray(args, buf); - buf.Append(""); - buf.Append(""); - - return buf.ToString(); - } - catch(Exception ex) - { - log4net.Util.LogLog.Error(declaringType, "INTERNAL ERROR during StringFormat error handling", ex); - return "Exception during StringFormat. See Internal Log."; - } - catch - { - log4net.Util.LogLog.Error(declaringType, "INTERNAL ERROR during StringFormat error handling"); - return "Exception during StringFormat. See Internal Log."; - } - } - - /// - /// Dump the contents of an array into a string builder - /// - private static void RenderArray(Array array, StringBuilder buffer) - { - if (array == null) - { - buffer.Append(SystemInfo.NullText); - } - else - { - if (array.Rank != 1) - { - buffer.Append(array.ToString()); - } - else - { - buffer.Append("{"); - int len = array.Length; - - if (len > 0) - { - RenderObject(array.GetValue(0), buffer); - for (int i = 1; i < len; i++) - { - buffer.Append(", "); - RenderObject(array.GetValue(i), buffer); - } - } - buffer.Append("}"); - } - } - } - - /// - /// Dump an object to a string - /// - private static void RenderObject(Object obj, StringBuilder buffer) - { - if (obj == null) - { - buffer.Append(SystemInfo.NullText); - } - else - { - try - { - buffer.Append(obj); - } - catch(Exception ex) - { - buffer.Append(""); - } - catch - { - buffer.Append(""); - } - } - } - - #endregion StringFormat - - #region Private Static Fields - - /// - /// The fully qualified type of the SystemStringFormat class. - /// - /// - /// Used by the internal logger to record the Type of the - /// log message. - /// - private readonly static Type declaringType = typeof(SystemStringFormat); - - #endregion Private Static Fields - } -} +#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.Text; +using System.Xml; +using System.Text.RegularExpressions; + +namespace log4net.Util +{ + /// + /// Utility class that represents a format string. + /// + /// + /// + /// Utility class that represents a format string. + /// + /// + /// Nicko Cadell + public sealed class SystemStringFormat + { + private readonly IFormatProvider m_provider; + private readonly string m_format; + private readonly object[] m_args; + + #region Constructor + + /// + /// Initialise the + /// + /// An that supplies culture-specific formatting information. + /// A containing zero or more format items. + /// An array containing zero or more objects to format. + public SystemStringFormat(IFormatProvider provider, string format, params object[] args) + { + m_provider = provider; + m_format = format; + m_args = args; + } + + #endregion Constructor + + /// + /// Format the string and arguments + /// + /// the formatted string + public override string ToString() + { + return StringFormat(m_provider, m_format, m_args); + } + + #region StringFormat + + /// + /// Replaces the format item in a specified with the text equivalent + /// of the value of a corresponding instance in a specified array. + /// A specified parameter supplies culture-specific formatting information. + /// + /// An that supplies culture-specific formatting information. + /// A containing zero or more format items. + /// An array containing zero or more objects to format. + /// + /// A copy of format in which the format items have been replaced by the + /// equivalent of the corresponding instances of in args. + /// + /// + /// + /// This method does not throw exceptions. If an exception thrown while formatting the result the + /// exception and arguments are returned in the result string. + /// + /// + private static string StringFormat(IFormatProvider provider, string format, params object[] args) + { + try + { + // The format is missing, log null value + if (format == null) + { + return null; + } + + // The args are missing - should not happen unless we are called explicitly with a null array + if (args == null) + { + return format; + } + + // Try to format the string + return String.Format(provider, format, args); + } + catch(Exception ex) + { + log4net.Util.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 && !NETSTANDARD1_3 + catch + { + log4net.Util.LogLog.Warn(declaringType, "Exception while rendering format ["+format+"]"); + return StringFormatError(null, format, args); + } +#endif + } + + /// + /// Process an error during StringFormat + /// + private static string StringFormatError(Exception formatException, string format, object[] args) + { + try + { + StringBuilder buf = new StringBuilder(""); + + if (formatException != null) + { + buf.Append("Exception during StringFormat: ").Append(formatException.Message); + } + else + { + buf.Append("Exception during StringFormat"); + } + buf.Append(" ").Append(format).Append(""); + buf.Append(""); + RenderArray(args, buf); + buf.Append(""); + buf.Append(""); + + return buf.ToString(); + } + catch(Exception ex) + { + log4net.Util.LogLog.Error(declaringType, "INTERNAL ERROR during StringFormat error handling", ex); + return "Exception during StringFormat. See Internal Log."; + } +#if !NET_2_0 && !MONO_2_0 && !MONO_3_5 && !MONO_4_0 && !NETSTANDARD1_3 + catch + { + log4net.Util.LogLog.Error(declaringType, "INTERNAL ERROR during StringFormat error handling"); + return "Exception during StringFormat. See Internal Log."; + } +#endif + } + + /// + /// Dump the contents of an array into a string builder + /// + private static void RenderArray(Array array, StringBuilder buffer) + { + if (array == null) + { + buffer.Append(SystemInfo.NullText); + } + else + { + if (array.Rank != 1) + { + buffer.Append(array.ToString()); + } + else + { + buffer.Append("{"); + int len = array.Length; + + if (len > 0) + { + RenderObject(array.GetValue(0), buffer); + for (int i = 1; i < len; i++) + { + buffer.Append(", "); + RenderObject(array.GetValue(i), buffer); + } + } + buffer.Append("}"); + } + } + } + + /// + /// Dump an object to a string + /// + private static void RenderObject(Object obj, StringBuilder buffer) + { + if (obj == null) + { + buffer.Append(SystemInfo.NullText); + } + else + { + try + { + buffer.Append(obj); + } + catch(Exception ex) + { + buffer.Append(""); + } +#if !NET_2_0 && !MONO_2_0 && !MONO_3_5 && !MONO_4_0 && !NETSTANDARD1_3 + catch + { + buffer.Append(""); + } +#endif + } + } + + #endregion StringFormat + + #region Private Static Fields + + /// + /// The fully qualified type of the SystemStringFormat class. + /// + /// + /// Used by the internal logger to record the Type of the + /// log message. + /// + private readonly static Type declaringType = typeof(SystemStringFormat); + + #endregion Private Static Fields + } +} diff --git a/src/Util/TextWriterAdapter.cs b/src/Util/TextWriterAdapter.cs old mode 100755 new mode 100644 index 67380204..b68eae84 --- a/src/Util/TextWriterAdapter.cs +++ b/src/Util/TextWriterAdapter.cs @@ -149,10 +149,17 @@ override public String NewLine /// /// /// +#if NETSTANDARD1_3 + virtual public void Close() + { + m_writer.Dispose(); + } +#else override public void Close() { m_writer.Close(); } +#endif /// /// Dispose this writer diff --git a/src/Util/ThreadContextProperties.cs b/src/Util/ThreadContextProperties.cs old mode 100755 new mode 100644 index a66155c9..17060852 --- a/src/Util/ThreadContextProperties.cs +++ b/src/Util/ThreadContextProperties.cs @@ -18,7 +18,9 @@ #endregion using System; +#if NETCF using System.Collections; +#endif namespace log4net.Util { @@ -36,10 +38,18 @@ public sealed class ThreadContextProperties : ContextPropertiesBase { #region Private Instance Fields +#if NETCF /// /// The thread local data slot to use to store a PropertiesDictionary. /// private readonly static LocalDataStoreSlot s_threadLocalSlot = System.Threading.Thread.AllocateDataSlot(); +#else + /// + /// Each thread will automatically have its instance. + /// + [ThreadStatic] + private static PropertiesDictionary _dictionary; +#endif #endregion Private Instance Fields @@ -74,18 +84,20 @@ internal ThreadContextProperties() /// override public object this[string key] { - get - { - PropertiesDictionary dictionary = GetProperties(false); - if (dictionary != null) + get + { +#if NETCF + PropertiesDictionary _dictionary = GetProperties(false); +#endif + if (_dictionary != null) { - return dictionary[key]; + return _dictionary[key]; } return null; } - set - { - GetProperties(true)[key] = value; + set + { + GetProperties(true)[key] = value; } } @@ -104,11 +116,32 @@ override public object this[string key] /// public void Remove(string key) { - PropertiesDictionary dictionary = GetProperties(false); - if (dictionary != null) +#if NETCF + PropertiesDictionary _dictionary = GetProperties(false); +#endif + if (_dictionary != null) + { + _dictionary.Remove(key); + } + } + + /// + /// Get the keys stored in the properties. + /// + /// + /// Gets the keys stored in the properties. + /// + /// a set of the defined keys + public string[] GetKeys() + { +#if NETCF + PropertiesDictionary _dictionary = GetProperties(false); +#endif + if (_dictionary != null) { - dictionary.Remove(key); + return _dictionary.GetKeys(); } + return null; } /// @@ -121,10 +154,12 @@ public void Remove(string key) /// public void Clear() { - PropertiesDictionary dictionary = GetProperties(false); - if (dictionary != null) +#if NETCF + PropertiesDictionary _dictionary = GetProperties(false); +#endif + if (_dictionary != null) { - dictionary.Clear(); + _dictionary.Clear(); } } @@ -135,7 +170,7 @@ public void Clear() /// /// Get the PropertiesDictionary for this thread. /// - /// create the dictionary if it does not exist, otherwise return null if is does not exist + /// create the dictionary if it does not exist, otherwise return null if does not exist /// the properties for this thread /// /// @@ -146,17 +181,20 @@ public void Clear() /// internal PropertiesDictionary GetProperties(bool create) { - PropertiesDictionary properties = (PropertiesDictionary)System.Threading.Thread.GetData(s_threadLocalSlot); - if (properties == null && create) +#if NETCF + PropertiesDictionary _dictionary = (PropertiesDictionary)System.Threading.Thread.GetData(s_threadLocalSlot); +#endif + if (_dictionary == null && create) { - properties = new PropertiesDictionary(); - System.Threading.Thread.SetData(s_threadLocalSlot, properties); + _dictionary = new PropertiesDictionary(); +#if NETCF + System.Threading.Thread.SetData(s_threadLocalSlot, _dictionary); +#endif } - return properties; + return _dictionary; } #endregion Internal Instance Methods } } - diff --git a/src/Util/ThreadContextStack.cs b/src/Util/ThreadContextStack.cs old mode 100755 new mode 100644 diff --git a/src/Util/ThreadContextStacks.cs b/src/Util/ThreadContextStacks.cs old mode 100755 new mode 100644 diff --git a/src/Util/Transform.cs b/src/Util/Transform.cs old mode 100755 new mode 100644 index 17919f9d..7e8f4086 --- a/src/Util/Transform.cs +++ b/src/Util/Transform.cs @@ -191,7 +191,10 @@ private static int CountSubstrings(string text, string substring) private const string CDATA_END = "]]>"; private const string CDATA_UNESCAPABLE_TOKEN = "]]"; - private static Regex INVALIDCHARS=new Regex(@"[^\x09\x0A\x0D\x20-\xFF\u00FF-\u07FF\uE000-\uFFFD]",RegexOptions.Compiled); + /// + /// Characters illegal in XML 1.0 + /// + private static Regex INVALIDCHARS=new Regex(@"[^\x09\x0A\x0D\x20-\uD7FF\uE000-\uFFFD]",RegexOptions.Compiled); #endregion Private Static Fields } } diff --git a/src/Util/TypeConverters/BooleanConverter.cs b/src/Util/TypeConverters/BooleanConverter.cs old mode 100755 new mode 100644 diff --git a/src/Util/TypeConverters/ConversionNotSupportedException.cs b/src/Util/TypeConverters/ConversionNotSupportedException.cs old mode 100755 new mode 100644 index b677aaf9..86ae9fc2 --- a/src/Util/TypeConverters/ConversionNotSupportedException.cs +++ b/src/Util/TypeConverters/ConversionNotSupportedException.cs @@ -18,7 +18,7 @@ #endregion using System; -#if !NETCF +#if !(NETCF || NETSTANDARD1_3) using System.Runtime.Serialization; #endif @@ -39,7 +39,11 @@ namespace log4net.Util.TypeConverters #if !NETCF [Serializable] #endif +#if NETSTANDARD1_3 + public class ConversionNotSupportedException : Exception +#else public class ConversionNotSupportedException : ApplicationException +#endif { #region Public Instance Constructors @@ -88,7 +92,7 @@ public ConversionNotSupportedException(String message, Exception innerException) #region Protected Instance Constructors -#if !NETCF +#if !(NETCF || NETSTANDARD1_3) /// /// Serialization constructor /// diff --git a/src/Util/TypeConverters/ConverterRegistry.cs b/src/Util/TypeConverters/ConverterRegistry.cs old mode 100755 new mode 100644 index 6669bc8e..0ddfb12f --- a/src/Util/TypeConverters/ConverterRegistry.cs +++ b/src/Util/TypeConverters/ConverterRegistry.cs @@ -19,6 +19,9 @@ using System; using System.Globalization; +#if NETSTANDARD1_3 +using System.Linq; +#endif using System.Reflection; using System.Collections; @@ -33,8 +36,8 @@ namespace log4net.Util.TypeConverters /// types. /// /// - /// Use the and - /// methods to register new converters. + /// Use the and + /// methods to register new converters. /// The and methods /// lookup appropriate converters to use. /// diff --git a/src/Util/TypeConverters/EncodingConverter.cs b/src/Util/TypeConverters/EncodingConverter.cs old mode 100755 new mode 100644 index d7f6a3a2..93c9eac9 --- a/src/Util/TypeConverters/EncodingConverter.cs +++ b/src/Util/TypeConverters/EncodingConverter.cs @@ -62,7 +62,7 @@ public bool CanConvertFrom(Type sourceType) /// the encoding /// /// - /// Uses the method to + /// Uses the method to /// convert the argument to an . /// /// diff --git a/src/Util/TypeConverters/IConvertFrom.cs b/src/Util/TypeConverters/IConvertFrom.cs old mode 100755 new mode 100644 diff --git a/src/Util/TypeConverters/IConvertTo.cs b/src/Util/TypeConverters/IConvertTo.cs old mode 100755 new mode 100644 diff --git a/src/Util/TypeConverters/IPAddressConverter.cs b/src/Util/TypeConverters/IPAddressConverter.cs old mode 100755 new mode 100644 index 1683306d..d9cbf327 --- a/src/Util/TypeConverters/IPAddressConverter.cs +++ b/src/Util/TypeConverters/IPAddressConverter.cs @@ -116,7 +116,11 @@ public object ConvertFrom(object source) } // Try to resolve via DNS. This is a blocking call. +#if NETSTANDARD1_3 + IPHostEntry host = Dns.GetHostEntryAsync(str).GetAwaiter().GetResult(); +#else IPHostEntry host = Dns.GetHostByName(str); +#endif if (host != null && host.AddressList != null && host.AddressList.Length > 0 && diff --git a/src/Util/TypeConverters/PatternLayoutConverter.cs b/src/Util/TypeConverters/PatternLayoutConverter.cs old mode 100755 new mode 100644 diff --git a/src/Util/TypeConverters/PatternStringConverter.cs b/src/Util/TypeConverters/PatternStringConverter.cs old mode 100755 new mode 100644 index f5e13f85..723cc254 --- a/src/Util/TypeConverters/PatternStringConverter.cs +++ b/src/Util/TypeConverters/PatternStringConverter.cs @@ -18,6 +18,9 @@ #endregion using System; +#if NETSTANDARD1_3 +using System.Reflection; +#endif using System.Text; using log4net.Util; @@ -69,7 +72,7 @@ public bool CanConvertTo(Type targetType) /// the converted object /// /// - /// Uses the method to convert the + /// Uses the method to convert the /// argument to a . /// /// diff --git a/src/Util/TypeConverters/TypeConverter.cs b/src/Util/TypeConverters/TypeConverter.cs old mode 100755 new mode 100644 index 48bc85aa..3a6d6a90 --- a/src/Util/TypeConverters/TypeConverter.cs +++ b/src/Util/TypeConverters/TypeConverter.cs @@ -19,6 +19,9 @@ using System; using System.Text; +#if NETSTANDARD1_3 +using System.Reflection; +#endif namespace log4net.Util.TypeConverters { @@ -61,7 +64,7 @@ public bool CanConvertFrom(Type sourceType) /// the Type /// /// - /// Uses the method to convert the + /// Uses the method to convert the /// argument to a . /// Additional effort is made to locate partially specified types /// by searching the loaded assemblies. @@ -77,7 +80,11 @@ public object ConvertFrom(object source) 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); } diff --git a/src/Util/TypeConverters/TypeConverterAttribute.cs b/src/Util/TypeConverters/TypeConverterAttribute.cs old mode 100755 new mode 100644 diff --git a/src/Util/WindowsSecurityContext.cs b/src/Util/WindowsSecurityContext.cs old mode 100755 new mode 100644 index 9e6e4510..0e902faf --- a/src/Util/WindowsSecurityContext.cs +++ b/src/Util/WindowsSecurityContext.cs @@ -275,7 +275,11 @@ public override IDisposable Impersonate(object state) /// token is used to initialize the WindowsIdentity. /// /// - private static WindowsIdentity LogonUser(string userName, string domainName, string password) +#if NET_4_0 || MONO_4_0 + [System.Security.SecuritySafeCritical] +#endif + [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, UnmanagedCode = true)] + private static WindowsIdentity LogonUser(string userName, string domainName, string password) { const int LOGON32_PROVIDER_DEFAULT = 0; //This parameter causes LogonUser to create a primary token. diff --git a/src/assembly/bin.xml b/src/assembly/bin.xml index 4090576e..c52bf0de 100644 --- a/src/assembly/bin.xml +++ b/src/assembly/bin.xml @@ -33,7 +33,7 @@ KEYS LICENSE NOTICE - contribs/** + contribs/** examples/** src/assembly/** src/changes/** @@ -41,10 +41,10 @@ src/ntdll/** src/performance/** src/site/** - tests/README - tests/*.xml - tests/*.sample - tests/*.bat + tests/README + tests/*.xml + tests/*.sample + tests/*.bat tests/input/** tests/resources/** tests/src/** diff --git a/src/log4net.vs2003.csproj b/src/log4net.vs2003.csproj deleted file mode 100644 index c8e0434f..00000000 --- a/src/log4net.vs2003.csproj +++ /dev/null @@ -1,1146 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/log4net.vs2003.sln b/src/log4net.vs2003.sln deleted file mode 100644 index 85ca6657..00000000 --- a/src/log4net.vs2003.sln +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "log4net.vs2003", "log4net.vs2003.csproj", "{F6A02431-167E-4347-BC43-65532C31CDB7}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "log4net.Tests.vs2003", "..\tests\src\log4net.Tests.vs2003.csproj", "{4B68B77E-0C8B-4296-930D-6AC2787170B8}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {F6A02431-167E-4347-BC43-65532C31CDB7}.Debug.ActiveCfg = Debug|.NET - {F6A02431-167E-4347-BC43-65532C31CDB7}.Debug.Build.0 = Debug|.NET - {F6A02431-167E-4347-BC43-65532C31CDB7}.Release.ActiveCfg = Release|.NET - {F6A02431-167E-4347-BC43-65532C31CDB7}.Release.Build.0 = Release|.NET - {4B68B77E-0C8B-4296-930D-6AC2787170B8}.Debug.ActiveCfg = Debug|.NET - {4B68B77E-0C8B-4296-930D-6AC2787170B8}.Debug.Build.0 = Debug|.NET - {4B68B77E-0C8B-4296-930D-6AC2787170B8}.Release.ActiveCfg = Release|.NET - {4B68B77E-0C8B-4296-930D-6AC2787170B8}.Release.Build.0 = Release|.NET - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/src/log4net.vs2008.csproj b/src/log4net.vs2008.csproj index edfd7d95..1166930b 100644 --- a/src/log4net.vs2008.csproj +++ b/src/log4net.vs2008.csproj @@ -1,726 +1,775 @@ - - - Local - 9.0.30729 - 2.0 - {181FE707-E161-4722-9F38-6AAAB6FAA106} - Debug - AnyCPU - - - - - log4net - - - JScript - Grid - IE50 - false - Library - log4net - - - - - - - 2.0 - - - ..\build\bin\net\2.0\debug\ - false - 285212672 - false - - - TRACE;DEBUG;NET;NET_2_0 - log4net.xml - true - 4096 - false - false - false - false - 4 - full - prompt - - - ..\build\bin\net\1.0\release\ - false - 285212672 - false - - - TRACE;STRONG;NET;NET_1_0; - log4net.xml - false - 4096 - true - false - false - false - 4 - none - prompt - - - - System - - - - System.Data - - - System.Web - - - System.XML - - - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - - - - - - - - \ No newline at end of file + + + + + + Local + 9.0.30729 + 2.0 + {181FE707-E161-4722-9F38-6AAAB6FAA106} + Debug + AnyCPU + + + + + log4net + + + JScript + Grid + IE50 + false + Library + log4net + + + + + + + 2.0 + + + ..\build\bin\net\2.0\debug\ + false + 285212672 + false + + + TRACE;DEBUG;NET;NET_2_0 + log4net.xml + true + 4096 + false + false + false + false + 4 + full + prompt + + + ..\build\bin\net\1.0\release\ + false + 285212672 + false + + + TRACE;STRONG;NET;NET_1_0; + log4net.xml + false + 4096 + true + false + false + false + 4 + none + prompt + + + + System + + + + System.Data + + + System.Web + + + System.XML + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/src/log4net.vs2008.sln b/src/log4net.vs2008.sln index 11a6af3a..2bf603c5 100644 --- a/src/log4net.vs2008.sln +++ b/src/log4net.vs2008.sln @@ -1,25 +1,45 @@ -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "log4net.vs2008", "log4net.vs2008.csproj", "{181FE707-E161-4722-9F38-6AAAB6FAA106}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "log4net.Tests.vs2008", "..\tests\src\log4net.Tests.vs2008.csproj", "{B0530F10-0238-49A9-93B0-8EF412E90BCF}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {181FE707-E161-4722-9F38-6AAAB6FAA106}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {181FE707-E161-4722-9F38-6AAAB6FAA106}.Debug|Any CPU.Build.0 = Debug|Any CPU - {181FE707-E161-4722-9F38-6AAAB6FAA106}.Release|Any CPU.ActiveCfg = Release|Any CPU - {181FE707-E161-4722-9F38-6AAAB6FAA106}.Release|Any CPU.Build.0 = Release|Any CPU - {B0530F10-0238-49A9-93B0-8EF412E90BCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B0530F10-0238-49A9-93B0-8EF412E90BCF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B0530F10-0238-49A9-93B0-8EF412E90BCF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B0530F10-0238-49A9-93B0-8EF412E90BCF}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +# +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT 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.vs2008", "log4net.vs2008.csproj", "{181FE707-E161-4722-9F38-6AAAB6FAA106}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "log4net.Tests.vs2008", "..\tests\src\log4net.Tests.vs2008.csproj", "{B0530F10-0238-49A9-93B0-8EF412E90BCF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {181FE707-E161-4722-9F38-6AAAB6FAA106}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {181FE707-E161-4722-9F38-6AAAB6FAA106}.Debug|Any CPU.Build.0 = Debug|Any CPU + {181FE707-E161-4722-9F38-6AAAB6FAA106}.Release|Any CPU.ActiveCfg = Release|Any CPU + {181FE707-E161-4722-9F38-6AAAB6FAA106}.Release|Any CPU.Build.0 = Release|Any CPU + {B0530F10-0238-49A9-93B0-8EF412E90BCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0530F10-0238-49A9-93B0-8EF412E90BCF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0530F10-0238-49A9-93B0-8EF412E90BCF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0530F10-0238-49A9-93B0-8EF412E90BCF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/log4net.vs2010.csproj b/src/log4net.vs2010.csproj new file mode 100644 index 00000000..7865f1ed --- /dev/null +++ b/src/log4net.vs2010.csproj @@ -0,0 +1,808 @@ + + + + + Local + 9.0.30729 + 2.0 + {181FE707-E161-4722-9F38-6AAAB6FAA106} + Debug + AnyCPU + + + + + log4net + + + JScript + Grid + IE50 + false + Library + log4net + + + + + + + 3.5 + v4.0 + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + + ..\build\bin\net\4.0\debug\ + false + 285212672 + false + + + TRACE;DEBUG;NET;NET_2_0;NET_4_0 + log4net.xml + true + 4096 + false + false + false + false + 4 + full + prompt + SecurityRules.ruleset + + + ..\build\bin\net\4.0\release\ + false + 285212672 + false + + + TRACE;STRONG;NET;NET_2_0;NET_4_0 + log4net.xml + false + 4096 + true + false + false + false + 4 + none + prompt + AllRules.ruleset + + + + System + + + + System.Data + + + System.Web + + + System.XML + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + + + + + + + + + diff --git a/src/log4net.vs2010.sln b/src/log4net.vs2010.sln new file mode 100644 index 00000000..db0afd90 --- /dev/null +++ b/src/log4net.vs2010.sln @@ -0,0 +1,45 @@ +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +# +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT 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.vs2010", "log4net.vs2010.csproj", "{181FE707-E161-4722-9F38-6AAAB6FAA106}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "log4net.Tests.vs2010", "..\tests\src\log4net.Tests.vs2010.csproj", "{B0530F10-0238-49A9-93B0-8EF412E90BCF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {181FE707-E161-4722-9F38-6AAAB6FAA106}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {181FE707-E161-4722-9F38-6AAAB6FAA106}.Debug|Any CPU.Build.0 = Debug|Any CPU + {181FE707-E161-4722-9F38-6AAAB6FAA106}.Release|Any CPU.ActiveCfg = Release|Any CPU + {181FE707-E161-4722-9F38-6AAAB6FAA106}.Release|Any CPU.Build.0 = Release|Any CPU + {B0530F10-0238-49A9-93B0-8EF412E90BCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0530F10-0238-49A9-93B0-8EF412E90BCF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0530F10-0238-49A9-93B0-8EF412E90BCF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0530F10-0238-49A9-93B0-8EF412E90BCF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/log4net.vs2012.csproj b/src/log4net.vs2012.csproj new file mode 100644 index 00000000..05a7062c --- /dev/null +++ b/src/log4net.vs2012.csproj @@ -0,0 +1,808 @@ + + + + + Local + 9.0.30729 + 2.0 + {181FE707-E161-4722-9F38-6AAAB6FAA106} + Debug + AnyCPU + + + + + log4net + + + JScript + Grid + IE50 + false + Library + log4net + + + + + + + 3.5 + v4.5 + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + + ..\build\bin\net\4.5\debug\ + false + 285212672 + false + + + TRACE;DEBUG;NET;NET_2_0;NET_4_0;NET_4_5 + log4net.xml + true + 4096 + false + false + false + false + 4 + full + prompt + SecurityRules.ruleset + + + ..\build\bin\net\4.5\release\ + false + 285212672 + false + + + TRACE;STRONG;NET;NET_2_0;NET_4_0;NET_4_5 + log4net.xml + false + 4096 + true + false + false + false + 4 + none + prompt + AllRules.ruleset + + + + System + + + + System.Data + + + System.Web + + + System.XML + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + + + + + + + + + diff --git a/src/log4net.vs2012.sln b/src/log4net.vs2012.sln new file mode 100644 index 00000000..925b0049 --- /dev/null +++ b/src/log4net.vs2012.sln @@ -0,0 +1,45 @@ +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.vs2012", "log4net.vs2012.csproj", "{181FE707-E161-4722-9F38-6AAAB6FAA106}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "log4net.Tests.vs2012", "..\tests\src\log4net.Tests.vs2012.csproj", "{B0530F10-0238-49A9-93B0-8EF412E90BCF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {181FE707-E161-4722-9F38-6AAAB6FAA106}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {181FE707-E161-4722-9F38-6AAAB6FAA106}.Debug|Any CPU.Build.0 = Debug|Any CPU + {181FE707-E161-4722-9F38-6AAAB6FAA106}.Release|Any CPU.ActiveCfg = Release|Any CPU + {181FE707-E161-4722-9F38-6AAAB6FAA106}.Release|Any CPU.Build.0 = Release|Any CPU + {B0530F10-0238-49A9-93B0-8EF412E90BCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0530F10-0238-49A9-93B0-8EF412E90BCF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0530F10-0238-49A9-93B0-8EF412E90BCF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0530F10-0238-49A9-93B0-8EF412E90BCF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/site/apt/download.apt b/src/site/apt/download.apt deleted file mode 100644 index 277a4edd..00000000 --- a/src/site/apt/download.apt +++ /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. - ------ -Download Apache log4net 1.2.10 - ------ - ------ - ------ - -Download Apache log4net 1.2.10 - - log4net 1.2.10 is distributed under the {{{http://www.apache.org/licenses/LICENSE-2.0.html} Apache License, version 2.0}}. - - log4net has graduated from the Incubator project, however at the time the following releases were made, - log4net was still undergoing incubation, therefore these releases are not officially endorsed by the ASF. - Future releases of log4net will be officially endorsed by the ASF. - - The link in the Mirrors column should display a list of available mirrors with a - default selection based on your inferred location. If you do not see that page, - try a different browser. The checksum and signature are links to - the originals on the main distribution server. - -*-------------------------+---------+----------+-----------+ -| | Mirrors | Checksum | Signature | -*-------------------------+---------+----------+-----------+ -*-------------------------+---------+----------+-----------+ -| log4net 1.2.10 (zip) | {{{http://archive.apache.org/dist/incubator/log4net/1.2.10/incubating-log4net-1.2.10.zip} incubating-log4net-1.2.10.zip}} | {{{http://archive.apache.org/dist/incubator/log4net/1.2.10/incubating-log4net-1.2.10.zip.md5} incubating-log4net-1.2.10.zip.md5}} | {{{http://archive.apache.org/dist/incubator/log4net/1.2.10/incubating-log4net-1.2.10.zip.asc} incubating-log4net-1.2.10.zip.asc}}| -| log4net 1.2.9-beta (zip) | {{{http://archive.apache.org/dist/incubator/log4net/1.2.9/incubating-log4net-1.2.9-beta.zip} incubating-log4net-1.2.9-beta.zip}} | {{{http://archive.apache.org/dist/incubator/log4net/1.2.9/incubating-log4net-1.2.9-beta.zip.md5} incubating-log4net-1.2.9-beta.zip.md5}} | {{{http://archive.apache.org/dist/incubator/log4net/1.2.9/incubating-log4net-1.2.9-beta.zip.asc} incubating-log4net-1.2.9-beta.zip.asc}}| -*-------------------------+---------+----------+-----------+ - - Please read {{{http://httpd.apache.org/dev/verification.html}Verifying Apache HTTP Server Releases}} - for more information on why you should verify our releases. - - -* Previous Releases - - Previous releases of log4net are available from the {{{http://sourceforge.net/project/showfiles.php?group_id=31983&release_id=171808}SourceForge Project Site}}. diff --git a/src/site/apt/roadmap.apt b/src/site/apt/roadmap.apt index c3602d5f..e3396ec4 100644 --- a/src/site/apt/roadmap.apt +++ b/src/site/apt/roadmap.apt @@ -13,15 +13,15 @@ ~~ See the License for the specific language governing permissions and ~~ limitations under the License. ------ - log4net Roadmap + Apache log4net Roadmap ------ ------ ------ -log4net Roadmap +Apache log4net™ Roadmap - The log4net development roadmap is managed by our JIRA issue tracking system. - - For a list of upcoming fixes and in-progress tasks see: - - {{{http://issues.apache.org/jira/browse/LOG4NET?report=com.atlassian.jira.plugin.system.project:roadmap-panel}log4net Roadmap}} + The log4net development roadmap is managed by our JIRA issue tracking system. + + For a list of upcoming fixes and in-progress tasks see: + + {{{http://issues.apache.org/jira/browse/LOG4NET?report=com.atlassian.jira.plugin.system.project:roadmap-panel}Apache log4net Roadmap}} diff --git a/src/site/resources/css/maven-base.css b/src/site/resources/css/maven-base.css new file mode 100644 index 00000000..7ef9c54b --- /dev/null +++ b/src/site/resources/css/maven-base.css @@ -0,0 +1,168 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ +body { + margin: 0px; + padding: 0px; +} +img { + border:none; +} +table { + padding:0px; + width: 100%; + margin-left: -2px; + margin-right: -2px; +} +acronym { + cursor: help; + border-bottom: 1px dotted #feb; +} +table.bodyTable th, table.bodyTable td { + padding: 2px 4px 2px 4px; + vertical-align: top; +} +div.clear{ + clear:both; + visibility: hidden; +} +div.clear hr{ + display: none; +} +#bannerLeft, #bannerRight { + font-size: xx-large; + font-weight: bold; +} +#bannerLeft img, #bannerRight img { + margin: 0px; +} +.xleft, #bannerLeft img { + float:left; +} +.xright, #bannerRight { + float:right; +} +#banner { + padding: 0px; +} +#banner img { + border: none; +} +#breadcrumbs { + padding: 3px 10px 3px 10px; +} +#leftColumn { + width: 170px; + float:left; + overflow: auto; +} +#bodyColumn { + margin-right: 1.5em; + margin-left: 197px; +} +#legend { + padding: 8px 0 8px 0; +} +#navcolumn { + padding: 8px 4px 0 8px; +} +#navcolumn h5 { + margin: 0; + padding: 0; + font-size: small; +} +#navcolumn ul { + margin: 0; + padding: 0; + font-size: small; +} +#navcolumn li { + list-style-type: none; + background-image: none; + background-repeat: no-repeat; + background-position: 0 0.4em; + padding-left: 16px; + list-style-position: outside; + line-height: 1.2em; + font-size: smaller; +} +#navcolumn li.expanded { + background-image: url(../images/expanded.gif); +} +#navcolumn li.collapsed { + background-image: url(../images/collapsed.gif); +} +#poweredBy { + text-align: center; +} +#navcolumn img { + margin-top: 10px; + margin-bottom: 3px; +} +#poweredBy img { + display:block; + margin: 20px 0 20px 17px; +} +#search img { + margin: 0px; + display: block; +} +#search #q, #search #btnG { + border: 1px solid #999; + margin-bottom:10px; +} +#search form { + margin: 0px; +} +#lastPublished { + font-size: x-small; +} +.navSection { + margin-bottom: 2px; + padding: 8px; +} +.navSectionHead { + font-weight: bold; + font-size: x-small; +} +.section { + padding: 4px; +} +#footer { + padding: 3px 10px 3px 10px; + font-size: x-small; +} +#breadcrumbs { + font-size: x-small; + margin: 0pt; +} +.source { + padding: 12px; + margin: 1em 7px 1em 7px; +} +.source pre { + margin: 0px; + padding: 0px; +} +#navcolumn img.imageLink, .imageLink{ + padding-left: 0px; + padding-bottom: 0px; + padding-top: 0px; + padding-right: 2px; + border: 0px; + margin: 0px; +} diff --git a/src/site/resources/css/site.css b/src/site/resources/css/site.css index 8b137891..6005acea 100644 --- a/src/site/resources/css/site.css +++ b/src/site/resources/css/site.css @@ -1 +1,22 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + diff --git a/src/site/resources/download_log4net.cgi b/src/site/resources/download_log4net.cgi new file mode 100755 index 00000000..4324f769 --- /dev/null +++ b/src/site/resources/download_log4net.cgi @@ -0,0 +1,22 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Wrapper script around mirrors.cgi script +# (we must change to that directory in order for python to pick up the +# python includes correctly) +cd /www/www.apache.org/dyn/mirrors +/www/www.apache.org/dyn/mirrors/mirrors.cgi $* diff --git a/src/site/resources/images/logos/maven-feather.png b/src/site/resources/images/logos/maven-feather.png new file mode 100644 index 00000000..b5ada836 Binary files /dev/null and b/src/site/resources/images/logos/maven-feather.png differ diff --git a/src/site/resources/images/ls-logo.jpg b/src/site/resources/images/ls-logo.jpg old mode 100755 new mode 100644 index 611c5c36..35f2f473 Binary files a/src/site/resources/images/ls-logo.jpg and b/src/site/resources/images/ls-logo.jpg differ diff --git a/src/site/site.vm b/src/site/site.vm new file mode 100644 index 00000000..4b46bbf6 --- /dev/null +++ b/src/site/site.vm @@ -0,0 +1,542 @@ + + +#macro ( link $href $name $target $img $position $alt $border $width $height ) + #set ( $linkTitle = ' title="' + $name + '"' ) + #if( $target ) + #set ( $linkTarget = ' target="' + $target + '"' ) + #else + #set ( $linkTarget = "" ) + #end + #if ( $href.toLowerCase().startsWith("http:/") || $href.toLowerCase().startsWith("https:/") || + $href.toLowerCase().startsWith("ftp:/") || $href.toLowerCase().startsWith("mailto:/") || + $href.toLowerCase().startsWith("file:/") || ($href.toLowerCase().indexOf("://") != -1) ) + #set ( $linkClass = ' class="externalLink"' ) + #else + #set ( $linkClass = "" ) + #end + #if ( $img ) + #if ( $position == "left" ) + #image($img $alt $border $width $height)$name + #else + $name #image($img $alt $border $width $height) + #end + #else + $name + #end +#end +## +#macro ( image $img $alt $border $width $height ) + #if( $img ) + #if ( ! ( $img.toLowerCase().startsWith("http:/") || $img.toLowerCase().startsWith("https:/") || + $img.toLowerCase().startsWith("ftp:/") || $img.toLowerCase().startsWith("mailto:/") || + $img.toLowerCase().startsWith("file:/") || ($img.toLowerCase().indexOf("://") != -1) ) ) + #set ( $imgSrc = $PathTool.calculateLink( $img, $relativePath ) ) + #set ( $imgSrc = $imgSrc.replaceAll( '\\', '/' ) ) + #set ( $imgSrc = ' src="' + $imgSrc + '"' ) + #else + #set ( $imgSrc = ' src="' + $img + '"' ) + #end + #if( $alt ) + #set ( $imgAlt = ' alt="' + $alt + '"' ) + #else + #set ( $imgAlt = ' alt=""' ) + #end + #if( $border ) + #set ( $imgBorder = ' border="' + $border + '"' ) + #else + #set ( $imgBorder = "" ) + #end + #if( $width ) + #set ( $imgWidth = ' width="' + $width + '"' ) + #else + #set ( $imgWidth = "" ) + #end + #if( $height ) + #set ( $imgHeight = ' height="' + $height + '"' ) + #else + #set ( $imgHeight = "" ) + #end + + #end +#end +#macro ( banner $banner $id ) + #if ( $banner ) + #if( $banner.href ) + #set ( $hrf = $banner.href ) + #if ( ! ( $hrf.toLowerCase().startsWith("http:/") || $hrf.toLowerCase().startsWith("https:/") || + $hrf.toLowerCase().startsWith("ftp:/") || $hrf.toLowerCase().startsWith("mailto:/") || + $hrf.toLowerCase().startsWith("file:/") || ($hrf.toLowerCase().indexOf("://") != -1) ) ) + #set ( $hrf = $PathTool.calculateLink( $hrf, $relativePath ) ) + #set ( $hrf = $hrf.replaceAll( '\\', '/' ) ) + #if ( ( $hrf == '' ) ) + #set ( $hrf = './' ) + #end + #end + + #else + + #end + #end +#end +## +#macro ( links $links ) + #set ( $counter = 0 ) + #foreach( $item in $links ) + #set ( $counter = $counter + 1 ) + #set ( $currentItemHref = $PathTool.calculateLink( $item.href, $relativePath ) ) + #set ( $currentItemHref = $currentItemHref.replaceAll( '\\', '/' ) ) + #link( $currentItemHref $item.name $item.target $item.img $item.position $item.alt $item.border $item.width $item.height ) + #if ( $links.size() > $counter ) + | + #end + #end +#end +## +#macro ( breadcrumbs $breadcrumbs ) + #foreach( $item in $breadcrumbs ) + #set ( $currentItemHref = $PathTool.calculateLink( $item.href, $relativePath ) ) + #set ( $currentItemHref = $currentItemHref.replaceAll( '\\', '/' ) ) + #if ( ( $currentItemHref == '' ) ) + #set ( $currentItemHref = './' ) + #end +## + #link( $currentItemHref $item.name $item.target $item.img $item.position $item.alt $item.border $item.width $item.height ) + > + #end + $title +#end +## +#macro ( displayTree $display $item ) + #if ( $item && $item.items && $item.items.size() > 0 ) + #foreach( $subitem in $item.items ) + #set ( $subitemHref = $PathTool.calculateLink( $subitem.href, $relativePath ) ) + #set ( $subitemHref = $subitemHref.replaceAll( '\\', '/' ) ) +## + #if ( $alignedFileName == $subitemHref ) + #set ( $display = true ) + #end +## + #displayTree( $display $subitem ) + #end + #end +#end +## +#macro ( menuItem $item ) + #set ( $collapse = "none" ) + #set ( $currentItemHref = $PathTool.calculateLink( $item.href, $relativePath ) ) + #set ( $currentItemHref = $currentItemHref.replaceAll( '\\', '/' ) ) +## + #if ( $item && $item.items && $item.items.size() > 0 ) + #if ( $item.collapse == false ) + #set ( $collapse = "expanded" ) + #else + ## By default collapsed + #set ( $collapse = "collapsed" ) + #end +## + #set ( $display = false ) + #displayTree( $display $item ) +## + #if ( $alignedFileName == $currentItemHref || $display ) + #set ( $collapse = "expanded" ) + #end + #end +
  • + #if ( $item.img ) + #if ( $item.position == "left" ) + #if ( $alignedFileName == $currentItemHref ) + #image($item.img $item.alt $item.border $item.width $item.height) $item.name + #else + #link($currentItemHref $item.name $item.target $item.img $item.position $item.alt $item.border $item.width $item.height) + #end + #else + #if ( $alignedFileName == $currentItemHref ) + $item.name #image($item.img $item.alt $item.border $item.width $item.height) + #else + #link($currentItemHref $item.name $item.target $item.img $item.position $item.alt $item.border $item.width $item.height) + #end + #end + #else + #if ( $alignedFileName == $currentItemHref ) + $item.name + #else + #link( $currentItemHref $item.name $item.target $item.img $item.position $item.alt $item.border $item.width $item.height ) + #end + #end + #if ( $item && $item.items && $item.items.size() > 0 ) + #if ( $collapse == "expanded" ) +
      + #foreach( $subitem in $item.items ) + #menuItem( $subitem ) + #end +
    + #end + #end +
  • +#end +## +#macro ( mainMenu $menus ) + #foreach( $menu in $menus ) + #if ( $menu.name ) + #if ( $menu.img ) + #if( $menu.position ) + #set ( $position = $menu.position ) + #else + #set ( $position = "left" ) + #end +## + #if ( ! ( $menu.img.toLowerCase().startsWith("http:/") || $menu.img.toLowerCase().startsWith("https:/") || + $menu.img.toLowerCase().startsWith("ftp:/") || $menu.img.toLowerCase().startsWith("mailto:/") || + $menu.img.toLowerCase().startsWith("file:/") || ($menu.img.toLowerCase().indexOf("://") != -1) ) ) + #set ( $src = $PathTool.calculateLink( $menu.img, $relativePath ) ) + #set ( $src = $src.replaceAll( '\\', '/' ) ) + #set ( $src = ' src="' + $src + '"' ) + #else + #set ( $src = ' src="' + $menu.img + '"' ) + #end +## + #if( $menu.alt ) + #set ( $alt = ' alt="' + $menu.alt + '"' ) + #else + #set ( $alt = ' alt="' + $menu.name + '"' ) + #end +## + #if( $menu.border ) + #set ( $border = ' border="' + $menu.border + '"' ) + #else + #set ( $border = ' border="0"' ) + #end +## + #if( $menu.width ) + #set ( $width = ' width="' + $menu.width + '"' ) + #else + #set ( $width = "" ) + #end + #if( $menu.height ) + #set ( $height = ' height="' + $menu.height + '"' ) + #else + #set ( $height = "" ) + #end +## + #set ( $img = '" ) +## + #if ( $position == "left" ) +
    $img $menu.name
    + #else +
    $menu.name $img
    + #end + #else +
    $menu.name
    + #end + #end + #if ( $menu.items && $menu.items.size() > 0 ) +
      + #foreach( $item in $menu.items ) + #menuItem( $item ) + #end +
    + #end + #end +#end +## +#macro ( copyright ) + #if ( $project ) + #if ( ${project.organization} && ${project.organization.name} ) + #set ( $period = "" ) + #else + #set ( $period = "." ) + #end +## + #set ( $currentYear = ${currentDate.year} + 1900 ) +## + #if ( ${project.inceptionYear} && ( ${project.inceptionYear} != ${currentYear.toString()} ) ) + ${project.inceptionYear}-${currentYear}${period} + #else + ${currentYear}${period} + #end +## + #if ( ${project.organization} ) + #if ( ${project.organization.name} && ${project.organization.url} ) + ${project.organization.name}. + #elseif ( ${project.organization.name} ) + ${project.organization.name}. + #end + #end + #end +#end +## +#macro ( publishDate $position $publishDate $version ) + #if ( $publishDate && $publishDate.format ) + #set ( $format = $publishDate.format ) + #else + #set ( $format = "yyyy-MM-dd" ) + #end +## + $dateFormat.applyPattern( $format ) +## + #set ( $dateToday = $dateFormat.format( $currentDate ) ) +## + #if ( $publishDate && $publishDate.position ) + #set ( $datePosition = $publishDate.position ) + #else + #set ( $datePosition = "left" ) + #end +## + #if ( $version ) + #if ( $version.position ) + #set ( $versionPosition = $version.position ) + #else + #set ( $versionPosition = "left" ) + #end + #else + #set ( $version = "" ) + #set ( $versionPosition = "left" ) + #end +## + #set ( $breadcrumbs = $decoration.body.breadcrumbs ) + #set ( $links = $decoration.body.links ) + + #if ( $datePosition.equalsIgnoreCase( "right" ) && $links && $links.size() > 0 ) + #set ( $prefix = " |" ) + #else + #set ( $prefix = "" ) + #end +## + #if ( $datePosition.equalsIgnoreCase( $position ) ) + #if ( ( $datePosition.equalsIgnoreCase( "right" ) ) || ( $datePosition.equalsIgnoreCase( "bottom" ) ) ) + $prefix $i18n.getString( "site-renderer", $locale, "template.lastpublished" ): $dateToday + #if ( $versionPosition.equalsIgnoreCase( $position ) ) +  | $i18n.getString( "site-renderer", $locale, "template.version" ): ${project.version} + #end + #elseif ( ( $datePosition.equalsIgnoreCase( "navigation-bottom" ) ) || ( $datePosition.equalsIgnoreCase( "navigation-top" ) ) ) +
    + $i18n.getString( "site-renderer", $locale, "template.lastpublished" ): $dateToday + #if ( $versionPosition.equalsIgnoreCase( $position ) ) +  | $i18n.getString( "site-renderer", $locale, "template.version" ): ${project.version} + #end +
    + #elseif ( $datePosition.equalsIgnoreCase("left") ) +
    + $i18n.getString( "site-renderer", $locale, "template.lastpublished" ): $dateToday + #if ( $versionPosition.equalsIgnoreCase( $position ) ) +  | $i18n.getString( "site-renderer", $locale, "template.version" ): ${project.version} + #end + #if ( $breadcrumbs && $breadcrumbs.size() > 0 ) + | #breadcrumbs( $breadcrumbs ) + #end +
    + #end + #elseif ( $versionPosition.equalsIgnoreCase( $position ) ) + #if ( ( $versionPosition.equalsIgnoreCase( "right" ) ) || ( $versionPosition.equalsIgnoreCase( "bottom" ) ) ) + $prefix $i18n.getString( "site-renderer", $locale, "template.version" ): ${project.version} + #elseif ( ( $versionPosition.equalsIgnoreCase( "navigation-bottom" ) ) || ( $versionPosition.equalsIgnoreCase( "navigation-top" ) ) ) +
    + $i18n.getString( "site-renderer", $locale, "template.version" ): ${project.version} +
    + #elseif ( $versionPosition.equalsIgnoreCase("left") ) +
    + $i18n.getString( "site-renderer", $locale, "template.version" ): ${project.version} + #if ( $breadcrumbs && $breadcrumbs.size() > 0 ) + | #breadcrumbs( $breadcrumbs ) + #end +
    + #end + #elseif ( $position.equalsIgnoreCase( "left" ) ) + #if ( $breadcrumbs && $breadcrumbs.size() > 0 ) +
    + #breadcrumbs( $breadcrumbs ) +
    + #end + #end +#end +## +#macro ( poweredByLogo $poweredBy ) + #if( $poweredBy ) + #foreach ($item in $poweredBy) + #if( $item.href ) + #set ( $href = $PathTool.calculateLink( $item.href, $relativePath ) ) + #set ( $href = $href.replaceAll( '\\', '/' ) ) + #else + #set ( $href="http://maven.apache.org/" ) + #end +## + #if( $item.name ) + #set ( $name = $item.name ) + #else + #set ( $name = $i18n.getString( "site-renderer", $locale, "template.builtby" ) ) + #set ( $name = "${name} Maven" ) + #end +## + #if( $item.img ) + #set ( $img = $item.img ) + #else + #set ( $img = "images/logos/maven-feather.png" ) + #end +## + #if ( ! ( $img.toLowerCase().startsWith("http:/") || $img.toLowerCase().startsWith("https:/") || + $img.toLowerCase().startsWith("ftp:/") || $img.toLowerCase().startsWith("mailto:/") || + $img.toLowerCase().startsWith("file:/") || ($img.toLowerCase().indexOf("://") != -1) ) ) + #set ( $img = $PathTool.calculateLink( $img, $relativePath ) ) + #set ( $img = $img.replaceAll( '\\', '/' ) ) + #end +## + #if( $item.alt ) + #set ( $alt = ' alt="' + $item.alt + '"' ) + #else + #set ( $alt = ' alt="' + $name + '"' ) + #end +## + #if( $item.border ) + #set ( $border = ' border="' + $item.border + '"' ) + #else + #set ( $border = "" ) + #end +## + #if( $item.width ) + #set ( $width = ' width="' + $item.width + '"' ) + #else + #set ( $width = "" ) + #end + #if( $item.height ) + #set ( $height = ' height="' + $item.height + '"' ) + #else + #set ( $height = "" ) + #end +## + + + + #end + #if( $poweredBy.isEmpty() ) + + $i18n.getString( + + #end + #else + + $i18n.getString( + + #end +#end +## +#macro ( googleAnalytics $accountId ) + #if( $accountId && $accountId != "" ) + + + #end +#end +## + + + + $title + + +#foreach( $author in $authors ) + +#end +#if ( $dateCreation ) + +#end +#if ( $dateRevision ) + +#end +#if ( $locale ) + +#end + #if ( $decoration.body.head ) + #foreach( $item in $decoration.body.head.getChildren() ) + ## Workaround for DOXIA-150 due to a non-desired behaviour in p-u + ## @see org.codehaus.plexus.util.xml.Xpp3Dom#toString() + ## @see org.codehaus.plexus.util.xml.Xpp3Dom#toUnescapedString() + #set ( $documentHeader = '' ) + #if ( $item.name == "script" ) + $StringUtils.replace( $item.toUnescapedString(), $documentHeader, "" ) + #else + $StringUtils.replace( $item.toString(), $documentHeader, "" ) + #end + #end + #end + $headContent + #googleAnalytics( $decoration.googleAnalyticsAccountId ) + + + + +
    + +
    +
    +
    + $bodyContent +
    +
    +
    +
    +
    + build.cmd compile-all -
    -

    - In order to build the Release builds of log4net a Strong - Name key is required. -

    -

    - Use the sn.exe tool in the - .NET Framework SDK to generate a strong name key pair. -

    -
    -sn -k log4net.snk
    -

    - The log4net.snk file should be placed in the root of the - log4net distribution, in the same folder as the log4net.build - file. -

    -
    -

    - NDoc 1.3 is used to build the log4net SDK documentation. - NDoc is available from ndoc.sourceforge.net. -

    -
    - -
    -

    - The log4net HTML documentation is built using Velocity. - The source are XML files in the xdocs/src directory. - Building the documentation requires Java, Ant, and Velocity. - Run ant from within the xdocs directory. + Sandcastle + Helpfile Builder is used to build the log4net SDK + documentation. Running it is currently not + integrated with the NAnt build process, you'll + have to open and run log4net.shfbproj + with SHFB manually.

    diff --git a/src/site/xdoc/release/config-examples.xml b/src/site/xdoc/release/config-examples.xml old mode 100755 new mode 100644 index c23f3c86..77ee1174 --- a/src/site/xdoc/release/config-examples.xml +++ b/src/site/xdoc/release/config-examples.xml @@ -25,10 +25,8 @@ limitations under the License. -
    +
    - -

    This document presents example configurations for the built-in appenders. @@ -45,7 +43,7 @@ limitations under the License.

    - For full details see the SDK Reference entry: log4net.Appender.AdoNetAppender. + For full details see the SDK Reference entry: log4net.Appender.AdoNetAppender.

    The configuration of the AdoNetAppender depends on the @@ -449,7 +447,7 @@ CREATE TABLE Log (

    - For full details see the SDK Reference entry: log4net.Appender.AspNetTraceAppender. + For full details see the SDK Reference entry: log4net.Appender.AspNetTraceAppender.

    The following example shows how to configure the AspNetTraceAppender @@ -469,7 +467,7 @@ CREATE TABLE Log (

    - For full details see the SDK Reference entry: log4net.Appender.BufferingForwardingAppender. + For full details see the SDK Reference entry: log4net.Appender.BufferingForwardingAppender.

    The following example shows how to configure the BufferingForwardingAppender @@ -502,7 +500,7 @@ CREATE TABLE Log (

    - For full details see the SDK Reference entry: log4net.Appender.ColoredConsoleAppender. + For full details see the SDK Reference entry: log4net.Appender.ColoredConsoleAppender.

    The following example shows how to configure the ColoredConsoleAppender @@ -544,7 +542,7 @@ CREATE TABLE Log (

    - For full details see the SDK Reference entry: log4net.Appender.ConsoleAppender. + For full details see the SDK Reference entry: log4net.Appender.ConsoleAppender.

    The following example shows how to configure the ConsoleAppender @@ -573,7 +571,7 @@ CREATE TABLE Log (

    - For full details see the SDK Reference entry: log4net.Appender.EventLogAppender. + For full details see the SDK Reference entry: log4net.Appender.EventLogAppender.

    The following example shows how to configure the EventLogAppender to log @@ -608,7 +606,7 @@ CREATE TABLE Log (

    - For full details see the SDK Reference entry: log4net.Appender.FileAppender. + For full details see the SDK Reference entry: log4net.Appender.FileAppender.

    The following example shows how to configure the FileAppender @@ -653,11 +651,30 @@ CREATE TABLE Log ( ]]> +

    + This example shows how to configure the appender to use the "inter process" locking + model. +

    + + + + + + + + + ]]> +

    + Before you change the locking model so that + multiple process may log to the same file, please + read the FAQ. +

    - For full details see the SDK Reference entry: log4net.Appender.ForwardingAppender. + For full details see the SDK Reference entry: log4net.Appender.ForwardingAppender.

    The following example shows how to configure the ForwardingAppender. @@ -676,9 +693,59 @@ CREATE TABLE Log ( ]]>

    +
    +

    + For full details see the SDK Reference entry: log4net.Appender.ManagedColoredConsoleAppender. +

    +

    + The following example shows how to configure the ManagedColoredConsoleAppender + to log messages to the console. By default the messages are sent to the console + standard output stream. This example shows how to highlight error messages. +

    + + + + + + + + + + + ]]> +

    + This example shows how to colorize multiple levels. +

    + + + + + + + + + + + + + + + + + + + + + + + ]]> +
    +

    - For full details see the SDK Reference entry: log4net.Appender.MemoryAppender. + For full details see the SDK Reference entry: log4net.Appender.MemoryAppender.

    It is unlikely that the MemoryAppender will be configured @@ -693,7 +760,7 @@ CREATE TABLE Log (

    - For full details see the SDK Reference entry: log4net.Appender.NetSendAppender. + For full details see the SDK Reference entry: log4net.Appender.NetSendAppender.

    The following example shows how to configure the NetSendAppender @@ -720,7 +787,7 @@ CREATE TABLE Log (

    - For full details see the SDK Reference entry: log4net.Appender.OutputDebugStringAppender. + For full details see the SDK Reference entry: log4net.Appender.OutputDebugStringAppender.

    The following example shows how to configure the OutputDebugStringAppender @@ -737,7 +804,7 @@ CREATE TABLE Log (

    - For full details see the SDK Reference entry: log4net.Appender.RemotingAppender. + For full details see the SDK Reference entry: log4net.Appender.RemotingAppender.

    The following example shows how to configure the RemotingAppender @@ -778,7 +845,7 @@ CREATE TABLE Log (

    - For full details see the SDK Reference entry: log4net.Appender.RollingFileAppender. + For full details see the SDK Reference entry: log4net.Appender.RollingFileAppender.

    The RollingFileAppender builds on the @@ -867,7 +934,7 @@ CREATE TABLE Log (

    - For full details see the SDK Reference entry: log4net.Appender.SmtpAppender. + For full details see the SDK Reference entry: log4net.Appender.SmtpAppender.

    The following example shows how to configure the SmtpAppender @@ -936,7 +1003,7 @@ CREATE TABLE Log (

    - For full details see the SDK Reference entry: log4net.Appender.SmtpPickupDirAppender. + For full details see the SDK Reference entry: log4net.Appender.SmtpPickupDirAppender.

    The SmtpPickupDirAppender is configured similarly @@ -978,7 +1045,7 @@ CREATE TABLE Log (

    - For full details see the SDK Reference entry: log4net.Appender.TraceAppender. + For full details see the SDK Reference entry: log4net.Appender.TraceAppender.

    The following example shows how to configure the TraceAppender @@ -998,7 +1065,7 @@ CREATE TABLE Log (

    - For full details see the SDK Reference entry: log4net.Appender.UdpAppender. + For full details see the SDK Reference entry: log4net.Appender.UdpAppender.

    The following example shows how to configure the UdpAppender @@ -1015,6 +1082,27 @@ CREATE TABLE Log ( ]]>

    + +
    +

    + For full details see the SDK Reference entry: log4net.Layout.DynamicPatternLayout. +

    +

    + The DynamicPatternLayout should be used whenever the header or footer should contain information that could change over time. + Compared to the static PatternLayout which does not re-evaluate on every invoke, the DynamicPatternLayout + does re-evaluate the pattern on every invoke. It does, for example, allow to include the current DateTime in the header and/or the footer which was not possible + with the static PatternLayout. +

    +

    + The following example shows how to configure the DynamicPatternLayout. +

    + + + + + ]]> +
    diff --git a/src/site/xdoc/release/example-apps.xml b/src/site/xdoc/release/example-apps.xml old mode 100755 new mode 100644 index 43ec2aa6..ca148885 --- a/src/site/xdoc/release/example-apps.xml +++ b/src/site/xdoc/release/example-apps.xml @@ -24,46 +24,13 @@ limitations under the License. - - - - - -
    + +
    - -

    - The following examples are only available in the log4net release download, not - on-line. To obtain the examples download one of the log4net releases. + The following examples are only available in the log4net source download, not + on-line. To obtain the examples download the log4net source release.

    @@ -77,7 +44,7 @@ links[i].href = "#overview";

    For example running nant in the examples\net\1.0\Tutorials\ConsoleApp\cs directory - will build the C# version of the .NET 1.0 ConsoleApp example. + will build the C# version of the Microsoft® .NET 1.0 ConsoleApp example.

    nant can be run in any directory containing a @@ -102,12 +69,12 @@ links[i].href = "#overview";

    There are Visual Studio .NET 2002 project files for the .NET 1.0 framework. - The solution files for C# and VB are in the examples\net\1.0 + The solution files for C# and VB are in the examples\net\1.0 folder.

    For the Managed C++ project there is a Visual Studio .NET 2003 project file - in the examples\net\1.1 folder. + in the examples\net\1.1 folder.

    @@ -127,26 +94,26 @@ links[i].href = "#overview";
    • MONO 1.0: - C# + C#
    • .NET 1.0: - C#, - VB + C#, + VB
    • .NET 1.1: - C++, - JScript.NET + C++, + JScript.NET
    • .NET Compact Framework 1.0: - C#, - VB + C#, + VB
    • SSCLI 1.0: - JScript.NET + JScript.NET

    @@ -167,8 +134,8 @@ links[i].href = "#overview";

    • .NET 1.0: - C#, - VB + C#, + VB

    @@ -195,7 +162,7 @@ links[i].href = "#overview";

    • .NET 1.0: - C# + C#

    @@ -218,7 +185,7 @@ links[i].href = "#overview";

    • .NET 1.0: - C# + C#

    @@ -243,20 +210,20 @@ links[i].href = "#overview";

    • MONO 1.0: - C# + C#
    • .NET 1.0: - C#, - VB + C#, + VB
    • .NET 1.1: - JScript.NET + JScript.NET
    • SSCLI 1.0: - C# + C#

    @@ -278,20 +245,20 @@ links[i].href = "#overview";

    • MONO 1.0: - C# + C#
    • .NET 1.0: - C#, - VB + C#, + VB
    • .NET 1.1: - JScript.NET + JScript.NET
    • SSCLI 1.0: - C# + C#

    @@ -313,20 +280,20 @@ links[i].href = "#overview";

    • MONO 1.0: - C# + C#
    • .NET 1.0: - C#, - VB + C#, + VB
    • .NET 1.1: - JScript.NET + JScript.NET
    • SSCLI 1.0: - C# + C#

    @@ -348,7 +315,7 @@ links[i].href = "#overview";

    • .NET 1.0: - C# + C#

    @@ -370,7 +337,7 @@ links[i].href = "#overview";

    • .NET 1.0: - C# + C#

    @@ -416,7 +383,7 @@ links[i].href = "#overview";

    • .NET 1.0: - C# + C#

    @@ -444,7 +411,7 @@ links[i].href = "#overview";

    • .NET 1.0: - C# + C#

    @@ -465,12 +432,12 @@ links[i].href = "#overview";

    • MONO 1.0: - C# + C#
    • .NET 1.0: - C#, - VB + C#, + VB

    @@ -490,7 +457,7 @@ links[i].href = "#overview";

    • .NET 1.0: - C# + C#

    diff --git a/src/site/xdoc/release/faq.xml b/src/site/xdoc/release/faq.xml old mode 100755 new mode 100644 index 18d905b5..e57cd7e0 --- a/src/site/xdoc/release/faq.xml +++ b/src/site/xdoc/release/faq.xml @@ -25,9 +25,9 @@ limitations under the License. -

    - - + + +
    @@ -88,7 +88,7 @@ limitations under the License.

    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). + the Microsoft® .NET runtime 1.0 (1.0.3705) or 1.1 (1.1.4322).

    Not all frameworks are created equal and some features have been excluded from @@ -138,7 +138,7 @@ limitations under the License. log4net supports multiple output appenders per logger.

    - See the features overview document for more information on the features of log4net. + See the features overview document for more information on the features of log4net.

    Back to Top

    @@ -261,17 +261,9 @@ limitations under the License.

    Back to Top

    -
    -

    - As fast as they get reported ;-) -

    -
    -

    Back to Top

    - -

    - log4net is a port of the popular log4j logging library. + log4net is a port of the popular Apache log4j™ 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 history page for more details.

    @@ -286,6 +278,82 @@ limitations under the License.

    Back to Top

    +
    +

    + Starting with log4net 1.2.11 there are two + different binary distributions, + oldkey and newkey. +

    + +

    + The oldkey 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. +

    + +

    + The newkey distribution contains + assemblies signed with the strong name key + available from log4net's + svn area or inside the source distribution. + Everybody can create assemblies that have the same + strong name. +

    + +

    + 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 + newkey is used throughout. +

    + +

    + The oldkey 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 newkey + assemblies. +

    + +

    + 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. +

    + +

    + We currently plan to distribute the new-key + assembly under a different name while providing + old and newkey log4net.dll 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 privatePath. +

    + +

    + 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. +

    + +
    +

    Back to Top

    +
    @@ -534,6 +602,18 @@ public class Foo

    Note: the .NET Compact Framework 1.0 does not support System.Reflection.MethodBase.GetCurrentMethod().

    + +

    + Note: the two forms are only equivalent + if Foo is not a + generic class. For a generic class Foo<T> the variant + using typeof generates + a different logger for each different type + parameter T while the + variant using reflection generates the same + logger for all Ts. +

    Back to Top

    @@ -659,24 +739,70 @@ public class FastLogger
    -

    - By default the FileAppender holds an exclusive write - lock on the log file while it is logging. This prevents other processes from - writing to the file. The FileAppender can be configured - to use a different locking model, MinimalLock, that - 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 loss in performance. - See the FileAppender config examples - for an example MinimalLock configuration. -

    -

    - While the MinimalLock model may be used to interleave - writes to a single file it may not be the optimal solution, especially when - logging from multiple machines. Alternatively you may have one or more processes - log to RemotingAppenders. - Using the RemoteLoggingServerPlugin (or - IRemoteLoggingSink) a process can receive all the events and - log them to a single log file. +

    + 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 ;-). +

    + +

    + FileAppender offers pluggable locking models for + this usecase but all existing implementations have + issues and drawbacks. +

    + +

    + By default the FileAppender 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. +

    + +

    + MinimalLock 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. +

    +

    + InterProcessLock + 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. +

    +

    + If you use RollingFileAppender things + become even worse as several process may try to + start rolling the log file concurrently. RollingFileAppender + completely ignores the locking model when + rolling files, rolling files is simply not + compatible with this scenario. +

    +

    + A better alternative is to have your processes + log to RemotingAppenders. Using + the RemoteLoggingServerPlugin + (or IRemoteLoggingSink) a + process can receive all the events and log + them to a single log file. One of the + examples shows how to use the RemoteLoggingServerPlugin.

    Back to Top

    @@ -845,6 +971,27 @@ public class FastLogger

    Back to Top

    +
    +

    + To prevent silent failure of log4net as reported as LOG4NET-342, + 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 + log4net.Repository.ILoggerRepository.Configured and enumerate the configuration messages as follows: +

    +
    +
    +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
    +	}
    +}
    +                        
    +
    +
    +

    Back to Top

    @@ -924,6 +1071,33 @@ public class FastLogger

    Back to Top

    + + +
    +

    + This problem has been reported by several people as issue + LOG4NET-178. + 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. +

    +

    + The first thing step to troubleshoot problems is enabling + the log4net internal debugging features as described + here + and fix all errors that pop up. If the problem still persists, + this comment + suggests to move the LOG4NET configuration out of the + web.config into a separate file + like log4net.config. 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 + this comment. +

    +
    +

    Back to Top

    @@ -943,12 +1117,103 @@ public class FastLogger

    - See the support page for details. + First make sure it really is a bug and not a + usage error. When in doubt, ask on the log4net-user mailing + list first. +

    +

    + If you have identified a bug, please report it + via our Issue + Tracker. You may want to check it hasn't + been reported before by searching the existing + issues. +

    +
    +

    Back to Top

    + +
    +

    + 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. +

    + +

    + As stated in the + manual the attribute will only be read for + the first assembly that tries to use log4net. + So it is important that you obtain your + ILog instance as early as possible. +

    + +

    + For a command line application "as early as + possible" probably is the class holding the + Main method, for a Web-Application + it would be your Global.asax class + and for a Windows Service it would be the class + deriving from ServiceBase.

    Back to Top

    +
    +

    + You may have overlooked initialization code for + log4net in your application. log4net can be + initialized explicitly by calling one of the + configurators + (e.g. BasicConfigurator or + XmlConfigurator in the + log4net.Config namespace, or + implicitly by including the + [XmlConfiguratorAttribute] in the + assembly where log4net is first used. +

    +

    + See the + manual 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 log4net doesn't log when built + in RELEASE mode. +

    + +
    +

    Back to Top

    + +
    +

    + 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. +

    +

    + Unfortunately re-connecting doesn't seem to be + working reliably. A workaround may be to add + ConnectRetryCount=0 to your + connection string. +

    +

    + For details see LOG4NET-442 +

    +
    @@ -959,6 +1224,17 @@ public class FastLogger Building a Better Server Control Experience, Part 2.

    + +
    +

    + Starting with version 2.0.6 we provide Nuget packages. For earlier + versions Jiří Činčura has kindly created + Nuget packages. +

    +

    Back to Top

    diff --git a/src/site/xdoc/release/features.xml b/src/site/xdoc/release/features.xml old mode 100755 new mode 100644 index 616fa089..c42b7235 --- a/src/site/xdoc/release/features.xml +++ b/src/site/xdoc/release/features.xml @@ -25,10 +25,8 @@ limitations under the License. -
    +
    - -

    log4net is a tool to help the programmer output log statements to a @@ -53,15 +51,15 @@ limitations under the License.

      -
    • Support for multiple frameworks

    • -
    • Output to multiple logging targets

    • -
    • Hierarchical logging architecture

    • -
    • XML Configuration

    • -
    • Dynamic Configuration

    • -
    • Logging Context

    • -
    • Proven architecture

    • -
    • Modular and extensible design

    • -
    • High performance with flexibility

    • +
    • Support for multiple frameworks
    • +
    • Output to multiple logging targets
    • +
    • Hierarchical logging architecture
    • +
    • XML Configuration
    • +
    • Dynamic Configuration
    • +
    • Logging Context
    • +
    • Proven architecture
    • +
    • Modular and extensible design
    • +
    • High performance with flexibility
    @@ -71,19 +69,34 @@ limitations under the License. log4net has specific builds for the following frameworks:

      -
    • Microsoft .NET Framework 1.0 (1.0.3705)
    • -
    • Microsoft .NET Framework 1.1 (1.1.4322)
    • -
    • Microsoft .NET Framework 2.0 (2.0.50727)
    • -
    • Microsoft .NET Compact Framework 1.0
    • - -
    • Mono 1.0
    • +
    • .NET Core 1.0 - using netstandard-1.3
    • +
    • Microsoft® .NET Framework 1.0*
    • +
    • Microsoft .NET Framework 1.1*
    • +
    • Microsoft .NET Framework 2.0
    • +
    • Microsoft .NET Framework 3.5
    • +
    • Microsoft .NET Framework 4.0
    • +
    • Microsoft .NET Framework 4.5
    • +
    • Microsoft .NET Framework 3.5 Client Profile
    • +
    • Microsoft .NET Framework 4.0 Client Profile
    • +
    • Microsoft .NET Compact Framework 1.0*
    • +
    • Microsoft .NET Compact Framework 2.0*
    • +
    • Mono 1.0*
    • Mono 2.0
    • -
    • Microsoft Shared Source CLI 1.0
    • -
    • CLI 1.0 Compatible
    • +
    • Mono 3.5
    • +
    • Mono 4.0
    • +
    • Microsoft Shared Source CLI 1.0*
    • +
    • CLI 1.0 Compatible*
    -

    - Note: Due to the .NET frameworks support for backward compatibility - log4net will run on future versions of the runtimes listed above. +

    The "Client Profile" builds are stripped down + versions of the "normal" builds that don't contain any + ASP.NET releated code - which for example means the + %aspnet-* patterns and the + AspNetTraceAppender are not available.

    + +

    + *Not + supported by the binary release but can be built + from the source release.

    @@ -132,6 +145,12 @@ limitations under the License. the standard our stream or the standard error stream. + + log4net.Appender.DebugAppender + + Writes logging events to the .NET system. + + log4net.Appender.EventLogAppender @@ -197,6 +216,15 @@ limitations under the License. Sends logging events to an email address. + + log4net.Appender.SmtpPickupDirAppender + + Sends logging events to an email + address but writes the emails to a + configurable directory rather than + sending them directly via SMTP. + + log4net.Appender.TelnetAppender @@ -218,7 +246,9 @@ limitations under the License. -

    +

    A special log4net.Appender.ForwardingAppender can + be used to wrap another appender, for example to + attach additional filters.

    @@ -273,7 +303,7 @@ limitations under the License.

    - log4net is based on the highly successful log4j logging library, + log4net is based on the highly successful Apache log4j™ logging library, in development since 1996. This popular and proven architecture has so far been ported to 12 languages.

    diff --git a/src/site/xdoc/release/framework-support.xml b/src/site/xdoc/release/framework-support.xml old mode 100755 new mode 100644 index ce7d3c6a..7cf2b34f --- a/src/site/xdoc/release/framework-support.xml +++ b/src/site/xdoc/release/framework-support.xml @@ -25,10 +25,8 @@ limitations under the License. -
    +
    - -

    log4net is built on a number of different frameworks. Each new version of the frameworks add @@ -43,22 +41,16 @@ limitations under the License.

    While the number of different builds available may seem confusing, you only need to select the nearest build for your platform that is equal to or earlier than your chosen deployment framework. - If you intend to deploy your application on the Microsoft .NET Framework 1.0 don't pick the + If you intend to deploy your application on the Microsoft® .NET Framework 1.0 don't pick the log4net build that is built against the Microsoft .NET Framework 1.1 because the .NET framework does not guarantee forward compatibility only backward compatibility.

    - The lowest common denominator build is the CLI 1.0 Compatible build. This build is compatible with - the ECMA/ISO CLI 1.0 standard APIs and will run on all frameworks that support the standard. (Note - that the Microsoft .NET Compact Framework does not support this standard). Use this build if you - intend to deploy you application on both the Microsoft .NET Frameworks and the Mono frameworks. -

    -

    - log4net now builds on 6 frameworks: + log4net is regularly built by its developers on the following frameworks:

    - +
    @@ -68,48 +60,107 @@ limitations under the License. - - + + + + + + + + + + + + + + - - + + - - + + + + + + + + + + + + + + + + + + + +
    Website
    Microsoft .NET Framework 1.0 (1.0.3705)http://msdn.microsoft.com/net.NET Core 1.0 providing .NET Standard 1.3https://dotnet.github.io/
    Microsoft .NET Framework 2.0http://msdn.microsoft.com/en-us/netframework/
    Microsoft .NET Framework 3.5http://msdn.microsoft.com/en-us/netframework/
    Microsoft .NET Framework 4.0http://msdn.microsoft.com/en-us/netframework/
    Microsoft .NET Framework 1.1 (1.1.4322)http://msdn.microsoft.com/netMicrosoft .NET Framework 3.5 Client Profilehttp://msdn.microsoft.com/en-us/library/cc656912.aspx
    Microsoft .NET Framework 2.0 (2.0.50727)http://msdn.microsoft.com/netMicrosoft .NET Framework 4.0 Client Profilehttp://msdn.microsoft.com/en-us/library/cc656912.aspx
    Microsoft .NET Framework 4.5http://msdn.microsoft.com/en-us/netframework/
    Mono 2.0http://www.mono-project.com
    Mono 3.5http://www.mono-project.com
    Mono 4.0http://www.mono-project.com
    +
    +

    + log4net should also build on the following + frameworks but binaries are not created by the + developers and source compatibility can not be + guaranteed: +

    +

    - For each of these frameworks a log4net assembly targeting the framework is supplied. Although it's - perfectly possible to use the .NET Framework 1.0 version of log4net on the .NET Framework 1.1, having + For most of these frameworks a log4net assembly targeting the framework is supplied. Although it's + perfectly possible to use the .NET Framework 3.5 version of log4net on the .NET Framework 4.0, having an assembly that really targets a specific framework allows us to use features in that framework that are not available in other frameworks or remove features from log4net that are not supported in a specific framework.

    +

    + There are no assemblies targeting the Compact + Framework 1.0/2.0, .NET Framework or Mono 1.x or + Microsoft Shared Source CLI 1.0 in the binary + release, but they can be built from the source + release. +

    @@ -118,7 +169,7 @@ limitations under the License. framework and the platform it runs on:

    - +
    @@ -127,14 +178,30 @@ limitations under the License. + + + + + + + + + + + + + + + - + + @@ -145,6 +212,13 @@ limitations under the License. + + + + + + + @@ -157,12 +231,26 @@ limitations under the License. + + + + + + + + + + + + + + @@ -177,12 +265,26 @@ limitations under the License. + + + + + + + + + + + + + + @@ -197,6 +299,13 @@ limitations under the License. + + + + + + + @@ -207,12 +316,26 @@ limitations under the License. + + + + + + + + + + + + + + @@ -227,6 +350,13 @@ limitations under the License. + + + + + + + @@ -237,17 +367,48 @@ limitations under the License. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -257,12 +418,26 @@ limitations under the License. + + + + + + + + + + + + + + @@ -274,6 +449,13 @@ limitations under the License. + + + + + + + @@ -287,12 +469,26 @@ limitations under the License. + + + + + + + + + + + + + + @@ -307,12 +503,26 @@ limitations under the License. + + + + + + + + + + + + + + @@ -327,6 +537,13 @@ limitations under the License. + + + + + + + @@ -337,6 +554,13 @@ limitations under the License. + + + + + + + @@ -347,6 +571,13 @@ limitations under the License. + + + + + + + @@ -357,33 +588,103 @@ limitations under the License. + + + + + + +
    Appender .NET Framework 1.0 .NET Framework 1.1 .NET Framework 2.0.NET Framework 3.5.NET Framework 4.0.NET Framework 4.5.NET Framework 3.5 Client Profile.NET Framework 4.0 Client Profile.NET Standard 1.3 .NET CF 1.0Mono 1.2.NET CF 2.0Mono Shared Source CLI 1.0 CLI 1.0 Compatible
    x x xxxxxxx x
    x x xxxxxxxx
    AspNetTraceAppender x x xxxx x x x xxxxxxxx
    ColoredConsoleAppender x x xxxxxx x x xxxxxxxx
    DebugAppenderx x xxxxxxxx
    EventLogAppender x x xxxxxx x x x xxxxxxxx
    ForwardingAppenderx x xxxxxxxx
    LocalSyslogAppender x x xxxxxxx x x
    ManagedColoredConsoleAppenderxxxxxxxx
    MemoryAppender xx x xxxxxxxx
    NetSendAppender x x xxxxxx x x xxxxxxxx x x xxxxxxxx
    RemotingAppender x x xxxxxx x xx x xxxxxxxx
    SmtpAppender x x xxxxxx x x x xxxxxxxx
    TelnetAppenderx x xxxxxxxx
    TraceAppenderx x xxxxxxxx
    UdpAppenderx x xxxxxxxx
    -
    +
    +

    + Targets netstandard-1.3 and thus doesn't support + a few things that work on Mono or the classical + .NET platform. +

    +

    Things that are not supported in log4net + for .NET Standard 1.3:

    +
      +
    • the ADO.NET appender
    • +
    • anything related to ASP.NET (trace appender + and several pattern converters)
    • +
    • .NET Remoting
    • +
    • log4net.LogicalThreadContext + and the associated properties and stack + classes
    • +
    • the colored console appender
    • +
    • the event log appender
    • +
    • The NetSendAppender
    • +
    • The SMTP appender
    • +
    • DOMConfigurator
    • +
    • stack trace patterns
    • +
    • access to appSettings (neither + the log4net section itself nor using the + AppSettingsPatternConverter)
    • +
    • Access to "special paths" using the + EnvironmentFolderPathPatternConverter
    • +
    • Impersonation of Windows accounts
    • +
    +
    + +
    +

    + none +

    +
    + +
    +

    + none +

    +
    + +
    +

    + none +

    +
    + +

    none

    -
    +

    none

    -
    +

    none

    +
    +

    + As of log4net 1.2.11 this version is identical + to the .NET 3.5 version without support for + ASP.NET specific appenders and patterns. +

    +
    + +
    +

    + As of log4net 1.2.11 this version is identical + to the .NET 4.0 version without support for + ASP.NET specific appenders and patterns. +

    +
    +
    -
      -
    • Assembly attributes

      The .NET Compact Framework 1.0 does not support retrieving assembly level @@ -425,8 +726,6 @@ namespace TestApp } } -

    • -
    • Notification events

      The .NET Compact Framework 1.0 does not support notification events during the @@ -440,8 +739,6 @@ namespace TestApp method in order to prevent losing logging events. See the code above for an example.

      -
    • -
    • FileSystemWatcher

      The .NET Compact Framework 1.0 does not support the @@ -453,8 +750,6 @@ namespace TestApp methods are not available. Watching changes to the log4net configuration file is not supported on the .NET Compact Framework 1.0.

      -
    • -
    • UserName

      The .NET Compact Framework 1.0 does not support the @@ -463,8 +758,6 @@ namespace TestApp the LoggingEvent.UserName property will return the value "NOT AVAILABLE".

      -
    • -
    • Identity

      The .NET Compact Framework 1.0 does not support the @@ -473,23 +766,17 @@ namespace TestApp the LoggingEvent.Identity property will return the value "NOT AVAILABLE".

      -
    • -
    • Environment variables

      The .NET Compact Framework 1.0 does not support retrieving environment variables, therefore it's not possible to substitute environment variables in parameter values when using the .NET Compact Framework 1.0 version of log4net.

      -
    • -
    • Serialization

      The .NET Compact Framework 1.0 does not support serialization, therefore none of the log4net classes in the .NET Compact Framework 1.0 version are serializable.

      -
    • -
    • LoggingEvent.Domain

      The .NET Compact Framework 1.0 does not support AppDomain functionality. The @@ -498,16 +785,12 @@ namespace TestApp PatternLayout. On the .NET Compact Framework 1.0 this value is generated by taking the file name for the application's primary module.

      -
    • -
    -

    There are 2 separate builds of log4net for mono; Mono 1.0, built using the C# compiler in a mode @@ -525,12 +808,20 @@ namespace TestApp none

    +
    +

    + none +

    +
    +
    +

    + none +

    +
    -
      -
    • FileSystemWatcher

      SSCLI 1.0 does not support the @@ -542,8 +833,6 @@ namespace TestApp methods are not available. Watching changes to the log4net configuration file is not supported on SSCLI 1.0.

      -
    • -
    • UserName

      SSCLI 1.0 does not support the @@ -552,8 +841,6 @@ namespace TestApp the LoggingEvent.UserName property will return the value "NOT AVAILABLE".

      -
    • -
    • Identity

      SSCLI 1.0 does not support the @@ -562,8 +849,6 @@ namespace TestApp the LoggingEvent.Identity property will return the value "NOT AVAILABLE".

      -
    • -
    diff --git a/src/site/xdoc/release/howto/chainsaw.xml b/src/site/xdoc/release/howto/chainsaw.xml old mode 100755 new mode 100644 index 8ad6f17e..1bfef699 --- a/src/site/xdoc/release/howto/chainsaw.xml +++ b/src/site/xdoc/release/howto/chainsaw.xml @@ -27,10 +27,8 @@ limitations under the License.
    - -

    - Apache log4j includes Chainsaw + Apache log4j™ includes Apache Chainsaw™ a graphical log viewer.

    @@ -45,10 +43,15 @@ limitations under the License. Save one or more of the sample xml config files to your local system and load them when Chainsaw starts.

    + +

    + Please note also that it may be necessary to configure Chainsaw tabs as reported as + issue LOG4NET-259. +

    - log4net can be configured to log messages via UDP in such a way that Chainsaw + Apache log4net™ can be configured to log messages via UDP in such a way that Chainsaw can receive and display them.

    diff --git a/src/site/xdoc/release/howto/index.xml b/src/site/xdoc/release/howto/index.xml old mode 100755 new mode 100644 index af86a6a5..43c72d94 --- a/src/site/xdoc/release/howto/index.xml +++ b/src/site/xdoc/release/howto/index.xml @@ -25,7 +25,7 @@ limitations under the License. -
    +

    Below are presented, in no particular order, a series of documents diff --git a/src/site/xdoc/release/manual/configuration.xml b/src/site/xdoc/release/manual/configuration.xml old mode 100755 new mode 100644 index 7d9be6e3..8cdddd8b --- a/src/site/xdoc/release/manual/configuration.xml +++ b/src/site/xdoc/release/manual/configuration.xml @@ -25,9 +25,7 @@ limitations under the License. -

    - - +

    @@ -411,6 +409,48 @@ DEBUG [main] (Bar.cs:12) - Doing it again!

    +
    +

    + If you use attributes to + configure log4net, two settings of the + appSettings section of your + application's configuration file can be used to + override the values given in your assembly's + attributes. +

    +

    + The setting with the key "log4net.Config" + overrides the configuration file name (and is + considered to be relative to your application's + base directory), the setting with the key + "log4net.Config.Watch" determines whether the file + should be monitored for changes. +

    +

    + Even though the assembly attribute +

    +
    +[assembly: log4net.Config.XmlConfigurator(Watch=false)]
    +                  
    +

    + would configure your application to use a + configuration file "TestApp.exe.config" and not + monitor it for changes you can override this to + use the file "log4net.config" and monitor it + instead by adding +

    +
    
    +  
    +  
    +]]>
    +                  
    + +

    + to your application's configuration file. +

    +
    +

    Typically the log4net configuration is specified using a file. This file can @@ -583,7 +623,7 @@ DEBUG [main] (Bar.cs:12) - Doing it again! The <log4net> element supports the following attributes:

    - +
    @@ -622,7 +662,7 @@ DEBUG [main] (Bar.cs:12) - Doing it again! The <log4net> element supports the following child elements:

    -
    +
    @@ -684,7 +724,7 @@ DEBUG [main] (Bar.cs:12) - Doing it again! The <appender> element supports the following attributes:

    -
    +
    @@ -714,7 +754,7 @@ DEBUG [main] (Bar.cs:12) - Doing it again! The <appender> element supports the following child elements:

    -
    +
    @@ -753,7 +793,7 @@ DEBUG [main] (Bar.cs:12) - Doing it again!

    For examples of configuring appenders see the - Example Appender Configuration + Example Appender Configuration document.

    @@ -765,7 +805,7 @@ DEBUG [main] (Bar.cs:12) - Doing it again! The <filter> element supports the following attributes:

    -
    +
    @@ -787,7 +827,7 @@ DEBUG [main] (Bar.cs:12) - Doing it again! The <filter> element supports the following child elements:

    -
    +
    @@ -859,7 +899,7 @@ DEBUG [main] (Bar.cs:12) - Doing it again! The <layout> element supports the following attributes:

    -
    +
    @@ -881,7 +921,7 @@ DEBUG [main] (Bar.cs:12) - Doing it again! The <layout> element supports the following child elements:

    -
    +
    @@ -930,7 +970,7 @@ DEBUG [main] (Bar.cs:12) - Doing it again! The <root> element supports the following child elements:

    -
    +
    @@ -979,7 +1019,7 @@ DEBUG [main] (Bar.cs:12) - Doing it again! The <logger> element supports the following attributes.

    -
    +
    @@ -1008,7 +1048,7 @@ DEBUG [main] (Bar.cs:12) - Doing it again! The <logger> element supports the following child elements:

    -
    +
    @@ -1054,7 +1094,7 @@ DEBUG [main] (Bar.cs:12) - Doing it again! The <renderer> element supports the following attributes.

    -
    +
    @@ -1101,7 +1141,7 @@ DEBUG [main] (Bar.cs:12) - Doing it again! The <param> element supports the following attributes.

    -
    +
    @@ -1139,7 +1179,7 @@ DEBUG [main] (Bar.cs:12) - Doing it again! The <param> element supports the following child elements:

    -
    +
    diff --git a/src/site/xdoc/release/manual/contexts.xml b/src/site/xdoc/release/manual/contexts.xml old mode 100755 new mode 100644 index 8284ef0f..c1ae4b32 --- a/src/site/xdoc/release/manual/contexts.xml +++ b/src/site/xdoc/release/manual/contexts.xml @@ -25,9 +25,7 @@ limitations under the License. -
    - - +

    Most real-world systems have to deal with multiple clients simultaneously. In a typical multithreaded implementation of such a system, different threads will @@ -53,7 +51,7 @@ limitations under the License.

    -
    +
    diff --git a/src/site/xdoc/release/manual/internals.xml b/src/site/xdoc/release/manual/internals.xml old mode 100755 new mode 100644 index 650461d5..cba3e591 --- a/src/site/xdoc/release/manual/internals.xml +++ b/src/site/xdoc/release/manual/internals.xml @@ -25,9 +25,7 @@ limitations under the License. -
    - - +

    One of the often-cited arguments against logging is its computational cost. diff --git a/src/site/xdoc/release/manual/introduction.xml b/src/site/xdoc/release/manual/introduction.xml old mode 100755 new mode 100644 index 891a822d..828f1e2c --- a/src/site/xdoc/release/manual/introduction.xml +++ b/src/site/xdoc/release/manual/introduction.xml @@ -25,16 +25,14 @@ limitations under the License. -

    - - +

    This document is based on Short introduction to log4j by Ceki Gülcü.

    - The log4net framework is based on log4j, see - http://logging.apache.org/log4j for more information on log4j. + The log4net framework is based on Apache log4j™, see + http://logging.apache.org/log4j/ for more information on log4j. The log4net framework, source code, binaries, documentation, examples and related materials are published under the terms of the Apache License, Version 2.0, @@ -83,12 +81,21 @@ limitations under the License. assembly targeting that framework is built:

      -
    • Microsoft .NET Framework 1.0 (1.0.3705)
    • -
    • Microsoft .NET Framework 1.1 (1.1.4322)
    • +
    • .NET Standard 1.3 via .NET Core 1.0
    • +
    • Microsoft® .NET Framework 1.0
    • +
    • Microsoft .NET Framework 1.1
    • +
    • Microsoft .NET Framework 2.0
    • +
    • Microsoft .NET Framework 3.5
    • +
    • Microsoft .NET Framework 4.0
    • +
    • Microsoft .NET Framework 4.5
    • +
    • Microsoft .NET Framework 3.5 Client Profile
    • +
    • Microsoft .NET Framework 4.0 Client Profile
    • Microsoft .NET Compact Framework 1.0
    • Microsoft .NET Compact Framework 2.0
    • Mono 1.0
    • Mono 2.0
    • +
    • Mono 3.5
    • +
    • Mono 4.0
    • Microsoft Shared Source CLI 1.0
    • CLI 1.0 Compatible
    @@ -290,7 +297,7 @@ namespace log4net

    -
    Scope Type
    +
    @@ -332,7 +339,7 @@ namespace log4net

    -
    Logger name
    +
    @@ -369,7 +376,7 @@ namespace log4net

    -
    Logger name
    +
    @@ -418,7 +425,7 @@ namespace log4net

    -
    Logger name
    +
    @@ -563,7 +570,7 @@ ILog y = LogManager.GetLogger("wombat");]]> The following appenders are defined in the log4net package:

    -
    Logger name
    +
    @@ -611,6 +618,12 @@ ILog y = LogManager.GetLogger("wombat");]]> the standard our stream or the standard error stream. + + + + - + @@ -758,7 +771,7 @@ ILog y = LogManager.GetLogger("wombat");]]> The table below shows an example:

    -
    Type
    log4net.Appender.DebugAppender + Writes logging events to the .NET system. +
    log4net.Appender.EventLogAppender @@ -630,7 +643,7 @@ ILog y = LogManager.GetLogger("wombat");]]>
    log4net.LocalSyslogAppenderlog4net.Appender.LocalSyslogAppender Writes logging events to the local syslog service (UNIX only).
    +
    @@ -841,7 +854,7 @@ ILog y = LogManager.GetLogger("wombat");]]> The following filters are defined in the log4net package:

    -
    Logger Name
    +
    @@ -937,7 +950,7 @@ ILog y = LogManager.GetLogger("wombat");]]> The following layouts are included in the log4net package:

    -
    Type
    +
    @@ -1018,6 +1031,11 @@ ILog y = LogManager.GetLogger("wombat");]]>log4net.ObjectRenderer.IObjectRenderer interface.

    +

    + Please note that ObjectRenderers are not used by the DebugFormat, + InfoFormat, WarnFormat, + ErrorFormat and FatalFormat methods. +

    diff --git a/src/site/xdoc/release/manual/plugins.xml b/src/site/xdoc/release/manual/plugins.xml old mode 100755 new mode 100644 index 015f2bd6..7d395b9c --- a/src/site/xdoc/release/manual/plugins.xml +++ b/src/site/xdoc/release/manual/plugins.xml @@ -25,9 +25,7 @@ limitations under the License. -
    - - +

    Plugins are additional modular components that are attached to a logger repository. diff --git a/src/site/xdoc/release/manual/repositories.xml b/src/site/xdoc/release/manual/repositories.xml old mode 100755 new mode 100644 index 0a1e8382..9bd78408 --- a/src/site/xdoc/release/manual/repositories.xml +++ b/src/site/xdoc/release/manual/repositories.xml @@ -25,9 +25,7 @@ limitations under the License. -

    - - +

    Logging repositories are considered advanced functionality. The default behavior diff --git a/src/site/xdoc/release/release-notes.xml b/src/site/xdoc/release/release-notes.xml old mode 100755 new mode 100644 index b8346208..10a366ef --- a/src/site/xdoc/release/release-notes.xml +++ b/src/site/xdoc/release/release-notes.xml @@ -25,10 +25,457 @@ limitations under the License. -

    - - +
    + +
    +

    + 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. +

    + +
    +
      +
    • [LOG4NET-540] - nuget dependencies for .NET Standard leak into net46 +
    • +
    +
    +
    + +
    + +

    + 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. +

    + +

    + 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. +

    + +

    + 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 framework + support for details. +

    + +
    +
      +
    • [LOG4NET-508] - NAnt release build is not optimized +
    • +
    • [LOG4NET-512] - Thread safety issue in Hierarchy.cs +
    • +
    • [LOG4NET-527] - broken link on config-examples.html +
    • +
    • [LOG4NET-529] - Possible thread-safety bug in LoggingEvent +
    • +
    • [LOG4NET-536] - Can't build for NETCF-2.0 +
    • +
    +
    +
    +
      +
    • [LOG4NET-530] - Use UTC internally to avoid ambiguous timestamps +
    • +
    +
    + +
    +
      +
    • [LOG4NET-467] - Is .NET Core, will be supported in the near future, or not +
    • +
    • [LOG4NET-511] - API to flush appenders +
    • +
    • [LOG4NET-526] - Add appSetting conversion pattern to PatternString +
    • +
    +
    +
    + +
    +
    +
      +
    • [LOG4NET-462] - ReadOnlyPropertiesDictionary not thread safe +
    • +
    • [LOG4NET-488] - Fix tests build +
    • +
    • [LOG4NET-489] - AdoNetAppender fails after upgrade to 2.0.4 +
    • +
    • [LOG4NET-490] - InterProcessLock Tests fail +
    • +
    • [LOG4NET-493] - Log4net 1.2.14/ADO.NET appender throws exception when starting (1.2.13 with same config works fine) +
    • +
    • [LOG4NET-494] - ArgumentOutOfRange with SQLite +
    • +
    • [LOG4NET-495] - Error when BufferSize is >1, parameter already defined +
    • +
    +
    +
    + +
    +
    +
      +
    • [LOG4NET-408] - Correction on InterProcessLock +
    • +
    • [LOG4NET-443] - Logger.CallAppenders +
    • +
    • [LOG4NET-447] - MemoryAppender class is not thread safe +
    • +
    • [LOG4NET-455] - LogicalThreadContext does not flow correctly through async/await +
    • +
    • [LOG4NET-479] - Cannot compile log4net.vs2008 +
    • +
    • [LOG4NET-484] - System.ObjectDisposedException with FileAppender+InterProcessLock +
    • +
    • [LOG4NET-485] - RollingFileAppender cannot be used by multiple process +
    • +
    • [LOG4NET-486] - Rolling File Appender with 'maxSizeRollBackups' and 'datePattern' does not detect existing logs initially +
    • +
    +
    + +
    +
      +
    • [LOG4NET-456] - Include debug symbol files in release packages +
    • +
    • [LOG4NET-457] - SMTP Appender should trim leading and trailing separators from address fields +
    • +
    +
    + +
    +
      +
    • [LOG4NET-473] - Option for file extension in SmtpPickupDirAppender +
    • +
    +
    +
    + +
    + +
    +
      +
    • [LOG4NET-132] - Environment variables are mistakenly case sensitive on windows +
    • +
    • [LOG4NET-376] - Race condition in AbsoluteTimeDateFormatter +
    • +
    • [LOG4NET-393] - Using dynamic methods with log4net causes NullReferenceException in StackFrameItem +
    • +
    • [LOG4NET-399] - Does not build for Compact Framework 2.0 +
    • +
    • [LOG4NET-404] - assemblies for .NET 3.5 are missing ILogExtensions +
    • +
    • [LOG4NET-405] - SmtpAppender encoding changes +
    • +
    + +
    + +
    + +
      +
    • [LOG4NET-394] - Lambda-based ILog-Extensions should catch errors +
    • +
    + +
    +
    + +
    + +

    + The binary distributions no longer contain assemblies + built for the Compact Framework 2.0 - you can build + those yourself using the source distribution. +

    + +
    +
      +
    • [LOG4NET-148] - ThreadContext uses LocalDataStore to store ThreadSpecific data instead should be using [ThreadStatic] variables. +
    • +
    • [LOG4NET-178] - Log4Net stops logging after appdomain recycle of ASP.NET2.0 application +
    • +
    • [LOG4NET-202] - AdoNetAppenderParameter.Size Property is not optional +
    • +
    • [LOG4NET-218] - Test StringFormatTest.TestFormatString fails +
    • +
    • [LOG4NET-220] - multiple users overwrite existing log file when RollingFileAppender is rolling over date and minimal locking is used +
    • +
    • [LOG4NET-228] - log4net.Util.HostName may throw System.Configuration.ConfigurationErrorsException in System.Net.Dns.GetHostName(). The exception should be ignored. +
    • +
    • [LOG4NET-266] - AdoNetAppender does not work on a IIS 7 website using Windows authentication +
    • +
    • [LOG4NET-277] - Registering a custom Object Renderer in configuration file +
    • +
    • [LOG4NET-284] - In a multithreaded application, duplicate messages are output. +
    • +
    • [LOG4NET-294] - Exception rendering object type [System.OutOfMemoryException] +
    • +
    • [LOG4NET-317] - LogicalThreadContext sometimes doesn't follow CallContext's logical thread +
    • +
    • [LOG4NET-322] - Conditional compilation symbols for .net4 Release +
    • +
    • [LOG4NET-323] - AbsoluteTimeDateFormatter caches string representation of now too aggressively +
    • +
    • [LOG4NET-331] - AdoNetAppender errors when writing Asp.net item when Request object is null +
    • +
    • [LOG4NET-335] - 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 +
    • +
    • [LOG4NET-341] - RemotingAppender Error +
    • +
    • [LOG4NET-343] - ArgumentOutOfRangeException in log4net hierarchy on "." logger name +
    • +
    • [LOG4NET-347] - Log4net not working in an ASP.Net environment with medium trust +
    • +
    • [LOG4NET-348] - System.IndexOutOfRangeException when StackFrameLevel is greater then StackFrames length +
    • +
    • [LOG4NET-352] - CS0419 during build with Mono >2.6 +
    • +
    • [LOG4NET-360] - EventLogAppender can corrupt the event log on Windows Vista and higher if the string is longer than 31839 bytes +
    • +
    • [LOG4NET-361] - RollingLogFileAppender does not correctly initialize the backup index when style is date or composite +
    • +
    • [LOG4NET-369] - preserveLogFileNameExtension is not considered when rolling over time after an application restart +
    • +
    • [LOG4NET-370] - RemoteSyslogAppender doesn't properly handle newline in log message +
    • +
    • [LOG4NET-371] - Log with formatting doesn't call custom renderers (IObjectRenderer) +
    • +
    • [LOG4NET-375] - typo / misspelling in log message +
    • +
    • [LOG4NET-378] - Rolling log file is overwritten when application is restarted +
    • +
    • [LOG4NET-379] - NullReferenceException in FileAppender when file is not filled. +
    • +
    • [LOG4NET-382] - TargetInvocationException occurs because MESSAGE_SIZE fields in EventLogAppender are initialized in wrong order +
    • +
    +
    + +
    +
      +
    • [LOG4NET-222] - [PATCH] Improve AnsiColorTerminalAppender to support marking colors as Light +
    • +
    • [LOG4NET-223] - [PATCH] Improve AnsiColorTerminalAppender to support marking colors as Light +
    • +
    • [LOG4NET-232] - Use ReaderWriterLockSlim instead of ReaderWriterLock. +
    • +
    • [LOG4NET-259] - Log4Net does not create a new tab in Chainsaw +
    • +
    • [LOG4NET-283] - OnlyOnceErrorHandler is not subclass-friendly +
    • +
    • [LOG4NET-292] - Managed ColoredConsoleAppender for .NET2/Mono. +
    • +
    • [LOG4NET-315] - SmtpAppender - Add support for ignoring certificate errors +
    • +
    • [LOG4NET-316] - Provide a Layout Pattern that is re-evaluated on each use +
    • +
    • [LOG4NET-318] - log4net doesn't pass verification +
    • +
    • [LOG4NET-334] - Appender Faill over +
    • +
    • [LOG4NET-354] - E-mail encoding configuration setting for SmtpAppender +
    • +
    • [LOG4NET-362] - [PATCH] SystemInfo.AssemblyLocationInfo throws unhandled ArgumentException "Absolute path required" when exe is started via UNC path +
    • +
    • [LOG4NET-386] - Can't access ThreadContext properties +
    • +
    +
    + +
    +
      +
    • [LOG4NET-290] - Add Lambda-based ILog-Extensions (embedded log.IsEnabled) +
    • +
    • [LOG4NET-342] - Add a way to prevent silent failure +
    • +
    +
    +
    + +
    +

    + 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. +

    + +

    + 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 the FAQ for details. +

    + +

    + 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. +

    + +
    +

    + The signature of + ILoggerFactory.CreateLogger has changed. +

    +
    + +
    +
      +
    • [LOG4NET-76] - TextWriterAdapter is not thread safe +
    • +
    • [LOG4NET-79] - SecurityException thrown in LogicalThreadContextProperties GetProperties +
    • +
    • [LOG4NET-81] - LoggerRepositorySkeleton's OnConfigurationChanged method always raises its event with EventArgs.Empty instead of passing through its EventArgs parameter. +
    • +
    • [LOG4NET-93] - Typos for node name in tutorial, excess quote, invalid XML +
    • +
    • [LOG4NET-94] - Incorrect config file for ..\examples\net\1.0\Tutorials\ConsoleApp +
    • +
    • [LOG4NET-95] - Level.CompareTo() may result a wrong Value -> sorting of Levels does not work +
    • +
    • [LOG4NET-113] - SystemInfo.GetTypeFromString() raises NotSupportedException +
    • +
    • [LOG4NET-123] - EnvironmentPatternConverter does not expand User or System level environment variables under Windows +
    • +
    • [LOG4NET-126] - Links on the log4net Examples page do not work, including the overview link explaining why the other links do not work +
    • +
    • [LOG4NET-128] - Either documentation is incorrect or a bug in SmtpAppender +
    • +
    • [LOG4NET-129] - EventLogAppender EventID parsing does not handle Active Properties properly +
    • +
    • [LOG4NET-135] - Bad example code in documentation +
    • +
    • [LOG4NET-137] - log4net.Filter.LevelMatchFilter does not work anymore +
    • +
    • [LOG4NET-143] - Invalid Repository Config Uri composition from "log4net.Config" application setting +
    • +
    • [LOG4NET-146] - System.NullReferenceException on FindAndRender object +
    • +
    • [LOG4NET-158] - XMLConfigurator.ConfigureAndWatch() leaks resources if called multiple times +
    • +
    • [LOG4NET-167] - ArrayOutOfBounds Exception in MemoryAppender.getEvents() +
    • +
    • [LOG4NET-212] - Threading bug in the PatternConverter.cs +
    • +
    • [LOG4NET-214] - EventLogAppender should also use config file to set EventId +
    • +
    • [LOG4NET-215] - Exception on Convert for return %class{1} name +
    • +
    • [LOG4NET-229] - Japanese characters get garbled with log4net.Layout.XmlLayoutSchemaLog4j +
    • +
    • [LOG4NET-241] - Issue tracking page does not link to project +
    • +
    • [LOG4NET-242] - Download page does not have link to KEYS file +
    • +
    • [LOG4NET-243] - broken link on http://logging.apache.org/log4net/release/example-apps.html +
    • +
    • [LOG4NET-244] - SmtpAppender.To Property has incorrect delimiter +
    • +
    • [LOG4NET-257] - Visual Studio 2010 .NET 4.0 Application does not copy log4net lib to bin directory +
    • +
    • [LOG4NET-265] - RemoteFileAppender Tests fail on Windows 7 +
    • +
    • [LOG4NET-274] - log4net doesn't log when running a .Net 4.0 Windows application built in Release mode +
    • +
    • [LOG4NET-297] - AppenderSkeleton.RequiresLayout docs and implementation don't match +
    • +
    • [LOG4NET-300] - FilterTest doesn't compile for .Net 2.0 +
    • +
    • [LOG4NET-301] - Unit tests fail on a clean checkout on .NET 2.0 using NAnt +
    • +
    • [LOG4NET-310] - EventLogAppender's ActivateOptions throws SecurityException on Vista/Win2k3 and later when not run as administrator +
    • +
    • [LOG4NET-311] - MinimalLock and AppendToFile=false don't work together in trunk's FileAppender +
    • +
    +
    + +
    +
      +
    • [LOG4NET-31] - Allow user to pass in additional parameters to <converter> node via some kind of <property> tag +
    • +
    • [LOG4NET-38] - EventLogAppender: Add support for setting the Category on Event Log messages. +
    • +
    • [LOG4NET-66] - PreserveFileExtension with StaticFileName +
    • +
    • [LOG4NET-77] - A small improvement of log4net.Layout.Pattern.ExceptionPatternConverter - added 'Option' propery support +
    • +
    • [LOG4NET-88] - support .NET 2.0 connectionStrings configuration section +
    • +
    • [LOG4NET-96] - Expose the Message, Exception, and ErrorCode properties of OnlyOnceErrorHandler. +
    • +
    • [LOG4NET-97] - Make Hierarchy's ILoggerFactory aware of the repository's LevelMap +
    • +
    • [LOG4NET-98] - 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 +
    • +
    • [LOG4NET-100] - IPAddressConverter improvement for .NET 2 or .NET 3 +
    • +
    • [LOG4NET-106] - TraceAppender : Add switch to disable using logger name as trace category +
    • +
    • [LOG4NET-112] - Add support to the UdpAppender for IP v6 remote addresses +
    • +
    • [LOG4NET-131] - Add Cc and Bcc support to SmtpAppender +
    • +
    • [LOG4NET-141] - Add CreateConnection method to AdoNetAppender to allow subclasses to have control of IDbConnection. +
    • +
    • [LOG4NET-153] - Make it easier to configure multiple appenders in code using BasicConfigurator +
    • +
    • [LOG4NET-157] - FAQ for getting the fully-qualified name of a class +
    • +
    • [LOG4NET-164] - using a named mutex for file appenders +
    • +
    • [LOG4NET-170] - Documentation improvement re: fixing and active properties +
    • +
    • [LOG4NET-246] - Make it possible to choose whether or not to watch configuration files specified using the "log4net.Config" appsetting key +
    • +
    + +
    +
    +
      +
    • The various static Configure methods of the Configurator classes now return collections of configuration messages rather than void. +
    • +
    • [LOG4NET-59] - add the ability to roll files based on universal time (UTC). +
    • +
    • [LOG4NET-64] - add the ability to preserve the log file name extension when rolling the log file. +
    • +
    • [LOG4NET-87] - Support ASP.Net related PatternConverters to allow items from the HttpContext.Current.Session, Cache, Request, etc. to be captured. +
    • [LOG4NET-92] - Build for Compact Framework 2.0 +
    • +
    • [LOG4NET-107] - Added ExceptionEvaluator +
    • +
    • [LOG4NET-115] - Expand UserAppDataPath in filename +
    • +
    • [LOG4NET-116] - allow smtp to ssl authenticate and with certificates. +
    • +
    • [LOG4NET-154] - Add a StackTracePatternConverter to display method calls leading up to log message +
    • +
    • [LOG4NET-155] - Add TimeEvaluator +
    • +
    • [LOG4NET-168] - New property ReplyTo address for the SmtpAppender required +
    • +
    • [LOG4NET-176] - Buildable with VS 2008 and .NET FW 3.5 +
    • +
    • [LOG4NET-233] - Support .NET 4.0 including Client Profile +
    • + +
    +
    + +
    +
    @@ -92,15 +539,11 @@ limitations under the License.
    -
      -
    • Renamed namespaces

      Renamed namespace log4net.spi to log4net.Core. Renamed namespace log4net.helpers to log4net.Util.

      -
    • -
    • Renamed config classes and attributes

      In the log4net.Config namespace the DOMConfigurator, @@ -115,8 +558,6 @@ limitations under the License. and AliasRepositoryAttribute types replace DomainAttribute and AliasDomainAttribute.

      -
    • -
    • Fixed pascal casing of type names

      Renamed AdoNetAppender, AspNetTraceAppender, @@ -125,28 +566,20 @@ limitations under the License. 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.

      -
    • -
    • Layouts changed to stream their output to a TextWriter

      Layouts have been changed to format their output to a TextWriter rather than return a string. This increases performance and reduces temporary object creation.

      -
    • -
    • C style string escapes no longer supported by config parser

      The XML config parser no longer supports decoding C style escape sequences in strings. Previously sequences like \n and \\ where decoded. Instead use the appropriate XML encodings as required.

      -
    • -
    -
      -
    • New CLI build

      A new log4net assembly is built that targets all CLI 1.0 compatible runtimes. @@ -158,8 +591,6 @@ limitations under the License. This build is only available in release configuration and can be found at bin\cli\1.0\release.

      -
    • -
    • Logging contexts

      Logging contexts can be used to record contextual data that is relevant to the current @@ -176,8 +607,6 @@ limitations under the License. LogicalThreadContext, and LoggingEvent. Context values specified in a narrower scope hide the matching value in a wider scope.

      -
    • -
    • PatternLayout customization and long pattern names

      The PatternLayout now supports long pattern names. @@ -206,8 +635,6 @@ limitations under the License.

      For full details see the SDK Reference entry: log4net.Layout.PatternLayout.

      -
    • -
    • PatternString for pattern based configuration

      A new pattern based type, PatternString, can be used in @@ -242,16 +669,12 @@ public class SpecialFolderPatternConverter : log4net.Util.PatternConverter

      For full details see the SDK Reference entry: log4net.Util.PatternString.

      -
    • -
    • Loading configuration from a URI

      The XmlConfigurator methods now support loading the configuration data from a URI. Config can be loaded from any URI supported by the System.Net.WebRequest class.

      -
    • -
    • Support for No-Touch deployment

      Log4net supports configuring No-Touch deployment applications using the @@ -259,8 +682,6 @@ public class SpecialFolderPatternConverter : log4net.Util.PatternConverter or extension is specified then this is resolved relative to the deployment URI.

      -
    • -
    • Config file parser enhancements

      The config file parser has been enhanced to support specifying the property subtype, or intermediate type, @@ -272,8 +693,6 @@ public class SpecialFolderPatternConverter : log4net.Util.PatternConverter Implicit conversion will be attempted between the value string and the type specified, and then again between the type and the target property type.

      -
    • -
    • .NET string formatting syntax

      Added .NET String.Format style formatting syntax methods to @@ -282,16 +701,12 @@ public class SpecialFolderPatternConverter : log4net.Util.PatternConverter WarnFormat, ErrorFormat and FatalFormat.

      -
    • -
    • Customizable levels

      Levels are defined by the repository LevelMap. The defined levels, the relative ordering of levels and level display names can be configured on a per-repository basis.

      -
    • -
    • Per-appender security contexts

      Appenders that interact with controlled platform resources, e.g. files, can be @@ -301,8 +716,6 @@ public class SpecialFolderPatternConverter : log4net.Util.PatternConverter privileges of the appender. The WindowsSecurityContext is used to specify alternative credentials on the Windows platform.

      -
    • -
    • Added new appenders

      AnsiColorTerminalAppender
      @@ -340,15 +753,11 @@ public class SpecialFolderPatternConverter : log4net.Util.PatternConverter

      -
    • -
    • Added new LoggerMatchFilter filter

      Added LoggerMatchFilter which matches a string against the event's logger name.

      -
    • -
    • Pluggable file locking models for the FileAppender

      The FileAppender (and by extension the @@ -361,23 +770,17 @@ public class SpecialFolderPatternConverter : log4net.Util.PatternConverter

      For full details see the SDK Reference entry: log4net.Appender.FileAppender.LockingModel.

      -
    • -
    • RollingFileAppender roll once

      The RollingFileAppender now supports a new rolling style, Once. In this mode the appender will roll the file once per run.

      -
    • -
    • SmtpAppender authentication

      On the .NET 1.1 platform only, the SmtpAppender supports authenticating against the mail server using either username and password or integrated NTLM authentication.

      -
    • -
    • AdoNetAppender ReconnectOnError

      Added new configuration property to AdoNetAppender. @@ -385,32 +788,22 @@ public class SpecialFolderPatternConverter : log4net.Util.PatternConverter will force the appender to attempt to reconnect to the database if the connection is lost.

      -
    • -
    • UdpAppender hostname support

      The UdpAppender config property RemoteAddress can now be specified as a DNS hostname string. The hostname is resolved to an IP address.

      -
    • -
    -
      -
    • FxCop compliance

      Updates to bring the internal code in line with the current FxCop rules.

      -
    • -
    • Separate NUnit tests

      Moved the NUnit tests into a separate project, log4net.Tests.

      -
    • -
    • Bug Fixes

      RemotingAppender
      @@ -436,15 +829,11 @@ public class SpecialFolderPatternConverter : log4net.Util.PatternConverter

      -
    • -
    -
      -
    • Changed assembly name to log4net

      The build output is now log4net.dll @@ -458,40 +847,30 @@ public class SpecialFolderPatternConverter : log4net.Util.PatternConverter by the assembly title. This includes the name of the framework that the assembly was built on.

      -
    • -
    • Combined Release and ReleaseStrong builds

      The Release and ReleaseStrong builds have been consolidated into a single build called Release. This Release build is strongly named.

      -
    • -
    • New Appender: ColoredConsoleAppender

      The ColoredConsoleAppender writes events to the application's console. It can be configured to specify the text and background colors for different level events.

      -
    • -
    • New Appender: SmtpPickupDirAppender

      The SmtpPickupDirAppender 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.

      -
    • -
    • New Layout: XmlLayoutSchemaLog4j

      This new layout formats the logging events as XML which complies with - the log4j event dtd. This can be used to transfer log event from log4net + 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 UdpAppender.

      -
    • -
    • New PatternLayout conversion characters

      Added support for capturing the current thread principal name and the @@ -509,15 +888,11 @@ public class SpecialFolderPatternConverter : log4net.Util.PatternConverter (Principal.Identity.Name). -

    • -
    • Types specified in the config file are now loaded ignoring case

      All types specified in the configuration files are now loaded using a case insensitive method.

      -
    • -
    • Fine grained fixing for buffered events

      The LoggingEvent now supports fine grained @@ -526,43 +901,31 @@ public class SpecialFolderPatternConverter : log4net.Util.PatternConverter property takes a combination of the FixFlags enumeration values.

      -
    • -
    • Code updated inline with FxCop 1.21

      In line with the FxCop 1.21 guidelines: Sealed utility classes. Added serialization security demand to GetObjectData. Renamed parameters.

      -
    • -
    • EventLogAppender 32K Limit

      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.

      -
    • -
    -
      -
    • Updated to support the Microsoft .NET Framework 1.1 Final

      Updated to support the Microsoft .NET Framework 1.1 Final Beta (1.1.4322).

      -
    • -
    • Features document

      Added a new document that covers the main features of log4net. - See the features + See the features document for more information.

      -
    • -
    • Hierarchy disabled until it is configured

      The Hierarchy is now disabled until it has been configured. @@ -582,34 +945,24 @@ public class SpecialFolderPatternConverter : log4net.Util.PatternConverter displayed on the console by default. This message will only be displayed if internal debugging is enabled.

      -
    • -
    • New examples in VisualBasic.NET, JScript and Managed C++

      New examples in VisualBasic.NET, JScript and Managed C++. TODO Link to document about examples.

      -
    • -
    • Code and Documentation Updates

      Code fixes. Documentation and manual updates. See the ChangeLog for more information.

      -
    • -
    • Added document with example appender configurations

      - See the Example Appender Configuration + See the Example Appender Configuration document for more information.

      -
    • -
    -
      -
    • Added support for multiple frameworks

      log4net 1.2.0 beta 6 adds support for the the following frameworks: @@ -646,24 +999,18 @@ public class SpecialFolderPatternConverter : log4net.Util.PatternConverter

      Not all frameworks are created equal and some features have been excluded from - some of the builds. See the Framework Support document for more information. + some of the builds. See the Framework Support document for more information.

      -
    • -
    • New build system using NAnt

      The new build system allows log4net to be built for all supported frameworks and in all build configurations in one go.

      -
    • -
    • New source code & distribution layout

      The source code & distribution layout has been updated to support the new build environment and multiple target frameworks.

      -
    • -
    • Removed DomainAttribute.UseDefaultDomain property

      Updated default behavior of DefaultRepositorySelector. Assemblies @@ -673,8 +1020,6 @@ public class SpecialFolderPatternConverter : log4net.Util.PatternConverter property then you should remove it, and if the default behavior is now sufficient, you do not need to specify the DomainAttribute at all.

      -
    • -
    • Updated configuration file parser

      Updated config file parser to use the element name as the property to set. Also @@ -703,16 +1048,12 @@ public class SpecialFolderPatternConverter : log4net.Util.PatternConverter <threshold value="DEBUG"/> </evaluator> </appender> -

    • -
    • Support for event ID

      The EventLogAppender now supports setting the event ID in the event log, this is taken from the EventID property from the per event Properties map on the LoggingEvent.

      -
    • -
    • Updated ADONetAppender

        @@ -725,8 +1066,6 @@ public class SpecialFolderPatternConverter : log4net.Util.PatternConverter Added ExceptionLayout to render the exception data

      -

    • -
    • Support for front-end extension

      This allows the logging API to be wrapped or adapted for specific purposes. Two @@ -755,59 +1094,31 @@ public class SpecialFolderPatternConverter : log4net.Util.PatternConverter

    Type

    - -

  • Added ForwardingAppender

    Forwards events to multiple sub appenders after applying filter rules.

    -
  • -
  • Added BufferingForwardingAppender

    Forward events to sub appenders after buffering them.

    -
  • -
  • Added ASPNetTraceAppender

    Logs events to the ASP.NET trace system.

    -
  • -
  • Added NetSendAppender

    Delivers logging events using the Windows Messenger service.

    -
  • -
  • Added UdpAppender

    Sends logging events as connectionless UDP datagrams to a remote host or a multicast group.

    -
  • -
  • Removed obsolete methods

    -
  • -
  • Lots of updates to improve our compliance with FxCop

    -
  • -
  • Improved SDK documentation

    -
  • -
    -
      -
    • Fixed Exception thrown when DOM Configurator called with a null XML Element.

      This occurred if the configuration file did not have a log4net section defined.

      -
    • -
    • Made level lookup case insensitive

      -
    • -
    • Prevented the Hierarchy's Threshold level from being set to a null reference

      -
    • -
    -
      -
    • Added event specific properties to the logging event object

      Appenders can add additional information to the events they are logging. The RemotingAppender @@ -815,88 +1126,50 @@ public class SpecialFolderPatternConverter : log4net.Util.PatternConverter These properties can be accessed using the PatternLayout with the %P{name} syntax.

      -
    • -
    • Added a plugin framework

      An IPlugin interface can be attached to any repository.

      -
    • -
    • A new RemoteLoggingServerPlugin plugin acts as the server for the RemotingAppender

      -
    • -
    • Updated the core log4net framework to work in an environment with no permissions

      Specific appenders still require additional permissions to log correctly

      -
    • -
    • Added support for domain aliasing using the AliasDomainAttribute

      This allows a parent assembly to take control of the logging domain for child assemblies.

      -
    • -
    • Added events for repository creation, configuration change, configuration reset and repository shutdown

      -
    • -
    • Added LevelMap to the ILoggerRepository interface

      The mapping from level name to level object is now repository specific, therefore each repository can have independent mappings.

      -
    • -
    • Moved hierarchy specific config file parser to new DOMHierarchyConfigurator class

      This is controlled by the Hierarchy object and allows for better encapsulation.

      -
    • -
    • Added OnlyFixPartialEventData property to the buffered appenders

      This setting causes slow settings to be ignored. This significantly improves the performance of the buffered appenders.

      -
    • -
    • XML entity references are supported in the XML config file.

      -
    • -
    • Added support for expanding environment variables in <param> values

      The environment variables must be specified as ${FOO} where FOO is the name of the variable to expand.

      -
    • -
    • Upgraded to use NUnit 2.0

      -
    • -
    • File appenders can specify the encoding to use for the file

      -
    • -
    • Added strong named configuration

      -
    • -
    -
      -
    • Added log4net.Ext.Trace extension

      This is a separate assembly that adds a trace level to log4net.

      -
    • -
    • The default log file output directory is now the application base directory not the current directory

      -
    • -
    • Added MemoryAppender

      Stores all the logging events in an in-memory buffer.

      -
    • -
    • Moved the Hierarchy implementation into a separate namespace

      The log4net.Repository.Hierarchy namespace now contains all the code that is specific to the Hierarchy implementation.

      -
    • -
    • Refactored the DOMConfigurator and BasicConfigurator

      The Hierarchy specific data schema and implementation could be has @@ -904,8 +1177,6 @@ public class SpecialFolderPatternConverter : log4net.Util.PatternConverter bootstrap code for these configurators remains in the log4net.Config namespace.

      -
    • -
    • Replaced the DOMConfiguratorAttribute UseExecutableDomain property with UseDefaultDomain

      @@ -913,34 +1184,18 @@ public class SpecialFolderPatternConverter : log4net.Util.PatternConverter allow the configuration of multiple assemblies to be accomplished more easily, especially when developing web applications (ASP.NET).

      -
    • -
    • A few good bug fixes!

      -
    • -
    -
      -
    • Added ADONetAppender

      Thanks to TechnologyOneCorp.com.

      -
    • -
    • Added TraceLogAssembly extensibility example

      -
    • -
    • Lots of bug fixes

      -
    • -
    -
      -
    • Added 6 new examples

      -
    • -
    • Split Category class into Logger and LogManager classes

      The instance methods from Category have moved to the Logger @@ -949,8 +1204,6 @@ public class SpecialFolderPatternConverter : log4net.Util.PatternConverter compatibility only. Changed interface ICategoryFactory to ILoggerFactory and the implementation class DefaultCategoryFactory to DefaultLoggerFactory.

      -
    • -
    • Replaced Priority class with Level class

      The Priority class has been replaced by the Level class. @@ -958,31 +1211,23 @@ public class SpecialFolderPatternConverter : log4net.Util.PatternConverter The Level class implements a static pool of Level objects. The Level class is sealed and serializable.

      -
    • -
    • Added ILoggerRepository interface implemented by Hierarchy

      The Hierarchy class implements the ILoggerRepository interface. This interface is used by the LogManager class and therefore allows different implementations of ILoggerRepository to be used.

      -
    • -
    • Enhanced NUnit tests

      All the NUnit tests can be run using a single TestSuite: NUnitGUI log4net.LogManager+AllTests,log4net.dll.

      -
    • -
    • Added support for serializing LoggingEvents

      The LoggingEvent class is serializable. All local state is captured before serialization occurs. This now allows LoggingEvent objects to be serialized between applications or machines.

      -
    • -
    • Added RemotingAppender

      Delivers LoggingEvents to a remote interface. This can be used to @@ -990,8 +1235,6 @@ public class SpecialFolderPatternConverter : log4net.Util.PatternConverter remoting sink that receives the logging events, see examples\net\remoting\RemotingServer for details.

      -
    • -
    • Added support for rendering composite objects

      The IObjectRenderer interface method DoRender now @@ -999,8 +1242,6 @@ public class SpecialFolderPatternConverter : log4net.Util.PatternConverter appropriate renderer from the RendererMap to render any nested objects.

      -
    • -
    • Added support for rendering exceptions

      The DefaultRenderer now has support for rendering exceptions to a @@ -1008,8 +1249,6 @@ public class SpecialFolderPatternConverter : log4net.Util.PatternConverter used to render exceptions in the LoggingEvent. This allows the rendering of specific exceptions to be enhanced by specific renderers.

      -
    • -
    • Added ITriggeringEventEvaluator interface

      This interface is used by SMTPAppender and RemotingAppender @@ -1019,24 +1258,18 @@ public class SpecialFolderPatternConverter : log4net.Util.PatternConverter implemented by the LevelEvaluator class, which triggers above a set level.

      -
    • -
    • Added regex matching to the MDCFilter, NDCFilter and StringMatchFilter

      The MDCFilter, NDCFilter and StringMatchFilter can now be configured to use regex matches in addition to substring matches. Set the RegexToMatch property to use this feature.

      -
    • -
    • Added XMLLayout

      emits an XML element for each LoggingEvent. This allows logging events to be stored and manipulated as XML. The DTD for the XML emitted is in the log4net-events.dtd

      -
    • -
    • Added support for <logger> and <level> elements in the DOMConfigurator

      @@ -1046,15 +1279,11 @@ public class SpecialFolderPatternConverter : log4net.Util.PatternConverter elements to be used in place of the <category> and <priority> elements. The old elements are still accepted for backward compatibility.

      -
    • -
    • Added Threshold property to Hierarchy

      Changed DisableXXX() methods on Hierarchy to a Threshold property.

      -
    • -
    • Added support for logging domains

      The LogManager supports multiple logging domains. The LogManager @@ -1069,15 +1298,11 @@ public class SpecialFolderPatternConverter : log4net.Util.PatternConverter without conflicting with other modules in the process. The domain for the assembly is configured using metadata attributes defined on the assembly.

      -
    • -
    • DOMConfigurator can set params to arbitrary objects

      Using a new <object> element, params can now be set to any creatable object.

      -
    • -
    diff --git a/src/site/xdoc/stylesheets/project.xml b/src/site/xdoc/stylesheets/project.xml deleted file mode 100755 index 557a2e01..00000000 --- a/src/site/xdoc/stylesheets/project.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - log4net - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/site/xdoc/stylesheets/site.vsl b/src/site/xdoc/stylesheets/site.vsl deleted file mode 100755 index 25910232..00000000 --- a/src/site/xdoc/stylesheets/site.vsl +++ /dev/null @@ -1,406 +0,0 @@ - - - - - - ## Defined variables - #set ($bodybg = "#ffffff") - #set ($bodyfg = "#000000") - #set ($bodylink = "#525D76") - - #set ($titlebg = "#FFFFFF") - #set ($titlefg = "#2222AA") - -## #set ($bannerbg = "#525D76") - #set ($bannerbg = "#FFFFFF") - #set ($bannerfg = "#2222AA") - - #set ($subbannerbg = "#828DA6") - #set ($subbannerfg = "#ffffff") - #set ($tablethbg = "#039acc") - #set ($tabletdbg = "#a0ddf0") - - -#document() - - -## This is where the macro's live - -#macro ( projectanchor $name $value ) -#if ($value.startsWith("http://")) - $name -## #elseif ($value.startsWith("/site")) -## $name -#else - $name -#end -#end - -#macro ( metaauthor $author $email ) - - -#end - -#macro ( image $value ) -#if ($value.getAttributeValue("width")) -#set ($width=$value.getAttributeValue("width")) -#end -#if ($value.getAttributeValue("height")) -#set ($height=$value.getAttributeValue("height")) -#end -#if ($value.getAttributeValue("align")) -#set ($align=$value.getAttributeValue("align")) -#end - -#end - -#macro ( old_source $value ) -
    - - - - - - - - - - - - - - - - -
    $escape.getText($value.getText())
    -
    -#end - -#macro ( source $value ) - -
    $escape.getText($value.getText())
    - -#end - -## =================================== -## titleSection macro -## =================================== -#macro ( titleSection $titleSection) - $titleSection.getAttributeValue("name") -#end - -## ================================ -## section macro -## ================================ -#macro ( section $section $level ) - #if($section.getAttributeValue("id")) - $section.getAttributeValue("name") - #else - $section.getAttributeValue("name") - #end -
    - #foreach ( $item in $section.getChildren() ) - #if ($items.getName().equals("img")) - #image ($item) - #elseif ($item.getName().equals("source")) - #source ($item) - #elseif ($item.getName().equals("table")) - #table ($item) - #elseif ($item.getName().equals("section")) - #set ($nextLevel = $level + 1) - #section ($item $nextLevel ) - #set ($nextLevel = $nextLevel - 1) - #elseif ($item.getName().equals("sectionMenu")) - #set ($nextLevel = $level + 1) - #sectionMenu1 ($item $item.getParent() $nextLevel) - #set ($nextLevel = $nextLevel - 1) - #else - $item - #end - #end -
    -#end - -## ================================ -## sectionMenu1 macro -## ================================ -#macro ( sectionMenu1 $sectionMenu $section $level ) - #if($sectionMenu.getAttributeValue("name")) - $sectionMenu.getAttributeValue("name") -
    - #foreach ( $items in $section.getChildren() ) - #if ($items.getName().equals("section")) - #sectionMenu2 ($items ) - #end - #end -
    - #else - #foreach ( $items in $section.getChildren() ) - #if ($items.getName().equals("section")) - #sectionMenu2 ($items ) - #end - #end - #end -#end - -## ================================ -## sectionMenu2 macro -## ================================ -#macro ( sectionMenu2 $section ) - #if ($section.getAttributeValue("id")) - $section.getAttributeValue("name")
    - #else - $section.getAttributeValue("name")
    - #end -
    - #foreach ( $items in $section.getChildren() ) - #if ($items.getName().equals("section")) - #sectionMenu2 ($items ) - #end - #end -
    -#end - -## =================================== -## make navigation bar -## =================================== - -#macro ( makeNavigationBar ) - -
    - #set ($menus = $project.getChild("body").getChildren("menu")) - #foreach ( $menu in $menus ) - - #foreach ($item in $menu.getChildren() ) - #set ($name = $item.getAttributeValue("name")) - - #end - #end -
    - -#end - -## ==================================== -## getProjectImage -## ==================================== -#macro (getProjectImage) - ## -#end - -#macro (printMeta $metaElement) - -#end - -#macro (messages $root) - #foreach ( $m in $root.getChild("body").getChildren() ) - #if ($m.getName().equals("message")) - -
    - $m.getChild("explanation").getContent() -
    - #end - #end -#end - -#macro (document) - #set ($properties = $root.getChild("properties") ) - - - - - - - - - #set ($authors = $root.getChild("properties").getChildren("author")) - #foreach ( $au in $authors ) - #metaauthor ( $au.getText() $au.getAttributeValue("email") ) - #end - - #set ($metas = $root.getChildren("meta")) - - ## Parse meta directives such as - ## - #foreach ($meta in $metas) #printMeta($meta) #end - - ## Support for tags. - #if ($root.getChild("properties").getChild("base")) - #set ($url = $root.getChild("properties").getChild("base").getAttributeValue("href")) - - #end - - - - #foreach ( $cssItem in $project.getChildren("css") ) - - #end - - $root.getChild("properties").getChild("title").getText() - - #if ($root.getChild("head")) - $root.getChild("head").getContent() - #end - - - - ## Google analytics code - - - - -## -## -## - #getProjectImage() -## -##
    - - - -
    - ##
    - - -## -## - -## -## -## -## -## - - - #messages ($root) - - -

     

    - -## -## - ##
    -##
    -##
    - - #foreach ( $item in $root.getChild("body").getChildren() ) - #if ($item.getName().equals("img")) - #image ($item) - #elseif ($item.getName().equals("section")) - #section ($item 1) - #elseif ($item.getName().equals("source")) - #source ($item) - #elseif ($item.getName().equals("table")) - #table ($item) - #elseif ($item.getName().equals("sectionMenu")) - #sectionMenu1 ($item $item.getParent() 1) - #else - $item - #end - #end - -## #if ($root.getChild("body").getChild("titleSection")) -## #set ($titleSection = $root.getChild("body").getChild("titleSection")) -## #titleSection($titleSection) -## #end -##
    -##
    -##
    -
    - Copyright © - #if($root.getChild("properties").getChild("copyright").getAttributeValue("year")) - ${root.getChild("properties").getChild("copyright").getAttributeValue("year")}, - #elseif($project.getChild("copyright").getAttributeValue("year")) - ${project.getChild("copyright").getAttributeValue("year")}, - #else - 1999-2007, - #end - #if($root.getChild("properties").getChild("copyright").getAttributeValue("holder")) - ${root.getChild("properties").getChild("copyright").getAttributeValue("holder")} - #elseif($project.getChild("copyright").getAttributeValue("holder")) - ${project.getChild("copyright").getAttributeValue("holder")} - #else - Apache Software Foundation - #end -
    - ##
    - - -
    - - - #makeNavigationBar() - - ## Call the google analyticis code to register this page - - - -#end - - - - - diff --git a/tests/lib/prerequisites.txt b/tests/lib/prerequisites.txt index a2e49c6c..ffec3284 100644 --- a/tests/lib/prerequisites.txt +++ b/tests/lib/prerequisites.txt @@ -1,37 +1,7 @@ -Prerequisites for log4net tests -=============================== - - -The nunit.framework.dll assembly version 2.2.7 is required to build -the log4net tests. - -NAnt 0.85 includes the 2.2.7 version of the nunit.framework.dll. - -The nunit.framework.dll is available as different builds for each -version of the .net runtime. To build multiple versions of the -log4net tests you will need several different copies of the -nunit.framework.dll. - -The log4net tests are currently built for the following runtimes: - -Microsoft .NET Framework 1.0 -Microsoft .NET Framework 1.1 -Microsoft .NET Framework 2.0 -Mono Framework 2.0 - -Under the tests/lib directory you must create the following directory -structure containing the nunit.framework.dll assembly built for the -appropriate version of the runtime: - -lib\ - net\ - 1.0\ - nunit.framework.dll - 1.1\ - nunit.framework.dll - 2.0\ - nunit.framework.dll - mono\ - 2.0\ - nunit.framework.dll - +Prerequisites for log4net tests +=============================== + +The nunit.framework.dll assembly version 2.6.4 is required to build +the log4net tests. The build process will download NUnit and place the +framework dll inside the lib directory corresponding to the current +framework. diff --git a/tests/nant.build b/tests/nant.build old mode 100755 new mode 100644 index 5aceb1f4..913c8599 --- a/tests/nant.build +++ b/tests/nant.build @@ -25,8 +25,19 @@ limitations under the License. + + + + + + + + - + @@ -77,6 +88,57 @@ limitations under the License. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -232,6 +294,7 @@ limitations under the License. + @@ -287,6 +350,121 @@ limitations under the License. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -301,10 +479,291 @@ limitations under the License. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/src/log4net.Tests.vs2008.csproj b/tests/src/log4net.Tests.vs2008.csproj index 55f2070e..aa8f63bc 100644 --- a/tests/src/log4net.Tests.vs2008.csproj +++ b/tests/src/log4net.Tests.vs2008.csproj @@ -1,185 +1,221 @@ - - - Local - 9.0.30729 - 2.0 - {B0530F10-0238-49A9-93B0-8EF412E90BCF} - Debug - AnyCPU - - - - - log4net.Tests - - - JScript - Grid - IE50 - false - Library - log4net.Tests - - - - - - - 2.0 - v3.5 - - - ..\bin\Debug\ - false - 285212672 - false - - - TRACE;DEBUG;NET_2_0 - - - true - 4096 - false - false - false - false - 4 - full - prompt - - - ..\bin\Release\ - false - 285212672 - false - - - TRACE - - - false - 4096 - true - false - false - false - 4 - none - prompt - - - - False - ..\..\..\ibatisnet-3\External-Bin\Net\2.0\nunit.framework.dll - - - System - - - - 3.5 - - - System.Data - - - System.Runtime.Remoting - - - System.XML - - - - - AssemblyVersionInfo.cs - Code - - - - - - - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - - Code - - - Code - - - Code - - - - Code - - - Code - - - - - - - Code - - - Code - - - Code - - - - - {181FE707-E161-4722-9F38-6AAAB6FAA106} - log4net.vs2008 - - - - - - - - - - \ No newline at end of file + + + + + + Local + 9.0.30729 + 2.0 + {B0530F10-0238-49A9-93B0-8EF412E90BCF} + Debug + AnyCPU + + + + + log4net.Tests + + + JScript + Grid + IE50 + false + Library + log4net.Tests + + + + + + + 2.0 + v3.5 + + + ..\bin\Debug\ + false + 285212672 + false + + + TRACE;DEBUG;NET_2_0 + + + true + 4096 + false + false + false + false + 4 + full + prompt + + + ..\bin\Release\ + false + 285212672 + false + + + TRACE + + + false + 4096 + true + false + false + false + 4 + none + prompt + + + + False + ..\..\..\ibatisnet-3\External-Bin\Net\2.0\nunit.framework.dll + + + System + + + + 3.5 + + + System.Data + + + System.Runtime.Remoting + + + System.XML + + + + + AssemblyVersionInfo.cs + Code + + + + + + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + Code + + + Code + + + Code + + + + + Code + + + Code + + + + + + + Code + + + Code + + + Code + + + Code + + + + + {181FE707-E161-4722-9F38-6AAAB6FAA106} + log4net.vs2008 + + + + + + + + + + diff --git a/tests/src/log4net.Tests.vs2010.csproj b/tests/src/log4net.Tests.vs2010.csproj new file mode 100644 index 00000000..d2e5fcc1 --- /dev/null +++ b/tests/src/log4net.Tests.vs2010.csproj @@ -0,0 +1,254 @@ + + + + + Local + 9.0.30729 + 2.0 + {B0530F10-0238-49A9-93B0-8EF412E90BCF} + Debug + AnyCPU + + + + + log4net.Tests + + + JScript + Grid + IE50 + false + Library + log4net.Tests + + + + + + + 3.5 + v4.0 + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + + ..\bin\Debug\ + false + 285212672 + false + + + TRACE;DEBUG;NET;NET_2_0;NET_4_0 + + + true + 4096 + false + false + false + false + 4 + full + prompt + AllRules.ruleset + + + ..\bin\Release\ + false + 285212672 + false + + + TRACE;NET;NET_2_0;NET_4_0 + + + false + 4096 + true + false + false + false + 4 + none + prompt + AllRules.ruleset + + + + False + ..\..\..\ibatisnet-3\External-Bin\Net\2.0\nunit.framework.dll + + + System + + + + 3.5 + + + System.Data + + + System.Runtime.Remoting + + + System.XML + + + + + AssemblyVersionInfo.cs + Code + + + + + + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + + Code + + + Code + + + + + Code + + + Code + + + + + + + Code + + + Code + + + Code + + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + + + + {181fe707-e161-4722-9f38-6aaab6faa106} + log4net.vs2010 + + + + + + + + + + \ No newline at end of file diff --git a/tests/src/log4net.Tests.vs2012.csproj b/tests/src/log4net.Tests.vs2012.csproj new file mode 100644 index 00000000..633afd22 --- /dev/null +++ b/tests/src/log4net.Tests.vs2012.csproj @@ -0,0 +1,260 @@ + + + + + Local + 9.0.30729 + 2.0 + {B0530F10-0238-49A9-93B0-8EF412E90BCF} + Debug + AnyCPU + + + + + log4net.Tests + + + JScript + Grid + IE50 + false + Library + log4net.Tests + + + + + + + 3.5 + v4.5 + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + + ..\bin\Debug\ + false + 285212672 + false + + + TRACE;DEBUG;NET;NET_2_0;NET_4_0;NET_4_5 + + + true + 4096 + false + false + false + false + 4 + full + prompt + AllRules.ruleset + + + ..\bin\Release\ + false + 285212672 + false + + + TRACE;NET;NET_2_0;NET_4_0;NET_4_5 + + + false + 4096 + true + false + false + false + 4 + none + prompt + AllRules.ruleset + + + + ..\..\src\packages\NUnit.2.6.4\lib\nunit.framework.dll + True + + + System + + + + 3.5 + + + System.Data + + + System.Runtime.Remoting + + + System.XML + + + + + AssemblyVersionInfo.cs + Code + + + + + + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + + Code + + + Code + + + + + Code + + + Code + + + + + + + Code + + + Code + + + Code + + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + + + + + + + {181fe707-e161-4722-9f38-6aaab6faa106} + log4net.vs2012 + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/src/packages.config b/tests/src/packages.config new file mode 100644 index 00000000..e594870a --- /dev/null +++ b/tests/src/packages.config @@ -0,0 +1,20 @@ + + + + + diff --git a/xdocs/build.xml b/xdocs/build.xml deleted file mode 100755 index 1b8acea3..00000000 --- a/xdocs/build.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - AnakiaTask is not present! Please check to make sure that velocity.jar is in your classpath. - - - - - - - - - - - - - diff --git a/xdocs/lib/ant-1.4.1.jar b/xdocs/lib/ant-1.4.1.jar deleted file mode 100644 index 8ad84e34..00000000 Binary files a/xdocs/lib/ant-1.4.1.jar and /dev/null differ diff --git a/xdocs/lib/commons-collections-2.0.jar b/xdocs/lib/commons-collections-2.0.jar deleted file mode 100644 index 4f4f97ba..00000000 Binary files a/xdocs/lib/commons-collections-2.0.jar and /dev/null differ diff --git a/xdocs/lib/jdom-b8.jar b/xdocs/lib/jdom-b8.jar deleted file mode 100644 index 7ccb9fda..00000000 Binary files a/xdocs/lib/jdom-b8.jar and /dev/null differ diff --git a/xdocs/lib/log4j-1.1.3.jar b/xdocs/lib/log4j-1.1.3.jar deleted file mode 100644 index dc2d758a..00000000 Binary files a/xdocs/lib/log4j-1.1.3.jar and /dev/null differ diff --git a/xdocs/lib/velocity-1.4-dev.jar b/xdocs/lib/velocity-1.4-dev.jar deleted file mode 100644 index e53aa86e..00000000 Binary files a/xdocs/lib/velocity-1.4-dev.jar and /dev/null differ diff --git a/xdocs/lib/xerces-1.4.4.jar b/xdocs/lib/xerces-1.4.4.jar deleted file mode 100644 index 99ee39d5..00000000 Binary files a/xdocs/lib/xerces-1.4.4.jar and /dev/null differ diff --git a/xdocs/src/contributing.xml b/xdocs/src/contributing.xml deleted file mode 100755 index ef6c91ff..00000000 --- a/xdocs/src/contributing.xml +++ /dev/null @@ -1,346 +0,0 @@ - - - - - - Nicko Cadell - Apache log4net: Contributing to log4net Development - - - - - -
    - - - - - -
    -

    - All discussion relating to log4net development takes place on this list. All SVN checkin - notifications are also copied to this list. -

    - -
    -

    - You can browse the mailing list archives at the following locations: -

    - - -
    - -
    -

    - Subscribe to either the list or to the digest list: -

    - - -
    - -
    -

    - To unsubscribe send an email to the relevant email address: -

    - - -
    - -
    -

    - Most of the guidelines for the log4net-user list also apply to the dev list. - Please have a quick read through the guidelines, thanks. -

    - -

    - To prevent spam, we require you to be subscribed to the list before posting to it. -

    - -

    - This is the log4net developer list, it holds discussions relating to the - development of log4net not the use of log4net. If you have a question that begins - with the word "How" or you are unsure as the the appropriate list to post to then - you probably want to start with the log4net-user list. -

    - -

    - Post to the list by sending mail to - log4net-dev@logging.apache.org. -

    -
    -
    - -
    -

    - The source for log4net is held in the Apache Subversion source code control repository. -

    - -
    -

    - Browse log4net - SVN repository using ViewCVS. -

    -
    - -
    -

    - Anyone can checkout source code from our anonymous SVN - server. To do so, simply use the following command (if you are - using a GUI SVN client, configure it appropriately). -

    - -

    - Checkout the logging/log4net module. -

    - - -svn checkout http://svn.apache.org/repos/asf/logging/log4net/trunk log4net - -

    - If you are not familiar with SVN, the Apache - Source Code Repositories - page has links to more information on SVN. -

    -
    - -
    - -
    -

    - Many bugs reported end up not being a bug in the log4net code, - but are due to incorrect configuration, problems caused by installed applications, - the operating system, etc. -

    -

    - Before reporting a bug please make every effort to investigate and resolve the problem yourself. - Just reporting a bug will not fix it. A good bug report includes a detailed - description of the problem and a succinct test case which can reproduce the problem. -

    -

    - Before reporting an issue please investigate the following information sources for - a potential resolution. -

    - -

    - Before reporting a bug, you are advised to discuss it on the relevant mailing list first. -

    -

    - Search the bug database to see if the bug - you are seeing has already been reported. If it has been reported then you can vote for the issue. -

    - -
    -

    - If after you have exhausted all other resources to resolve a problem you may want to file a bug report. - Please make sure the problem is a bug in Logging and not a bug in your application. -

    -

    - Please make sure you provide as much information as possible. Its very hard to fix a bug if the person - looking into the problem can't reproduce it. Here is a listing of information which should be included: -

    -
      -
    • Version - log4net version, or if from a nightly build, version and date of build.
    • -
    • Application Type - Assembly type, i.e. exe or dll, and how your code is launched, e.g. console application, windows application, ASP.NET project, COM+ hosted object, etc...
    • -
    • Framework - The .NET framework running the application, name (e.g. MS .NET, Mono, SSCLI) and version.
    • -
    • Platform - Computer operating system, version, and hardware platform in use.
    • -
    • Configuration - Attach configuration files if they would help track down the bug.
    • -
    • Log Files - Review your logs files, produced with internal log4net debug enabled. Submit any relevant sections of the log which help document the bug.
    • -
    • Stack Traces - Any stack traces generated by the bug, if any.
    • -
    • Example - Example configuration files or web applications which demonstrate the bug. When submitting an example which reproduces the bug, please try to make it as simple as possible.
    • -
    • Bug Fix Patch - A patch created using diff -u which fixes the bug. (If you have found a bug fix which can be applied to the code).
    • -
    • Description of the Bug - A description of the bug, include observed as well as expected behavior.
    • -
    • Miscellaneous - Any other information you feel will help track down the problem.
    • -
    -

    - Just reporting a bug will not fix it. A good bug report includes a detailed description of the - problem and a succinct test case which can reproduce the problem. The very best sort of report - includes an NUnit testcase which reproduces the issue, this means that we can fix it and that we can - be sure that it stays fixed in future! -

    -

    - Report a log4net issue here. You will need to login to JIRA before you can submit an issue. -

    -
    -
    - -
    -

    - Before starting to work on a patch it is probably a good idea to join the log4net-dev - mailing list to check that equivalent or complementary work is not already underway. -

    -

    - Currently the only supported way of submitting patches to log4net - is via the JIRA issue tracking system. -

    -

    - The preferred method of generating a patch is a unified context diff against - the latest development version in SVN. To do this you should do the following: -

    -
      -
    • -

      - Get the latest version of the code from SVN, see the section above on - Anonymous SVN Access for details on how to obtain the SVN version. -

      -
    • -
    • -

      - Make your code changes to the log4net source. Please follow existing - code styles where possible. If adding new API methods or classes then - these should be appropriately documented with code comments. - Contributions intended for inclusion in ASF products must be licensed - to ASF under the terms of the - Apache Software License. -

      -
    • -
    • -

      - Generate a unified context diff for the files you have changed. Run the - svn diff > patch-file command from the root of the log4net - codebase to generate a diff file. -

      -
    • -
    • -

      - If you have added new files these will not be included in the diff. You - will need to attach these files separately. -

      -
    • -
    -

    - If you are not using SVN then you can still generate a unified context diff - using the diff GNU tool with the -u command line options. - The GNU tools are available for Windows as part - of the Cygwin package. -

    -

    - If you are unable to generate a diff please submit each file separately and place - block comments around each code change to highlight the differences. -

    - -

    - In order to submit your patch please follow the following steps: -

    -
      -
    • -

      - Create a new issue for your patch. On the - log4net issues home page - select the Create New Issue from the menu bar. You will need to be logged - into JIRA in order to create an issue. -

      -
    • -
    • -

      - Select the issue type as appropriate. -

      -
    • -
    • -

      - Prefix the summary with [PATCH]. Enter a description of the changes made, - new features, or bug fixes in your patch. -

      -
    • -
    • -

      - Once the issue has been created you can attach your patch file to the issue - by selecting the Attach file to this issue operation from the left hand - menu. When attaching your patch you must select the Grant license to ASF for - inclusion in ASF works option. When attaching a patch please include in the - description the baseline version of log4net you used to build your patch, if against - an SVN version please include the version number and if from a tag or branch include - the repository path. -

      -
    • -
    • -

      - If you have other files to attach, e.g. you have added new files to log4net, then - attach each file separately. Please include in the description the name of the file - attached and the path it should live in the project. -

      -
    • -
    -

    - A notification will be sent to the log4net-dev list once you have created your issue, - however it may also be worth mailing the log4net-dev list to encourage the project - committers to apply your patch, or at least find out when they may do so. -

    -
    - - -
    - - -
    diff --git a/xdocs/src/downloads.xml b/xdocs/src/downloads.xml deleted file mode 100755 index a482b177..00000000 --- a/xdocs/src/downloads.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - Nicko Cadell - Apache log4net: Downloads - - - - - -
    - -
    -

    - log4net has graduated from the Incubator project, however at the time - the following releases were made, log4net was still undergoing incubation, - therefore these releases are not officially endorsed by the ASF. -

    -

    - Future releases of log4net will be officially endorsed by the ASF. -

    -
    - -
    -

    - The following stable releases are available: -

    - - -
    - - - -
    - - -

    - Previous releases of log4net are available from the sourceforge site: -

    - - -
    - -
    - - - -
    diff --git a/xdocs/src/history.xml b/xdocs/src/history.xml deleted file mode 100755 index 7a9264ce..00000000 --- a/xdocs/src/history.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - Nicko Cadell - Apache log4net: Project History - - - - - -
    - -

    - The log4net project was started by Neoworks Limited - in June 2001. It was created as an internal project within Neoworks to port the Apache - log4j code base to the Microsoft .NET Framework. The code base was initially branched - from a pre-alpha log4j 1.2. -

    - -

    - In July 2001 a Sourceforge project was started - and log4net was published under the Apache Software License. The first public release of - log4net was made in September 2001. A further 10 releases were made on the sourceforge - site. -

    - -

    - In December 2003 the Apache Logging Services project was created. - In February 2004 log4net was donated by Neoworks to the Apache Software Foundation - to become a member of the Logging Services project. -

    - -

    - In February 2007 log4net graduated from the Apache Incubator project to become a - fully fledged Apache project. Apache log4net is a subproject of the Logging Services project. -

    - -
    - - -
    diff --git a/xdocs/src/index.xml b/xdocs/src/index.xml deleted file mode 100755 index 7459d258..00000000 --- a/xdocs/src/index.xml +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - Nicko Cadell - Apache log4net: Home - - - - - -
    - -
    -

    - log4net is a tool to help the programmer output log statements to a variety - of output targets. log4net is a port of the excellent log4j framework to the - .NET runtime. We have kept the framework similar in spirit to the original log4j - while taking advantage of new features in the .NET runtime. - For more information on log4net see the features document. -

    - -

    - log4net is part of the Apache Logging Services - project. The Logging Services project is intended to provide cross-language logging - services for purposes of application debugging and auditing. -

    -
    - -
    - -
    - -
      -
    • -

      - Curt Arnold -

      -
    • -
    • -

      - Nicko Cadell -

      -
    • -
    • -

      - Niall Daley -

      -
    • -
    • -

      - Gert Driesen -

      -
    • -
    • -

      - Ron Grabowski -

      -
    • -
    - -
    - -
    - -
      -
    • -

      - Julian Biddle -

      -
    • -
    • -

      - Daniel Cazzulino -

      -
    • -
    • -

      - Aspi Havewala -

      -
    • -
    • -

      - Rick Hobbs -

      -
    • -
    • -

      - Lance Nehring -

      -
    • -
    • -

      - Angelika Schnagl -

      -
    • -
    • -

      - Edward Smit -

      -
    • -
    • -

      - Douglas de la Torre -

      -
    • -
    • -

      - Thomas Voss -

      -
    • -
    -
    - -
    - -
    - - -
    diff --git a/xdocs/src/license.xml b/xdocs/src/license.xml deleted file mode 100755 index 8fa813f4..00000000 --- a/xdocs/src/license.xml +++ /dev/null @@ -1,266 +0,0 @@ - - - - - - Nicko Cadell - Apache log4net: License - - - - - -
    - -
    -

    - The Apache Software License Version 2.0 applies to all releases of - log4net starting with log4net 1.2.1. -

    - - - - -

    - The License is accompanied by this NOTICE: -

    - - - -
    - -
    - - -
    diff --git a/xdocs/src/release/building.xml b/xdocs/src/release/building.xml deleted file mode 100755 index af918960..00000000 --- a/xdocs/src/release/building.xml +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - Nicko Cadell - Apache log4net: Building log4net - - - - - -
    - - -

    - The log4net release builds are built using NAnt. Log4net can also be built - using Visual Studio .NET 2002, 2003, or 2005. -

    -

    - To build a release build of log4net you will need to create a strong - name key file. See the Strong Name section below. -

    - -
    -

    - Visual Studio .NET 2002, 2003 and 2005 are supported build platforms for log4net. -

    - -
    -

    - The log4net distribution includes a solution and project file - for Visual Studio .NET 2002. Open the log4net.sln - from the src directory in the distribution. -

    -

    - The log4net project requires only the following references: -

    -
      -
    • System
    • -
    • System.Data
    • -
    • System.Web
    • -
    • System.XML
    • -
    -
    - -
    -

    - Open the Visual Studio .NET 2002 solution file as above. - Visual Studio will convert the solution and project files - to Visual Studio .NET 2003 format. -

    -

    - After converting the log4net project you must change the - Conditional Compilation Constants specified for the - log4net project. Open the project properties dialog and - select the Configuration Properties/Build sheet. - Replace the NET_1_0 constant with NET_1_1. - Remember to do this for both Debug and Release configurations. -

    -

    - The log4net project file is not suitable for building log4net - for the .NET Compact Framework. To build for the Compact Framework - you must create a new C# project for Smart Devices. Configure the - project as a library project. Add all the C# files from the - src directory in the distribution. -

    -
    - -
    -

    - Open the Visual Studio .NET 2002 solution file as above. - Visual Studio will convert the solution and project files - to Visual Studio .NET 2003 format. -

    -

    - After converting the log4net project you must change the - Conditional compilation symbols specified for the - log4net project. Open the project properties page and - select the Build sheet. - Replace the NET_1_0 symbol with NET_2_0. - Remember to do this for both Debug and Release configurations. -

    -

    - In addition the log4net project requires the following new references: -

    -
      -
    • System.Configuration
    • -
    -

    - The log4net project file is not suitable for building log4net - for the .NET Compact Framework. To build for the Compact Framework - you must create a new C# project for Smart Devices. Configure the - project as a library project. Add all the C# files from the - src directory in the distribution. -

    -
    -
    - -
    -

    - The log4net distribution is built using the NAnt tool. - A recent NAnt version 0.85 nightly build is required to build log4net, this is - available from nant.sourceforge.net. -

    -

    - To support building log4net for the SSCLI framework the NAnt configuration - files need to be updated to specify the SSCLI framework directory. -

    -

    - To build log4net from the command line, change directory to the root of the - log4net distribution, ensure that the nant executable is in the - PATH, and then run the following command: -

    -
    -nant -buildfile:log4net.build compile-all
    -

    - This command will build log4net for all the supported frameworks - that are available on the current machine. To list all the build - targets that are available run the following command: -

    -
    -nant -buildfile:log4net.build -projecthelp
    -

    - Under windows the build.cmd can be used - to script the nant build. This can be called from a different - directory and will locate the correct log4net.build file to use. - For example: -

    -
    -build.cmd compile-all
    -
    - -
    -

    - In order to build the Release builds of log4net a Strong - Name key is required. -

    -

    - Use the sn.exe tool in the - .NET Framework SDK to generate a strong name key pair. -

    -
    -sn -k log4net.snk
    -

    - The log4net.snk file should be placed in the root of the - log4net distribution, in the same folder as the log4net.build - file. -

    -
    - -
    -

    - NDoc 1.3 is used to build the log4net SDK documentation. - NDoc is available from ndoc.sourceforge.net. -

    -
    - -
    -

    - The log4net HTML documentation is built using Velocity. - The source are XML files in the xdocs/src directory. - Building the documentation requires Java, Ant, and Velocity. - Run ant from within the xdocs directory. -

    -
    - -
    - -
    diff --git a/xdocs/src/release/config-examples.xml b/xdocs/src/release/config-examples.xml deleted file mode 100755 index 88b3d16d..00000000 --- a/xdocs/src/release/config-examples.xml +++ /dev/null @@ -1,1038 +0,0 @@ - - - - - - Nicko Cadell - Apache log4net: Config Examples - - - - - -
    - - - -
    -

    - This document presents example configurations for the built-in appenders. - These configurations are designed to work with the - log4net.Config.DOMConfigurator and the - log4net.Repository.Hierarchy.Hierarchy. -

    -

    - These examples are by no means exhaustive configurations for the appenders. - For a full list of the parameters that can be specified to each appender and - more details on each options see the SDK documentation for the appender. -

    -
    - -
    -

    - For full details see the SDK Reference entry: log4net.Appender.AdoNetAppender. -

    -

    - The configuration of the AdoNetAppender depends on the - provider selected for the target database. Here are some examples. -

    -
    -

    - The following example shows how to configure the AdoNetAppender - to log messages to a SQL Server database. The events are written in batches of 100 - (BufferSize). The ConnectionType specifies the fully qualified type name - for the System.Data.IDbConnection to use to connect to the - database. The ConnectionString is database provider specific. - The CommandText is either a prepared statement or a stored procedure, in this - case it is a prepared statement. Each parameter to the prepared statement or stored procedure - is specified with its name, database type and a layout that renders the value for the - parameter. -

    -

    - The database table definition is: -

    - -

    - The appender configuration is: -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ]]> -
    - -
    -

    - This example shows how to write events to an Access Database. -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ]]> -
    - -
    -

    - This example shows how to write events to an Oracle9i Database. -

    -

    - The database table definition is: -

    - -

    - The appender configuration is: -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ]]> -
    - -
    -

    - This example shows how to write events to an Oracle8i Database. -

    -

    - The database table definition is: -

    - -

    - The appender configuration is: -

    - - - - - - - - - - - - - - - - - - - - - - - - - - ]]> -
    - -
    -

    - This example shows how to write events to an IBM DB2 8.2 Database. - The following syntax should also work with older DB2 database servers. -

    -

    - The database table definition is: -

    - -

    - The appender configuration is: -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ]]> -
    - - -
    -

    - This example shows how to write events to a SQLite Database. - This was tested against v0.21 of the - SQLite .NET provider. -

    -

    - SQLite doesn't have strongly-typed columns or field lengths but its - recommended you still include this information for readability. - The database table definition is: -

    - -

    - The appender configuration is: -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ]]> -
    - -
    - - -
    -

    - For full details see the SDK Reference entry: log4net.Appender.AspNetTraceAppender. -

    -

    - The following example shows how to configure the AspNetTraceAppender - to log messages to the ASP.NET TraceContext. The messages are written to the - System.Web.TraceContext.Write method if they are below - level WARN. If they are WARN or above they are written to the - System.Web.TraceContext.Warn method. -

    - - - - - - ]]> -
    - -
    -

    - For full details see the SDK Reference entry: log4net.Appender.BufferingForwardingAppender. -

    -

    - The following example shows how to configure the BufferingForwardingAppender - to buffer 100 messages before delivering them to the ConsoleAppender. -

    - - - - - ]]> -

    - This example shows how to deliver only significant events. A LevelEvaluator - is specified with a threshold of WARN. This means that the events will only - be delivered when a message with level of WARN or higher level is logged. - Up to 512 (BufferSize) previous messages of any level will also be delivered to provide context - information. Messages not sent will be discarded. -

    - - - - - - - - - ]]> -
    - -
    -

    - For full details see the SDK Reference entry: log4net.Appender.ColoredConsoleAppender. -

    -

    - The following example shows how to configure the ColoredConsoleAppender - to log messages to the console. By default the messages are sent to the console - standard output stream. This example shows how to highlight error messages. -

    - - - - - - - - - - - ]]> -

    - This example shows how to colorize multiple levels. -

    - - - - - - - - - - - - - - - ]]> -
    - -
    -

    - For full details see the SDK Reference entry: log4net.Appender.ConsoleAppender. -

    -

    - The following example shows how to configure the ConsoleAppender - to log messages to the console. By default the messages are sent to the console - standard output stream. -

    - - - - - - ]]> -

    - This example shows how to direct the log messages to the console error stream. -

    - - - - - - - ]]> -
    - -
    -

    - For full details see the SDK Reference entry: log4net.Appender.EventLogAppender. -

    -

    - The following example shows how to configure the EventLogAppender to log - to the Application event log on the local machine using the - event Source of the AppDomain.FriendlyName. -

    - - - - - - ]]> -

    - This example shows how to configure the EventLogAppender to - use a specific event Source. -

    - - - - - - - ]]> -

    - For more information on how to setup the event log to allow the - EventLogAppender to write to it, see the - FAQ: Why doesn't the EventLogAppender work?. -

    -
    - -
    -

    - For full details see the SDK Reference entry: log4net.Appender.FileAppender. -

    -

    - The following example shows how to configure the FileAppender - to write messages to a file. The file specified is log-file.txt. The file will - be appended to rather than overwritten each time the logging process starts. -

    - - - - - - - - ]]> -

    - This example shows how to configure the file name to write to using - an environment variable TMP. The encoding to use to write - to the file is also specified. -

    - - - - - - - - - ]]> -

    - This example shows how to configure the appender to use the minimal locking - model that allows multiple processes to write to the same file. -

    - - - - - - - - - ]]> -
    - -
    -

    - For full details see the SDK Reference entry: log4net.Appender.ForwardingAppender. -

    -

    - The following example shows how to configure the ForwardingAppender. - The forwarding appender allows a set of constraints to be used to decorate an appender. - In this example the ConsoleAppender is decorated with a Threshold of - level WARN. This means that an event directed to the ConsoleAppender - directly will be logged regardless of its level, but an event directed to the ForwardingAppender - will only be passed on to the ConsoleAppender if its level is WARN - or higher. This appender is used only in special circumstances. -

    - - - - - ]]> -
    - -
    -

    - For full details see the SDK Reference entry: log4net.Appender.MemoryAppender. -

    -

    - It is unlikely that the MemoryAppender will be configured - using a config file, but if you want to do it here's how. -

    - - - - ]]> -
    - -
    -

    - For full details see the SDK Reference entry: log4net.Appender.NetSendAppender. -

    -

    - The following example shows how to configure the NetSendAppender - to deliver messages to a specific user's screen. As this appender is typically only - used for important notifications a Threshold of level Error - is specified. This example delivers the messages to the user nicko on the - machine SQUARE. However things are not always straight forward using the Windows - Messenger Service, one possible outcome using this configuration is that the Server - will broadcast looking for a WINS server which it will then ask to deliver the message - to the Recipient, the WINS server will deliver it to the first terminal that the - user logged in from. -

    - - - - - - - - - ]]> -
    - -
    -

    - For full details see the SDK Reference entry: log4net.Appender.OutputDebugStringAppender. -

    -

    - The following example shows how to configure the OutputDebugStringAppender - to write logging messages to the OutputDebugString API. -

    - - - - - - ]]> -
    - -
    -

    - For full details see the SDK Reference entry: log4net.Appender.RemotingAppender. -

    -

    - The following example shows how to configure the RemotingAppender - to deliver logging events to a specified Sink (in this example - the sink is tcp://localhost:8085/LoggingSink). - In this example the events are delivered in blocks of 95 events because - of the BufferSize. No events are discarded. The OnlyFixPartialEventData - option allows the appender to ignore certain logging event properties that - can be very slow to generate (e.g. the calling location information). -

    - - - - - - - ]]> -

    - This example configures the RemotingAppender to - deliver the events only when an event with level ERROR - or above is logged. When the events are delivered, up to 200 (BufferSize) - previous events (regardless of level) will be delivered to provide context. - Events not delivered will be discarded. -

    - - - - - - - - - - ]]> -
    - -
    -

    - For full details see the SDK Reference entry: log4net.Appender.RollingFileAppender. -

    -

    - The RollingFileAppender builds on the - FileAppender and has the same options - as that appender. -

    -

    - The following example shows how to configure the RollingFileAppender - to write to the file log.txt. The file written to will always be called log.txt - because the StaticLogFileName param is specified. The file will be rolled based on - a size constraint (RollingStyle). Up to 10 (MaxSizeRollBackups) - old files of 100 KB each (MaximumFileSize) will be kept. These rolled files will be - named: log.txt.1, log.txt.2, log.txt.3, etc... -

    - - - - - - - - - - - - ]]> -

    - This example show how to configure the RollingFileAppender - to roll log files on a date period. This example will roll the log file every minute! - To change the rolling period adjust the DatePattern value. - For example, a date pattern of "yyyyMMdd" will roll every day. - See System.Globalization.DateTimeFormatInfo for a list of available patterns. -

    - - - - - - - - - - ]]> -

    - This example show how to configure the RollingFileAppender - to roll log files on a date period and within a date period on file size. For each day - only the last 10 files of 1MB will be kept. -

    - - - - - - - - - - - - ]]> -

    - This example show how to configure the RollingFileAppender - to roll log files once per program execution. The appendToFile - property is set to false to prevent the appender from overwriting - the existing files. The maxSizeRollBackups is set to negative - 1 to allow an infinite number of backup files. The file size does have to be limited but - here it is set to 50 Gigabytes which, if a log file exceeds this size limit during a single - run then it will also be rolled. -

    - - - - - - - - - - - ]]> -

    - A more basic approach to once per application rolling is to use a FileAppender - with appendToFile set to false or set the - RollingFileAppender's rollingStyle property to false. -

    - - - - - - - - - ]]> - - -
    - -
    -

    - For full details see the SDK Reference entry: log4net.Appender.SmtpAppender. -

    -

    - The following example shows how to configure the SmtpAppender - to deliver log events via SMTP email. The To, From, Subject and - SmtpHost are required parameters. - This example shows how to deliver only significant events. A LevelEvaluator - is specified with a threshold of WARN. This means that an email - will be sent for each WARN or higher level message that is logged. - Each email will also contain up to 512 (BufferSize) previous messages of any level to - provide context. Messages not sent will be discarded. -

    - - - - - - - - - - - - - - - ]]> -

    - This example shows how to configure the SmtpAppender - to deliver all messages in emails with 512 (BufferSize) messages per - email. -

    - - - - - - - - - - - - ]]> -

    - This example shows a more verbose formatting layout for the mail messages. -

    - - - - - - - - - - - - - - - ]]> -
    - -
    -

    - For full details see the SDK Reference entry: log4net.Appender.SmtpPickupDirAppender. -

    -

    - The SmtpPickupDirAppender is configured similarly - to the SmtpAppender. The only difference is that rather - than specify a SmtpHost parameter a PickupDir must be specified. -

    -

    - The PickupDir parameter is a path that must exist and the code executing the - appender must have permission to create new files and write to them in this directory. - The path is relative to the application's base directory (AppDomain.BaseDirectory). -

    -

    - The following example shows how to configure the SmtpPickupDirAppender - to deliver log events via SMTP email. The To, From, Subject and - PickupDir are required parameters. - This example shows how to deliver only significant events. A LevelEvaluator - is specified with a threshold of WARN. This means that an email - will be sent for each WARN or higher level message that is logged. - Each email will also contain up to 512 (BufferSize) previous messages of any level to - provide context. Messages not sent will be discarded. -

    - - - - - - - - - - - - - - - ]]> -
    - -
    -

    - For full details see the SDK Reference entry: log4net.Appender.TraceAppender. -

    -

    - The following example shows how to configure the TraceAppender - to log messages to the System.Diagnostics.Trace system. - This is the tracing system supplied with the .net base class libraries. - See the MSDN documentation for the System.Diagnostics.Trace - class for more details on how to configure the trace system. -

    - - - - - - ]]> -
    - -
    -

    - For full details see the SDK Reference entry: log4net.Appender.UdpAppender. -

    -

    - The following example shows how to configure the UdpAppender - to send events to a RemoteAddress on the specified RemotePort. -

    - - - - - - - - - ]]> -
    -
    - - -
    diff --git a/xdocs/src/release/example-apps.xml b/xdocs/src/release/example-apps.xml deleted file mode 100755 index 2a0e76a0..00000000 --- a/xdocs/src/release/example-apps.xml +++ /dev/null @@ -1,504 +0,0 @@ - - - - - - Nicko Cadell - Apache log4net: Examples - - - - - - - - - -
    - - - -
    -

    - The following examples are only available in the log4net release download, not - on-line. To obtain the examples download one of the log4net releases. - -

    -
    - -
    -
    -

    - A single example can be build by running nant from - the example directory. -

    -

    - For example running nant in the - examples\net\1.0\Tutorials\ConsoleApp\cs directory - will build the C# version of the .NET 1.0 ConsoleApp example. -

    -

    - nant can be run in any directory containing a - nant.build file. The typical behavior of the build file - is to build all projects under the current directory. -

    -

    - For example running nant in the - examples\net\1.1 directory - will build all the examples for the .NET 1.1 platform. -

    -
    - -
    -

    - To build all the examples either run nant in the - examples directory or you can specify the - compile-examples target to the main log4net nant build. -

    -
    - -
    -

    - There are Visual Studio .NET 2002 project files for the .NET 1.0 framework. - The solution files for C# and VB are in the examples\net\1.0 - folder. -

    -

    - For the Managed C++ project there is a Visual Studio .NET 2003 project file - in the examples\net\1.1 folder. -

    -
    -
    - -
    - -
    -

    - ConsoleApp shows how to write a simple console application that initializes - logging and logs various events. -

    -

    - This example is available for the following platforms and languages. If a version - is not available for your chosen platform and language combination then select the - nearest platform for the appropriate language. -

    - -

    - To run this example execute ConsoleApp.exe from the build output directory. -

    -
    - -
    -

    - ConsoleApp shows how to write a simple ASP.NET web application that initializes - logging and logs various events. -

    -

    - This example is available for the following platforms and languages. If a version - is not available for your chosen platform and language combination then select the - nearest platform for the appropriate language. -

    -
      -
    • - .NET 1.0: - C#, - VB -
    • -
    -

    - To run this example you need to have an ASP.NET container application to - host the web application, for example IIS. In IIS create a new virtual - directory pointing to the WebApp src directory. Configure IIS to recognize - this virtual directory as an application. Open up a web browser, navigate to - the virtual directory and to the WebForm1.aspx page within it. -

    -
    - -
    -

    - The RemotingClient application is a simple console application that configures - log4net with the RemotingAppender. This appender will attempt to deliver the - logging events to a remoting listener. This example should be run in conjunction - with the RemotingServer. -

    -

    - This example is available for the following platforms and languages. If a version - is not available for your chosen platform and language combination then select the - nearest platform for the appropriate language. -

    -
      -
    • - .NET 1.0: - C# -
    • -
    -

    - To run this example execute RemotingClient.exe from the build output directory. -

    -
    - -
    -

    - The RemotingServer application is a simple console application that listens for - logging events from a remote RemotingAppender and then logs them through the - local log4net instance. This example should be run in conjunction - with the RemotingClient. -

    -

    - This example is available for the following platforms and languages. If a version - is not available for your chosen platform and language combination then select the - nearest platform for the appropriate language. -

    -
      -
    • - .NET 1.0: - C# -
    • -
    -

    - To run this example execute RemotingServer.exe from the build output directory. - While this process is running execute the RemotingClient.exe program on - the same machine. The logging events from the client are transferred to the server. -

    -
    - -
    -

    - The SimpleModule is a class library that is intended to be used as part of - the SimpleApp example, - This class library uses the log4net.Config.Repository - attribute to create a separate configuration space from other assemblies. -

    -

    - This example is available for the following platforms and languages. If a version - is not available for your chosen platform and language combination then select the - nearest platform for the appropriate language. -

    -
      -
    • - MONO 1.0: - C# -
    • -
    • - .NET 1.0: - C#, - VB -
    • -
    • - .NET 1.1: - JScript.NET -
    • -
    • - SSCLI 1.0: - C# -
    • -
    -

    - This library is intended to be used as part of the SimpleApp example. -

    -
    - -
    -

    - The SharedModule is a class library that is intended to be used as part of - the SimpleApp example, - This class library uses log4net but does not attempt to configure logging. -

    -

    - This example is available for the following platforms and languages. If a version - is not available for your chosen platform and language combination then select the - nearest platform for the appropriate language. -

    -
      -
    • - MONO 1.0: - C# -
    • -
    • - .NET 1.0: - C#, - VB -
    • -
    • - .NET 1.1: - JScript.NET -
    • -
    • - SSCLI 1.0: - C# -
    • -
    -

    - This library is intended to be used as part of the SimpleApp example. -

    -
    - -
    -

    - The SimpleApp example uses the SimpleModule and SharedModule to demonstrate - the ways in which multiple assemblies within the same process may be - separately configured. -

    -

    - This example is available for the following platforms and languages. If a version - is not available for your chosen platform and language combination then select the - nearest platform for the appropriate language. -

    -
      -
    • - MONO 1.0: - C# -
    • -
    • - .NET 1.0: - C#, - VB -
    • -
    • - .NET 1.1: - JScript.NET -
    • -
    • - SSCLI 1.0: - C# -
    • -
    -

    - To run this example execute SimpleApp.exe from the build output directory. -

    -
    - -
    -

    - The EventIDLogApp example demonstrates using the log4net.Ext.EventID extension. - The extension needs to be built separately from the - extensions\net\1.0\log4net.Ext.EventID directory. -

    -

    - This example is available for the following platforms and languages. If a version - is not available for your chosen platform and language combination then select the - nearest platform for the appropriate language. -

    -
      -
    • - .NET 1.0: - C# -
    • -
    -

    - To run this example execute EventIDLogApp.exe from the build output directory. -

    -
    - -
    -

    - The TraceLogApp example demonstrates using the log4net.Ext.Trace extension. - The extension needs to be built separately from the - extensions\net\1.0\log4net.Ext.Trace directory. -

    -

    - This example is available for the following platforms and languages. If a version - is not available for your chosen platform and language combination then select the - nearest platform for the appropriate language. -

    -
      -
    • - .NET 1.0: - C# -
    • -
    -

    - To run this example execute TraceLogApp.exe from the build output directory. -

    -
    - -
    -

    - This project includes the following example appenders. -

    -
      -
    • - AsyncAppender -
    • -
    • - FastDbAppender -
    • -
    • - FireEventAppender -
    • -
    • - MessageBoxAppender -
    • -
    • - MessageObjectExpanderAppender -
    • -
    • - MsmqAppender -
    • -
    • - PatternFileAppender -
    • -
    • - SimpleSmtpAppender -
    • -
    -

    - This example is available for the following platforms and languages. If a version - is not available for your chosen platform and language combination then select the - nearest platform for the appropriate language. -

    -
      -
    • - .NET 1.0: - C# -
    • -
    -

    - To run this example execute SampleAppendersApp.exe from the build output directory. -

    -
    - -
    -

    - This project includes the following example layouts. -

    -
      -
    • - ForwardingLayout -
    • -
    • - LineWrappingLayout -
    • -
    -

    - This example is available for the following platforms and languages. If a version - is not available for your chosen platform and language combination then select the - nearest platform for the appropriate language. -

    -
      -
    • - .NET 1.0: - C# -
    • -
    -

    - To run this example execute SampleLayoutsApp.exe from the build output directory. -

    -
    - -
    -

    - The NotLogging example benchmarks the performance of log4net logging statements in - user code in various scenarios including when logging is disabled. -

    -

    - This example is available for the following platforms and languages. If a version - is not available for your chosen platform and language combination then select the - nearest platform for the appropriate language. -

    -
      -
    • - MONO 1.0: - C# -
    • -
    • - .NET 1.0: - C#, - VB -
    • -
    -

    -

    -
    - -
    -

    - The WmiAppender sample shows an example appender that fires events through - Windows Management Instrumentation. -

    -

    - This example is available for the following platforms and languages. If a version - is not available for your chosen platform and language combination then select the - nearest platform for the appropriate language. -

    -
      -
    • - .NET 1.0: - C# -
    • -
    -

    -

    -
    - -
    - -
    - -
    diff --git a/xdocs/src/release/faq.xml b/xdocs/src/release/faq.xml deleted file mode 100755 index 18d905b5..00000000 --- a/xdocs/src/release/faq.xml +++ /dev/null @@ -1,969 +0,0 @@ - - - - - - Nicko Cadell - Apache log4net: Frequently Asked Questions - - - - - -
    - - -
    - -
    -

    - 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 production 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 (and common to all of - the log4x libraries) 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. There - is a tight balance between these two requirements. -

    -
    -

    Back to Top

    - - -
    -

    - No. log4net is not reliable. It is a best-effort and fail-stop logging system. -

    -

    - By fail-stop, we mean that log4net will not throw unexpected exceptions at - run-time potentially causing your application to crash. If for any reason, log4net - throws an uncaught exception (except for ArgumentException and - ArgumentNullException which may be thrown), please send an email - to the - log4net-user@logging.apache.org mailing list. Uncaught exceptions - are handled as serious bugs requiring immediate attention. -

    -

    - Moreover, log4net will not revert to System.Console.Out - or System.Console.Error 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 - System.Console.Error and System.Diagnostics.Trace - indicating that logging can not be performed. -

    -
    -

    Back to Top

    - - -
    -

    - 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). -

    -

    - Not all frameworks are created equal and some features have been excluded from - some of the builds. See the Framework Support - document for more information. -

    -
    -

    Back to Top

    - - -
    -

    - There is a directory containing examples in log4net\examples. - The examples are broken down by framework. -

    -
    -

    Back to Top

    - - -
    -
      -
    • - log4net is optimized for speed.
    • -
    • - log4net is based on a named logger hierarchy.
    • -
    • - log4net is fail-stop but not reliable.
    • -
    • - log4net is thread-safe.
    • -
    • - log4net is not restricted to a predefined set of facilities.
    • -
    • - Logging behavior can be set at runtime using a configuration file. - Configuration files are in XML format.
    • -
    • - log4net is designed to handle exceptions from the start.
    • -
    • - log4net can direct its output to many sinks including: a file, the console, the NT EventLog or even e-mail.
    • -
    • - log4net categorizes logging into levels: DEBUG, INFO, WARN, ERROR and FATAL.
    • -
    • - The format of the log output can be easily changed by implementing a new layout class.
    • -
    • - The target of the log output as well as the writing strategy can be altered by - writing a new appender class.
    • -
    • - log4net supports multiple output appenders per logger.
    • -
    -

    - See the features overview document for more information on the features of log4net. -

    -
    -

    Back to Top

    - - -
    -

    - Yes, log4net is thread-safe. -

    -
    -

    Back to Top

    - - -
    -

    - The log output can be customized in many ways. Moreover, one can completely - override the output format by implementing one's own ILayout -

    -

    - Here is an example output using PatternLayout with the conversion - pattern %timestamp [%thread] %-5level %logger{2} %ndc - %message%newline -

    - -

    - 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 nested diagnostic context (NDC). Note the - nested diagnostic context may be empty as in the first two statements. The text - after the '-' is the message of the statement. -

    -
    -

    Back to Top

    - - -
    -

    - The logger concept lies at the heart of log4net's configuration. Loggers are organized into a - hierarchy and give the programmer run-time control on which logging statements - are printed or not. -

    -

    - Loggers are assigned levels through the configuration of log4net. A log statement is - routed through to the appender depending on its level and its logger. -

    -
    -

    Back to Top

    - - -
    -

    - 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. You are free to do whatever you wish with - your proprietary log4net extensions. In particular, you may choose to - never release your extensions to the wider public. For details see the - Apache License, Version 2.0. -

    -

    - 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. -

    -

    - 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. -

    -

    - Unless the proprietary log4net extension is business critical, there is little - reason for not donating your extensions back to the project. -

    -
    -

    Back to Top

    - - -
    -
      -
    1. - Stick to the existing indentation style even if you hate it. -

      - Alternating between indentation styles makes it hard to understand the source - code. Make it hard on yourself but easier on others. -

      -
    2. -
    3. - Thoroughly test your code. -

      - There is nothing more irritating than finding the bugs in debugging (i.e. logging) code. -

      -
    4. -
    5. - Keep it simple, small and fast. -

      - It's all about the application not about logging. -

      -
    6. -
    7. - Did I mention sticking with the indentation style?
    8. -
    -
    -

    Back to Top

    - - -
    -

    - As fast as they get reported ;-) -

    -
    -

    Back to Top

    - - -
    -

    - log4net is a port of the popular log4j 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 history page for more details. -

    -
    -

    Back to Top

    - - -
    -

    - The log4net home page is a good place to start. -

    -
    -

    Back to Top

    - -
    - -
    - -
    -

    - 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. -

    -

    - Configuration files are specified in XML. See log4net.Config.XmlConfigurator - for more details. -

    -

    - See the various log4net.Layout and log4net.Appender - components for specific configuration options. -

    -
    -

    Back to Top

    - - -
    -

    - Setting the Threshold 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: -

    - ]]> -
    -

    Back to Top

    - -
    -

    - log4net uses public properties to configure components such as - Appenders, Layouts, Loggers etc. -

    -

    - Thus, any writable public property in on the appender corresponds to a - configurable option. For example, in RollingFileAppender the - public int MaxSizeRollBackups { set; } property corresponds to - the MaxSizeRollBackups option. -

    -

    - Layouts options are also defined by their writable properties. Same goes for most - other log4net components. -

    -
    -

    Back to Top

    - - -
    -

    - Yes it is. Setting the Threshold option of any appender extending - AppenderSkeleton, (most log4net appenders extend - AppenderSkeleton) will filter out all log events - with a lower level than the value of the threshold option. -

    -

    - 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. -

    -

    - This policy usually best encapsulates what the user actually wants to do, as - opposed to her mind-projected solution. -

    -

    - If you must filter events by exact level match, then you can attach a - LevelMatchFilter to any appender to filter out logging - events by exact level match. -

    -
    -

    Back to Top

    - - -
    -

    - Yes. The XmlConfigurator supports automatic - reloading through the ConfigureAndWatch APIs. See the API - documentation for more details. -

    -
    -

    Back to Top

    - - -
    -

    - Yes. When specifying the type in the configuration file you can give the assembly - qualified name of the type. For example: -

    - ]]> -

    - The .NET runtime will try to locate the assembly called MyAssembly. - How .NET locates assemblies is beyond the scope of this FAQ. -

    -

    - 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 System.Type.GetType. - See the next FAQ on how to get the version and public key for an assembly. -

    -
    -

    Back to Top

    - - -
    -

    - 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 - http://www.aisto.com/roeder/dotnet. -

    -
    -

    Back to Top

    - - -
    -

    - 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. -

    - -
    -
    - -]]> -
    -

    Back to Top

    - - -
    -

    - Log4net supports a pattern syntax for setting string properties similar to the - PatternLayout used to format the output messages. - This pattern syntax can be used by specifying type="log4net.Util.PatternString" - on the string property in the config file. This tells the config parser to pass the - value to the PatternString type before converting the result - to a string. For details on the patterns supported see the - PatternString SDK Reference. -

    -

    - The following example sets the file name for a FileAppender to include the - current process id by specifying the %processid pattern in the - File property. -

    - - - -]]> -
    -

    Back to Top

    - - -
    - -
    - -
    -

    - Yes, there are. -

    -

    - You can name logging loggers by locality. 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: -

    -
      -
    • - It is very simple to implement.
    • -
    • - It is very simple to explain to new developers.
    • -
    • - It automatically mirrors your application's own modular design.
    • -
    • - It can be further refined at will.
    • -
    • - Printing the logger automatically gives information on the locality of the - log statement.
    • -
    -

    - However, this is not the only way for naming loggers. A common alternative - is to name loggers by functional areas. For example, the - "database" logger, "remoting" logger, "security" logger, or the "XML" - logger. -

    -

    - You may choose to name loggers by functionality and subcategorize by - locality, as in "DATABASE.MyApp.MyClass" or - "DATABASE.MyApp.MyModule.MyOtherClass". -

    -

    - You are totally free in choosing the names of your loggers. The - log4net package merely allows you to manage your names in a hierarchy. However, - it is your responsibility to define this hierarchy. -

    -

    - Note: by naming loggers by locality one tends to name things by - functionality, since in most cases the locality relates closely to - functionality. -

    -
    -

    Back to Top

    - - -
    -

    - You can easily retrieve the fully-qualified name of a class in a static block - for class X, with the statement typeof(X).Name. - Note that X is the class name and span an instance. - However because the LogManager.GetLogger method is overloaded - to take an instance of Type as well as string - usually only the type of the class is required. -

    -

    - Here is the suggested usage template: -

    - -

    - An equivalent and more portable solution, though slightly longer, is to use the declaring type - of the static constructor. -

    - -

    - Note: the .NET Compact Framework 1.0 does not support System.Reflection.MethodBase.GetCurrentMethod(). -

    -
    -

    Back to Top

    - - -
    -

    - For some logger log, writing, -

    - -

    - incurs the cost of constructing the message parameter, that is converting both - integer i and entry[i] to - a string, and concatenating intermediate strings. This, regardless of whether - the message will be logged or not. -

    -

    - If you are worried about speed, then write -

    - -

    - This way you will not incur the cost of parameter construction if debugging is - disabled for logger log. 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 IsDebugEnabled and once in Debug. - This is an insignificant overhead since evaluating a logger takes less than - 1% of the time it takes to actually log a statement. -

    -
    -

    Back to Top

    - - -
    -

    - 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: -

    - -

    - It is possible to further eliminate the calls to IsDebugEnabled - 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: -

    - -

    - So why exactly is this faster? Well to start with the IsDebugEnabled - is not called for each log statement, it is called once per logger. Furthermore as the - isDebugEnabled variable is private static readonly - the JIT compiler can at run-time optimize out the if 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. -

    -

    - 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 XmlConfigurator.ConfigureAndWatch 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. -

    -
    -

    Back to Top

    - - -
    -

    - 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. -

    -

    - It is simpler to use a context property or stack (ThreadContext). - Typically, one would ThreadContext.Properties["ID"] = "XXX" - 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. -

    -

    - See the ThreadContext and the PatternLayout classes for more - information. -

    -
    -

    Back to Top

    - - -
    -

    - It is quite nontrivial to define the semantics of a "removed" logger which is - still referenced by the user. -

    -
    -

    Back to Top

    - - -
    -

    - By default the FileAppender holds an exclusive write - lock on the log file while it is logging. This prevents other processes from - writing to the file. The FileAppender can be configured - to use a different locking model, MinimalLock, that - 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 loss in performance. - See the FileAppender config examples - for an example MinimalLock configuration. -

    -

    - While the MinimalLock model may be used to interleave - writes to a single file it may not be the optimal solution, especially when - logging from multiple machines. Alternatively you may have one or more processes - log to RemotingAppenders. - Using the RemoteLoggingServerPlugin (or - IRemoteLoggingSink) a process can receive all the events and - log them to a single log file. -

    -
    -

    Back to Top

    - - -
    -

    - The timestamp is created when the logging event is created. That is so say, - when the Debug, Info, - Warn, Error - or Fatal 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 RemotingAppender, - 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. -

    -
    -

    Back to Top

    - - -
    -

    - The simple answer is as soon as possible. The long answer is more complex. -

    -

    - If you are configuring log4net programmatically, i.e. by calling the - XmlConfigurator.Configure method then you should do so - before you begin logging and it is reasonable to do this very soon after application - start. -

    -

    - 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 LogManager.GetLogger is made. It is necessary - that the first call to LogManager.GetLogger 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. -

    -
    -

    Back to Top

    - - -
    - -
    - -
    -

    - Yes. You can implement the log4net.Layout.ILayout - interface to create you own customized log format, or you can extend the - LayoutSkeleton class which provides a default - implementation of the ILayout interface. - Appenders can be parameterized to use the layout of your choice. -

    -
    -

    Back to Top

    - - -
    -

    - Yes. You can implement the log4net.Appender.IAppender - interface to create you own customized appender. We recommend that you extend the - log4net.Appender.AppenderSkeleton 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 log4net.Appender.TraceAppender as an - example of the minimum amount of code required to get an appender working. -

    -

    - 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: -

    - ]]> -

    - The .NET runtime will try to locate the assembly called MyAssembly. - How .NET locates assemblies is beyond the scope of this FAQ. -

    -
    -

    Back to Top

    - -
    - -
    - -
    -

    - There are 2 different ways to enable internal debugging in log4net. - These are listed below. The preferred method is to specify - the log4net.Internal.Debug option in the application's - config file. -

    -
      -
    • -

      - 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 log4net.Internal.Debug - application setting must be set to the value true. - For example: -

      -
      -<?xml version="1.0" encoding="utf-8" ?>
      -<configuration>
      -    <appSettings>
      -        <add key="log4net.Internal.Debug" value="true"/>
      -    </appSettings>
      -</configuration>
      -

      - This setting is read immediately on startup an will cause all internal - debugging messages to be emitted. -

      -
    • -
    • -

      - To enable log4net's internal debug programmatically you need - to set the log4net.Util.LogLog.InternalDebugging - property to true. Obviously the sooner this - is set the more debug will be produced. -

      -
    • -
    -

    - Internal debugging messages are written to the console and to the - System.Diagnostics.Trace - 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 System.Console.Out. 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 - http://www.sysinternals.com - may be used to capture these messages. -

    -

    - As log4net internal debug messages are written to the System.Diagnostics.Trace - 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: -

    -
    -<configuration>
    -    ...
    -    
    -    <system.diagnostics>
    -        <trace autoflush="true">
    -            <listeners>
    -                <add 
    -                    name="textWriterTraceListener" 
    -                    type="System.Diagnostics.TextWriterTraceListener" 
    -                    initializeData="C:\tmp\log4net.txt" />
    -            </listeners>
    -        </trace>
    -    </system.diagnostics>
    -
    -    ...
    -</configuration>
    -

    - Make sure that the process running your application has permission - to write to this file. -

    -
    -

    Back to Top

    - - -
    -

    - 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. -

    -

    - 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. -

    -

    - There are a couple of solutions: -

    -
      -
    1. -

      - Make the ASPNET user a member of the Administrators group. This will work because the - user will then have the required permissions. This is not recommended - for production use. -

      -
    2. -
    3. -

      - 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 - System.Diagnostics.EventLogInstaller in the Microsoft .NET - Framework SDK for an example of how to create a simple event log installer. -

      -
    4. -
    -

    - There is a Microsoft Knowledge Base article that covers this issue and how to resolve - it. - PRB: "Requested Registry Access Is Not Allowed" Error Message When ASP.NET - Application Tries to Write New EventSource in the EventLog. -

    -
    -

    Back to Top

    - - -
    -

    - 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. -

    -
    -

    Back to Top

    - - -
    -

    - 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. -

    -

    - A windows service is launched by windows. The current directory in - a service is set to the windows system directory (e.g. - C:\Windows\System32). 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 - AppDomain.BaseDirectory. - Note that the log4net internals never use the current directory. -

    -
    -

    Back to Top

    - - -
    -

    - For details on the different ways in which ADO.NET can connect to a database see: - Connecting to a Data Source Using ADO.NET. -

    -

    - 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: - ODBC .NET Data Provider. -

    -
    -

    Back to Top

    - - -
    -

    - See the support page for details. -

    -
    -

    Back to Top

    - - -
    - -
    - -
    -

    - There is a good discussion of this topic on Robert McLaws blog: - Building a Better Server Control Experience, Part 2. -

    -
    -

    Back to Top

    - -
    - -
    - - -
    diff --git a/xdocs/src/release/features.xml b/xdocs/src/release/features.xml deleted file mode 100755 index 616fa089..00000000 --- a/xdocs/src/release/features.xml +++ /dev/null @@ -1,284 +0,0 @@ - - - - - - Nicko Cadell - Apache log4net: Features - - - - - -
    - - - -
    -

    - 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. -

    -

    - log4net is designed with two distinct goals in mind: speed and flexibility -

    -
    - -
    -
      -
    • Support for multiple frameworks

    • -
    • Output to multiple logging targets

    • -
    • Hierarchical logging architecture

    • -
    • XML Configuration

    • -
    • Dynamic Configuration

    • -
    • Logging Context

    • -
    • Proven architecture

    • -
    • Modular and extensible design

    • -
    • High performance with flexibility

    • -
    -
    - -
    -

    - log4net runs on all ECMA CLI 1.0 compatible runtimes. - log4net has specific builds for the following frameworks: -

    -
      -
    • Microsoft .NET Framework 1.0 (1.0.3705)
    • -
    • Microsoft .NET Framework 1.1 (1.1.4322)
    • -
    • Microsoft .NET Framework 2.0 (2.0.50727)
    • -
    • Microsoft .NET Compact Framework 1.0
    • - -
    • Mono 1.0
    • -
    • Mono 2.0
    • -
    • Microsoft Shared Source CLI 1.0
    • -
    • CLI 1.0 Compatible
    • -
    -

    - Note: Due to the .NET frameworks support for backward compatibility - log4net will run on future versions of the runtimes listed above. -

    -
    - -
    -

    - log4net ships with the following appenders (not on all frameworks): -

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Type - Description
    log4net.Appender.AdoNetAppender - Writes logging events to a database using either prepared statements or stored - procedures. -
    log4net.Appender.AnsiColorTerminalAppender - Writes color highlighted logging events to a an ANSI terminal window. -
    log4net.Appender.AspNetTraceAppender - 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. -
    log4net.Appender.ColoredConsoleAppender - Writes color highlighted logging events to the application's Windows Console. -
    log4net.Appender.ConsoleAppender - Writes logging events to the application's Console. The events may go to either - the standard our stream or the standard error stream. -
    log4net.Appender.EventLogAppender - Writes logging events to the Windows Event Log. -
    log4net.Appender.FileAppender - Writes logging events to a file in the file system. -
    log4net.Appender.LocalSyslogAppender - Writes logging events to the local syslog service (UNIX only). -
    log4net.Appender.MemoryAppender - Stores logging events in an in memory buffer. -
    log4net.Appender.NetSendAppender - Writes logging events to the Windows Messenger service. These messages are - displayed in a dialog on a users terminal. -
    log4net.Appender.OutputDebugStringAppender - 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. -
    log4net.Appender.RemoteSyslogAppender - Writes logging events to a remote syslog service using UDP networking. -
    log4net.Appender.RemotingAppender - Writes logging events to a remoting sink using .NET remoting. -
    log4net.Appender.RollingFileAppender - 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. -
    log4net.Appender.SmtpAppender - Sends logging events to an email address. -
    log4net.Appender.TelnetAppender - Clients connect via Telnet to receive logging events. -
    log4net.Appender.TraceAppender - Writes logging events to the .NET trace system. -
    log4net.Appender.UdpAppender - Sends logging events as connectionless UDP datagrams to a remote host or a - multicast group using a UdpClient. -
    -
    -

    -

    - -
    -

    - 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. -

    -
    - -
    -

    - 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 - flexibility to express all configurations. -

    -

    - Alternatively log4net can be configured programmatically. -

    -
    - -
    -

    - 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 - terminating the process in question. This can a very valuable tool in - investigating issues with deployed applications. -

    -
    - -
    -

    - 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 - logged as part of each subsequent logging message made from the same thread. -

    -
    - -
    -

    - log4net is based on the highly successful log4j logging library, - in development since 1996. This popular and proven architecture has - so far been ported to 12 languages. -

    -
    - -
    - -
    diff --git a/xdocs/src/release/framework-support.xml b/xdocs/src/release/framework-support.xml deleted file mode 100755 index f8d14e81..00000000 --- a/xdocs/src/release/framework-support.xml +++ /dev/null @@ -1,592 +0,0 @@ - - - - - - Nicko Cadell - Apache log4net: Supported Frameworks - - - - - -
    - - - -
    -

    - 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. -

    -

    - 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. -

    -

    - While the number of different builds available may seem confusing, you only need to select the - nearest build for your platform that is equal to or earlier than your chosen deployment framework. - If you intend to deploy your application on the Microsoft .NET Framework 1.0 don't pick the - log4net build that is built against the Microsoft .NET Framework 1.1 because the .NET framework - does not guarantee forward compatibility only backward compatibility. -

    -

    - The lowest common denominator build is the CLI 1.0 Compatible build. This build is compatible with - the ECMA/ISO CLI 1.0 standard APIs and will run on all frameworks that support the standard. (Note - that the Microsoft .NET Compact Framework does not support this standard). Use this build if you - intend to deploy you application on both the Microsoft .NET Frameworks and the Mono frameworks. -

    -

    - log4net now builds on 6 frameworks: -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FrameworkWebsite
    Microsoft .NET Framework 1.0 (1.0.3705)http://msdn.microsoft.com/net
    Microsoft .NET Framework 1.1 (1.1.4322)http://msdn.microsoft.com/net
    Microsoft .NET Framework 2.0 (2.0.50727)http://msdn.microsoft.com/net
    Microsoft .NET Compact Framework 1.0http://msdn2.microsoft.com/en-us/netframework/aa497273.aspx
    Microsoft .NET Compact Framework 2.0http://msdn2.microsoft.com/en-us/netframework/aa497273.aspx
    Mono 1.2.3http://www.mono-project.com
    Microsoft Shared Source CLI 1.0http://msdn.microsoft.com/library/en-us/dndotnet/html/mssharsourcecli.asp
    CLI 1.0 Compatiblehttp://msdn.microsoft.com/net/ecma/
    -
    -

    - For each of these frameworks a log4net assembly targeting the framework is supplied. Although it's - perfectly possible to use the .NET Framework 1.0 version of log4net on the .NET Framework 1.1, having - an assembly that really targets a specific framework allows us to use features in that framework that - are not available in other frameworks or remove features from log4net that are not supported in a - specific framework. -

    -
    - -
    -

    - The appenders available to each framework depend on the functionality of the - framework and the platform it runs on: -

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Appender.NET Framework 1.0.NET Framework 1.1.NET Framework 2.0.NET CF 1.0Mono 1.2Shared Source CLI 1.0CLI 1.0 Compatible
    AdoNetAppenderxxxxxx
    AnsiColorTerminalAppenderxxxxxxx
    AspNetTraceAppenderxxxxx
    BufferingForwardingAppenderxxxxxxx
    ColoredConsoleAppenderxxx
    ConsoleAppenderxxxxxxx
    DebugAppenderxxxxxxx
    EventLogAppenderxxxxx
    FileAppenderxxxxxxx
    ForwardingAppenderxxxxxxx
    LocalSyslogAppenderxxxxx
    MemoryAppenderxxxxxxx
    NetSendAppenderxxx
    OutputDebugStringAppenderxxxx
    RemoteSyslogAppenderxxxxxxx
    RemotingAppenderxxxxxx
    RollingFileAppenderxxxxxxx
    SmtpAppenderxxxxx
    SmtpPickupDirAppenderxxxxxxx
    TelnetAppenderxxxxxxx
    TraceAppenderxxxxxxx
    UdpAppenderxxxxxxx
    -
    -
    - -
    -
    -

    - none -

    -
    - -
    -

    - none -

    -
    - -
    -

    - none -

    -
    - -
    -
      -
    • -

      Assembly attributes

      -

      - The .NET Compact Framework 1.0 does not support retrieving assembly level - attributes, therefore all log4net configuration attributes were removed from - the .NET Compact Framework 1.0 version of log4net. -

      -

      - For Smart-device applications, the log4net system can be configured by passing - the location of the log4net configuration file to the - log4net.Config.XmlConfigurator.Configure(FileInfo) - method in the entry point of the application. -

      -

      For example:

      -

      -

      -namespace TestApp
      -{
      -    using System.IO;
      -
      -    public class EntryPoint
      -    {
      -        /// <summary>
      -        /// Application entry point.
      -        /// </summary>
      -        public static void Main() 
      -        {
      -            // Uncomment the next line to enable log4net internal debugging
      -            // log4net.Util.LogLog.InternalDebugging = true;
      -
      -            // This will instruct log4net to look for a configuration file
      -            // called config.log4net in the root directory of the device
      -            log4net.Config.XmlConfigurator.Configure(new FileInfo(@"\config.log4net"));
      -
      -            ...
      -            
      -            // This will shutdown the log4net system
      -            log4net.LogManager.Shutdown();
      -        }
      -    }
      -}                        
      -                            
      -
    • -
    • -

      Notification events

      -

      - The .NET Compact Framework 1.0 does not support notification events during the - application shutdown, therefore log4net cannot automatically hook the - application shutdown notification. -

      -

      - Applications will need to programmatically shutdown the log4net system during - the application's shutdown using the - log4net.LogManager.Shutdown() - method in order to prevent losing logging events. - See the code above for an example. -

      -
    • -
    • -

      FileSystemWatcher

      -

      - The .NET Compact Framework 1.0 does not support the - System.IO.FileSystemWatcher - class. As a result, the - XmlConfiguratorAttribute.Watch - property and the - XmlConfigurator.ConfigureAndWatch - methods are not available. Watching changes to the log4net configuration - file is not supported on the .NET Compact Framework 1.0. -

      -
    • -
    • -

      UserName

      -

      - The .NET Compact Framework 1.0 does not support the - System.Security.Principal.WindowsIdentity class. - This is used to capture the current thread's user identity. Therefore - the LoggingEvent.UserName property will return the value - "NOT AVAILABLE". -

      -
    • -
    • -

      Identity

      -

      - The .NET Compact Framework 1.0 does not support the - System.Security.Principal.IPrincipal interface. - This is used to capture the current thread's user identity. Therefore - the LoggingEvent.Identity property will return the value - "NOT AVAILABLE". -

      -
    • -
    • -

      Environment variables

      -

      - The .NET Compact Framework 1.0 does not support retrieving environment - variables, therefore it's not possible to substitute environment variables in - parameter values when using the .NET Compact Framework 1.0 version of log4net. -

      -
    • -
    • -

      Serialization

      -

      - The .NET Compact Framework 1.0 does not support serialization, therefore none of - the log4net classes in the .NET Compact Framework 1.0 version are serializable. -

      -
    • -
    • -

      LoggingEvent.Domain

      -

      - The .NET Compact Framework 1.0 does not support AppDomain functionality. The - friendly name for the current AppDomain is stored in the LoggingEvent.Domain - property and is accessed using the %a pattern of the - PatternLayout. On the .NET Compact Framework 1.0 this - value is generated by taking the file name for the application's primary module. -

      -
    • -
    -
    - -
    -

    - There are 2 separate builds of log4net for mono; Mono 1.0, built using the C# compiler in a mode - which is compatible with the CLI 1.0 language specification, and; Mono 2.0, built using the .NET - 2.0 extensions to the C# language. -

    - -
    -

    - none -

    -
    -
    -

    - none -

    -
    - -
    - -
    -
      -
    • -

      FileSystemWatcher

      -

      - SSCLI 1.0 does not support the - System.IO.FileSystemWatcher - class. As a result, the - XmlConfiguratorAttribute.Watch - property and the - XmlConfigurator.ConfigureAndWatch - methods are not available. Watching changes to the log4net configuration - file is not supported on SSCLI 1.0. -

      -
    • -
    • -

      UserName

      -

      - SSCLI 1.0 does not support the - System.Security.Principal.WindowsIdentity class. - This is used to capture the current thread's user identity. Therefore - the LoggingEvent.UserName property will return the value - "NOT AVAILABLE". -

      -
    • -
    • -

      Identity

      -

      - SSCLI 1.0 does not support the - System.Security.Principal.IPrincipal interface. - This is used to capture the current thread's user identity. Therefore - the LoggingEvent.Identity property will return the value - "NOT AVAILABLE". -

      -
    • -
    -
    - -
    -

    - This build of log4net is designed to run on any ECMA CLI 1.0 compatible runtime. - The assembly does not support any platform specific features. The build includes - the common subset of functionality found in the .NET 1.0 and Mono 1.0 builds. - The output assembly is built using the Microsoft .NET 1.0 compiler and library. -

    -

    - The log4net CLI 1.0 assembly is runtime compatible with the following frameworks: -

    -
      -
    • Microsoft .NET Framework 1.0 (and higher)
    • -
    • Mono 1.0 (and higher)
    • -
    -

    - Only a Release build is generated for this configuration because the assembly - debugging information has not been standardized. -

    -
    - -
    - -
    - - -
    diff --git a/xdocs/src/release/howto/chainsaw.xml b/xdocs/src/release/howto/chainsaw.xml deleted file mode 100755 index 8ad6f17e..00000000 --- a/xdocs/src/release/howto/chainsaw.xml +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - Ron Grabowski - Nicko Cadell - Apache log4net: How To view logging events using Apache log4j Chainsaw - - - - - -
    - - -

    - Apache log4j includes Chainsaw - a graphical log viewer. -

    -

    - Chainsaw can either receive and display log events in realtime over - the network, or it can load a previously created log file. -

    - -

    - Before Chainsaw can display data, one or more receivers must be setup. - This is usually done by specifying an xml config file when the program - first starts up.
    - Save one or more of the sample xml config files to your local system and - load them when Chainsaw starts. -

    - -
    -

    - log4net can be configured to log messages via UDP in such a way that Chainsaw - can receive and display them. -

    - -
    -

    - Configure log4net to use a UdpAppender with the following config snippet: -

    - - - - - - - -]]> -
    - -
    -

    - Chainsaw should be configured to start a UDPReceiver using the - following configuration document: -

    - - - - - - - -]]> -
    - -
    - -
    -

    - Chainsaw can also load an XML log file if it is formatted according - to the log4j schema. Use the following log4net config to output - to file using the log4j schema: -

    - - - - - - - -]]> - -

    - To load the file into Chainsaw drag the file into the Chainsaw - app and drop it on the tab labeled Drag & Drop log files here. -

    -
    - -
    - -
    diff --git a/xdocs/src/release/howto/index.xml b/xdocs/src/release/howto/index.xml deleted file mode 100755 index 0cbb9622..00000000 --- a/xdocs/src/release/howto/index.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - Nicko Cadell - Apache log4net: How Tos - - - - - -
    - -

    - Below are presented, in no particular order, a series of documents - on how to get stuff done. -

    -

    - New documents can be contributed via the issue tracking system. - See the Contributing page for - details. -

    - - - -
    - -
    diff --git a/xdocs/src/release/manual/configuration.xml b/xdocs/src/release/manual/configuration.xml deleted file mode 100755 index 7d9be6e3..00000000 --- a/xdocs/src/release/manual/configuration.xml +++ /dev/null @@ -1,1207 +0,0 @@ - - - - - - Nicko Cadell - Apache log4net Manual: Configuration - - - - - -
    - - - -
    -

    - Inserting log requests into the application code requires a fair amount of - planning and effort. Observation shows that approximately 4 percent of code is - dedicated to logging. Consequently, even moderately sized applications will - have thousands of logging statements embedded within their code. Given their - number, it becomes imperative to manage these log statements without the need - to modify them manually. -

    -

    - The log4net environment is fully configurable programmatically. However, it is - far more flexible to configure log4net using configuration files. Currently, - configuration files are written in XML. -

    -

    - Let us give a taste of how this is done with the help of an imaginary - application - MyApp - that uses log4net. -

    -
    -using Com.Foo;
    -
    -// Import log4net classes.
    -using log4net;
    -using log4net.Config;
    -
    -public class MyApp 
    -{
    -    // Define a static logger variable so that it references the
    -    // Logger instance named "MyApp".
    -    private static readonly ILog log = LogManager.GetLogger(typeof(MyApp));
    -
    -    static void Main(string[] args) 
    -    {
    -        // Set up a simple configuration that logs on the console.
    -        BasicConfigurator.Configure();
    -
    -        log.Info("Entering application.");
    -        Bar bar = new Bar();
    -        bar.DoIt();
    -        log.Info("Exiting application.");
    -    }
    -}
    -

    - MyApp - begins by importing log4net related classes. It then defines a static logger - variable with the name - MyApp - which happens to be the fully qualified name of the class. -

    -

    - MyApp - uses the following - Bar - class: -

    -
    -// Import log4net classes.
    -using log4net;
    -
    -namespace Com.Foo
    -{
    -    public class Bar 
    -    {
    -        private static readonly ILog log = LogManager.GetLogger(typeof(Bar));
    -
    -        public void DoIt()
    -        {
    -            log.Debug("Did it again!");
    -        }
    -    }
    -}
    -

    - The invocation of the - BasicConfigurator.Configure() - method creates a rather simple log4net setup. This method is hardwired to add - to the root logger a - ConsoleAppender. The output will be formatted using a - PatternLayout - set to the pattern - "%-4timestamp [%thread] %-5level %logger %ndc - %message%newline". -

    -

    - Note that by default, the root logger is assigned to - Level.DEBUG. -

    -

    - The output of MyApp is: -

    - -

    - As a side note, let me mention that in log4net child loggers link only to their - existing ancestors. In particular, the logger named - Com.Foo.Bar - is linked directly to the - root - logger, thereby circumventing the unused - Com - or - Com.Foo - loggers. This significantly increases performance and reduces log4net's memory - footprint. -

    -

    - The - MyApp - class configures log4net by invoking - BasicConfigurator.Configure() - method. Other classes only need to import the - log4net - namespace, retrieve the loggers they wish to use, and log away. -

    -

    - The previous example always outputs the same log information. Fortunately, it - is easy to modify - MyApp - so that the log output can be controlled at run-time. Here is a slightly - modified version. -

    -
    -using Com.Foo;
    -
    -// Import log4net classes.
    -using log4net;
    -using log4net.Config;
    -
    -public class MyApp 
    -{
    -    private static readonly ILog log = LogManager.GetLogger(typeof(MyApp));
    -
    -    static void Main(string[] args) 
    -    {
    -        // BasicConfigurator replaced with XmlConfigurator.
    -        XmlConfigurator.Configure(new System.IO.FileInfo(args[0]));
    -
    -        log.Info("Entering application.");
    -        Bar bar = new Bar();
    -        bar.DoIt();
    -        log.Info("Exiting application.");
    -    }
    -}
    -

    - This version of - MyApp - instructs the - XmlConfigurator - to parse a configuration file and set up logging accordingly. The path to the - configuration file is specified on the command line. -

    -

    - Here is a sample configuration file that results in exactly same output as the - previous - BasicConfigurator - based example. -

    - - - - - - - - - - - - - - - -]]> -

    - Suppose we are no longer interested in seeing the output of any component - belonging to the - Com.Foo - package. The following configuration file shows one possible way of achieving - this. -

    - - - - - - - - - - - - - - - - - - - - - -]]> -

    - The output of - MyApp - configured with this file is shown below. -

    - -2000-09-07 14:07:41,508 [main] INFO MyApp - Entering application. -2000-09-07 14:07:41,529 [main] INFO MyApp - Exiting application. -

    - As the logger - Com.Foo.Bar - does not have an assigned level, it inherits its level from - Com.Foo, which was set to WARN in the configuration - file. The log statement from the - Bar.DoIt - method has the level DEBUG, lower than the logger level WARN. Consequently, - DoIt() - method's log request is suppressed. -

    -

    - Here is another configuration file that uses multiple appenders. -

    - - - - - - - - - - - - - - - - - - - - - - - - -]]> -

    - Calling the enhanced MyApp with the this configuration file will output the - following on the console. -

    - -

    - In addition, as the root logger has been allocated a second appender, output - will also be directed to the - example.log - file. This file will be rolled over when it reaches 100KB. When roll-over - occurs, the old version of - example.log - is automatically moved to - example.log.1. -

    -

    - Note that to obtain these different logging behaviors we did not need to - recompile code. We could just as easily have logged to an email address, - redirected all - Com.Foo - output to an NT Event logger, or forwarded logging events to a remote log4net - server, which would log according to local server policy. -

    -

    - For more examples of configuring appenders using the XmlConfigurator - see the Example Appender Configuration - document. -

    - -
    -

    - The log4net configuration can be configured using assembly-level attributes rather than - specified programmatically. -

    -
      -
    • - XmlConfiguratorAttribute -

      - The log4net.Config.XmlConfiguratorAttribute Allows the - XmlConfigurator to be configured using the following properties: -

      -
        -
      • - ConfigFile -

        - If specified, this is the filename of the configuration file to use with the - XmlConfigurator. This file path is relative to the - application base directory (AppDomain.CurrentDomain.BaseDirectory). -

        -

        - This property cannot be used in conjunction with the - ConfigFileExtension property. -

        -
      • -
      • - ConfigFileExtension -

        - If specified, this is the extension for the configuration file. The assembly - file name is used as the base name with the this extension appended. For example - if the assembly is loaded from the a file TestApp.exe - and the ConfigFileExtension property is set to - log4net then the configuration file name is - TestApp.exe.log4net. This is equivalent to setting the - ConfigFile property to TestApp.exe.log4net. -

        -

        - The path to the configuration file is build by using the application base - directory (AppDomain.CurrentDomain.BaseDirectory), - the assembly file name and the configuration file extension. -

        -

        - This property cannot be used in conjunction with the - ConfigFile property. -

        -
      • -
      • - Watch -

        - If this flag is specified and set to true - then the framework will watch the configuration file and will reload the config - each time the file is modified. -

        -
      • -
      -

      - If neither of the ConfigFile or ConfigFileExtension - properties are specified, the application configuration file (e.g. TestApp.exe.config) - will be used as the log4net configuration file. -

      -

      - Example usage: -

      -
      -// Configure log4net using the .config file
      -[assembly: log4net.Config.XmlConfigurator(Watch=true)]
      -// This will cause log4net to look for a configuration file
      -// called TestApp.exe.config in the application base
      -// directory (i.e. the directory containing TestApp.exe)
      -// The config file will be watched for changes.
      -                            
      -
      -// Configure log4net using the .log4net file
      -[assembly: log4net.Config.XmlConfigurator(ConfigFileExtension="log4net",Watch=true)]
      -// This will cause log4net to look for a configuration file
      -// called TestApp.exe.log4net in the application base
      -// directory (i.e. the directory containing TestApp.exe)
      -// The config file will be watched for changes.
      -                            
      -

      - This attribute may only be used once per assembly. -

      -
    • -
    -

    - Using attributes can be a clearer method for defining where the application's - configuration will be loaded from. However it is worth noting that attributes - are purely passive. They are information only. Therefore if you use configuration - attributes you must invoke log4net to allow it to read the attributes. A simple - call to LogManager.GetLogger will cause the attributes - on the calling assembly to be read and processed. Therefore it is imperative - to make a logging call as early as possible during the application start-up, and - certainly before any external assemblies have been loaded and invoked. -

    -
    - -
    -

    - Typically the log4net configuration is specified using a file. This file can - be read in one of two ways: -

    -
      -
    • Using the .NET System.Configuration API
    • -
    • Reading the file contents directly
    • -
    - -
    -

    - The System.Configuration API is only available if the - configuration data is in the application's config file; the file named - MyApp.exe.config or Web.config. Because the System.Configuration - API does not support reloading of the config file the configuration settings - cannot be watched using the log4net.Config.XmlConfigurator.ConfigureAndWatch - methods. The main advantage of using the System.Configuration - APIs to read the configuration data is that it requires less permissions than accessing - the configuration file directly. -

    -

    - The only way to configure an application using the System.Configuration - APIs is to call the log4net.Config.XmlConfigurator.Configure() method or - the log4net.Config.XmlConfigurator.Configure(ILoggerRepository) method. -

    -

    - In order to embed the configuration data in the .config file the section name must be - identified to the .NET config file parser using a configSections element. - The section must specify the log4net.Config.Log4NetConfigurationSectionHandler - that will be used to parse the config section. This type must be fully assembly qualified - because it is being loaded by the .NET config file parser not by log4net. The correct - assembly name for the log4net assembly must be specified. - The following is a simple example configuration file that specifies the correct - section handler to use for the log4net section. -

    - - - -
    - - - - - - - - - - - - -]]> -

    - In the above example the log4net assembly is specified. - This assembly must be located where the .NET runtime can find it. For example it could - be located in the same directory as the application. If the log4net assembly is stored in - the GAC then the fully qualified assembly name must be specified including the culture, - version and public key. -

    -

    - When using the .config file to specify the configuration the section name and - XML element name must be log4net. -

    -
    - -
    -

    - The XmlConfigurator can directly read any XML file and use it to configure log4net. - This includes the application's .config file; the file named MyApp.exe.config - or Web.config. The only reason not to read the configuration file directly is if the - application does not have sufficient permissions to read the file, then the configuration - must be loaded using the .NET configuration APIs (see above). -

    -

    - The file to read the configuration from can be specified using any of - the log4net.Config.XmlConfigurator methods that - accept a System.IO.FileInfo object. Because the - file system can be monitored for file change notifications the - ConfigureAndWatch methods can be used to monitor - the configuration file for modifications and automatically reconfigure log4net. -

    -

    - Additionally the log4net.Config.XmlConfiguratorAttribute - can be used to specify the file to read the configuration from. -

    -

    - The configuration is read from the log4net element - in the file. Only one log4net element can be specified - in the file but it may be located anywhere in the XML hierarchy. For example it - may be the root element: -

    - - - - - - - - - - - -]]> -

    - Or it may be nested within other elements: -

    - - - -
    - - - - - - - - - - - - -]]> -

    - The above example shows how the configuration data can be embedded - inside a .config file even though the file is being read directly - by log4net. An important note is that the .NET config file parser - will throw an exception if it finds an element that has not been - registered using the configSections element. - Therefore in the above example the log4net - section name is registered, but the type specified to handle the - section is System.Configuration.IgnoreSectionHandler. - This is a built-in class that indicates that another method for reading - the config section will be employed. -

    -
    - -
    - -
    -

    - log4net includes a configuration reader that parses an XML DOM, the - log4net.Config.XmlConfigurator. This section defines the - syntax accepted by the configurator. -

    -

    - This is an example of a valid XML configuration. The root element - must be <log4net>. Note that this does not mean - that this element cannot be embedded in another XML document. See the section above - on Configuration Files for more information - on how to embed the XmlConfigurator XML in a configuration file. -

    - - - - - - - - - - -]]> -

    - The <log4net> element supports the following attributes: -

    -
    - - - - - - - - - - - - - - - - - - - - - -
    AttributeDescription
    debug - Optional attribute. Value must be either true or false. - The default value is false. Set this attribute to true - to enable internal log4net debugging for this configuration. -
    update - Optional attribute. Value must be either Merge or Overwrite. - The default value is Merge. Set this attribute to Overwrite - to reset the configuration of the repository being configured before applying this configuration. -
    threshold - Optional attribute. Value must be the name of a level registered on the repository. - The default value is ALL. Set this attribute to limit the messages - that are logged across the whole repository, regardless of the logger that the message is logged to. -
    -
    -

    - The <log4net> element supports the following child elements: -

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ElementDescription
    appender - Zero or more elements allowed. Defines an appender. -
    logger - Zero or more elements allowed. Defines the configuration of a logger. -
    renderer - Zero or more elements allowed. Defines an object renderer. -
    root - Optional element, maximum of one allowed. Defines the configuration of the root logger. -
    param - Zero or more elements allowed. Repository specific parameters -
    -
    - -
    -

    - Appenders may only be defined as child elements of the <log4net> - element. Each appender must be uniquely named. The implementing type for the appender must be specified. -

    -

    - This example shows an appender of type log4net.Appender.ConsoleAppender being - defined. The appender will be known as ConsoleAppender. -

    - - - - -]]> - -

    - The <appender> element supports the following attributes: -

    -
    - - - - - - - - - - - - - - - - - -
    AttributeDescription
    name - Required attribute. Value must be a string name for this appender. The name must be unique - among all the appenders defined in this configuration file. This name is used by the - <appender-ref> element of a Logger to reference an appender. -
    type - Required attribute. Value must be the type name for this appender. If the appender is - not defined in the log4net assembly this type name must be fully assembly qualified. -
    -
    -

    - The <appender> element supports the following child elements: -

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    ElementDescription
    appender-ref - Zero or more elements allowed. Allows the appender to reference other appenders. - Not supported by all appenders. -
    filter - Zero or more elements allowed. Defines the filters used by this appender. -
    layout - Optional element, maximum of one allowed. Defines the layout used by this appender. -
    param - Zero or more elements allowed. Appender specific parameters. -
    -
    - -

    - For examples of configuring appenders see the - Example Appender Configuration - document. -

    - -
    -

    - Filters elements may only be defined as children of <appender> elements. -

    -

    - The <filter> element supports the following attributes: -

    -
    - - - - - - - - - - - - - -
    AttributeDescription
    type - Required attribute. Value must be the type name for this filter. If the filter is - not defined in the log4net assembly this type name must be fully assembly qualified. -
    -
    -

    - The <filter> element supports the following child elements: -

    -
    - - - - - - - - - - - - - -
    ElementDescription
    param - Zero or more elements allowed. Filter specific parameters. -
    -
    - -

    - Filters form a chain that the event has to pass through. Any filter along the way can accept the event - and stop processing, deny the event and stop processing, or allow the event on to the next filter. - If the event gets to the end of the filter chain without being denied it is implicitly accepted and will be logged. -

    - - - -]]> -

    - This filter will deny events that have a level that is lower than INFO - or higher than FATAL. - All events between INFO and FATAL will be logged. -

    -

    - If we want to only allow messages through that have a specific substring (e.g. 'database') - then we need to specify the following filters: -

    - - - -]]> -

    - The first filter will look for the substring 'database' in the message text of the event. - If the text is found the filter will accept the message and filter processing will stop, - the message will be logged. If the substring is not found the event will be passed to - the next filter to process. If there is no next filter the event would be implicitly - accepted and would be logged. But because we don't want the non matching events to be - logged we need to use a log4net.Filter.DenyAllFilter - that will just deny all events that reach it. This filter is only useful at the end of the filter chain. -

    -

    - If we want to allow events that have either 'database' or 'ldap' in the message text we can use the following filters: -

    - - -
    - - - -]]> -
    - -
    -

    - Layout elements may only be defined as children of <appender> elements. -

    -

    - The <layout> element supports the following attributes: -

    -
    - - - - - - - - - - - - - -
    AttributeDescription
    type - Required attribute. Value must be the type name for this layout. If the layout is - not defined in the log4net assembly this type name must be fully assembly qualified. -
    -
    -

    - The <layout> element supports the following child elements: -

    -
    - - - - - - - - - - - - - -
    ElementDescription
    param - Zero or more elements allowed. Layout specific parameters. -
    -
    -

    - This example shows how to configure a layout that uses the log4net.Layout.PatternLayout. -

    - - -]]> - -
    -
    - -
    -

    - Only one root logger element may only be defined and it must be a child of <log4net> element. - The root logger is the root of the logger hierarchy. All loggers ultimately inherit from this logger. -

    -

    - An example root logger: -

    - - - -]]> - -

    - The <root> element supports no attributes. -

    -

    - The <root> element supports the following child elements: -

    -
    - - - - - - - - - - - - - - - - - - - - - -
    ElementDescription
    appender-ref - Zero or more elements allowed. Allows the logger to reference appenders by name. -
    level - Optional element, maximum of one allowed. Defines the logging level for this logger. - This logger will only accept event that are at this level or above. -
    param - Zero or more elements allowed. Logger specific parameters. -
    -
    -
    - -
    -

    - Logger elements may only be defined as children of the <log4net> element. -

    -

    - An example logger: -

    - - - -]]> - -

    - The <logger> element supports the following attributes. -

    -
    - - - - - - - - - - - - - - - - - -
    AttributeDescription
    name - Required attribute. Value must be the name of the logger. -
    additivity - Optional attribute. Value may be either true or false. - The default value is true. Set this attribute to false - to prevent this logger from inheriting the appenders defined on parent loggers. -
    -
    -

    - The <logger> element supports the following child elements: -

    -
    - - - - - - - - - - - - - - - - - - - - - -
    ElementDescription
    appender-ref - Zero or more elements allowed. Allows the logger to reference appenders by name. -
    level - Optional element, maximum of one allowed. Defines the logging level for this logger. - This logger will only accept event that are at this level or above. -
    param - Zero or more elements allowed. Logger specific parameters. -
    -
    -
    - -
    -

    - Renderer elements may only be defined as children of the <log4net> element. -

    -

    - An example renderer: -

    - ]]> - -

    - The <renderer> element supports the following attributes. -

    -
    - - - - - - - - - - - - - - - - - -
    AttributeDescription
    renderingClass - Required attribute. Value must be the type name for this renderer. If the type is - not defined in the log4net assembly this type name must be fully assembly qualified. - This is the type of the object that will take responsibility for rendering the - renderedClass. -
    renderedClass - Required attribute. Value must be the type name for the target type for this renderer. If the type is - not defined in the log4net assembly this type name must be fully assembly qualified. - This is the name of the type that this renderer will render. -
    -
    -

    - The <renderer> element supports no child elements. -

    -
    - -
    -

    - Parameter elements may be children of many elements. See the specific elements above for details. -

    -

    - An example param: -

    - ]]> - -

    - The <param> element supports the following attributes. -

    -
    - - - - - - - - - - - - - - - - - - - - - -
    AttributeDescription
    name - Required attribute. Value must be the name of the parameter to set on the parent object. -
    value - Optional attribute. One of value or type attributes must be specified. - The value of this attribute is a string that can be converted to the value of the - parameter. -
    type - Optional attribute. One of value or type attributes must be specified. - The value of this attribute is a type name to create and set as the value of the - parameter. If the type is not defined in the log4net assembly this type name must - be fully assembly qualified. -
    -
    -

    - The <param> element supports the following child elements: -

    -
    - - - - - - - - - - - - - -
    ElementDescription
    param - Zero or more elements allowed. Parameter specific parameters. -
    -
    -

    - An example param that uses nested param elements: -

    - - -]]> - -
    -

    - Configuration parameters map directly to writable properties on an object. - The properties available depend on the actual type of the object being - configured. The log4net SDK documentation contains the API reference for - all the components included in the log4net assembly. -

    -

    - For 3rd party components please see their relevant API reference for - details of the properties available. -

    -
    - -
    -

    - All parameters may alternately be specified using the parameter name as the element name - rather than using the param element and name attribute. -

    -

    - For example a param: -

    - - -]]> -

    - may be written as: -

    - - -]]> -
    -
    -
    - -
    - -
    - - diff --git a/xdocs/src/release/manual/contexts.xml b/xdocs/src/release/manual/contexts.xml deleted file mode 100755 index 96c7ce66..00000000 --- a/xdocs/src/release/manual/contexts.xml +++ /dev/null @@ -1,266 +0,0 @@ - - - - - - Nicko Cadell - Apache log4net Manual: Contexts - - - - - -
    - - -

    - Most real-world systems have to deal with multiple clients simultaneously. In a - typical multithreaded implementation of such a system, different threads will - handle different clients. Logging is especially well suited to trace and debug - complex distributed applications. An approach to differentiate the - logging output of one client from another is to instantiate a new separate - logger for each client. However this promotes the proliferation of loggers and - increases the management overhead of logging. -

    -

    - A lighter technique is to uniquely stamp each log request initiated from the - same client interaction. -

    -

    - Log4net supports different types of contextual logging and contexts with different scopes. -

    - -
    -

    - Contextual data can be set in different scopes. These contexts have progressively narrower visibility. - In the logging event itself the values from all of the contexts are combined together such that - values specified in a lower scoped context hide values from a higher context. -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ScopeTypeDescription
    Globallog4net.GlobalContext - The global context is shared by all threads in the current AppDomain. - This context is thread safe for use by multiple threads concurrently. -
    Threadlog4net.ThreadContext - The thread context is visible only to the current managed thread. -
    Logical Threadlog4net.ThreadLogicalContext - The logical thread context is visible to a logical thread. Logical - threads can jump from one managed thread to another. For more details - see the .NET API System.Runtime.Remoting.Messaging.CallContext. -
    Eventlog4net.Core.LoggingEvent - Each event captures the current contextual state at the time the event - is generated. Contextual data can be set on the event itself. This context - is only visible to the code generating the event itself. -
    -
    -
    - -
    -

    - The log4net contexts store properties, i.e. name value pairs. The name is a string - the value is any object. A property can be set as follows: -

    - -

    - If properties with the same name are set in more than one context scope then - the value in the narrowest scope (lower down in the list above) will hide the - other values. -

    -

    - The property values are stored as objects within the LoggingEvent. - The PatternLayout supports rendering the value of a named - property using the %property{name} syntax. The value is - converted to a string by passing it to the log4net.ObjectRenderer.RendererMap - which will locate any custom renderer for the value type. The default behavior for - custom types is to call the object's ToString() method. -

    - -
    -

    - An active property value is one who's value changes over time. -

    -

    - For example, imagine a custom type that implemented the - ToString() method to return the - number of bytes allocated by the runtime garbage collector. -

    - -

    - An instance of this type can be added to the log4net.GlobalContext - during application startup: -

    - -

    - Once this property is set in the context all subsequent logging events will have a property - called GCAllocatedBytes. The value of the property will be an instance of the - GCAllocatedBytesHelper type. When this value is rendered to a - string by calling the ToString method the current number of bytes - allocated by the garbage collector will be returned and included in the output. -

    -

    - Note that the ToStringmethod will not be - called until the LoggingEventis rendered, as - explained in the Fixingsection. An active property - is not eligible to be fixed unless it implements - IFixingRequired. -

    -
    -
    - -
    -

    - Some properties, e.g. the current thread property, or any - active properties, are not realised - until their containing LoggingEventis rendered. If the - LoggingEventis been sent to a buffering appender (such as - AdoNetAppender) then this rendering will not happen - unless the - BufferingAppenderSkeleton's - Fix propertyhas been set. In addition, an active property is not eligible to be fixed unless it implements - IFixingRequired. -

    -
    - -
    -

    - Sometimes simple key value pairs are not the most convenient way of capturing contextual - information. A stack of information is a very convenient way of storing data especially - as our applications tend to be stack based. -

    -

    - The ThreadContext and LogicalThreadContext - also support storing contextual data in a stack. The stack is stored in context property, - therefore stacks have names and more than one stack can exist in the same context. A property - value set in a narrower context would override a stack with the same property name set in a - wider scoped context. -

    -

    - The stack supports Push and Pop methods. - As more contextual data is pushed onto the stack the stack grows. When the stack is rendered - all the data pushed onto the stack is output with the most recent data to the right hand - end of the string. -

    -

    - As the stack is just an object stored in the context properties it is also rendered - using the same PatternLayout syntax: %property{name}. - Where name is the name of the stack. -

    -

    - Calls the the stack's Push and Pop - methods must be matched up so that each push has a corresponding pop. The - Push method also returns an IDisposable - object that will perform the required pop operation when it is disposed. This allows - the C# using syntax to be used to automate the stack management. -

    - -

    - The INFO level log has a stack stored in its NDC property. The top item in the - stack is the string context. - The using syntax ensures that the value context is popped off the stack - at the end of the block. -

    -

    - The using - syntax is recommended because it removes some work load from the developer and - reduces errors in matching up the Push and Pop calls, especially when exceptions - can occur. -

    -
    - -
    -

    - The NDC (Nested Diagnostic Context) exists for compatibility - with older versions of log4net. This helper class implements a stack which is stored - in the thread context property named NDC. -

    -
    - -
    -

    - The MDC (MappedDiagnostic Context) exists for compatibility - with older versions of log4net. This helper class implements a properties map which is - mapped directly through to the thread context properties. -

    -
    - -

    - To illustrate this point, let us take the example of a web service delivering - content to numerous clients. The web service can build the NDC at the very - beginning of the request before executing other code. The contextual - information can be the client's host name and other information inherent to the - request, typically information contained in cookies. Hence, even if the web - service is serving multiple clients simultaneously, the logs initiated by the - same code, i.e. belonging to the same logger, can still be distinguished - because each client request will have a different NDC stack. Contrast this with - the complexity of passing a freshly instantiated logger to all code exercised - during the client's request. -

    -

    - Nevertheless, some sophisticated applications, such as virtual hosting web - servers, must log differently depending on the virtual host context and also - depending on the software component issuing the request. Log4net supports - multiple logger repositories. This would allow each virtual host to possess its own copy - of the logger hierarchy. Configuring multiple logger hierarchies is beyond the - scope of this document. -

    - -
    - -
    diff --git a/xdocs/src/release/manual/internals.xml b/xdocs/src/release/manual/internals.xml deleted file mode 100755 index 650461d5..00000000 --- a/xdocs/src/release/manual/internals.xml +++ /dev/null @@ -1,261 +0,0 @@ - - - - - - Nicko Cadell - Apache log4net Manual: Internals - - - - - -
    - - -
    -

    - One of the often-cited arguments against logging is its computational cost. - This is a legitimate concern as even moderately sized applications can generate - thousands of log requests. Much effort was spent measuring and tweaking logging - performance. Log4net claims to be fast and flexible: speed first, flexibility - second. -

    -

    - The user should be aware of the following performance issues. -

    -
      -
    1. - Logging performance when logging is turned off. -

      - When logging is turned off entirely or just for a set of levels, the cost of a - log request consists of a method invocation plus an integer comparison. -

      -

      - However, The method invocation involves the "hidden" cost of parameter - construction. -

      -

      - For example, for some logger - log, writing, -

      -
      -log.Debug("Entry number: " + i + " is " + entry[i].ToString());
      -

      - incurs the cost of constructing the message parameter, i.e. converting both - integer - i - and - entry[i] - to strings, and concatenating intermediate strings, regardless of whether the - message will be logged or not. This cost of parameter construction can be quite - high and it depends on the number and type of the parameters involved. -

      -

      - To avoid the parameter construction cost write: -

      -
      -if(log.IsDebugEnabled)
      -{
      -    log.Debug("Entry number: " + i + " is " + entry[i].ToString());
      -}
      -

      - This will not incur the cost of parameter construction if debugging is - disabled. On the other hand, if the logger is debug-enabled, it will incur - twice the cost of evaluating whether the logger is enabled or not: once in - IsDebugEnabled - and once in - Debug. This is an insignificant overhead because - evaluating a logger takes about 1% of the time it takes to actually log. -

      -

      - Certain users resort to pre-processing or compile-time techniques to compile - out all log statements. This leads to perfect performance efficiency with - respect to logging. However, since the resulting application binary does not - contain any log statements, logging cannot be turned on for that binary. In - many people's opinion this is a disproportionate price to pay in exchange for a - small performance gain. -

      -
    2. -
    3. - The performance of deciding whether to log or not to log when logging is - turned on. -

      - This is essentially the performance of walking the logger hierarchy. When - logging is turned on, log4net still needs to compare the level of the log - request with the level of the request logger. However, loggers may not have an - assigned level; they can inherit them from the logger hierarchy. Thus, before - inheriting a level, the logger may need to search its ancestors. -

      -

      - There has been a serious effort to make this hierarchy walk to be as fast as - possible. For example, child loggers link only to their existing ancestors. In - the - BasicConfigurator - example shown earlier, the logger named - Com.Foo.Bar - is linked directly to the root logger, thereby circumventing the nonexistent - Com - or - Com.Foo - loggers. This significantly improves the speed of the walk, especially in - "sparse" hierarchies. -

      -

      - The typical cost of walking the hierarchy is typically 3 times slower than when - logging is turned off entirely. -

      -
    4. -
    5. - Actually outputting log messages -

      - This is the cost of formatting the log output and sending it to its target - destination. Here again, a serious effort was made to make layouts (formatters) - perform as quickly as possible. The same is true for appenders. -

      -
    6. -
    -

    - Although log4net has many features, its first design goal was speed. Some - log4net components have been rewritten many times to improve performance. - Nevertheless, contributors frequently come up with new optimizations. You - should be pleased to know that when configured with the - SimpleLayout - performance tests have shown log4net to log within an order of magnitude of - System.Console.WriteLine. -

    -
    - -
    -

    - The following is the series of steps and checks that a messages goes through while being logged. - For the purposes of this example we will document an INFO level - message being logged on logger ConsoleApp.LoggingExample. This logger is configured - to use the log4net.Appender.ConsoleAppender. The repository used - in this example is a log4net.Repository.Hierarchy object. -

    -
      -
    1. -

      - The user logs a message using the ILog.Info method on the logger - obtained using a call to log4net.LogManager.GetLogger("ConsoleApp.LoggingExample"). - For example: log4net.LogManager.GetLogger("ConsoleApp.LoggingExample").Info("Application Start"); - The ILog interface is actually an extension to log4net that provides level - specific logging methods (i.e. Debug, Info, Warn, Error, and Fatal). -

      -
    2. -
    3. -

      - The message is then logged through to the ILogger.Log method on the - appropriate log4net.Repository.Hierarchy.Logger object. The - ILogger.Log method takes the Level to - log at as a parameter and therefore works for all levels. -

      -
    4. -
    5. -

      - The repository threshold level is compared to the message level to determine if the message - can be logged. If the message level is below the threshold level the message is not logged. - In this case the repository is a log4net.Repository.Hierarchy object. -

      -
    6. -
    7. -

      - The Logger level is compared to the message level to determine if the - message can be logged. Note that the Logger level is inherited from a - parent Logger if not specified explicitly for this Logger. - If the message level is below the Logger level the message is not logged. -

      -
    8. -
    9. -

      - A LoggingEvent instance is created to encapsulate the message being logged. -

      -
    10. -
    11. -

      - The list of appenders for the Logger is built. This includes appenders - attached to parent Loggers except where excluded by the - Logger.Additivity property. -

      -
    12. -
    13. -

      - The LoggingEvent object is passed to the - IAppender.DoAppend method for each appender. -

      -
    14. -
    -

    - For Each Appender that the LoggingEvent is delivered to the following - actions take place: -

    -
      -
    1. -

      - The appender threshold level is compared to the message level to determine if the message - can be logged. If the message level is below the threshold level the message is not logged. -

      -
    2. -
    3. -

      - If the appender has a filter chain the LoggingEvent is passed down the - filter chain which can decide if the message can be logged or not. -

      -
    4. -
    5. -

      - Next an appender specific check is performed. Usually this check will verify that all the - required properties are set for the appender (e.g. a Layout is set if required). -

      -
    6. -
    7. -

      - The LoggingEvent is passed to the appender specific - Append method. What happens now is specific to the appender. -

      -
    8. -
    -

    - The following actions take place in the ConsoleAppender.Append method: -

    -
      -
    1. -

      - The ConsoleAppender uses a Layout to - format the message as a string for display. -

      -
    2. -
    3. -

      - The Layout uses the LoggingEvent.RenderedMessage - property to get the string for the message object. This uses the registered - IObjectRenderer for the type of the message object. -

      -
    4. -
    5. -

      - The message text is displayed on the console using the Console.WriteLine method. -

      -
    6. -
    -
    - -
    - -
    diff --git a/xdocs/src/release/manual/introduction.xml b/xdocs/src/release/manual/introduction.xml deleted file mode 100755 index 626b290d..00000000 --- a/xdocs/src/release/manual/introduction.xml +++ /dev/null @@ -1,1028 +0,0 @@ - - - - - - Nicko Cadell - Apache log4net Manual: Introduction - - - - - -
    - - -
    -

    - This document is based on Short introduction to log4j by Ceki Gülcü. -

    -

    - The log4net framework is based on log4j, see - http://logging.apache.org/log4j for more information on log4j. - The log4net framework, source code, binaries, documentation, examples and related - materials are published under the terms of the - Apache License, Version 2.0, - a copy of which has been included with this distribution in the LICENSE.txt file. -

    -

    - This document is an introduction to the log4net API, its unique features and - design rationale. Log4net is an open source project based on the work of many - authors. It allows the developer to control which log statements are output - with arbitrary granularity. It is fully configurable at runtime using external - configuration files. -

    -

    - Almost every large application includes its own logging or tracing API. - Inserting log statements into code is a low-tech method for debugging it. It - may also be the only way because debuggers are not always available or - applicable. This is usually the case for multithreaded applications and - distributed applications at large. -

    -

    - Once an application has been deployed it may not be possible to utilize - development and debugging tools. An administrator can use effective logging - systems to diagnose and fix many configuration issues. -

    -

    - Experience indicates that logging is an important component of the development - cycle. It offers several advantages. It provides precise context about the - execution of the application. Once inserted into the code, the generation of - logging output requires no human intervention. Moreover, log output can be - saved in persistent medium to be studied at a later time. In addition to its - use in the development cycle, a sufficiently rich logging package can also be - viewed as an auditing tool. -

    -

    - Logging does have its drawbacks. It can slow down an application. If too - verbose, it can cause scrolling blindness. To alleviate these concerns, log4net - is designed to be reliable, fast and extensible. Since logging is rarely the - main focus of an application, the log4net API strives to be simple to - understand and to use. -

    -
    - -
    -

    - Log4net is available for several frameworks. For each supported framework an - assembly targeting that framework is built: -

    -
      -
    • Microsoft .NET Framework 1.0 (1.0.3705)
    • -
    • Microsoft .NET Framework 1.1 (1.1.4322)
    • -
    • Microsoft .NET Framework 2.0 (2.0.50727)
    • -
    • Microsoft .NET Compact Framework 1.0
    • -
    • Microsoft .NET Compact Framework 2.0
    • -
    • Mono 1.0
    • -
    • Mono 2.0
    • -
    • Microsoft Shared Source CLI 1.0
    • -
    • CLI 1.0 Compatible
    • -
    -

    - Not all frameworks are created equal and some features have been excluded from - some of the builds. See the Framework Support - document for more information. -

    -
    - -
    -

    - Log4net has three main components: loggers, appenders and layouts. - These three types of components work together to enable developers to log - messages according to message type and level, and to control at runtime how - these messages are formatted and where they are reported. These components are - helped by filters that control the actions of the appender and - object renderers that turn objects into strings. -

    - -
    -

    - The first and foremost advantage of any logging API over plain - System.Console.WriteLine - resides in its ability to disable certain log statements while allowing others - to print unhindered. This capability assumes that the logging space, that is, - the space of all possible logging statements, is categorized according to some - developer-chosen criteria. -

    -

    - Loggers are named entities. Logger names are case-sensitive and they follow the - following hierarchical naming rule: -

    -
    -
    Named Hierarchy
    -
    -

    - A logger is said to be an ancestor of another logger if its name - followed by a dot is a prefix of the descendant logger name. A logger is - said to be a parent of a child logger if there are no ancestors - between itself and the descendant logger. -

    -

    - The hierarchy works very much in the same way as the namespace and class - hierarchy in .NET. This is very convenient as we shall soon see. -

    -
    -
    -

    - For example, the logger named - "Foo.Bar" - is a parent of the logger named - "Foo.Bar.Baz". Similarly, - "System" - is a parent of - "System.Text" - and an ancestor of - "System.Text.StringBuilder". This naming scheme - should be familiar to most developers. -

    -

    - The root logger resides at the top of the logger hierarchy. It is exceptional - in three ways: -

    -
      -
    1. - It always exists
    2. -
    3. - It cannot be retrieved by name
    4. -
    5. - It always has an assigned level
    6. -
    -

    - Loggers are retrieved using the static method from the - log4net.LogManager - class. The - GetLogger - methods take the name of the desired logger as a parameter. They are listed - below: -

    - -

    - The - GetLogger - methods that takes a - Type - parameter uses the fully qualified type name as the name of the logger to - retrieve. -

    -

    - These - GetLogger - methods return an - ILog - interface. That is the representation of the Logger passed back to the - developer. The - ILog - interface is defined below: -

    - -

    - Loggers may be assigned levels. Levels are instances of the - log4net.Core.Level - class. The following levels are defined in order of increasing priority: -

    -
      -
    • - ALL -
    • -
    • - DEBUG -
    • -
    • - INFO -
    • -
    • - WARN -
    • -
    • - ERROR -
    • -
    • - FATAL -
    • -
    • - OFF -
    • -
    -

    - If a given logger is not assigned a level, then it inherits one from its - closest ancestor with an assigned level. More formally: -

    -
    -
    Level Inheritance
    -
    -

    - The inherited level for a given logger X, is equal to the first - non-null level in the logger hierarchy, starting at X and proceeding - upwards in the hierarchy towards the root logger. -

    -
    -
    -

    - To ensure that all loggers can eventually inherit a level, the root logger - always has an assigned level. The default value for the root logger is - DEBUG. -

    -

    - Below are four tables with various assigned level values and the resulting - inherited levels according to the above rule. -

    -

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Logger name - Assigned level - Inherited level
    rootProotProot
    XnoneProot
    X.YnoneProot
    X.Y.ZnoneProot
    -
    -

    - In Example 1 above, only the root logger is assigned a level. This level - value, - Proot, is inherited by the other loggers - X, - X.Y - and - X.Y.Z. -

    -

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Logger name - Assigned level - Inherited level
    rootProotProot
    XPxPx
    X.YPxyPxy
    X.Y.ZPxyzPxyz
    -
    -

    - In Example 2 above, all loggers have an assigned level value. There is - no need for level inheritance. -

    -

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Logger name - Assigned level - Inherited level
    rootProotProot
    XPxPx
    X.YnonePx
    X.Y.ZPxyzPxyz
    -
    -

    - In Example 3 above, the loggers - root, - X - and - X.Y.Z - are assigned the levels - Proot, - Px - and - Pxyz - respectively. The logger - X.Y - inherits its level value from its parent - X. -

    -

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Logger name - Assigned level - Inherited level
    rootProotProot
    XPxPx
    X.YnonePx
    X.Y.ZnonePx
    -
    -

    - In Example 4 above, the loggers root and - X - and are assigned the levels - Proot - and - Px - respectively. The loggers - X.Y - and - X.Y.Z - inherits their level value from their nearest parent - X - having an assigned level. -

    -

    - Logging requests are made by invoking one of the printing methods of a logger - instance (through the log4net.ILog). These printing methods are - Debug, - Info, - Warn, - Error, and - Fatal. -

    -

    - By definition, the printing method determines the level of a logging request. - For example, if - log - is a logger instance, then the statement - log.Info("..") - is a logging request of level INFO. -

    -

    - A logging request is said to be enabled if its level is higher than or - equal to the level of its logger. Otherwise, the request is said to be disabled. - A logger without an assigned level will inherit one from the hierarchy. This - rule is summarized below. -

    -
    -
    Basic Selection Rule
    -
    -

    - A log request of level L in a logger with (either assigned or inherited, - whichever is appropriate) level K, is enabled if L >= K. -

    -
    -
    -

    - This rule is at the heart of log4net. It assumes that levels are ordered. For - the standard levels, we have - DEBUG < INFO < WARN < ERROR < FATAL. -

    -

    - Calling the - log4net.LogManager.GetLogger - method with the same name will always return a reference to the exact same - logger object. -

    -

    - For example, in: -

    - -

    - x - and - y - refer to exactly the same logger object. -

    -

    - Thus, it is possible to configure a logger and then to retrieve the same - instance somewhere else in the code without passing around references. In - fundamental contradiction to biological parenthood, where parents always - precede their children, log4net loggers can be created and configured in any - order. In particular, a "parent" logger will find and link to its descendants - even if it is instantiated after them. -

    -

    - Configuration of the log4net environment is typically done at application - initialization. The preferred way is by reading a configuration file. This - approach will be discussed shortly. -

    -

    - Log4net makes it easy to name loggers by software component. This can be - accomplished by statically instantiating a logger in each class, with the - logger name equal to the fully qualified name of the class. This is a useful - and straightforward method of defining loggers. As the log output bears the - name of the generating logger, this naming strategy makes it easy to identify - the origin of a log message. However, this is only one possible, albeit common, - strategy for naming loggers. Log4net does not restrict the possible set of - loggers. The developer is free to name the loggers as desired. -

    -

    - Nevertheless, naming loggers after the class where they are located seems to be - the best strategy known so far. It is simple an obvious to the developers where - each log message came from. Most importantly it leverages the design of the - application to produce the design of the logger hierarchy. Hopefully some - thought has gone into the design of the application. -

    -
    - -
    -

    - The ability to selectively enable or disable logging requests based on their - logger is only part of the picture. Log4net allows logging requests to print to - multiple destinations. In log4net speak, an output destination is called an appender. - Appenders must implement the log4net.Appenders.IAppender - interface. -

    -

    - The following appenders are defined in the log4net package: -

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Type - Description
    log4net.Appender.AdoNetAppender - Writes logging events to a database using either prepared statements or stored - procedures. -
    log4net.Appender.AnsiColorTerminalAppender - Writes color highlighted logging events to a an ANSI terminal window. -
    log4net.Appender.AspNetTraceAppender - 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. -
    log4net.Appender.BufferingForwardingAppender - Buffers logging events before forwarding them to child appenders. -
    log4net.Appender.ColoredConsoleAppender - Writes logging events to the application's Console. The events may go to either - the standard our stream or the standard error stream. The events may have configurable - text and background colors defined for each level. -
    log4net.Appender.ConsoleAppender - Writes logging events to the application's Console. The events may go to either - the standard our stream or the standard error stream. -
    log4net.Appender.EventLogAppender - Writes logging events to the Windows Event Log. -
    log4net.Appender.FileAppender - Writes logging events to a file in the file system. -
    log4net.Appender.ForwardingAppender - Forwards logging events to child appenders. -
    log4net.LocalSyslogAppender - Writes logging events to the local syslog service (UNIX only). -
    log4net.Appender.MemoryAppender - Stores logging events in an in memory buffer. -
    log4net.Appender.NetSendAppender - Writes logging events to the Windows Messenger service. These messages are - displayed in a dialog on a users terminal. -
    log4net.Appender.OutputDebugStringAppender - 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. -
    log4net.Appender.RemoteSyslogAppender - Writes logging events to a remote syslog service using UDP networking. -
    log4net.Appender.RemotingAppender - Writes logging events to a remoting sink using .NET remoting. -
    log4net.Appender.RollingFileAppender - 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. -
    log4net.Appender.SmtpAppender - Sends logging events to an email address. -
    log4net.Appender.SmtpPickupDirAppender - Writes SMTP messages as files into a pickup directory. - These files can then be read and sent by an SMTP agent - such as the IIS SMTP agent. -
    log4net.Appender.TelnetAppender - Clients connect via Telnet to receive logging events. -
    log4net.Appender.TraceAppender - Writes logging events to the .NET trace system. -
    log4net.Appender.UdpAppender - Sends logging events as connectionless UDP datagrams to a remote host or a - multicast group using a UdpClient. -
    -
    -

    - More than one appender can be attached to a logger. -

    -

    - - Each enabled logging request for a given logger will be forwarded to all - the appenders in that logger as well as the appenders higher in the hierarchy. - - In other words, appenders are inherited additively from the logger hierarchy. - For example, if a console appender is added to the root logger, then all - enabled logging requests will at least print on the console. If in addition a - file appender is added to a logger, say X, then enabled logging requests - for X and X's children will print on a file and on the - console. It is possible to override this default behavior so that appender - accumulation is no longer additive by setting the additivity flag on the logger - to - false. -

    -

    - The rules governing appender additivity are summarized below. -

    -
    -
    Appender Additivity
    -
    -

    - The output of a log statement of logger X will go to all the appenders - in X and its ancestors. This is the meaning of the term "appender - additivity". -

    -

    - However, if an ancestor of logger X, say Y, has the additivity - flag set to - false, then X's output will be directed to all - the appenders in X and it's ancestors up to and including Y but - not the appenders in any of the ancestors of Y. -

    -

    - Loggers have their additivity flag set to - true - by default. -

    -
    -
    -

    - The table below shows an example: -

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Logger Name - Added Appenders - Additivity Flag - Output Targets - Comment
    rootA1not applicableA1There is no default appender attached to root.
    xA-x1, A-x2trueA1, A-x1, A-x2Appenders of "x" and root.
    x.ynonetrueA1, A-x1, A-x2Appenders of "x" and root.
    x.y.zA-xyz1trueA1, A-x1, A-x2, A-xyz1Appenders in "x.y.z", "x" and root.
    securityA-secfalseA-secNo appender accumulation since the additivity flag is set to - false.
    security.accessnonetrueA-secOnly appenders of "security" because the additivity flag in "security" is set - to - false.
    -
    -
    - -
    -

    - Appenders can filter the events that are delivered to them. The filters can be - specified in the configuration to allow fine control of the events that are - logged through different appenders. -

    -

    - The simplest form of control is to specify a - Threshold - on the appender. This works by logging only the events that have a level that - is greater than or equal to the threshold. -

    -

    - More complex and custom event filtering can be done using the filter chain - defined on each appender. Filters must implement the - log4net.Filter.IFilter interface. -

    -

    - The following filters are defined in the log4net package: -

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Type - Description
    log4net.Filter.DenyAllFilter - Drops all logging events. -
    log4net.Filter.LevelMatchFilter - An exact match to the event's level. -
    log4net.Filter.LevelRangeFilter - Matches against a range of levels. -
    log4net.Filter.LoggerMatchFilter - Matches against a the start of the logger name. -
    log4net.Filter.PropertyFilter - Matches a substring from a specific property value. -
    log4net.Filter.StringMatchFilter - Matches a substring from the event's message. -
    -
    -

    - The filters can be configured to either accept or reject the event based upon - the match. -

    -
    - -
    -

    - More often than not, users wish to customize not only the output destination - but also the output format. This is accomplished by associating a layout - with an appender. The layout is responsible for formatting the logging request - according to the user's wishes, whereas an appender takes care of sending the - formatted output to its destination. The - PatternLayout, part of the standard log4net - distribution, lets the user specify the output format according to conversion - patterns similar to the C language - printf - function. -

    -

    - For example, the PatternLayout with the conversion pattern - "%timestamp [%thread] %-5level %logger - %message%newline" - will output something akin to: -

    - -

    - The first field is the number of milliseconds elapsed since the start of the - program. The second field is the thread making the log request. The third field - is the level of the log statement. The fourth field is the name of the logger - associated with the log request. The text after the '-' is the message of the - statement. -

    -

    - The following layouts are included in the log4net package: -

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Type - Description
    log4net.Layout.ExceptionLayout - Renders the exception text from the logging - event. -
    log4net.Layout.PatternLayout - Formats the logging event according to a flexible - set of formatting flags. -
    log4net.Layout.RawTimeStampLayout - Extracts the timestamp from the logging event. -
    log4net.Layout.RawUtcTimeStampLayout - Extracts the timestamp from the logging event in Universal Time. -
    log4net.Layout.SimpleLayout - Formats the logging event very simply: - [level] - [message] -
    log4net.Layout.XmlLayout - Formats the logging event as an XML element. -
    log4net.Layout.XmlLayoutSchemaLog4j - Formats the logging event as an XML element that - complies with the log4j event dtd. -
    -
    -
    - -
    -

    - Just as importantly, log4net will render the content of the log message - according to user specified criteria. For example, if you frequently need to - log - Oranges, an object type used in your current project, - then you can register an - OrangeRenderer - that will be invoked whenever an orange needs to be logged. -

    -

    - Object rendering follows the class hierarchy. For example, assuming oranges are - fruits, if you register an - FruitRenderer, all fruits including oranges will be - rendered by the - FruitRenderer, unless of course you registered an - orange specific - OrangeRenderer. -

    -

    - Object renderers have to implement the - log4net.ObjectRenderer.IObjectRenderer - interface. -

    -
    - -
    - -
    - -
    diff --git a/xdocs/src/release/manual/plugins.xml b/xdocs/src/release/manual/plugins.xml deleted file mode 100755 index 015f2bd6..00000000 --- a/xdocs/src/release/manual/plugins.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - Nicko Cadell - Apache log4net Manual: Plugins - - - - - -
    - - -
    -

    - Plugins are additional modular components that are attached to a logger repository. -

    -

    - Plugins are stored in the PluginMap of an - ILoggerRepository. - Plugins are attached to the repository by using the PluginMap.Add - method. -

    -

    - The following plugins are included in the log4net package: -

    -
    - - - - - - - - - -
    - Type - Description
    log4net.Plugin.RemoteLoggingServerPlugin - Creates a remote logging sink that can receive logging events from a - RemotingAppender. -
    -
    -
      -
    • -

      RemoteLoggingServerPlugin

      -

      - Creates a remote logging sink that can receive logging events from a - RemotingAppender. -

      -

      - Creates a remoting logging sink. A single - parameter must be passed to the constructor that specifies the sink URI. This is a - name used to identify the logging sink object published via remoting and must be - agreed with the client before communication can take place. -

      -

      - Example usage: -

      - -
    • -
    - -
    -

    - Plugins can be configured using the following assembly-level attributes: -

    -
      -
    • -

      PluginAttribute

      -

      - Specifies a plugin type to create and attach to the default repository. This attribute - does not allow plugins to be parameterized. The plugin class must have a public default constructor. -

      -

      - This attribute may be used as many times as necessary to attach plugins to the repository. -

      -
    • -
    -
    -
    - -
    - -
    diff --git a/xdocs/src/release/manual/repositories.xml b/xdocs/src/release/manual/repositories.xml deleted file mode 100755 index 0a1e8382..00000000 --- a/xdocs/src/release/manual/repositories.xml +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - Nicko Cadell - Apache log4net Manual: Repositories - - - - - -
    - - -
    -

    - Logging repositories are considered advanced functionality. The default behavior - should be sufficient for most users. -

    -

    - Log4net supports logging repositories. A repository is uniquely named. - Each repository is a (ILoggerRepository). - Multiple assemblies can link to the same repository. -

    -

    - By default there is a single logging repository per process (more precisely per AppDomain). This extends - across all assemblies loaded into the process and allows them to all share a - single configuration. The configuration of the repository only needs to be done once, - typically in the entry point to the application, either programmatically or using - a configuration attribute. -

    -

    - Named logging repositories can be created using the LogManager.CreateRepository - method. The repository for can be retrieved using the - LogManager.GetRepository method. - A repository created in this way will need to be configured programmatically. -

    - -
    -

    - An assembly may choose to utilize a named logging repository rather than the default repository. - This completely separates the logging for the assembly from the rest of the application. - This can be very useful to component developers that wish to use log4net for their - components but do not want to require that all the applications that use their - component are aware of log4net. It also means that their debugging configuration is - separated from the applications configuration. The assembly should specify the - RepositoryAttribute to set its logging repository. -

    -

    - The log4net logging repositories can be configured using the following assembly-level - attributes: -

    -
      -
    • - AliasRepositoryAttribute -

      - Specifies a named repository to use as this assembly's repository. -

      -

      - An assembly's logger repository is defined by its - RepositoryAttribute, however this can be overridden by an - assembly loaded before the target assembly. -

      -

      - An assembly can alias another assembly's repository by specifying - this attribute with the name of the target repository. -

      -

      - This attribute may be used as many times as necessary to alias all the required - repositories. -

      -
    • -
    • - RepositoryAttribute -

      - Specifies the logging repository for the assembly. -

      -

      - Assemblies are mapped to logging repositories. This attribute controls the configuration of the repository. The - Name property specifies the name of the repository - for this assembly. The RepositoryType - property specifies the type of the repository object to create for the assembly. - If this attribute is not specified and a Name - is not specified then the assembly will be part of the default shared logging - repository. -

      -

      - This attribute may only be used once per assembly. -

      -
    • -
    -
    -
    -
    - -
    diff --git a/xdocs/src/release/release-notes.xml b/xdocs/src/release/release-notes.xml deleted file mode 100755 index b8346208..00000000 --- a/xdocs/src/release/release-notes.xml +++ /dev/null @@ -1,1085 +0,0 @@ - - - - - - Nicko Cadell - Apache log4net: Release Notes - - - - - -
    - - - -
    - -
    -
      -
    • [LOG4NET-21] - RemotingAppender fails once NDC becomes empty
    • -
    • [LOG4NET-22] - XmlLayout allows output of invalid control characters
    • -
    • [LOG4NET-23] - example-apps.html links are off by one folder level
    • -
    • [LOG4NET-25] - RollingFileAppender can fail if RollOverIfDateBoundaryCrossing required
    • -
    • [LOG4NET-28] - AdoNetAppender does not support inserting NULL into columns
    • -
    • [LOG4NET-29] - LevelMatchFilter should return Neutral when no match is found
    • -
    • [LOG4NET-32] - AdoNetAppender losing first entry
    • -
    • [LOG4NET-35] - Exception rendering ThreadContextStack if null value pushed into stack
    • -
    • [LOG4NET-36] - System.Diagnostics.Trace may throw exception if AppDomain does not have config file
    • -
    • [LOG4NET-40] - RollingFileAppender does not limit files to MaxSizeRollBackups when CountDirection is 1
    • -
    • [LOG4NET-41] - RollingFileAppender roll over date fail
    • -
    • [LOG4NET-42] - Serialised LoggingEvent does not preserve the Fix flags
    • -
    • [LOG4NET-43] - Specifying an empty string as a property in the config file results in an error
    • -
    • [LOG4NET-44] - XmlLayout emits all properties under a node named global-properties, rather than just properties.
    • -
    • [LOG4NET-49] - CountingQuietTextWriter does not count strings written with WriteLine
    • -
    • [LOG4NET-50] - Process.StartTime hangs on some systems
    • -
    • [LOG4NET-60] - Bug in RollingFileAppender.cs causing failure to timely roll files on monthly interval
    • -
    • [LOG4NET-63] - 1.2.9.0 Documentation typos
    • -
    • [LOG4NET-65] - Unhandled SecurityException exception for FileIOPermission while loading configuration file
    • -
    • [LOG4NET-67] - CVE-2006-0743 Security vulnerability in LocalSyslogAppender
    • -
    • [LOG4NET-69] - Exception thrown when *Format methods are given a malformed format string
    • -
    • [LOG4NET-70] - CoreDll.dll referenced with different capitalisation
    • -
    • [LOG4NET-73] - ADONetAppender.ActivateOptions() leaks database connection when called multiple times
    • -
    -
    - -
    -
      -
    • [LOG4NET-11] - Add Flush command to API
    • -
    • [LOG4NET-24] - Programmatic flush of BufferingAppenderSkeleton buffer
    • -
    • [LOG4NET-37] - Allow the RepositorySelector type to be specified using the AppSettings config
    • -
    • [LOG4NET-46] - Support appenders that can output multiple events efficiently
    • -
    • [LOG4NET-51] - WmiAppender
    • -
    -
    - -
    -
      -
    • [LOG4NET-3] - Support per event patterns in FileAppender File name
    • -
    • [LOG4NET-13] - Allow SMTPAppender to have replaceable parameters in Subject
    • -
    • [LOG4NET-15] - Email high "importance" priority setting with SmtpAppender
    • -
    • [LOG4NET-17] - Line-wrapping Appender Layouts
    • -
    • [LOG4NET-33] - Ability to use global property to point to log4net configuration file
    • -
    • [LOG4NET-34] - Allow xml config values to be set via XmlNodeType.CDATA or XmlNodeType.Text rather than just value="foo"
    • -
    • [LOG4NET-45] - PluginAttribute does not allow plugin type to be specified as a Type, only as a string
    • -
    • [LOG4NET-52] - Allow XML configurator to set properties of type Object
    • -
    • [LOG4NET-53] - Allow repository properties to be set in the config file
    • -
    • [LOG4NET-56] - Support rendering IEnumerator objects as well as ICollections
    • -
    • [LOG4NET-58] - Support clean build on .NET 2.0
    • -
    • [LOG4NET-72] - Performance of ILog.xxxFormat methods
    • -
    • [LOG4NET-74] - Change MemoryAppender member variables to protected
    • -
    -
    - -
    - -
    - -
    -
      -
    • -

      Renamed namespaces

      -

      - Renamed namespace log4net.spi to log4net.Core. - Renamed namespace log4net.helpers to log4net.Util. -

      -
    • -
    • -

      Renamed config classes and attributes

      -

      - In the log4net.Config namespace the DOMConfigurator, - DOMConfiguratorAttribute, DomainAttribute, - and AliasDomainAttribute have been marked as obsolete. These types are - still available and functional in this release. -

      -

      - The XmlConfigurator and XmlConfiguratorAttribute - types replace DOMConfigurator and - DOMConfiguratorAttribute. The RepositoryAttribute - and AliasRepositoryAttribute types replace - DomainAttribute and AliasDomainAttribute. -

      -
    • -
    • -

      Fixed pascal casing of type names

      -

      - Renamed AdoNetAppender, AspNetTraceAppender, - SmtpAppender, Iso8601DateFormatter, - MdcFilter, and NdcFilter. - 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. -

      -
    • -
    • -

      Layouts changed to stream their output to a TextWriter

      -

      - Layouts have been changed to format their output to a TextWriter - rather than return a string. This increases performance and reduces temporary object creation. -

      -
    • -
    • -

      C style string escapes no longer supported by config parser

      -

      - The XML config parser no longer supports decoding C style escape sequences in strings. - Previously sequences like \n and \\ - where decoded. Instead use the appropriate XML encodings as required. -

      -
    • -
    -
    - -
    -
      -
    • -

      New CLI build

      -

      - 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. -

      -

      - This build is only available in release configuration and can be found at - bin\cli\1.0\release. -

      -
    • -
    • -

      Logging contexts

      -

      - 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 - MDC and NDC and a replacement for - them. The MDC and NDC have been - reimplemented to use the ThreadContext as storage. -

      -

      - 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: - GlobalContext, ThreadContext, - LogicalThreadContext, and LoggingEvent. - Context values specified in a narrower scope hide the matching value in a wider scope. -

      -
    • -
    • -

      PatternLayout customization and long pattern names

      -

      - The PatternLayout now supports long pattern names. - These pattern names are significantly more readable than the single character patterns. -

      -

      - The PatternLayout now supports custom patterns. New patterns - can be defined in the config file: -

      -
      -<layout type="log4net.Layout.PatternLayout">
      -
      -  <converter>
      -    <name value="myConverter" />
      -    <type value="TestApp.MyPatternConverter, TestApp" />
      -  </converter>
      -
      -  <conversionPattern value="%-5level %logger - %myConverter - %message%newline" />
      -</layout>
      -

      - The above config defines a custom pattern called myConverter - which is bound to the TestApp.MyPatternConverter, TestApp - type. This type must extend the log4net.Util.PatternConverter - base class. The custom pattern can then be used in the pattern string. -

      -

      - For full details see the SDK Reference entry: log4net.Layout.PatternLayout. -

      -
    • -
    • -

      PatternString for pattern based configuration

      -

      - A new pattern based type, PatternString, 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: -

      -
      -<file type="log4net.Util.PatternString">
      -
      -  <converter>
      -    <name value="folder" />
      -    <type value="TestApp.SpecialFolderPatternConverter,TestApp" />
      -  </converter>
      -
      -  <conversionPattern value="%folder{LocalApplicationData}\log-file.txt" />
      -</file>
      -

      - The code for the SpecialFolderPatternConverter - is as follows: -

      -
      -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));
      -  }
      -}
      -

      - For full details see the SDK Reference entry: log4net.Util.PatternString. -

      -
    • -
    • -

      Loading configuration from a URI

      -

      - The XmlConfigurator methods now support loading the - configuration data from a URI. Config can be loaded from any URI supported by the - System.Net.WebRequest class. -

      -
    • -
    • -

      Support for No-Touch deployment

      -

      - Log4net supports configuring No-Touch deployment applications using the - XmlConfiguratorAttribute. If a relative config file - or extension is specified then this is resolved relative to the deployment - URI. -

      -
    • -
    • -

      Config file parser enhancements

      -

      - The config file parser has been enhanced to support specifying the property subtype, or intermediate type, - directly on the property element, for example: -

      -
      -<layout type="log4net.Layout.PatternLayout" value="%message%newline" />
      -

      - Implicit conversion will be attempted between the value string and the type specified, - and then again between the type and the target property type. -

      -
    • -
    • -

      .NET string formatting syntax

      -

      - Added .NET String.Format style formatting syntax methods to - the ILog interface. The new methods are: - DebugFormat, InfoFormat, - WarnFormat, ErrorFormat - and FatalFormat. -

      -
    • -
    • -

      Customizable levels

      -

      - Levels are defined by the repository LevelMap. The defined - levels, the relative ordering of levels and level display names can be configured on - a per-repository basis. -

      -
    • -
    • -

      Per-appender security contexts

      -

      - 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 SecurityContext can be used to elevate the - privileges of the appender. The WindowsSecurityContext - is used to specify alternative credentials on the Windows platform. -

      -
    • -
    • -

      Added new appenders

      -
      -
      AnsiColorTerminalAppender
      -
      -

      - The AnsiColorTerminalAppender 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 ColoredConsoleAppender instead. -

      -
      -
      LocalSyslogAppender
      -
      -

      - 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! -

      -
      -
      RemoteSyslogAppender
      -
      -

      - The RemoteSyslogAppender uses the BSD syslog protocol to - log to a syslog daemon. The syslogd listens for for messages on UDP port 514. -

      -
      -
      TelnetAppender
      -
      -

      - The TelnetAppender 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. -

      -
      -
      -
    • -
    • -

      Added new LoggerMatchFilter filter

      -

      - Added LoggerMatchFilter which matches a string against - the event's logger name. -

      -
    • -
    • -

      Pluggable file locking models for the FileAppender

      -

      - The FileAppender (and by extension the - RollingFileAppender) now support pluggable file - locking models. The default model, ExclusiveLock, - maintains the current exclusive file locking behavior. An alternative - model, MinimalLock, can be used to support writing to - a single output file from multiple processes. -

      -

      - For full details see the SDK Reference entry: log4net.Appender.FileAppender.LockingModel. -

      -
    • -
    • -

      RollingFileAppender roll once

      -

      - The RollingFileAppender now supports a new - rolling style, Once. In this mode the appender - will roll the file once per run. -

      -
    • -
    • -

      SmtpAppender authentication

      -

      - On the .NET 1.1 platform only, the SmtpAppender supports authenticating - against the mail server using either username and password or integrated NTLM authentication. -

      -
    • -
    • -

      AdoNetAppender ReconnectOnError

      -

      - Added new configuration property to AdoNetAppender. - Setting ReconnectOnError to true - will force the appender to attempt to reconnect to the database if the connection - is lost. -

      -
    • -
    • -

      UdpAppender hostname support

      -

      - The UdpAppender config property RemoteAddress - can now be specified as a DNS hostname string. The hostname is resolved to an IP address. -

      -
    • -
    -
    - -
    -
      -
    • -

      FxCop compliance

      -

      - Updates to bring the internal code in line with the current FxCop rules. -

      -
    • -
    • -

      Separate NUnit tests

      -

      - Moved the NUnit tests into a separate project, log4net.Tests. -

      -
    • -
    • -

      Bug Fixes

      -
      -
      RemotingAppender
      -
      -

      - Sends events from a ThreadPool thread - rather than the calling thread to prevent transfer, - and potential loss, of the CallContext. -

      -
      -
      RollingFileAppender
      -
      -

      - Fixed date rolling period detection for non UTC timezones. -

      -
      -
      ColoredConsoleAppender
      -
      -

      - 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. -

      -
      -
      -
    • -
    -
    - -
    - -
    -
      -
    • -

      Changed assembly name to log4net

      -

      - The build output is now log4net.dll - for all frameworks. This is a breaking change. -

      -

      - 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 log4net. - 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. -

      -
    • -
    • -

      Combined Release and ReleaseStrong builds

      -

      - The Release and ReleaseStrong builds have been consolidated into - a single build called Release. This Release build is strongly named. -

      -
    • -
    • -

      New Appender: ColoredConsoleAppender

      -

      - The ColoredConsoleAppender writes events to the - application's console. It can be configured to specify the text and background - colors for different level events. -

      -
    • -
    • -

      New Appender: SmtpPickupDirAppender

      -

      - The SmtpPickupDirAppender 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. -

      -
    • -
    • -

      New Layout: XmlLayoutSchemaLog4j

      -

      - This new layout formats the logging events as XML which complies with - the 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 UdpAppender. -

      -
    • -
    • -

      New PatternLayout conversion characters

      -

      - Added support for capturing the current thread principal name and the - app domain friendly name for each logging event. -

      -
      -
      %a
      -
      - Used to output the friendly name of the AppDomain where the - logging event was generated. -
      -
      %u
      -
      - Used to output the user name for the currently active user - (Principal.Identity.Name). -
      -
      -
    • -
    • -

      Types specified in the config file are now loaded ignoring case

      -

      - All types specified in the configuration files are now loaded - using a case insensitive method. -

      -
    • -
    • -

      Fine grained fixing for buffered events

      -

      - The LoggingEvent 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 Fix - property takes a combination of the FixFlags - enumeration values. -

      -
    • -
    • -

      Code updated inline with FxCop 1.21

      -

      - In line with the FxCop 1.21 guidelines: - Sealed utility classes. Added serialization security demand to GetObjectData. - Renamed parameters. -

      -
    • -
    • -

      EventLogAppender 32K Limit

      -

      - 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. -

      -
    • -
    -
    - -
    -
      -
    • -

      Updated to support the Microsoft .NET Framework 1.1 Final

      -

      - Updated to support the Microsoft .NET Framework 1.1 Final Beta (1.1.4322). -

      -
    • -
    • -

      Features document

      -

      - Added a new document that covers the main features of log4net. - See the features - document for more information. -

      -
    • -
    • -

      Hierarchy disabled until it is configured

      -

      - 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. -

      -

      - If you are configuring log4net programmatically (i.e. not using - one of the built-in configurators) you must set the - ILoggerRepository.Configured property - to true once you have configured - the repository. -

      -

      - 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. -

      -
    • -
    • -

      New examples in VisualBasic.NET, JScript and Managed C++

      -

      - New examples in VisualBasic.NET, JScript and Managed C++. - TODO Link to document about examples. -

      -
    • -
    • -

      Code and Documentation Updates

      -

      - Code fixes. Documentation and manual updates. - See the ChangeLog for more information. -

      -
    • -
    • -

      Added document with example appender configurations

      -

      - See the Example Appender Configuration - document for more information. -

      -
    • -
    -
    - -
    -
      -
    • -

      Added support for multiple frameworks

      -

      - log4net 1.2.0 beta 6 adds support for the the following frameworks: -

      -
      - - - - - - - - - - - - - - - - - - - - - - - - -
      - Framework - Website
      Microsoft .NET Framework 1.1 Final Beta (1.1.4322)http://msdn.microsoft.com/net
      Microsoft .NET Compact Framework 1.0 (1.0.5000)http://msdn.microsoft.com/vstudio/device/compactfx.asp
      Mono 0.23http://www.go-mono.org
      Microsoft Shared Source CLI 1.0http://msdn.microsoft.com/library/en-us/dndotnet/html/mssharsourcecli.asp
      -
      -
      -

      - Not all frameworks are created equal and some features have been excluded from - some of the builds. See the Framework Support document for more information. -

      -
    • -
    • -

      New build system using NAnt

      -

      - The new build system allows log4net to be built for all supported frameworks and - in all build configurations in one go. -

      -
    • -
    • -

      New source code & distribution layout

      -

      - The source code & distribution layout has been updated to support the new - build environment and multiple target frameworks. -

      -
    • -
    • -

      Removed DomainAttribute.UseDefaultDomain property

      -

      - Updated default behavior of DefaultRepositorySelector. Assemblies - are now by default placed into the default domain. To specify another domain, - the DomainAttribute must be used. This is the opposite behavior - to what was previously available. If you were previously specifying the DomainAttribute.UseDefaultDomain - property then you should remove it, and if the default behavior is now - sufficient, you do not need to specify the DomainAttribute at all. -

      -
    • -
    • -

      Updated configuration file parser

      -

      - Updated config file parser to use the element name as the property to set. Also - removed <object> tag, the type attribute can now be - specified on the property element directly. -

      -

      - For example: -

      -
      -<appender>
      -  <param name="Evaluator">
      -    <object type="log4net.spi.LevelEvaluator">
      -      <constructor>
      -        <param type="log4net.spi.Level" value="DEBUG"/>
      -      </constructor>
      -    </object>
      -  </param>
      -</appender>
      -

      - becomes: -

      -
      -<appender>
      -  <evaluator type="log4net.spi.LevelEvaluator">
      -    <threshold value="DEBUG"/>
      -  </evaluator>
      -</appender>
      -
    • -
    • -

      Support for event ID

      -

      - The EventLogAppender now supports setting the event ID in the - event log, this is taken from the EventID property from the per - event Properties map on the LoggingEvent. -

      -
    • -
    • -

      Updated ADONetAppender

      -

      -

        -
      • - Added support for prepared statements and stored procedures
      • -
      • - Added RawTimeStampLayoutto correctly convert the timestamps into - database date time format
      • -
      • - Added ExceptionLayout to render the exception data
      • -
      -

      -

    • -
    • -

      Support for front-end extension

      -

      - This allows the logging API to be wrapped or adapted for specific purposes. Two - extension samples are included in the distribution: -

      -
      - - - - - - - - - - - - - - - - - -
      - Extension - Description
      log4net.Ext.TraceAdds trace logging methods
      log4net.Ext.EventIDAdds additional eventId parameter to all methods
      -
      -

      -

    • -
    • -

      Added ForwardingAppender

      -

      Forwards events to multiple sub appenders after applying filter rules.

      -
    • -
    • -

      Added BufferingForwardingAppender

      -

      Forward events to sub appenders after buffering them.

      -
    • -
    • -

      Added ASPNetTraceAppender

      -

      Logs events to the ASP.NET trace system.

      -
    • -
    • -

      Added NetSendAppender

      -

      Delivers logging events using the Windows Messenger service.

      -
    • -
    • -

      Added UdpAppender

      -

      Sends logging events as connectionless UDP datagrams to a remote host or a - multicast group.

      -
    • -
    • -

      Removed obsolete methods

      -
    • -
    • -

      Lots of updates to improve our compliance with FxCop

      -
    • -
    • -

      Improved SDK documentation

      -
    • -
    -
    - -
    -
      -
    • -

      Fixed Exception thrown when DOM Configurator called with a null XML - Element.

      -

      This occurred if the configuration file did not have a log4net section defined.

      -
    • -
    • -

      Made level lookup case insensitive

      -
    • -
    • -

      Prevented the Hierarchy's Threshold level from being set to a null reference

      -
    • -
    -
    - -
    -
      -
    • -

      Added event specific properties to the logging event object

      -

      - Appenders can add additional information to the events they are logging. The RemotingAppender - and the SMTPAppender both add a 'hostname' property to the events. - These properties can be accessed using the PatternLayout with the - %P{name} syntax. -

      -
    • -
    • -

      Added a plugin framework

      -

      An IPlugin interface can be attached to any repository.

      -
    • -
    • -

      A new RemoteLoggingServerPlugin plugin acts as the server for the - RemotingAppender

      -
    • -
    • -

      Updated the core log4net framework to work in an environment with no - permissions

      -

      Specific appenders still require additional permissions to log correctly

      -
    • -
    • -

      Added support for domain aliasing using the AliasDomainAttribute

      -

      This allows a parent assembly to take control of the logging domain for child - assemblies.

      -
    • -
    • -

      Added events for repository creation, configuration change, configuration reset - and repository shutdown

      -
    • -
    • -

      Added LevelMap to the ILoggerRepository interface

      -

      The mapping from level name to level object is now repository specific, - therefore each repository can have independent mappings.

      -
    • -
    • -

      Moved hierarchy specific config file parser to new DOMHierarchyConfigurator class

      -

      This is controlled by the Hierarchy object and allows for better - encapsulation.

      -
    • -
    • -

      Added OnlyFixPartialEventData property to the buffered appenders

      -

      This setting causes slow settings to be ignored. This significantly improves the - performance of the buffered appenders.

      -
    • -
    • -

      XML entity references are supported in the XML config file.

      -
    • -
    • -

      Added support for expanding environment variables in <param> values

      -

      - The environment variables must be specified as ${FOO} where FOO - is the name of the variable to expand. -

      -
    • -
    • -

      Upgraded to use NUnit 2.0

      -
    • -
    • -

      File appenders can specify the encoding to use for the file

      -
    • -
    • -

      Added strong named configuration

      -
    • -
    -
    - -
    -
      -
    • -

      Added log4net.Ext.Trace extension

      -

      This is a separate assembly that adds a trace level to log4net.

      -
    • -
    • -

      The default log file output directory is now the application base directory not - the current directory

      -
    • -
    • -

      Added MemoryAppender

      -

      Stores all the logging events in an in-memory buffer.

      -
    • -
    • -

      Moved the Hierarchy implementation into a separate namespace

      -

      - The log4net.Repository.Hierarchy namespace now contains all the - code that is specific to the Hierarchy implementation. -

      -
    • -
    • -

      Refactored the DOMConfigurator and BasicConfigurator

      -

      - The Hierarchy specific data schema and implementation could be has - now been moved to the log4net.Repository.Hierarchy namespace. The - bootstrap code for these configurators remains in the log4net.Config - namespace. -

      -
    • -
    • -

      Replaced the DOMConfiguratorAttribute UseExecutableDomain - property with UseDefaultDomain

      -

      - This change to the implementation of the DOMConfiguratorAttribute should - allow the configuration of multiple assemblies to be accomplished more easily, - especially when developing web applications (ASP.NET). -

      -
    • -
    • -

      A few good bug fixes!

      -
    • -
    -
    - -
    -
      -
    • -

      Added ADONetAppender

      -

      Thanks to TechnologyOneCorp.com.

      -
    • -
    • -

      Added TraceLogAssembly extensibility example

      -
    • -
    • -

      Lots of bug fixes

      -
    • -
    -
    - -
    -
      -
    • -

      Added 6 new examples

      -
    • -
    • -

      Split Category class into Logger and LogManager classes

      -

      - The instance methods from Category have moved to the Logger - class. The static methods from Category have moved to the LogManager - class. The Category class still exists but for backward - compatibility only. Changed interface ICategoryFactory to ILoggerFactory - and the implementation class DefaultCategoryFactory to DefaultLoggerFactory. -

      -
    • -
    • -

      Replaced Priority class with Level class

      -

      - The Priority class has been replaced by the Level class. - The Priority class still exists for backward compatibility only. - The Level class implements a static pool of Level objects. - The Level class is sealed and serializable. -

      -
    • -
    • -

      Added ILoggerRepository interface implemented by Hierarchy

      -

      - The Hierarchy class implements the ILoggerRepository interface. - This interface is used by the LogManager class and therefore - allows different implementations of ILoggerRepository to be used. -

      -
    • -
    • -

      Enhanced NUnit tests

      -

      - All the NUnit tests can be run using a single TestSuite: NUnitGUI - log4net.LogManager+AllTests,log4net.dll. -

      -
    • -
    • -

      Added support for serializing LoggingEvents

      -

      - The LoggingEvent class is serializable. All local state is - captured before serialization occurs. This now allows LoggingEvent - objects to be serialized between applications or machines. -

      -
    • -
    • -

      Added RemotingAppender

      -

      - Delivers LoggingEvents 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 examples\net\remoting\RemotingServer - for details. -

      -
    • -
    • -

      Added support for rendering composite objects

      -

      - The IObjectRenderer interface method DoRender now - takes a RendererMap argument. This allows the renderer to use the - appropriate renderer from the RendererMap to render any nested - objects. -

      -
    • -
    • -

      Added support for rendering exceptions

      -

      - The DefaultRenderer now has support for rendering exceptions to a - string. This includes nested exceptions. The RendererMap is now - used to render exceptions in the LoggingEvent. This allows the - rendering of specific exceptions to be enhanced by specific renderers. -

      -
    • -
    • -

      Added ITriggeringEventEvaluator interface

      -

      - This interface is used by SMTPAppender and RemotingAppender - to determine if a LoggingEvent 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 LevelEvaluator class, which triggers above a - set level. -

      -
    • -
    • -

      Added regex matching to the MDCFilter, NDCFilter and StringMatchFilter

      -

      - The MDCFilter, NDCFilter and StringMatchFilter - can now be configured to use regex matches in addition to substring matches. - Set the RegexToMatch property to use this feature. -

      -
    • -
    • -

      Added XMLLayout

      -

      - emits an XML element for each LoggingEvent. This allows logging - events to be stored and manipulated as XML. The DTD for the XML emitted is in - the log4net-events.dtd -

      -
    • -
    • -

      Added support for <logger> and <level> elements in the - DOMConfigurator

      -

      - As the Category and Priority classes have been - replaced by the Logger and Level classes. The DOMConfigurator - has been updated to allow the <logger> and <level> - elements to be used in place of the <category> and <priority> - elements. The old elements are still accepted for backward compatibility. -

      -
    • -
    • -

      Added Threshold property to Hierarchy

      -

      - Changed DisableXXX() methods on Hierarchy to a Threshold - property. -

      -
    • -
    • -

      Added support for logging domains

      -

      - The LogManager supports multiple logging domains. The LogManager - uses an instance of the IRepositorySelector class to map from - domains to ILoggerRepository instances. The default implementation - is to have a separate ILoggerRepository for each domain. When a - call is made to the static methods on LogManager 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 ILoggerRepository. 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. -

      -
    • -
    • -

      DOMConfigurator can set params to arbitrary objects

      -

      - Using a new <object> element, params can now be set to any - creatable object. -

      -
    • -
    -
    - -
    - -
    diff --git a/xdocs/src/roadmap.xml b/xdocs/src/roadmap.xml deleted file mode 100755 index bbffc23f..00000000 --- a/xdocs/src/roadmap.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - Nicko Cadell - Apache log4net: Development Roadmap - - - - - -
    -

    - The log4net development roadmap is managed by our JIRA issue tracking system. -

    -

    - For a list of upcoming fixes and in-progress tasks see: -

    - -
    - - - -
    diff --git a/xdocs/src/stylesheets/project.xml b/xdocs/src/stylesheets/project.xml deleted file mode 100755 index 557a2e01..00000000 --- a/xdocs/src/stylesheets/project.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - log4net - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/xdocs/src/stylesheets/site.vsl b/xdocs/src/stylesheets/site.vsl deleted file mode 100755 index 25910232..00000000 --- a/xdocs/src/stylesheets/site.vsl +++ /dev/null @@ -1,406 +0,0 @@ - - - - - - ## Defined variables - #set ($bodybg = "#ffffff") - #set ($bodyfg = "#000000") - #set ($bodylink = "#525D76") - - #set ($titlebg = "#FFFFFF") - #set ($titlefg = "#2222AA") - -## #set ($bannerbg = "#525D76") - #set ($bannerbg = "#FFFFFF") - #set ($bannerfg = "#2222AA") - - #set ($subbannerbg = "#828DA6") - #set ($subbannerfg = "#ffffff") - #set ($tablethbg = "#039acc") - #set ($tabletdbg = "#a0ddf0") - - -#document() - - -## This is where the macro's live - -#macro ( projectanchor $name $value ) -#if ($value.startsWith("http://")) - $name -## #elseif ($value.startsWith("/site")) -## $name -#else - $name -#end -#end - -#macro ( metaauthor $author $email ) - - -#end - -#macro ( image $value ) -#if ($value.getAttributeValue("width")) -#set ($width=$value.getAttributeValue("width")) -#end -#if ($value.getAttributeValue("height")) -#set ($height=$value.getAttributeValue("height")) -#end -#if ($value.getAttributeValue("align")) -#set ($align=$value.getAttributeValue("align")) -#end - -#end - -#macro ( old_source $value ) -
    - - - - - - - - - - - - - - - - -
    $escape.getText($value.getText())
    -
    -#end - -#macro ( source $value ) - -
    $escape.getText($value.getText())
    - -#end - -## =================================== -## titleSection macro -## =================================== -#macro ( titleSection $titleSection) - $titleSection.getAttributeValue("name") -#end - -## ================================ -## section macro -## ================================ -#macro ( section $section $level ) - #if($section.getAttributeValue("id")) - $section.getAttributeValue("name") - #else - $section.getAttributeValue("name") - #end -
    - #foreach ( $item in $section.getChildren() ) - #if ($items.getName().equals("img")) - #image ($item) - #elseif ($item.getName().equals("source")) - #source ($item) - #elseif ($item.getName().equals("table")) - #table ($item) - #elseif ($item.getName().equals("section")) - #set ($nextLevel = $level + 1) - #section ($item $nextLevel ) - #set ($nextLevel = $nextLevel - 1) - #elseif ($item.getName().equals("sectionMenu")) - #set ($nextLevel = $level + 1) - #sectionMenu1 ($item $item.getParent() $nextLevel) - #set ($nextLevel = $nextLevel - 1) - #else - $item - #end - #end -
    -#end - -## ================================ -## sectionMenu1 macro -## ================================ -#macro ( sectionMenu1 $sectionMenu $section $level ) - #if($sectionMenu.getAttributeValue("name")) - $sectionMenu.getAttributeValue("name") -
    - #foreach ( $items in $section.getChildren() ) - #if ($items.getName().equals("section")) - #sectionMenu2 ($items ) - #end - #end -
    - #else - #foreach ( $items in $section.getChildren() ) - #if ($items.getName().equals("section")) - #sectionMenu2 ($items ) - #end - #end - #end -#end - -## ================================ -## sectionMenu2 macro -## ================================ -#macro ( sectionMenu2 $section ) - #if ($section.getAttributeValue("id")) - $section.getAttributeValue("name")
    - #else - $section.getAttributeValue("name")
    - #end -
    - #foreach ( $items in $section.getChildren() ) - #if ($items.getName().equals("section")) - #sectionMenu2 ($items ) - #end - #end -
    -#end - -## =================================== -## make navigation bar -## =================================== - -#macro ( makeNavigationBar ) - -
    - #set ($menus = $project.getChild("body").getChildren("menu")) - #foreach ( $menu in $menus ) - - #foreach ($item in $menu.getChildren() ) - #set ($name = $item.getAttributeValue("name")) - - #end - #end -
    - -#end - -## ==================================== -## getProjectImage -## ==================================== -#macro (getProjectImage) - ## -#end - -#macro (printMeta $metaElement) - -#end - -#macro (messages $root) - #foreach ( $m in $root.getChild("body").getChildren() ) - #if ($m.getName().equals("message")) - -
    - $m.getChild("explanation").getContent() -
    - #end - #end -#end - -#macro (document) - #set ($properties = $root.getChild("properties") ) - - - - - - - - - #set ($authors = $root.getChild("properties").getChildren("author")) - #foreach ( $au in $authors ) - #metaauthor ( $au.getText() $au.getAttributeValue("email") ) - #end - - #set ($metas = $root.getChildren("meta")) - - ## Parse meta directives such as - ## - #foreach ($meta in $metas) #printMeta($meta) #end - - ## Support for tags. - #if ($root.getChild("properties").getChild("base")) - #set ($url = $root.getChild("properties").getChild("base").getAttributeValue("href")) - - #end - - - - #foreach ( $cssItem in $project.getChildren("css") ) - - #end - - $root.getChild("properties").getChild("title").getText() - - #if ($root.getChild("head")) - $root.getChild("head").getContent() - #end - - - - ## Google analytics code - - - - -## -## -## - #getProjectImage() -## -##
    - - - -
    - ##
    - - -## -## - -## -## -## -## -## - - - #messages ($root) - - -

     

    - -## -## - ##
    -##
    -##
    - - #foreach ( $item in $root.getChild("body").getChildren() ) - #if ($item.getName().equals("img")) - #image ($item) - #elseif ($item.getName().equals("section")) - #section ($item 1) - #elseif ($item.getName().equals("source")) - #source ($item) - #elseif ($item.getName().equals("table")) - #table ($item) - #elseif ($item.getName().equals("sectionMenu")) - #sectionMenu1 ($item $item.getParent() 1) - #else - $item - #end - #end - -## #if ($root.getChild("body").getChild("titleSection")) -## #set ($titleSection = $root.getChild("body").getChild("titleSection")) -## #titleSection($titleSection) -## #end -##
    -##
    -##
    -
    - Copyright © - #if($root.getChild("properties").getChild("copyright").getAttributeValue("year")) - ${root.getChild("properties").getChild("copyright").getAttributeValue("year")}, - #elseif($project.getChild("copyright").getAttributeValue("year")) - ${project.getChild("copyright").getAttributeValue("year")}, - #else - 1999-2007, - #end - #if($root.getChild("properties").getChild("copyright").getAttributeValue("holder")) - ${root.getChild("properties").getChild("copyright").getAttributeValue("holder")} - #elseif($project.getChild("copyright").getAttributeValue("holder")) - ${project.getChild("copyright").getAttributeValue("holder")} - #else - Apache Software Foundation - #end -
    - ##
    - - -
    - - - #makeNavigationBar() - - ## Call the google analyticis code to register this page - - - -#end - - - - - diff --git a/xdocs/src/support.xml b/xdocs/src/support.xml deleted file mode 100755 index dbf661ec..00000000 --- a/xdocs/src/support.xml +++ /dev/null @@ -1,229 +0,0 @@ - - - - - - Nicko Cadell - Apache log4net: Support - - - - - -
    - -

    - log4net user support is provided via a mailing list. Discussion on log4net is held on the - log4net-user mailing list. Please search the archives before posting because it - is likely that your question has been answered before. -

    - -
    -

    - You can browse the mailing list archives at the following locations: -

    - - -
    - -
    -

    - Subscribe to either the list or to the digest list: -

    - - -
    - -
    -

    - To unsubscribe send an email to the relevant email address: -

    - - -
    - -
    -

    - Before posting please read the following guidelines: -

    - -
      -
    • -

      - Ask smart questions
      - Every volunteer project obtains its strength from the people involved - in it. You are welcome to join any of our mailing lists. You can - choose to lurk, or actively participate; it's up to you. The level of - community responsiveness to specific questions is generally directly - proportional to the amount of effort you spend formulating your - question. Eric Raymond and Rick Moen have even written an essay entitled - "Asking Smart Questions" - precisely on this topic. -

      -
    • - -
    • -

      - Keep your email short and to the point
      - If your email is more than about a page of text, chances are that it - won't get read by very many people. It is much better to try to pack a - lot of informative information (see above about asking smart questions) - into as small of an email as possible. If you are replying to a previous - email, it is a good idea to only quote the parts that you are replying - to and to remove the unnecessary bits. This makes it easier for people - to follow a thread as well as making the email archives easier to search - and read. -

      -
    • - -
    • -

      - Do your best to ensure that you are not sending HTML or "Stylelized" email to the list
      - If you are using Outlook or Outlook Express or Eudora, chances are that - you are sending HTML email by default. There is usually a setting that - will allow you to send "Plain Text" email. If you are using Microsoft - products to send email, there are several bugs in the software that - prevent you from turning off the sending of HTML email. Please read this - page as well. -

      -
    • - -
    • -

      - Watch where you are sending email
      - Our mailing lists have set the Reply-To to go back to the - list. That means that when you Reply to a message, it will go to the list - and not to the original author directly. The reason is because it helps - facilitate discussion on the list for everyone to benefit from. Be careful - of this as sometimes you may intend to reply to a message directly to someone - instead of the entire list. -

      -

      - The appropriate contents of the Reply-To header is an age-old debate that - should not be brought up on the mailing lists. You can examine opposing points of view - condemning - our convention and condoning - it. Bringing this topic up for debate again on a mailing list will add nothing new - and is considered off-topic. -

      -
    • - -
    • -

      - Do not cross post messages
      - In other words, pick a mailing list and send your messages to that mailing - list only. Do not send your messages to multiple mailing lists. The reason is - that people may be subscribed to one list and not to the other. Therefore, - some people will only see part of the conversation. -

      -
    • -
    - -

    - Where relevant please try to include the following information in your postings. -

    - -
      -
    • -

      - Specify the version of log4net you are using. -

      -
    • - -
    • -

      - Specify what your assembly type is, i.e. exe or dll, and how your code is launched, - e.g. console application, windows application, ASP.NET project, COM+ hosted object, etc... -

      -
    • - -
    • -

      - Specify which runtime platform (e.g. MS .NET, Mono, SSCLI) you are using and which version. -

      -
    • - -
    • -

      - If you are having configuration issues then include logging configuration files if any, plus source code. -

      -
    • - -
    • -

      - If possible please reproduce your issue with the - internal log4net debugging - enabled. Include this debug output in your post, it is usually the first thing we ask for in diagnosing issues. -

      -
    • - -
    • -

      - If you think you have found a bug then a short example reproducing the problem is very much appreciated. -

      -
    • -
    - -

    - To prevent spam, we require you to be subscribed to the list before posting to it. -

    - -

    - Ask questions and report bugs via email to the - log4net-user@logging.apache.org - mailing list. -

    -
    -
    - - - -