Log4j how to get the value of PID and display it to my file appender

Five Stars

Log4j how to get the value of PID and display it to my file appender

Hello,

 

The code "%pid" does not work it outputs "ERRORid". What shall I use to get the value of PID of my job? Example: NScQO5

 

how.png

Moderator

Re: Log4j how to get the value of PID and display it to my file appender

Hello,

Are you referring to process ids (PIDs) from Talend jobs for main and independent processes? If so, please use below statement,this will print your PID and hostname.
System.out.println(java.lang.management.ManagementFactory.getRuntimeMXBean().getName());
The tstatcatcher will capture pid, father_pid and root_pid 

Let us know if it is what you are looking for.

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Eleven Stars

Re: Log4j how to get the value of PID and display it to my file appender

Five Stars

Re: Log4j how to get the value of PID and display it to my file appender

What I want is to possibly write a code inside the log4j xml so the file that the log4j produces will also contain the job's process id.

 

 

Thank you 

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Put Massive Amounts of Data to Work

Learn how to make your data more available, reduce costs and cut your build time

Watch Now

How OTTO Utilizes Big Data to Deliver Personalized Experiences

Read about OTTO's experiences with Big Data and Personalized Experiences

Blog