Format DateTime in frontail/rules

Hello,

I am having trouble with some formatting issues i am unsure how to configure after some research.
Currently my stuff is the following and it works, but i would like it in a more user friendly format.

logInfo("openHAB.rules", "openHAB_StartTime:" +openHAB_StartTime.state.toString)

Which look like :

Item 'openHAB_StartTime' received command 2019-11-13T17:37:12.897-0600

This is what i WANT, and I am trying to use in the logs and it does not work.

openHAB_StartTime	"OpenHAB Started at:[%1$tm-%1$td-%1$tY %1$tI:%1$tM.%1$tS %1$tp]"

OpenHAB Started at: 11-13-2019 05:37.12 pm

When i do

logInfo("openHAB.rules", "openHAB_StartTime: %1$tm-%1$td-%1$tY %1$tI:%1$tM.%1$tS %1$tp",openHAB_StartTime.state)

I get

openHAB_StartTime: %1$tm-%1$td-%1$tY %1$tI:%1$tM.%1$tS %1$tp

How do I get the log/rules format to follow the Items configuration format and show like the following?

logInfo("openHAB.rules", "openHAB_StartTime: 11-13-2019 05:37.12 pm

Thanks for any help!

Well, it’s only a log file - that would be good enough for me.

There are examples of formatting DateTime states to string here in this Tutorials & Example post

To change the format of the stuff at the beginning of a log statement, you need to change the $OH_USERDATA/etc/org.ops4j.pax.logging.cfg file. Look at the log4j2 docs for how to change the timestamp format.