You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Stuart Roebuck <st...@adolos.co.uk> on 2001/07/24 16:41:53 UTC
[LogKit][PATCH2] 'method' field for PatternFormatter
This is probably quite expense on resources during use, but it does what I'
d originally wanted and produces info on the method called.
[%{method}]
could result in, for example:
[com.adolos.taskmanager.TaskBin.createHashMapKey(TaskBin.java:142)]
Stuart.
<Attachment missing>
On Tuesday, July 24, 2001, at 02:32 pm, Stuart Roebuck wrote:
> Apologies,
>
> My last patch is based on a misinterpretation of the original code. This
> doesn't give the method from which the LogEvent was called: only the
> Class.
> It's still useful, but the names of my methods and the field are
> inappropriate.
>
> Stuart.
>
> On Tuesday, July 24, 2001, at 02:02 pm, Stuart Roebuck wrote:
>
>> I've just added in a 'method' field for PatternFormatter based on the
>> code added to Cocoon today by Sylvain Wallez. It adds the facility to
>> display the complete path of the calling method in the log, e.g.:
>>
>> (%{method})
>>
>> could result in:
>>
>> (com.adolos.MyStuff.myMethod)
>>
>> I've tried to make the changes so that there is no additional overhead
>> if this field is not displayed.
>>
>> It works for me!
-------------------------------------------------------------------------
Stuart Roebuck stuart.roebuck@adolos.com
Lead Developer Java, XML, MacOS X, XP, etc.
ADOLOS <http://www.adolos.com/>
Re: [LogKit][PATCH2] 'method' field for PatternFormatter
Posted by Peter Donald <do...@apache.org>.
Looks good. I may try to refactor it a bit (place it in org.apache.log.util.*
rather than LogEvent) but I like it. I have had an idea gestating for a while
now to add extra information like this. I will try to write up a proposal
tomorrow evening (or maybe the weekend) to see what yall think.
On Wed, 25 Jul 2001 00:41, Stuart Roebuck wrote:
> This is probably quite expense on resources during use, but it does what I'
> d originally wanted and produces info on the method called.
>
> [%{method}]
>
> could result in, for example:
>
> [com.adolos.taskmanager.TaskBin.createHashMapKey(TaskBin.java:142)]
>
> Stuart.
>
> <Attachment missing>
>
> On Tuesday, July 24, 2001, at 02:32 pm, Stuart Roebuck wrote:
> > Apologies,
> >
> > My last patch is based on a misinterpretation of the original code. This
> > doesn't give the method from which the LogEvent was called: only the
> > Class.
> > It's still useful, but the names of my methods and the field are
> > inappropriate.
> >
> > Stuart.
> >
> > On Tuesday, July 24, 2001, at 02:02 pm, Stuart Roebuck wrote:
> >> I've just added in a 'method' field for PatternFormatter based on the
> >> code added to Cocoon today by Sylvain Wallez. It adds the facility to
> >> display the complete path of the calling method in the log, e.g.:
> >>
> >> (%{method})
> >>
> >> could result in:
> >>
> >> (com.adolos.MyStuff.myMethod)
> >>
> >> I've tried to make the changes so that there is no additional overhead
> >> if this field is not displayed.
> >>
> >> It works for me!
>
> -------------------------------------------------------------------------
> Stuart Roebuck stuart.roebuck@adolos.com
> Lead Developer Java, XML, MacOS X, XP, etc.
> ADOLOS <http://www.adolos.com/>
----------------------------------------
Content-Type: text/plain; charset="us-ascii"; name="Attachment: 1"
Content-Transfer-Encoding: 7bit
Content-Description:
----------------------------------------
----------------------------------------
Content-Type: application/octet-stream; charset="us-ascii";
name="changes.patch"
Content-Transfer-Encoding: quoted-printable
Content-Description:
----------------------------------------
----------------------------------------
Content-Type: text/plain; charset="us-ascii"; name="Attachment: 3"
Content-Transfer-Encoding: 7bit
Content-Description:
----------------------------------------
--
Cheers,
Pete
*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof." |
| - John Kenneth Galbraith |
*-----------------------------------------------------*
---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org
Re: [LogKit][PATCH2] 'method' field for PatternFormatter
Posted by Peter Donald <do...@apache.org>.
Hi,
oops soz - I prolly didn't make myself clear. It should work if you replace
the following line from your patch
str = getMethod( event.getMethod(), run.m_format );
with
str = getMethod( StackIntrospector.getCallerMethod( Logger.class ),
run.m_format );
Does that make it clearer? It will essentially look for where Logger.class is
first called.
On Fri, 27 Jul 2001 04:29, Stuart Roebuck wrote:
> Peter,
>
> Thanks for making use of the code.
>
> I'd like to test it, but I'm not sure how you envisage it's use. My
> original code adapted LogEvent to give ready access to the information
> from an adapted PatternFormatter. If I'm going to test it, its seems to
> be sensible to build some code that fits your design plans.
>
> Stuart.
>
> On Thursday, July 26, 2001, at 04:11 pm, Peter Donald wrote:
> > Hi,
> >
> > I refactored part of your code into
> >
> > org.apache.log.util.StackIntrospector.getCallerMethod(Class clazz);
> >
> > and to make it work like old version you would go
> >
> > StackIntrospector.getCallerMethod( Logger.class );
> >
> > Could you check I didn't stuff anything up and make sure my comments make
> > sense ? ;)
> >
> > TIA
> >
> > On Wed, 25 Jul 2001 00:41, Stuart Roebuck wrote:
> >> This is probably quite expense on resources during use, but it does what
> >> I'
> >> d originally wanted and produces info on the method called.
> >>
> >> [%{method}]
> >>
> >> could result in, for example:
> >>
> >> [com.adolos.taskmanager.TaskBin.createHashMapKey(TaskBin.java:142)]
> >>
> >> Stuart.
> >>
> >> <Attachment missing>
> >>
> >> On Tuesday, July 24, 2001, at 02:32 pm, Stuart Roebuck wrote:
> >>> Apologies,
> >>>
> >>> My last patch is based on a misinterpretation of the original code.
> >>> This
> >>> doesn't give the method from which the LogEvent was called: only the
> >>> Class.
> >>> It's still useful, but the names of my methods and the field are
> >>> inappropriate.
> >>>
> >>> Stuart.
> >>>
> >>> On Tuesday, July 24, 2001, at 02:02 pm, Stuart Roebuck wrote:
> >>>> I've just added in a 'method' field for PatternFormatter based on the
> >>>> code added to Cocoon today by Sylvain Wallez. It adds the facility to
> >>>> display the complete path of the calling method in the log, e.g.:
> >>>>
> >>>> (%{method})
> >>>>
> >>>> could result in:
> >>>>
> >>>> (com.adolos.MyStuff.myMethod)
> >>>>
> >>>> I've tried to make the changes so that there is no additional overhead
> >>>> if this field is not displayed.
> >>>>
> >>>> It works for me!
> >>
> >> ------------------------------------------------------------------------
> >>- Stuart Roebuck
> >> stuart.roebuck@adolos.com Lead Developer
> >> Java, XML, MacOS X, XP, etc. ADOLOS
> >> <http://www.adolos.com/
> >
> > ----------------------------------------
> > Content-Type: text/plain; charset="us-ascii"; name="Attachment: 1"
> > Content-Transfer-Encoding: 7bit
> > Content-Description:
> > ----------------------------------------
> >
> > ----------------------------------------
> > Content-Type: application/octet-stream; charset="us-ascii";
> > name="changes.patch"
> > Content-Transfer-Encoding: quoted-printable
> > Content-Description:
> > ----------------------------------------
> >
> > ----------------------------------------
> > Content-Type: text/plain; charset="us-ascii"; name="Attachment: 3"
> > Content-Transfer-Encoding: 7bit
> > Content-Description:
> > ----------------------------------------
> >
> > --
> > Cheers,
> >
> > Pete
> >
> > *-----------------------------------------------------*
> >
> > | "Faced with the choice between changing one's mind, |
> > | and proving that there is no need to do so - almost |
> > | everyone gets busy on the proof." |
> > | - John Kenneth Galbraith |
> >
> > *-----------------------------------------------------*
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: avalon-dev-help@jakarta.apache.org
>
> -------------------------------------------------------------------------
> Stuart Roebuck stuart.roebuck@adolos.com
> Lead Developer Java, XML, MacOS X, XP, etc.
> ADOLOS <http://www.adolos.com/>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: avalon-dev-help@jakarta.apache.org
--
Cheers,
Pete
*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof." |
| - John Kenneth Galbraith |
*-----------------------------------------------------*
---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org
Re: [LogKit][PATCH2] 'method' field for PatternFormatter
Posted by Stuart Roebuck <st...@adolos.co.uk>.
Peter,
Thanks for making use of the code.
I'd like to test it, but I'm not sure how you envisage it's use. My
original code adapted LogEvent to give ready access to the information
from an adapted PatternFormatter. If I'm going to test it, its seems to
be sensible to build some code that fits your design plans.
Stuart.
On Thursday, July 26, 2001, at 04:11 pm, Peter Donald wrote:
> Hi,
>
> I refactored part of your code into
>
> org.apache.log.util.StackIntrospector.getCallerMethod(Class clazz);
>
> and to make it work like old version you would go
>
> StackIntrospector.getCallerMethod( Logger.class );
>
> Could you check I didn't stuff anything up and make sure my comments make
> sense ? ;)
>
> TIA
>
> On Wed, 25 Jul 2001 00:41, Stuart Roebuck wrote:
>> This is probably quite expense on resources during use, but it does what
>> I'
>> d originally wanted and produces info on the method called.
>>
>> [%{method}]
>>
>> could result in, for example:
>>
>> [com.adolos.taskmanager.TaskBin.createHashMapKey(TaskBin.java:142)]
>>
>> Stuart.
>>
>> <Attachment missing>
>>
>> On Tuesday, July 24, 2001, at 02:32 pm, Stuart Roebuck wrote:
>>> Apologies,
>>>
>>> My last patch is based on a misinterpretation of the original code.
>>> This
>>> doesn't give the method from which the LogEvent was called: only the
>>> Class.
>>> It's still useful, but the names of my methods and the field are
>>> inappropriate.
>>>
>>> Stuart.
>>>
>>> On Tuesday, July 24, 2001, at 02:02 pm, Stuart Roebuck wrote:
>>>> I've just added in a 'method' field for PatternFormatter based on the
>>>> code added to Cocoon today by Sylvain Wallez. It adds the facility to
>>>> display the complete path of the calling method in the log, e.g.:
>>>>
>>>> (%{method})
>>>>
>>>> could result in:
>>>>
>>>> (com.adolos.MyStuff.myMethod)
>>>>
>>>> I've tried to make the changes so that there is no additional overhead
>>>> if this field is not displayed.
>>>>
>>>> It works for me!
>>
>> -------------------------------------------------------------------------
>> Stuart Roebuck stuart.roebuck@adolos.com
>> Lead Developer Java, XML, MacOS X, XP, etc.
>> ADOLOS <http://www.adolos.com/
>> >
>
> ----------------------------------------
> Content-Type: text/plain; charset="us-ascii"; name="Attachment: 1"
> Content-Transfer-Encoding: 7bit
> Content-Description:
> ----------------------------------------
>
> ----------------------------------------
> Content-Type: application/octet-stream; charset="us-ascii";
> name="changes.patch"
> Content-Transfer-Encoding: quoted-printable
> Content-Description:
> ----------------------------------------
>
> ----------------------------------------
> Content-Type: text/plain; charset="us-ascii"; name="Attachment: 3"
> Content-Transfer-Encoding: 7bit
> Content-Description:
> ----------------------------------------
>
> --
> Cheers,
>
> Pete
>
> *-----------------------------------------------------*
> | "Faced with the choice between changing one's mind, |
> | and proving that there is no need to do so - almost |
> | everyone gets busy on the proof." |
> | - John Kenneth Galbraith |
> *-----------------------------------------------------*
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: avalon-dev-help@jakarta.apache.org
>
-------------------------------------------------------------------------
Stuart Roebuck stuart.roebuck@adolos.com
Lead Developer Java, XML, MacOS X, XP, etc.
ADOLOS <http://www.adolos.com/>
---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org
Re: [LogKit][PATCH2] 'method' field for PatternFormatter
Posted by Peter Donald <do...@apache.org>.
Hi,
I refactored part of your code into
org.apache.log.util.StackIntrospector.getCallerMethod(Class clazz);
and to make it work like old version you would go
StackIntrospector.getCallerMethod( Logger.class );
Could you check I didn't stuff anything up and make sure my comments make
sense ? ;)
TIA
On Wed, 25 Jul 2001 00:41, Stuart Roebuck wrote:
> This is probably quite expense on resources during use, but it does what I'
> d originally wanted and produces info on the method called.
>
> [%{method}]
>
> could result in, for example:
>
> [com.adolos.taskmanager.TaskBin.createHashMapKey(TaskBin.java:142)]
>
> Stuart.
>
> <Attachment missing>
>
> On Tuesday, July 24, 2001, at 02:32 pm, Stuart Roebuck wrote:
> > Apologies,
> >
> > My last patch is based on a misinterpretation of the original code. This
> > doesn't give the method from which the LogEvent was called: only the
> > Class.
> > It's still useful, but the names of my methods and the field are
> > inappropriate.
> >
> > Stuart.
> >
> > On Tuesday, July 24, 2001, at 02:02 pm, Stuart Roebuck wrote:
> >> I've just added in a 'method' field for PatternFormatter based on the
> >> code added to Cocoon today by Sylvain Wallez. It adds the facility to
> >> display the complete path of the calling method in the log, e.g.:
> >>
> >> (%{method})
> >>
> >> could result in:
> >>
> >> (com.adolos.MyStuff.myMethod)
> >>
> >> I've tried to make the changes so that there is no additional overhead
> >> if this field is not displayed.
> >>
> >> It works for me!
>
> -------------------------------------------------------------------------
> Stuart Roebuck stuart.roebuck@adolos.com
> Lead Developer Java, XML, MacOS X, XP, etc.
> ADOLOS <http://www.adolos.com/>
----------------------------------------
Content-Type: text/plain; charset="us-ascii"; name="Attachment: 1"
Content-Transfer-Encoding: 7bit
Content-Description:
----------------------------------------
----------------------------------------
Content-Type: application/octet-stream; charset="us-ascii";
name="changes.patch"
Content-Transfer-Encoding: quoted-printable
Content-Description:
----------------------------------------
----------------------------------------
Content-Type: text/plain; charset="us-ascii"; name="Attachment: 3"
Content-Transfer-Encoding: 7bit
Content-Description:
----------------------------------------
--
Cheers,
Pete
*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof." |
| - John Kenneth Galbraith |
*-----------------------------------------------------*
---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org