You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Nicko Cadell <ni...@neoworks.com> on 2004/09/27 17:47:28 UTC

RE: Anyone consdiering attributes? CLR Profiler

The general code profiler sample is in the .NET SDK. If you have Visual
Studio .NET 2003 it should be in

C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Tool
Developers Guide\Samples\profiler\gcp_profiler

Nicko 

> -----Original Message-----
> From: Denis, Rich [mailto:Rich.Denis@ps.net] 
> Sent: 27 September 2004 16:07
> To: Nicko Cadell
> Subject: RE: Anyone consdiering attributes?
> 
> Nicko,
>  Would it be possible to see the CLR Profiler that you write 
> about?  How did you do that?  Thanks.
> 
> 
> Rich Denis
> perotsystems(tm)
> 
> 
> 972.577.5869 Wk
> rich.denis@ps.net
> 
> -----Original Message-----
> From: Nicko Cadell [mailto:nicko@neoworks.com]
> Sent: Sunday, September 26, 2004 4:37 PM
> To: Log4NET User
> Subject: RE: Anyone consdiering attributes?
> 
> This was something that I looked at a long time ago, AOP and 
> dynamic injection sounded like a great idea, however it 
> performance impact is huge for simple method calls. There are 
> some context boundaries where this works, i.e. remoting or 
> database access, but it is not appropriate for normal method calls.
> 
> The approach that I thought had the most promise was to 
> post-process the assembly. Essentially take the assembly 
> decompile it to IL (which is straight forward), look for 
> method or class attributes, inject the logging calls (as IL) 
> into the assembly IL for each method entry and exit point, 
> then reassemble the assembly from the modified IL. This means 
> that you can on a per assembly basis add logging calls or 
> remove all logging calls. 
> 
> I did not peruse this approach because I was able to do what 
> I needed by writing a CLR profiler and using that to log 
> method calls, parameters and results.
> 
> Nicko
> 
> > -----Original Message-----
> > From: Ayende Rahien [mailto:Ayende@Ayende.com]
> > Sent: 26 September 2004 13:44
> > To: 'Log4NET User'; mgutierrez@firstam.com
> > Subject: RE: Anyone consdiering attributes?
> > 
> > You can do it using ContextBoundObject and some context 
> settings, it's 
> > not very well known (at least that I've seen), but it's possible.
> > If you want something like this, check out an Aspect Oriented 
> > Programning (AOP) for dotNet, They should contain it already.
> > Be aware, currently, AFAIK, there is some performance hit 
> using this 
> > method, as always, measure and see if it's acceptable.
> >  
> > ________________________________
> > 
> > From: Mario Gutierrez [mailto:mgutierrez@firstam.com]
> > Sent: Thursday, September 23, 2004 7:12 PM
> > To: 'Log4NET User'
> > Subject: RE: Anyone consdiering attributes?
> >  
> > The idea is to have attributes like LogEntry and LogExit that 
> > automaticaly log the entry and exit of any method call. As 
> I read more 
> > about attributes, I'm not sure it's possible to do this 
> unless I build 
> > an entire framework to read these attributes and act on them. Since 
> > there are dependency injection frameworks, Spring and pico come to 
> > mind, I think I'll use one of those instead and create interceptors.
> >  
> > -----Original Message-----
> > From: Ayende Rahien [mailto:Ayende@Ayende.com]
> > Sent: Wednesday, September 22, 2004 6:07 PM
> > To: 'Log4NET User'; mgutierrez@firstam.com
> > Subject: RE: Anyone consdiering attributes?
> > 	What do you want to do with this?
> > 	 
> > 	 
> > 	
> > ________________________________
> > 
> > 	From: Mario Gutierrez [mailto:mgutierrez@firstam.com] 
> > 	Sent: Thursday, September 23, 2004 1:44 AM
> > 	To: 'Log4NET User'
> > 	Subject: Anyone consdiering attributes?
> > 	 
> > 	If not, maybe I'll contribute if I can find a free weekend.
> > 	 
> > 	[LogEntry(ifLevel=Debug)]
> > 	public void Foo() {
> > 	    // ...
> > 	}
> > 	 
> > 	.: mario gutierrez
> > 	 
> > 
>