| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| <!-- Generated by Apache Maven Doxia at 2017-04-28 --> |
| <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
| <title>Apache log4net – Apache log4net Manual: Repositories - Apache log4net</title> |
| <link rel="stylesheet" href="../../css/bootstrap.min.css" type="text/css" /> |
| <link rel="stylesheet" href="../../css/site.css" type="text/css" /> |
| <script type="text/javascript" src="../../js/jquery.min.js"></script> |
| <script type="text/javascript" src="../../js/bootstrap.min.js"></script> |
| <script type="text/javascript" src="../../js/prettify.min.js"></script> |
| <script type="text/javascript" src="../../js/site.js"></script> |
| <meta name="author" content="Nicko Cadell" /> |
| <meta name="Date-Revision-yyyymmdd" content="20170428" /> |
| <meta http-equiv="Content-Language" content="en" /> |
| <meta name="keywords" content="building log4net, log4net" /> |
| </head> |
| <body class="composite"> |
| <a href="https://logging.apache.org/"> |
| <img class="logo-left" src="../../images/ls-logo.jpg" alt="Apache logging services logo" /> |
| </a> |
| <!--img class="logo-right" src="../../images/logo.png" alt="Apache log4net logo" /--> |
| <div class="clear"></div> |
| |
| <div class="navbar"> |
| <div class="navbar-inner"> |
| <div class="container-fluid"> |
| <a class="brand" href="http://logging.apache.org/log4net/">Apache log4net ™</a> |
| <ul class="nav"> |
| <li> |
| |
| |
| <a href="https://wiki.apache.org/logging" class="external" target="_blank" title="Logging Wiki">Logging Wiki</a> |
| </li> |
| <li> |
| |
| |
| <a href="https://www.apache.org/" class="external" target="_blank" title="Apache">Apache</a> |
| </li> |
| <li> |
| |
| |
| <a href="https://logging.apache.org/" class="external" target="_blank" title="Logging Services">Logging Services</a> |
| </li> |
| <li> |
| |
| |
| <a href="https://github.com/apache/logging-log4net/" class="external" target="_blank" title="GitHub">GitHub</a> |
| </li> |
| </ul> |
| </div> |
| </div> |
| </div> |
| |
| <div class="container-fluid"> |
| <table class="layout-table"> |
| <tr> |
| <td class="sidebar"> |
| <div class="well sidebar-nav"> |
| <ul class="nav nav-list"> |
| <li class="nav-header"><i class="icon-home"></i>Apache log4net</li> |
| <li class="none"> |
| <a href="../../index.html" title="About">About</a> |
| </li> |
| <li class="none"> |
| <a href="../../download_log4net.cgi" title="Download">Download</a> |
| </li> |
| <li class="none"> |
| <a href="../../release/release-notes.html" title="Release Notes">Release Notes</a> |
| </li> |
| <li class="none"> |
| <a href="../../license.html" title="License">License</a> |
| </li> |
| </ul> |
| <ul class="nav nav-list"> |
| <li class="nav-header"><i class="icon-file"></i>Documentation</li> |
| <li class="none"> |
| <a href="../../release/features.html" title="Features">Features</a> |
| </li> |
| <li class="none"> |
| <a href="../../release/framework-support.html" title="Supported Frameworks">Supported Frameworks</a> |
| </li> |
| <li class="none"> |
| <a href="../../release/example-apps.html" title="Example Apps">Example Apps</a> |
| </li> |
| <li class="none"> |
| <a href="../../release/config-examples.html" title="Config Examples">Config Examples</a> |
| </li> |
| <li class="none"> |
| <a href="../../release/building.html" title="Building">Building</a> |
| </li> |
| <li class="none"> |
| <a href="../../release/faq.html" title="FAQ">FAQ</a> |
| </li> |
| <li class="none"> |
| <a href="../../release/howto/index.html" title="How Tos">How Tos</a> |
| </li> |
| <li class="none"> |
| <a href="../../release/sdk/index.html" title="SDK Reference">SDK Reference</a> |
| </li> |
| </ul> |
| <ul class="nav nav-list"> |
| <li class="nav-header"><i class="icon-book"></i>Manual</li> |
| <li class="none"> |
| <a href="../../release/manual/introduction.html" title="Introduction">Introduction</a> |
| </li> |
| <li class="none"> |
| <a href="../../release/manual/configuration.html" title="Configuration">Configuration</a> |
| </li> |
| <li class="none"> |
| <a href="../../release/manual/contexts.html" title="Contexts">Contexts</a> |
| </li> |
| <li class="none"> |
| <a href="../../release/manual/plugins.html" title="Plugins">Plugins</a> |
| </li> |
| <li class="none active"> |
| <a href="../../release/manual/repositories.html" title="Repositories">Repositories</a> |
| </li> |
| <li class="none"> |
| <a href="../../release/manual/internals.html" title="Internals">Internals</a> |
| </li> |
| </ul> |
| <ul class="nav nav-list"> |
| <li class="nav-header"><i class="icon-pencil"></i>For Contributors</li> |
| <li class="none"> |
| <a href="../../mail-lists.html" title="Mailing Lists">Mailing Lists</a> |
| </li> |
| <li class="none"> |
| <a href="../../issue-tracking.html" title="Issue Tracking">Issue Tracking</a> |
| </li> |
| <li class="none"> |
| <a href="../../source-repository.html" title="Repository">Repository</a> |
| </li> |
| <li class="none"> |
| <a href="../../integration.html" title="Continuous Integration">Continuous Integration</a> |
| </li> |
| </ul> |
| <ul class="nav nav-list"> |
| <li class="nav-header"><i class="icon-cog"></i>Project Reports</li> |
| <li class="none"> |
| <a href="../../rat-report.html" title="RAT Report">RAT Report</a> |
| </li> |
| </ul> |
| <ul class="nav nav-list"> |
| <li class="nav-header"><i class="icon-info-sign"></i>Apache</li> |
| <li class="none"> |
| |
| |
| <a href="http://www.apache.org/" class="external" target="_blank" title="Home">Home</a> |
| </li> |
| <li class="none"> |
| |
| |
| <a href="http://www.apache.org/licenses/" class="external" target="_blank" title="License">License</a> |
| </li> |
| <li class="none"> |
| |
| |
| <a href="http://www.apache.org/foundation/sponsorship.html" class="external" target="_blank" title="Sponsorship">Sponsorship</a> |
| </li> |
| <li class="none"> |
| |
| |
| <a href="http://www.apache.org/foundation/thanks.html" class="external" target="_blank" title="Thanks">Thanks</a> |
| </li> |
| <li class="none"> |
| |
| |
| <a href="http://www.apache.org/security/" class="external" target="_blank" title="Security">Security</a> |
| </li> |
| <li class="none"> |
| |
| |
| <a href="http://www.apachecon.com" class="external" target="_blank" title="Conferences">Conferences</a> |
| </li> |
| </ul> |
| </div> |
| <div id="poweredBy"> |
| <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy"> |
| <img class="poweredBy" alt="Built by Maven" src="../../images/maven-feather.png" /> |
| </a> |
| </div> |
| </td> |
| <td class="content"> |
| <!-- Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to you under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. --> |
| |
| |
| <a name="main"></a> |
| <div class="section" id="main"> |
| <h2><a name="Apache_log4net_Manual_-_Repositories"></a>Apache log4net™ Manual - Repositories</h2> |
| <a name="repository"></a> |
| <div class="section" id="repository"> |
| <h2><a name="Logging_Repositories"></a>Logging Repositories</h2> |
| |
| <p> |
| Logging repositories are considered advanced functionality. The default behavior |
| should be sufficient for most users. |
| </p> |
| |
| <p> |
| Log4net supports logging repositories. A repository is uniquely named. |
| Each repository is a (<span class="code">ILoggerRepository</span>). |
| Multiple assemblies can link to the same repository. |
| </p> |
| |
| <p> |
| 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. |
| </p> |
| |
| <p> |
| Named logging repositories can be created using the <span class="code">LogManager.CreateRepository</span> |
| method. The repository for can be retrieved using the |
| <span class="code">LogManager.GetRepository</span> method. |
| A repository created in this way will need to be configured programmatically. |
| </p> |
| |
| <a name="attributes"></a> |
| <div class="section" id="attributes"> |
| <h2><a name="Attributes"></a>Attributes</h2> |
| |
| <p> |
| 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 |
| <span class="code">RepositoryAttribute</span> to set its logging repository. |
| </p> |
| |
| <p> |
| The log4net logging repositories can be configured using the following assembly-level |
| attributes: |
| </p> |
| |
| <ul> |
| |
| <li> |
| <b>AliasRepositoryAttribute</b> |
| |
| <p> |
| Specifies a named repository to use as this assembly's repository. |
| </p> |
| |
| <p> |
| An assembly's logger repository is defined by its |
| <span class="code">RepositoryAttribute</span>, however this can be overridden by an |
| assembly loaded before the target assembly. |
| </p> |
| |
| <p> |
| An assembly can alias another assembly's repository by specifying |
| this attribute with the name of the target repository. |
| </p> |
| |
| <p> |
| This attribute may be used as many times as necessary to alias all the required |
| repositories. |
| </p> |
| </li> |
| |
| <li> |
| <b>RepositoryAttribute</b> |
| |
| <p> |
| Specifies the logging repository for the assembly. |
| </p> |
| |
| <p> |
| Assemblies are mapped to logging repositories. This attribute controls the configuration of the repository. The |
| <span class="code">Name</span> property specifies the name of the repository |
| for this assembly. The <span class="code">RepositoryType</span> |
| property specifies the type of the repository object to create for the assembly. |
| If this attribute is not specified and a <span class="code">Name</span> |
| is not specified then the assembly will be part of the default shared logging |
| repository. |
| </p> |
| |
| <p> |
| This attribute may only be used once per assembly. |
| </p> |
| </li> |
| </ul> |
| </div> |
| </div> |
| </div> |
| |
| |
| </td> |
| </tr> |
| </table> |
| </div> |
| |
| <div class="footer"> |
| <p>Copyright © 2004-2017 <a class="external" href="http://www.apache.org">Apache Software Foundation</a>. All Rights Reserved.</p> |
| <p>Apache log4net, Apache, log4net, the Apache feather logo, the Apache Logging Services project logo and the Built by Maven logo are trademarks of The Apache Software Foundation.</p> |
| <p>Site powered by <a class="external" href="http://getbootstrap.com/">Twitter Bootstrap</a>. Icons from <a class="external" href="http://glyphicons.com/">Glyphicons Free</a>.</p> |
| </div> |
| </div> |
| </body> |
| </html> |