I would like to add some additional imformation to my MessageBox.Log ASCII file. In the docs I read “Logging Messages to a file (you can determine the file structure and what gets written there)” and “You can do this in the global PrimeLog embed point (before the parent call) in your Data DLL (for multi-dll applications).” CapeSoft MessageBox Complete Documentation but the answer does not say what should I add in that embed point.
I want to add the procedure name ( just to the log, I know I can add it to to the message displayed to end users but it may confuse them) and the BIOS name of the computer acquired from GetComputerName WinAPi call
How can I add additional data fields to messagebox ascii file?
Forget the “procedure name ( just to the log …)” - I found unticking “display the procedure and application name that called the Message()” does the trick. ‘Maintain the Procedure name in the Error Class’ checkbox adds the procedure name to the log only.
So the only question that stays is how do I add additional fields to the log?
Greg, put a comment in that embed point, like !Hi Gregg.
Then generate and/or compile your app.
Then open the APPNAME.CLW module and search for your comment.
This will give a look at the code in context and should help you determine how to proceed.
Post the code you find here if you need additional help.
If you follow @Rick_UpperPark advice and you are using the dictionary file from MessageBox you will see something like this:
To add additional fields, you can add column(s) to the table and then populate it here.
Hi Rick, I managed to accomplish what I wanted diffently, not by adding a new field but by appending value to existing one
in ds_Message procedure I added this code
! Start of "MessageBox - Alter Message Parameters"
ThisMessageBox.FromExe = CLIP(ThisMessageBox.FromExe) & ',' & ComputerName
amd I’m getting the below in MessageBox.Log
12.01.2024,15:00:22, 0:00:02,,1,Testing,test message,MainWin,Test.exe,MYLAPTOP,
In my APPNAME.CLW module I have this, but the below code does not add anything to messagebox.log
ThisMessageBox.PrimeLog procedure () !CapeSoft MessageBox Object Procedure
!CapeSoft MessageBox Template Generated code to prime the logging records
!Because there is no File selected, record priming is handled in the object and
!the default ASCII file is used to log the records.
! My custom code start
TestField = 'My test fiels'
ExtraDetails = TestField & ComputerName
! My custom code end
Was wondering if “you can determine the file structure and what gets written there” only applies to TPS files. Your example seems to be referring to using dictionary TPS file for logging and I am using ASCII file.
ASCII file is convenient for me as I can easily rotate it on the server side and filter using commandline even if I have no Clarion tools at hand. Also I don’t have to worry about error 47 if I add columns to it.