Log file name

64 views
Skip to first unread message

Michel Jraiche

unread,
May 13, 2022, 12:07:54 PM5/13/22
to jPOS Users
Hello, is there a way to include the current date in a log file name using the property file?

example of my configuration for the log:
<log-listener class="org.jpos.util.RotateLogListener">
<property name="file" value="log/ctm.log" />
<property name="window" value="86400" />
<property name="copies" value="90" />
<property name="maxsize" value="100000000" />
</log-listener>

Alejandro Revilla

unread,
May 13, 2022, 12:09:23 PM5/13/22
to jPOS Users
Use the DailyLogListener instead of RotateLogListener

You can find here[1] sample config.

Ref:

Michel Jraiche

unread,
May 13, 2022, 4:13:21 PM5/13/22
to jPOS Users
perfect thank you!

Michel Jraiche

unread,
May 25, 2022, 4:24:43 PM5/25/22
to jPOS Users
Hello again, I implemented the DailyLogListener as suggested and also set it to delete files when they reach a "maxage" it starts working fine, but after a few rotations and deletes I get this exception randomly:  Exception in thread "Timer-0" java.io.UncheckedIOException: java.nio.file.NoSuchFileException: log/ctm-25-05-2022.1.log.gzip7998305803977416871.tmp, and its not always with a tmp file it also happens with the regular .gzip, the exception says it didnt find the files but when I check the specified path those files are there.

this is the configuration I have just for debugging and testing purposes:

<log-listener class="org.jpos.util.DailyLogListener">
<property name="sleeptime" value="5" /> <!-- optional, default one day -->
<property name="maxage" value="1" />
<property name="maxsize" value="100000000" />
<!--needed-->
<property name="prefix" value="log/ctm" />
<property name="suffix" value=".log"/> <!-- optional -->
<!--optional the default is "-yyyy-MM-dd" -->
<property name="date-format" value="-dd-MM-yyyy"/>

<!--optional the default is gzip-->
<property name="compression-format" value="gzip"/>
<!--optional the default is .zip for zip, .gz for gzip-->
<property name="delete-regex" value=".*.gzip.*"/>
<property name="compressed-suffix" value=".gzip"/>
<property name="first-rotate-time" value="16:10:00"/>

</log-listener>
Reply all
Reply to author
Forward
0 new messages