How can I configure log4j to not print the exception stacktrace?

前端 未结 8 2351
攒了一身酷
攒了一身酷 2020-12-09 09:52

We use Log4j (and Commons Logging) to log our error messages. Now we want to set up an additional log appender that outputs fatal errors to syslog, but without the exception

8条回答
  •  暖寄归人
    2020-12-09 10:39

    As of Log4j2, you can just add "%ex{0}" to your log pattern (assuming you're using PatternLayout)

    https://logging.apache.org/log4j/log4j-2.1/manual/layouts.html

提交回复
热议问题