logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amnon Lahav" <amnon.la...@gmail.com>
Subject Re: log.info prints exceptios
Date Tue, 06 Nov 2007 08:12:37 GMT
thanks for your detailed answer curt , that was my mistake i was under the
impression that treshold specifies the only level which will be printed out
if i  understand right from what i've read in order to use filters i must
switch to a log4j xml configurations .
i avoided the ("message",e) type because i tough i'll only be getting
exceptions there (error.log) so i won't need the "explanation" it'll appear
in the stacktrace , but as i allso found out the exception gets printed out
as a stacktrace only in the info log and not the error log whre is only
printed out as a e.getMessage() type , why is that happening ?
thanks .

On 11/6/07, Curt Arnold <carnold@apache.org> wrote:
> On Nov 5, 2007, at 4:11 PM, Amnon Lahav wrote:
> >
> > when exceptions are thrown from within the info try catch they
> > still get printed out in the info log and not in the warn , the
> > wanr allso prints them but i don't want info.log to do it as well ?
> >
> Could you clarify that sentence, I'm not sure what you are trying to
> say.
> From your configuration code, you have three log files, info.log,
> warn.log, and error.log.  The info.log file would be expected to have
> any log request of level info and higher, warn.log would have any
> request of level warn and higher and error.log would have any request
> of level error and higher.
> You log an exception object as the message for an error level
> request.  The toString() value of the exception would be expected to
> appear in all three files.  The code is legal, any object can be
> passed as a message and have its toString() method called to get the
> message text.  But it is much more common to pass an exception as the
> second arg on a log request like:
> logger.error("Exception during data operation", e);
> Threshold sets the lower limit of the logging requests processed by
> an appender.  If you want to limit info.log to be only messages with
> the INFO level, you would have to use a filter.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message