Log4J Custom Fields

后端 未结 3 1690
再見小時候
再見小時候 2020-12-15 06:08

Introduction:

I\'m trying to get additional fields to log with log4j, and its working but only when I create an appender in code and not in the log4j.properties

3条回答
  •  甜味超标
    2020-12-15 07:13

    From the example you posted, I can only guess that AppServerPatternLayout is not in the package logging. Everything else looks find. Add

    log4j.DEBUG=true
    

    to your properties file. log4j will then dump what it does while reading the properties. Maybe that gives you an idea what's wrong.

    If that doesn't help, consider to use Nested Diagnostic Contexts.

提交回复
热议问题