https://learninghub.kx.com/forums/topic/error-while-logging-in-kx-api-code
var1:first exec sum smb from select smb1;
.log.LOG.info(“log SampleMean %s”;string var1);
when trying to log with code :.log.LOG.info(“log SampleMean %s”;string var1); HDB and some process is not coming post restart. seems like conversion error. please advise
Can you explain more clearly what you're trying to do and the error you are receiving?
Hi iodwyer- Thanks for your reply, I'm trying the below code, if var1 is having a number or decimal value, how can we print in in logfile say as its HDB process I would like to print the value of var1 in HDB logs. I tried below Loging code but unfortunately it didn't work. there are no specific error.
var1:first exec sum smb from select smb1;
.log.LOG.info(“log SampleMean %s”;string var1);
See example below, hopefully this helps.
ubuntu@ian-dev:~$ q
KDB+ 4.1 2025.04.28 Copyright (C) 1993-2025 Kx Systems
l64/ 4()core 15990MB ubuntu ian-dev.firstderivatives.com 127.0.1.1 EXPIRE 2025.07.13 iodwyer@kx.com KXAI #84167
q).com_kx_log.init[:fd://stdout
:fd:///tmp/app.log; ``]
8c6b8b64-6815-6084-0a3e-178401251b68 5ae7962d-49f2-404d-5aec-f7c8abbae288
q).log.LOG:.com_kx_log.new[`Test; ()]
q).log.LOG.info (“log SampleMean %1”; 10)
{“time”:“2025-06-12T00:03:13.532z”,“component”:“Test”,“level”:“INFO”,“message”:“log SampleMean 10”}
\
ubuntu@ian-dev:~$ cat /tmp/app.log
{“time”:“2025-06-12T00:03:13.532z”,“component”:“Test”,“level”:“INFO”,“message”:“log SampleMean 10”}