Handling prefix in DailyLogListener

Skip to first unread message


Nov 4, 2022, 2:58:15 AM11/4/22
to jPOS Users

In the DailyLogListener there are two parameters prefix and suffix, prefix is being used to give the log file path and log file name.

The "setConfiguration" method has the below lines

String suffix = cfg.get("suffix", ".log");
String prefix = cfg.get("prefix");
this.logName = prefix + suffix;

Here the logName is initialized with local variables of prefix and suffix. Shouldn't it be initialized with a global prefix and suffix? Because when I override setPrefix() method it did not help.

Why I want to override is, in the logger configuration I have given the relative path "logs/systemLog" in the prefix which will mean that from the application directory it has to look for the logs folder. But when I deploy the application in tomcat it didn't work, I have to give an absolute path. So I am trying to override the set prefix method where I will pre-pad the tomcat base path to the value configured in the logger configuration file.

Thanks & Regards


Andrés Alcarraz

Nov 4, 2022, 12:53:37 PM11/4/22
to jpos-...@googlegroups.com

Hi Praveen, I’ve just created a PR to fix that.

Let’s see if it gets approved.

In the meanwhile as a workaround, you could create a ConfigurationWrapper class that overrides the get method to return what you want for that specific property, and pass that to super.setConfiguration, it’s not elegant but could work, or you can apply the patch.

Best regards.


El 4/11/22 a las 01:58, praveenk...@gmail.com escribió:

jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/5a9ce4a9-c615-4578-b9fe-2472335344e9n%40googlegroups.com.

Reply all
Reply to author
0 new messages