Title: Message
So something like this for web apps?
 

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)

  Dim file As String = ConfigurationSettings.AppSettings("log4net")
 
log4net.Config.DOMConfigurator.Configure(New IO.FileInfo(file))

End Sub

Then in your code you could do:
 
Private Shared log As log4net.ILog _
    
 = log4net.LogManager.GetLogger(GetType(MyClass))
 
Or I guess you can do this (Thanks Nicko)
 
' Load the configuration from the 'WebApp.dll.log4net' file
<Assembly:log4net.Config.DOMConfigurator(ConfigFileExtension:="log4net", Watch:=true)>
Public Class Global
End Class
 
Do we have someplace where we can write this down? Or can we add it to the 1.1 folder I didn't even think to look in the 1.0 folder.
 
Dru


From: Denis, Rich [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 16, 2004 4:39 PM
To: Log4NET User
Subject: RE: Logging Perf Hit

As for calling Configure, I'm not sure where that goes in an ASP.Net application.

 

You can either call configure manually in the app_start code or you can assign an assembly attribute to handle the configuration call for you.  For asp.net apps this seems to works well for me.

 

Rich Denis
perotsystems\


From: Benjamin Peikes [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 16, 2004 10:44 AM
To: Log4NET User
Subject: RE: Logging Perf Hit

 

You should make your loggers static, one for each class. In VB that would be Shared. That way they only get created once for each class.

 

As for calling Configure, I'm not sure where that goes in an ASP.Net application.

 

Benjamin Peikes
Gargoyle Strategic Investments
201-227-2209

 

 


From: Dru Sellers [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 16, 2004 11:39 AM
To: 'Log4NET User'
Subject: Logging Perf Hit

In my ASP.Net pages I am doing this in about every method


log4net.Config.DOMConfigurator.Configure(New IO.FileInfo(file))
Dim log As log4net.ILog = log4net.LogManager.GetLogger(GetType(Verify))

Do I need to do this all the time or is there a way to work around this?

 

Dru

 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.794 / Virus Database: 538 - Release Date: 11/10/2004


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.794 / Virus Database: 538 - Release Date: 11/10/2004


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.794 / Virus Database: 538 - Release Date: 11/10/2004

Reply via email to