----------  Forwarded Message  ----------

Subject: Re: Fwd: %{method} LogKit pattern with Excaliburs LogKitLoggerManager
Date: Thu, 31 Oct 2002 10:31:40 +1100
From: Peter Donald <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>

Hi there,

Unfortunately there is no inbuilt way to fix this at this stage. However for
an imediate fix to your problem you can write your own pattern formatter
(copy paste from ExtendedPatternFormatter if you want). Then replace
"getMethod" with changes as below (look for //PD: to see changes).

    /**
     * Utility method to format category.
     *
     * @param event the event
     * @param format ancilliary format parameter - allowed to be null
     * @return the formatted string
     */
    private String getMethod( final LogEvent event, final String format )
    {
        final ContextMap map = event.getContextMap();
        if( null != map )
        {
            final Object object = map.get( "method" );
            if( null != object )
            {
                return object.toString();
            }
        }

        //PD: Changed the next line to refer to Framework Logger class
 instead final String result =
              StackIntrospector.getCallerMethod( LogKitLogger.class );
        if( null == result )
        {
            return "UnknownMethod";
        }
        return result;
    }

On Thu, 31 Oct 2002 02:21, Shash Chatterjee wrote:
> Hi!
>
> I posted this on the users' list a couple days back, but did not get an
> answer.  I am trying to figure out if this is a known limitation of having
> a "facade" between the end-user app and Logkit, or I am doing something
> incorrectly.
>
> Thanks,
> Shash
>
> From: "Shash Chatterjee" <[EMAIL PROTECTED]>
>
> >Reply-To: "Avalon framework users" <[EMAIL PROTECTED]>
> >To: <[EMAIL PROTECTED]>
> >Subject: %{method} LogKit pattern with Excaliburs LogKitLoggerManager
> >Date: Sun, 27 Oct 2002 23:52:07 -0600
> >
> >Hi!
> >
> >I am trying to use an extended logkit pattern formatter with our
> >Fortress/DefaultContainer-based container.
> >However, %{method} always resolves to
> >"org.apache.avalon.framework.logger.LogKitLogger.debug(LogKitLogger.java:3
> >9) ".
> >
> >I can see that this is because ExtendPatternFormatter#getMethod() is
> >popping
> >up to "org.apache.log.Logger" from the call-stack, which still leaves
> >LogKitLogger on the stack above the method I am really intesrested in.
> >
> >I am getting my Logger (org.apache.avalon.framework.logger.Logger) as
> > such:
> >
> >     import org.apache.avalon.excalibur.logger.LogKitLoggerManager;
> >     import org.apache.avalon.excalibur.logger.LoggerManager;
> >     import org.apache.avalon.framework.logger.Logger;
> >
> >     private static Logger rootLogger = null;
> >     private static LoggerManager rootLoggerManager = null;
> >      ......
> >       LogKitLoggerManager tmp = new LogKitLoggerManager();
> >       try {
> >            tmp.contextualize(rootContext);
> >            tmp.configure(logkitConf);  // built from a logkit.xconf
> >      } catch .....
> >         ....
> >      }
> >      rootLoggerManager = tmp;
> >      rootLogger = rootLoggerManager.getLoggerForCategory("root");
> >      rootLogger.debug("......");
> >     .....
> >
> >So, what am I doing wrong and how can I get around this problem?
> >
> >Thanks,
> >Shash
> >
> >--
> >To unsubscribe, e-mail:
> ><mailto:avalon-users-unsubscribe@;jakarta.apache.org>
> >For additional commands, e-mail:
> ><mailto:avalon-users-help@;jakarta.apache.org>
>
> _________________________________________________________________
> Unlimited Internet access for only $21.95/month.  Try MSN!
> http://resourcecenter.msn.com/access/plans/2monthsfree.asp

--
Cheers,

Peter Donald
----------------------------------------
"Liberty means responsibility. That is
      why most men dread it." - Locke
----------------------------------------


--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@;jakarta.apache.org>

-------------------------------------------------------

-- 
Cheers,

Peter Donald
*------------------------------------------------------*
| An expert is someone who knows everything about the  |
| topic except for its place in the world.             |
*------------------------------------------------------*


--
To unsubscribe, e-mail:   <mailto:avalon-users-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-users-help@;jakarta.apache.org>

Reply via email to