OOOPS.

I hadn't fully implemented Cecki's previous advice.

SORRY !!

(The answer is:

    Reason 1) PriorityMatchFilter does not support subclasses of 
org.apache.log4j.Priority.

    This is easy to fix: in PriorityMatchFilter just change the lines containing

     priorityToMatch = Priority.toPriority(value, null);

    to

     priorityToMatch = OptionConverter.toPriority(value, null);

    There are two such lines.
)

----- Original Message -----
From: "Jay Riddell" <[EMAIL PROTECTED]>
To: "LOG4J Users Mailing List" <[EMAIL PROTECTED]>
Sent: Wednesday, July 18, 2001 10:55 AM
Subject: Re: how to specify non-standard Priority level in xml config file?


> I have a similarly extended/non-standard Priority (called NOTIFY).
>
> I am having problems filtering it, however.
>
> My XML is:
>
> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd" [
>   <!ENTITY MyCategory "MyCategoryClass">
> ]>
>
>       <categoryFactory name="MyCategory" class="MyCategoryFactory">
>       </categoryFactory>
>
>     <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
>
>       <filter class="org.apache.log4j.varia.PriorityMatchFilter">
>             <param name="PriorityToMatch" value="NOTIFY#com.myPriorityClass" />
>             <param name="AcceptOnMatch" value="true" />
>         </filter>
>         <filter class="org.apache.log4j.varia.DenyAllFilter">
>         </filter>
>     </appender>
>
>     <root>
>         <priority value="Debug"/>
>         <appender-ref ref="CONSOLE"/>
>     </root>
> </log4j:configuration>
>
> This DENIES really well, but it won't select/admit my NOTIFY priority.
>
> I based my Priority on XPriority.
>
> And then, learning that XPriority was not as complete as it could be,
> I recently updated it (from Ernie Parker's email from yesterday) with
> all 4 of the static priority methods:
>
>    public static Priority toPriority(String sArg)
>    public static Priority toPriority(int i)
>    public static Priority toPriority(String sArg, Priority defaultValue)
>    public static Priority toPriority(int i, Priority defaultValue)
>
>
> Do I have to extend PriorityMatch to have it support my extended Priority ??
>
> Thanks.
>
> ----- Original Message -----
> From: "Mike Papper" <[EMAIL PROTECTED]>
> To: "LOG4J Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Tuesday, July 17, 2001 9:57 PM
> Subject: Re: how to specify non-standard Priority level in xml config file?
>
>
> > ok WERE DONE FOR NOW THAT FIXED IT. wAS THIS ANOTHER CHANGE UP TO 1.2 (from
> > 1.1b)? - oops with the caps lock.
> >
> > Mike
> >
> > ----- Original Message -----
> > From: "Ceki Gülcü" <[EMAIL PROTECTED]>
> > To: "LOG4J Users Mailing List" <[EMAIL PROTECTED]>
> > Sent: Tuesday, July 17, 2001 9:39 AM
> > Subject: Re: how to specify non-standard Priority level in xml config file?
> >
> >
> > Mike,
> >
> > Add the following method to com.yaga.logger.CritPriority. Your custom
> > priority should then work as expected. Regards. Ceki
> >
> >   public
> >   static
> >   Priority toPriority(String sArg, Priority defaultValue) {
> >
> >     if(sArg == null) {
> >       return defaultValue;
> >     }
> >
> >     String stringVal = sArg.toUpperCase();
> >
> >     if(stringVal.equals("CRIT")) {
> >       return CritPriority.CRIT;
> >     }
> >
> >     return Priority.toPriority(sArg, defaultValue);
> >   }
> >
> >
> > At 09:14 17.07.2001 -0700, you wrote:
> > >Heres my priority class (copied from a log4j posting a whileback) which is
> > >also attached:
> > >
> > >--------------------------------------------
> > >package com.yaga.logger;
> > >
> > >import java.util.*;
> > >import java.io.*;
> > >
> > >import org.apache.log4j.*;
> > >
> > >/**
> > > * A class that allows priorities greater than error but less than alert or
> > >fatal
> > > *
> > > * @author Mike Papper
> > > * @version $Id:1.0.3$
> > > *
> > > */
> > >
> > >/**
> > > * This extends the central log4j class to add count methods.
> > > */
> > >public class CritPriority extends Priority {
> > >
> > >    public static final int  CRIT_INT  = 42000;
> > >
> > >    // We assimilate CRIT to CRIT on Syslog
> > >    static final int SYSLOG_CRIT_INT   = 2;
> > >
> > >    public static final CritPriority CRIT =
> > >        new CritPriority(CRIT_INT, "CRIT", SYSLOG_CRIT_INT);
> > >
> > >    protected CritPriority(int level, String strLevel, int syslogEquiv) {
> > >        super(level, strLevel, syslogEquiv);
> > >    }
> > >
> > >    public static Priority toPriority(String sArg) {
> > >        if (sArg == null)
> > >          return CritPriority.CRIT;
> > >
> > >        return (sArg.equalsIgnoreCase("CRIT")) ?
> > >            CritPriority.CRIT :
> > >              Priority.toPriority(sArg);
> > >    }
> > >
> > >    public static Priority toPriority(int i) throws
> > IllegalArgumentException
> > >{
> > >        return (i == CRIT_INT) ?
> > >            CritPriority.CRIT :
> > >            Priority.toPriority(i);
> > >    }
> > >}
> > >
> > >--------------------------------------------
> > >----- Original Message -----
> > >From: "Ceki Gülcü" <[EMAIL PROTECTED]>
> > >To: "LOG4J Users Mailing List" <[EMAIL PROTECTED]>
> > >Sent: Monday, July 16, 2001 11:03 PM
> > >Subject: Re: how to specify non-standard Priority level in xml config file?
> > >
> > >
> > >
> > >Mike,
> > >
> > >No this means that there is something wrong with your priority class. Send
> > >it over.
> > >
> > >At 20:00 16.07.2001 -0700, Mike Papper wrote:
> > >>Here is what I see:
> > >>
> > >>---------------------
> > >>log4j: Appender [logx] to be rolled on top of every hour.
> > >>log4j: Attaching appender named [errorx] to appender named [async].
> > >>log4j: Class name: [com.yaga.logger.DailyRollingFileAppender]
> > >>log4j: Setting property [file] to [logs/webclient/crit/crit].
> > >>log4j: Setting property [datePattern] to ['.'yyyy_MM_dd_HH'].
> > >>log4j: Setting property [append] to [true].
> > >>log4j: toPriority:class=[com.yaga.logger.CritPriority]:pri=[crit]
> > >>log4j: Setting property [threshold] to [DEBUG].
> > >>log4j: Setting property [immediateFlush] to [true].
> > >>log4j: Parsing layout of class: "org.apache.log4j.PatternLayout"
> > >>log4j: Setting property [conversionPattern] to [%d{ISO8601}#%r [%t %C::%M
> > >at
> > >>%L]
> > >> %p %c: %m%n].
> > >>log4j: Appender [errorx] to be rolled on top of every hour.
> > >>log4j: Attaching appender named [syslogx] to appender named [async].
> > >>-----------------------------------
> > >>
> > >>This indicates that it reads the line, parses and notices "crit" is used
> > >but
> > >>ignores it. I am using log4j version 1.1.2 (jakarta-log4j-1.1.2)
> > >>
> > >>Mike Papper
> > >>
> > >>----- Original Message -----
> > >>From: "Ceki Gülcü" <[EMAIL PROTECTED]>
> > >>To: "LOG4J Users Mailing List" <[EMAIL PROTECTED]>
> > >>Sent: Monday, July 16, 2001 5:42 PM
> > >>Subject: Re: how to specify non-standard Priority level in xml config
> > file?
> > >>
> > >>
> > >>At 17:20 16.07.2001 -0700, you wrote:
> > >>>I want to set the priority in the Appender not in the category, so does
> > >>this
> > >>>mean that my using:
> > >>>
> > >>><param name="Threshold" value="crit" class="com.myclass.classname"/>
> > >>>
> > >>>wont work?
> > >>>
> > >>>I also tried:
> > >>>
> > >>><param name="Threshold" value="crit#com.myclass.classname"/>
> > >>
> > >>As far as I can tell, the following works.
> > >>
> > >><param name="Threshold" value="crit#com.myclass.classname"/>
> > >>
> > >>Set the log4j.debug system property to see internal log4j message.
> > >>The syntax is:
> > >>
> > >>java -Dlog4j.debug your.test.application
> > >>
> > >>This should show you that the string after the # is interpreted as a class
> > >>name.
> > >>
> > >>Regards, Ceki
> > >>
> > >>
> > >>
> > >>>----- Original Message -----
> > >>>From: "Jay Riddell" <[EMAIL PROTECTED]>
> > >>>To: "LOG4J Users Mailing List" <[EMAIL PROTECTED]>
> > >>>Sent: Monday, July 16, 2001 5:08 PM
> > >>>Subject: Re: how to specify non-standard Priority level in xml config
> > >file?
> > >>>
> > >>>
> > >>>>     Try the following:
> > >>>>
> > >>>>    <category name="com" class="com.myclass.className">
> > >>>>         <priority value="myPriority#com.classNameOfMyPriority" />
> > >>>>     </category>
> > >>>>
> > >>>>
> > >>>> ----- Original Message -----
> > >>>> From: "Mike Papper" <[EMAIL PROTECTED]>
> > >>>> To: "LOG4J Users Mailing List" <[EMAIL PROTECTED]>
> > >>>> Sent: Monday, July 16, 2001 4:49 PM
> > >>>> Subject: Re: how to specify non-standard Priority level in xml config
> > >>>file?
> > >>>>
> > >>>>
> > >>>> > This did not work. My Priority class is extended from log4j's
> > Priority
> > >>>> > class.
> > >>>> > I saw no error in log4j either.
> > >>>> >
> > >>>> > Heres what I used in my XML:
> > >>>> >
> > >>>> > <param name="Threshold" value="crit" class="com.myclass.classname"/>
> > >>>> >
> > >>>> >
> > >>>> > ----- Original Message -----
> > >>>> > From: "Ceki Gülcü" <[EMAIL PROTECTED]>
> > >>>> > To: "LOG4J Users Mailing List" <[EMAIL PROTECTED]>
> > >>>> > Sent: Thursday, July 12, 2001 11:34 PM
> > >>>> > Subject: Re: how to specify non-standard Priority level in xml config
> > >>>file?
> > >>>> >
> > >>>> >
> > >>>> > At 19:27 12.07.2001 -0700, you wrote:
> > >>>> > >I have:
> > >>>> > >
> > >>>> > ><param name="Threshold" value="error"/>
> > >>>> > >
> > >>>> > >and I really want:
> > >>>> > >
> > >>>> > ><param name="Threshold" value="crit"/>
> > >>>> > >
> > >>>> > >where crit represents a class named CritPriority, a subclass of
> > >>>Priority
> > >>>> > >I've defined
> > >>>> > >
> > >>>> > >Is there a way to do this with the xml configurator?
> > >>>> > >
> > >>>> > >Can I put an integer value in here like so:
> > >>>> > >
> > >>>> > ><param name="Threshold" value="42000"/>
> > >>>> > >
> > >>>> > >?
> > >>>> > >
> > >>>> > >Mike Papper
> > >>>> >
> > >>>> > Mike,
> > >>>> >
> > >>>> > Try
> > >>>> >
> > >>>> > <param name="Threshold" value="crit" class="your.priority.subclass"/>
> > >>>> >
> > >>>> > The log4j.dtd is the a place to go to clarify the capabilities of the
> > >>>XML
> > >>>> > configuration file.
> > >>>> >
> > >>>> > By the way, whenever the "class" attribute is not available usually
> > >the
> > >>>> > following alternate syntax is available:
> > >>>> >
> > >>>> > value="crit#your.priority.subclass"   (in XML type config files)
> > >>>> >
> > >>>> > value=crit#your.priority.subclass     (in property type config files)
> > >>>> >
> > >>>> > Hope this helps, Ceki
> > >>>> >
> > >>>> > --
> > >>>> > Ceki Gülcü - http://qos.ch
> > >>>> >
> > >>>> >
> > >>>> > ---------------------------------------------------------------------
> > >>>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >>>> > For additional commands, e-mail: [EMAIL PROTECTED]
> > >>>> >
> > >>>> >
> > >>>> >
> > >>>> > ---------------------------------------------------------------------
> > >>>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >>>> > For additional commands, e-mail: [EMAIL PROTECTED]
> > >>>> >
> > >>>> >
> > >>>>
> > >>>>
> > >>>> ---------------------------------------------------------------------
> > >>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >>>> For additional commands, e-mail: [EMAIL PROTECTED]
> > >>>>
> > >>>
> > >>>
> > >>>---------------------------------------------------------------------
> > >>>To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >>>For additional commands, e-mail: [EMAIL PROTECTED]
> > >>
> > >>--
> > >>Ceki Gülcü - http://qos.ch
> > >>
> > >>
> > >>---------------------------------------------------------------------
> > >>To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >>For additional commands, e-mail: [EMAIL PROTECTED]
> > >>
> > >>
> > >>
> > >>---------------------------------------------------------------------
> > >>To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >>For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >--
> > >Ceki Gülcü - http://qos.ch
> > >
> > >
> > >---------------------------------------------------------------------
> > >To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> > >---------------------------------------------------------------------
> > >To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> > --
> > Ceki Gülcü - http://qos.ch
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to