Skip to content
Advertisement

How to format log4j timestamp with nanoseconds and timezone?

I want to achieve a timestamp that has nanoseconds and time zone difference, example:

2021-11-30 22:21:41.829798+02:00

I failed with variations like:

%d{yyyy-MM-dd HH:mm:ss.nnnnnnXXX}

Dependency:

JavaScript

Is that supported with log4j and if so how can I achieve that?

thanks.

Advertisement

Answer

I was able to find an obvious solution 🙂

JavaScript

I separated the timestamp with nanos from the timezone itself and it worked.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement