logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <ralph.go...@dslextreme.com>
Subject Re: logging Exception toString with slf4j
Date Fri, 09 Oct 2020 05:26:44 GMT
One other option is to use the Log4j API and do

logger.atWarn().log(“{}”, throwable);

Since the LogBuilder adds exceptions using a separate method the log method knows it is a
parameter to the format.

FWIW, there is no disadvantage in switching to the Log4j API. It can be bridged to other logging
implementations just like SLF4J can. Plus Log4j is actively maintained whereas SLF4J hasn’t
had any activity in over a year.


> On Oct 8, 2020, at 9:06 PM, Bobby Bissett <robert.bissett@enterprisedb.com> wrote:
> On Thu, Oct 8, 2020 at 10:37 PM Clément Guillaume <cguillaume@hotpads.com>
> wrote:
>> I guess I can do the following (not very elegant)
>>  logger.warn("{} ", (Object)new Exception("my message"));
> Or just log: new Exception("my message").toString();
> Cheers,
> Bobby

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

View raw message