Issue Details (XML | Word | Printable)

Key: LOG4NET-33
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Nicko Cadell
Reporter: patrick conant
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Log4net

Ability to use global property to point to log4net configuration file

Created: 08/Jun/05 01:17 AM   Updated: 11/Jul/05 11:22 PM
Return to search
Component/s: Core
Affects Version/s: 1.2.9
Fix Version/s: 1.2.10

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works configuration.xml.diff.txt 2005-06-08 02:04 AM patrick conant 29 kB
Text File Licensed for inclusion in ASF works DefaultRepositorySelector.cs.diff.txt 2005-06-10 11:05 PM patrick conant 5 kB
Text File Licensed for inclusion in ASF works LogManager.cs.diff.txt 2005-06-08 02:04 AM patrick conant 3 kB
Environment: Any

Resolution Date: 11/Jul/05 11:22 PM


 Description  « Hide
The log4j tool has the ability to specify a system property to point to the logging configuration file. For instance, when starting a java program (such as tomcat), one can pass "-Dlog4j.configuration=http://mydomain/log4j.xml" as a command line parameter. Log4j checks to see whether this property is available and, if it is, uses the return value from the URL to configure categories and appenders.

A similar mechanism in log4net would allow a few improvements in logging configuring:
* No need to use the XmlConfiguratorAttribute in any assemblies
* No need to know at design time where the log4net config file will be located
* Ability to configure logging for all components in an app domain by setting a property in the app domain's config file
* Ability to configure logging for all components on a machine by setting a property in the machine.config file
* Ability to updating config file contents without updating app or machine config contents.

I'd propose doing a direct mirror of the log4j capabilities into log4net as follows:
* Update the LogManager class with a static constructor that mirrors the static block in the LogManager class in log4j
* Use System.Configuration.ConfigurationSettings.AppSettings.Get(...) instead of java's System.getProperty(...)
* Don't support the configuratorClass attribute (yet) because the XmlConfigurator seems to be the only logical choice
* Don't implement the DEFAULT_XML_CONFIGURATION_FILE or DEFAULT_CONFIGURATION_FILE property checks (yet).

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Repository Revision Date User Message
ASF #312300 Mon Jul 11 14:18:46 UTC 2005 nicko Fix for LOG4NET-33. Added code to look for the AppSetting 'log4net.Config' when configuring the default repository. If located it is loaded as a URI relative to the application base directory.
Files Changed
MODIFY /logging/log4net/trunk/src/Core/DefaultRepositorySelector.cs