[Bug] logger fails to log message with %

Post Reply
thomasb
Newbie
Posts: 1
Joined: Tue Dec 03, 2024 2:47 pm

[Bug] logger fails to log message with %

Post by thomasb »

Hello all,

I hope this is the correct location to post this. If not please excuse me and move this to the right location.

There is a bug in the FlowElement logger:
Whenever I use a % sign in the log, the logger gives an error: 'Invalid placeholders in log message'.

Some url's (for example S3 presigned url's) need to use % in the url, so it would be valid behaviour to allow this in the log message in my opinion.

Kind regards,

Thomas
Padawan
Advanced member
Posts: 364
Joined: Mon Jun 12, 2017 8:48 pm
Location: Belgium
Contact:

Re: [Bug] logger fails to log message with %

Post by Padawan »

The % signs are intended to be used as placeholders for variables. This is mainly used to do logging in different languages.
You can find more information on the intended behavior in the documentation:
https://www.enfocus.com/manuals/Develop ... sages.html

I don't use translations so I usually do logging like this:

Code: Select all

await job.log(LogLevel.Warning, 'Something takes longer for job %1 with name "%2" ',['%1', '%2', '%3', '%4', '%5', '%6', '%7', '%8', '%9', '%10' ])
This way it searches for the placeholders and replaces them with the placeholders. The end result is successful logging with % signs in the string.

That being said, I did ask Enfocus Support to log a feature request that if there is no array with replacements used, that the logging function does not try to do replacements and just accepts strings with % in them. Feel free to report the same to Enfocus Support, the more people that report it, the bigger the chance it gets implemented.
Post Reply