How to add the Process id to a LOG4J log file?

后端 未结 3 694
时光说笑
时光说笑 2021-02-12 21:31

I currently have the below pattern layout in log4j. I want to add the Process id to the log file. How can I do it?

log4j.appender.A1.layout=org.apache.log4j.Pa         


        
3条回答
  •  不知归路
    2021-02-12 22:08

    There is no way of doing it using standard Java classes. Generally process ID is appended at file level not at the log level. And here (archived here) is an example of doing it.

提交回复
热议问题