logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric.W...@bcbsks.com
Subject Re: log4j - Level creation in config file
Date Tue, 03 Apr 2007 22:09:46 GMT




Thanks again Curt!

As I have milled over in my mind your ideas and my needs, I came to your
solution.  I don't have to have the Formatter output AUDIT: by using the
%Priority, I can make the log record look any way I want for this group
of log records just like you stated below and all without me writing more
Java code.

Eric

On Apr 3, 2007, at 4:14 PM, Eric.Wolf@bcbsks.com wrote:
>
> Thanks Curt!  I like your thoughts.
>
> Here are some more details to clarify.
>
> I want to treat the "Audit" level as data for auditors and I want it to
log
> when it is in production and the RootLogger is set to "ERROR".  My plan
was
> to extend or something a new "Audit" level and set it to an integer of
> 45,000.  This way it will be logged in production and when the formatter
> outputs the "Priority", I will get on the log record "AUDIT".  That is my
> goal and I thought that warranted a new level.  If I use anything below
> "ERROR" as the level, it won't log in production.  I guess I could set
the
> "threshold" on that set of loggers lower so I could use like "INFO" but I
> will get all the others I don't want as well.
>
> Does my need warrant a new level?  Any other thoughts?
>
> Thanks,
> Eric
>

If you set the threshold on the root logger to ERROR and the
threshold on "audit" to INFO, then you should get all INFO level and
higher messages logged to any logger that starts with "audit." and
ERROR and higher level messages on any other logger.  I think that
would do what you want and be much simpler than trying to introduce a
custom level.

> I want to treat the "Audit" level as data for auditors

That clearly suggests that the audience is different, not that the
message has a higher or lower significance than one of the existing
levels.  Consider that "auditors" may assign different significance
to different messages, so you might want to do something like:

auditLogger.info("Expense statement 10104 accepted and reimbursement
for $10.71 issued");

auditLogger.error("CEO has transferred $10.57 million dollars into
personal bank account");

> My plan was
> to extend or something a new "Audit" level and set it to an integer of
> 45,000.

Others who have had similar ideas placed Audit down somewhere between
DEBUG and INFO.  The difference in opinion on the correct value
suggests that is really is orthogonal to significance.

Use a different branch of the logger hierarchy, you will be much
happier.


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


Mime
View raw message