Discussion:
Confused about log4j.properties
Kawthar Bt M Sulaiman
2004-04-02 04:01:06 UTC
Permalink
Hi,

In this file, there's:

log4j.rootCategory=debug, MO ----> <first>

Then,

log4j.appender.MO=org.apache.log4j.DailyRollingFileAppender
log4j.appender.MO.Threshold=DEBUG. -----> <second>
...

My question, is the debug <on first> and <debug on second> has the
same
meaning? So, if I just want to log INFO and above, do I change the
Threashold=INFO only or both?

I was looking for a documentation on what each lines mean but
couldn't find it.

Confidential information may be contained in this e-mail and any files transmitted with it ('Message'). If you are not the addressee indicated in this Message (or responsible for delivery of this Message to such person), you are hereby notified that any dissemination, distribution, printing or copying of this Message or any part thereof is strictly prohibited. In such a case, you should delete this Message immediately and advise the sender by return e-mail. Opinions, conclusions and other information in this Message that do not relate to the official business of Maxis shall be understood as neither given nor endorsed by Maxis.
Simon Kitching
2004-04-02 04:15:20 UTC
Permalink
Post by Kawthar Bt M Sulaiman
Hi,
log4j.rootCategory=debug, MO ----> <first>
Then,
log4j.appender.MO=org.apache.log4j.DailyRollingFileAppender
log4j.appender.MO.Threshold=DEBUG. -----> <second>
...
My question, is the debug <on first> and <debug on second> has the
same
meaning? So, if I just want to log INFO and above, do I change the
Threashold=INFO only or both?
When some code logs a message, it specifies a priority and a category.
If the message priority is less than the category priority, then the
message is totally ignored.

Once the message gets past that first cutoff, some significant work gets
done (creating a LogEvent object etc), then the message is sent on to
each appender (ie "outputter") associated with the category.

If any of those appenders has a threshold set, then that appender
discards (ignores) the message if its priority is less than the
threshold.

So this allows you to say:
* category X has two appenders: file and email
* for category X, ignore everything lower than INFO
* for the file appender, accept all that pass the category priority
(ie no threshold set)
* for the email appender, ignore those messages which got past the
category filtering, but are lower than WARN

It is more efficient to filter at the category level than the appender
level, but if you want different amounts of detail written to different
appenders for the same category, then the threshold setting allows you
to do this.

Cheers,

Simon
Kawthar Bt M Sulaiman
2004-04-02 04:25:17 UTC
Permalink
Oh ok.... now I understand.

Thank you.
--Kawthar
Post by Kawthar Bt M Sulaiman
Hi,
log4j.rootCategory=debug, MO ----> <first>
Then,
log4j.appender.MO=org.apache.log4j.DailyRollingFileAppender
log4j.appender.MO.Threshold=DEBUG. -----> <second>
...
My question, is the debug <on first> and <debug on second> has the
same
meaning? So, if I just want to log INFO and above, do I change the
Threashold=INFO only or both?
When some code logs a message, it specifies a priority and a category.
If the message priority is less than the category priority, then the
message is totally ignored.

Once the message gets past that first cutoff, some significant work
gets
done (creating a LogEvent object etc), then the message is sent on to
each appender (ie "outputter") associated with the category.

If any of those appenders has a threshold set, then that appender
discards (ignores) the message if its priority is less than the
threshold.

So this allows you to say:
* category X has two appenders: file and email
* for category X, ignore everything lower than INFO
* for the file appender, accept all that pass the category priority
(ie no threshold set)
* for the email appender, ignore those messages which got past the
category filtering, but are lower than WARN

It is more efficient to filter at the category level than the appender
level, but if you want different amounts of detail written to different

appenders for the same category, then the threshold setting allows you
to do this.

Cheers,

Simon




---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-***@logging.apache.org
For additional commands, e-mail: log4j-user-***@logging.apache.org


Confidential information may be contained in this e-mail and any files transmitted with it ('Message'). If you are not the addressee indicated in this Message (or responsible for delivery of this Message to such person), you are hereby notified that any dissemination, distribution, printing or copying of this Message or any part thereof is strictly prohibited. In such a case, you should delete this Message immediately and advise the sender by return e-mail. Opinions, conclusions and other information in this Message that do not relate to the official business of Maxis shall be understood as neither given nor endorsed by Maxis.
Paul Smith
2004-04-02 04:34:54 UTC
Permalink
And just one more thing to factor in:

log4j.threshold=........

This property defines the base threshold that ALL log events must be
greater than or equal to before going on and evaluating the
category/logger & appender thresholds that have been discussed.

This property is like the primary valve in a water pipe system
regulating the main flow in a very very course manor.

By default this top level threshold is "ALL". But you could set it to,
say, INFO to effectively discard/ignore all DEBUGs in the quickest way
possible.

Hope that helps.

Paul Smith
Post by Kawthar Bt M Sulaiman
Oh ok.... now I understand.
Thank you.
--Kawthar
Post by Kawthar Bt M Sulaiman
Hi,
log4j.rootCategory=debug, MO ----> <first>
Then,
log4j.appender.MO=org.apache.log4j.DailyRollingFileAppender
log4j.appender.MO.Threshold=DEBUG. -----> <second>
...
My question, is the debug <on first> and <debug on second> has the
same
meaning? So, if I just want to log INFO and above, do I change the
Threashold=INFO only or both?
When some code logs a message, it specifies a priority and a category.
If the message priority is less than the category priority, then the
message is totally ignored.
Once the message gets past that first cutoff, some significant work
gets
done (creating a LogEvent object etc), then the message is sent on to
each appender (ie "outputter") associated with the category.
If any of those appenders has a threshold set, then that appender
discards (ignores) the message if its priority is less than the
threshold.
* category X has two appenders: file and email
* for category X, ignore everything lower than INFO
* for the file appender, accept all that pass the category priority
(ie no threshold set)
* for the email appender, ignore those messages which got past the
category filtering, but are lower than WARN
It is more efficient to filter at the category level than the appender
level, but if you want different amounts of detail written to different
appenders for the same category, then the threshold setting allows you
to do this.
Cheers,
Simon
---------------------------------------------------------------------
Confidential information may be contained in this e-mail and any files transmitted with it ('Message'). If you are not the addressee indicated in this Message (or responsible for delivery of this Message to such person), you are hereby notified that any dissemination, distribution, printing or copying of this Message or any part thereof is strictly prohibited. In such a case, you should delete this Message immediately and advise the sender by return e-mail. Opinions, conclusions and other information in this Message that do not relate to the official business of Maxis shall be understood as neither given nor endorsed by Maxis.
---------------------------------------------------------------------
Loading...