You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Blondeel Thibault <th...@acunia.com> on 2002/02/07 10:14:15 UTC

How to work with custom Priorities?

Hi everybody,


I am a new user of Log4j .... and I was just messing around to get used
to the Log4j architecture. I wanted more priorities so I wrote my own
Priority class extended from the default Log4j.Priority. But then came
the problem ... nothing was logged anymore! I use the log() method form
the Log4j.Category where you have to suply the priority(in this case my
priorities), msg and a Thrownable ... In my property file I put
something like:  log4j.category.Cat=ALERT#MyProperty, A1

Do I have to write a sub-class of Category ?

Thx for helping me ...


Best regards,

Thibault


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to work with custom Priorities?

Posted by Blondeel Thibault <th...@acunia.com>.
Ceki Gülcü wrote:

> Thibault,
>
> No, you definitely do not need to sub-class category. I suggest that you
> run log4j with the debug option on. As in
>
> log4j.debug=true
> log4j.category.Cat=ALERT#MyProperty, A1
> ...
>
> to see that the ALERT priority is being read in.
>
> Now, if the ALERT priority is higher than the priority of your log
> statement, then
> log4j will not print anything...
>
> Hope this helps, Ceki
>

Thanks for your reply ... I found the problem ... my priorities where defined
the other way around. I mean the highest priority the lowest int_value they had
... so I had to overwrite the isGreaterOrEqual() method of the Priority class.
But now I have another problem (... the usual life of a programmer :)) ...), it
works fine with the property file  "log4j.category.Cat=ALERT#MyProperty, A1"
but not with my xml file "<priority class="MyPriority" value="alert"/>" . When I
turn de debug option at the command line -Dlog4j.debug then I can see that the
xml file is correctly being parsed but he set category to DEBUG default value
....???
Is there something wrong with my xml synthax? Can I assign one of my priorities
to the root category?

Best regards,

Thibault


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to work with custom Priorities?

Posted by Ceki Gülcü <ce...@qos.ch>.
Thibault,

No, you definitely do not need to sub-class category. I suggest that you
run log4j with the debug option on. As in

log4j.debug=true
log4j.category.Cat=ALERT#MyProperty, A1
...

to see that the ALERT priority is being read in.

Now, if the ALERT priority is higher than the priority of your log 
statement, then
log4j will not print anything...

Hope this helps, Ceki

At 10:14 07.02.2002 +0100, you wrote:
>Hi everybody,
>
>
>I am a new user of Log4j .... and I was just messing around to get used
>to the Log4j architecture. I wanted more priorities so I wrote my own
>Priority class extended from the default Log4j.Priority. But then came
>the problem ... nothing was logged anymore! I use the log() method form
>the Log4j.Category where you have to suply the priority(in this case my
>priorities), msg and a Thrownable ... In my property file I put
>something like:  log4j.category.Cat=ALERT#MyProperty, A1
>
>Do I have to write a sub-class of Category ?
>
>Thx for helping me ...
>
>
>Best regards,
>
>Thibault
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>

--
Ceki Gülcü



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>