Question
· Jan 27, 2022

not able to see whole log message in message viewer in Management Portal

Hi Community

I have logged final generated json in the object script class using below statement

$$$LOGINFO("JSON = " _newMsg.Read())

where newMsg contains JSON stream, which contains nearly 1000000 + bytes.

In message viewer I am able to see Only some part of the json .

I want to capture all the json for my validation, how can i see total JSON in Management portal or any other source?

Thanks in Advance

Product version: Caché 2017.1
Discussion (3)2
Log in or sign up to continue
set tmpStr = ##class(%Stream.FileCharacter).%New()
do tmpStr.LinkToFile("/some/writeable/location/temp.json")
do tmpStr.CopyFrom(newMsg)
do tmpStr.%Save()

You should then be able to open the JSON file outside of Caché/Ensemble, from the location to which it was written.

EDIT: The location could potentially be /<cache-install-dir>/csp/user/<filename> ... in which case you may be able to access it through the Caché/Ensemble web server and display it in your web browser:

http://<hostname>:<port>/csp/user/<filename>

Hi,

Please try below, you should be able to read all json content. This works !

set oref = ##class(%Stream.GlobalCharacter).%New() 
do oref.Write(newMsg) // where newMsg contains JSON stream
$$$LOGINFO("JSON = " _oref.Read())

You can also read only certain number of characters from json, for more understanding please go through below intersystems documentation Reading and Writing Stream Data

Thanks,

Anusri

If you check Ens.Util.Log class where logs are stored, you'll notice that Text property is limited to 32 000 characters, so logging anything larger than that is impossible.

There are several approaches you can take:

  • Logging to files as described by @Jeffrey Drumm. I'd add that you can use %File:TempFilename to obtain a random but valid filename to write to. Alternatively use session id and timestamp to create the filename, with each session having a separate folder.
  • Logging to streams. Use %Stream.GblChrCompress to save on space. JSON is very compressible.
  • Use a debugging business operation. Create a business operation which accepts everything and either defers or just does nothing. Send a copy of your stream there. This way you get immediate access to a content from the Visual Trace.