Displaying dates of log timestamps on Karaf Console

  • Platform information:
    • Hardware: Raspberry Pi 3
    • OS: Raspbian 9
    • openHAB version: 2.5.3-1

Issue of the topic: When I check the log tail on the Karaf Console, I can only see the time each log was generated with the format HH:mm:ss.ms

19:02:40.372 [INFO ] [ernal.service.RemoteControllerService] - Using None interface
19:02:40.385 [INFO ] [ernal.service.RemoteControllerService] - Using None interface
22:23:59.472 [INFO ] [ernal.service.RemoteControllerService] - Using None interface
22:23:59.486 [INFO ] [ernal.service.RemoteControllerService] - Using None interface

How can I display the timestamp’s date by default? Something like MM/DD/YYYY HH:mm:ss.ms

03/30/2020 19:02:40.385 [INFO ] [ernal.service.RemoteControllerService] - Using None interface
03/31/2020 22:23:59.472 [INFO ] [ernal.service.RemoteControllerService] - Using None interface

I think this should have been asked before, but couldn’t find anything related.

Try changing the pattern in:

/var/lib/openhab2/etc/org.apache.karaf.log.cfg

or

/opt/openhab2/userdata/etc/org.apache.karaf.log.cfg

according to the file locations.

#
# The pattern used to format the log statement when using log:display. This pattern is according
# to the log4j layout. You can override this parameter at runtime using log:display with -p.
#
pattern = %d{MM/dd/YYYY HH:mm:ss.SSS} [%-5.5p] [%-37.37c] - %m%n

Hi again,

I wonder if there’s a way to make the change permanent. Every time I update OH packages, the setting gets overriden by the default and I realize it when I have a problem and have to run in debug mode.