Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

logger and spaces #3722

benprim ·

I'm trying to ident some information using logger.info (extract from a log file)
I need to keep the spaces in from of the string, but looks like logger.info is triming spaces at the beginning of a string, and even if i add a char before it concats all following spaces into one

groovy:
def test ="      test";
logger.info("{}",test);
test = "_"+test;
logger.info("{}",test);
logger.info("{}",test.replace(' ','_')

Result

10:19:37,522 INFO  - Running step...
10:19:37,537 INFO  - test
10:19:37,537 INFO  - _ test
10:19:37,538 INFO  - _______test

Is there a way to force the spaces to be dispayed ?
Thanks

  • replies 5
  • views 3572
  • stars 0
robinshen ADMIN ·

This is not supported as QB displays the log as html, and extra spaces will be displayed as single space in html

benprim ·

Thanks Robin for the reply,
Could we have a way to send a preformated or html enconding message to the logger ?

robinshen ADMIN ·

You may submit an improvement request at track.pmease.com

drdt ·

What happens if you replace the spaces with HTML tag &nbsp (non-breaking space)?

robinshen ADMIN ·

It will also be escaped right now to keep the log displaying safe. So   will be displayed as " " literally.