logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicko Cadell" <ni...@neoworks.com>
Subject RE: Unhandled exception!
Date Mon, 20 Feb 2006 19:42:12 GMT
No, log4net should just fail to locate and load the config file. I will
checkin a fix for this.

Cheers,
Nicko

> -----Original Message-----
> From: Morten Andersen [mailto:morten@vianett.no] 
> Sent: 20 February 2006 17:10
> To: Log4NET User
> Subject: Re: Unhandled exception!
> 
> Should it be possible for log4net to take a whole site down 
> because of an exception like this?
> 
> Best Regards
> *Morten Andersen*
> Developer
> Vianett AS <http://www.vianett.no/> | morten@vianett.no 
> <mailto:morten@vianett.no> | Office: +47 69 20 69 74 
> <callto://+4769206974> | Skype: mortander <callto://mortander>
> 
> 
> 
> Nicko Cadell wrote:
> > When log4net loads config file via the XmlConfiguratorAttribute it 
> > always opens the file directly itself. It therefore needs to know 
> > where the application is deployed. This is known as path 
> discovery and 
> > requires a specific CAS permission.
> >
> > If the application is hosted on a local drive or a network 
> share the 
> > configurator needs to have the PathDiscovery 
> FileIOPermission in order 
> > to find the config file relative to the application base directory.
> >
> > CAS permissions are granted via the security configuration 
> of the .NET 
> > runtime. Permissions are layered to allow them to be specified on a 
> > user, machine or enterprise basis. By default locally deployed 
> > applications will have PathDiscovery permission.
> >
> > If you cannot grant your application the PathDiscovery 
> permission you 
> > must load the configuration from the application's .config file by 
> > calling the log4net.Config.XmlConfigurator.Configure() method 
> > programmatically. Remove any XmlConfiguratorAttribute you have 
> > specified and add a call to XmlConfigurator.Configure() as early as 
> > possible in your application start-up.
> >
> > Cheers,
> > Nicko
> >
> >   
> >> -----Original Message-----
> >> From: Morten Andersen [mailto:morten@vianett.no]
> >> Sent: 01 February 2006 11:39
> >> To: log4net-dev@logging.apache.org; Log4NET User
> >> Subject: Unhandled exception!
> >>
> >>
> >>     /Security Exception/
> >>
> >> *Description: *The application attempted to perform an 
> operation not 
> >> allowed by the security policy.  To grant this application the 
> >> required permission please contact your system administrator or 
> >> change the application's trust level in the configuration file.
> >>
> >> *Exception Details: *System.Security.SecurityException: 
> >> Request for the permission of type
> >> 'System.Security.Permissions.FileIOPermission,
> >> mscorlib, Version=2.0.0.0, Culture=neutral, 
> >> PublicKeyToken=b77a5c561934e089' failed.
> >>
> >> Line 78: this.log = log4net.LogManager.GetLogger(logfilename);
> >>
> >> ||
> >>
> >> [SecurityException: Request for the permission of type 
> >> 'System.Security.Permissions.FileIOPermission, mscorlib, 
> >> Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' 
> >> failed.]
> >>    System.Security.CodeAccessSecurityEngine.Check(Object
> >> demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
> >>    System.Security.CodeAccessPermission.Demand() +59
> >>    System.AppDomainSetup.VerifyDir(String dir, Boolean 
> normalize) +110
> >>    System.AppDomain.get_BaseDirectory() +61
> >>    log4net.Util.SystemInfo.get_ApplicationBaseDirectory() +31
> >>    log4net.Config.XmlConfiguratorAttribute.Configure(Assembly
> >> sourceAssembly, ILoggerRepository targetRepository) +30
> >>    
> >> log4net.Core.DefaultRepositorySelector.ConfigureRepository(Ass
> >> embly assembly, ILoggerRepository repository) +314
> >>    
> >> log4net.Core.DefaultRepositorySelector.CreateRepository(Assemb
> >> ly repositoryAssembly, Type repositoryType, String repositoryName, 
> >> Boolean readAssemblyAttributes) +532
> >>    
> >> log4net.Core.DefaultRepositorySelector.CreateRepository(Assemb
> >> ly repositoryAssembly, Type repositoryType) +42
> >>    
> >> log4net.Core.DefaultRepositorySelector.GetRepository(Assembly
> >> repositoryAssembly) +80
> >>    log4net.Core.LoggerManager.GetLogger(Assembly
> >> repositoryAssembly, String name) +132
> >>    log4net.LogManager.GetLogger(Assembly 
> repositoryAssembly, String 
> >> name) +30
> >>    log4net.LogManager.GetLogger(String name) +34
> >>       
> >>
> >>
> >> --
> >>
> >> Best Regards
> >> *Morten Andersen*
> >> Developer
> >> Vianett AS <http://www.vianett.no/> | morten@vianett.no 
> >> <mailto:morten@vianett.no> | Office: +47 69 20 69 74 
> >> <callto://+4769206974> | Skype: mortander <callto://mortander>
> >>
> >>
> >>     
> >
> >   
> 

Mime
View raw message