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 Steve Pruitt <SP...@exstream.com> on 2006/04/25 18:46:19 UTC

Cannot reconcile custom level placement

I have a custom level named Action that has some specific logging
semantics.  Currently, the Action level is below Error in the level
hierarchy.  I implemented a log wrapper as described in the Log4J
manual.  The wrapper implements a action print method.

What I want is for Action level events to be written to the log when the
log-level filter is set to either Action or Error.  When the level
filter is set to Action, I want Error log requests dropped.

When the log-level filter is set to Error and I log something at Action
level, the is printed to the log ok, but the printed level is Error.  I
want the log to print the log request level, not the log's effective
level.

My action method logs with this call, where logger is the instance of
Logger.

logger.log(logger.getLevel(), message);

If I replace it with:

logger.log(ActionLevel.ACTION, message);

then naturally nothing prints because the effective level is Error.

If I flip the level order and put Action higher than Error, it looks
like I create the same problem just reversed.

All I want is to get the log to print the level of the logging request
and not the log's effective level, which it appears to me what it is
doing.  Is my basic approach flawed, or am I missing something obvious?


-S

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