UDP Logging strips carriage returns from multiline Address

Regarding connecting to external program's.
VK3AMA
Advanced Class
Posts: 31
Joined: 01 Feb 2013, 22:36

UDP Logging strips carriage returns from multiline Address

Post by VK3AMA »

Tested against Log4OM 1.25, both log types, sqlite and MySQL.
Using the UDP logging interface, NO direct writing to the logs.

The problem... When sending multi-line Address data with carriage return/line feed line endings, the carriage returns are being stripped (line feeds only remaining). This results in the address appearing as a single line when viewed in Log4OM with no line-breaks. Checking the sqlite and MySQL databases directly confirms that the carriage returns are being stripped and not stored.

When a QSO is manually entered in Log4OM with a multi-line address, both database types are correctly storing the CRLF endings.

Is this a defect or by design?

de Laurie, VK3AMA
User avatar
G4POP
Log4OM Alpha Team
Posts: 10752
Joined: 21 Jan 2013, 14:55
Location: Burnham on Crouch, Essex UK

Re: UDP Logging strips carriage returns from multiline Address

Post by G4POP »

Laurie,
I have asked Lele to respond because I cant answer this one
73 Terry G4POP
User avatar
IW3HMH
Site Admin
Posts: 2925
Joined: 21 Jan 2013, 14:20
Location: Quarto d'Altino - Venezia (ITA)
Contact:

Re: UDP Logging strips carriage returns from multiline Address

Post by IW3HMH »

The UDP you're using is the one formerly used for HRD?
Daniele Pistollato - IW3HMH
VK3AMA
Advanced Class
Posts: 31
Joined: 01 Feb 2013, 22:36

Re: UDP Logging strips carriage returns from multiline Address

Post by VK3AMA »

IW3HMH wrote:The UDP you're using is the one formerly used for HRD?
I seem to recall that many Log4OM versions ago the UDP interface was referred to the HRD interface or something similar with HRD in the wording.

I am using the inbound settings available via the Log4OM Communicator window. "UDP connection for Incoming QSO" settings, "UDP Connection (Add Message}" enabled on the default 2236 port.

Is this not the correct way to get a QSO logged from a 3rd party application (in my case JTAlert)? I see no alternate setting for this logging function.

de Laurie, VK3AMA
VK3AMA
Advanced Class
Posts: 31
Joined: 01 Feb 2013, 22:36

Re: UDP Logging strips carriage returns from multiline Address

Post by VK3AMA »

Examining the Log4OMCommunicator_log file, I also note that it records the address with the carriage returns (0x0D) stripped, line feeds (0x0A) remain. So the stripping is happening before the Communicator logfile is updated.

My guess is the code responsible for either receiving the UDP packet or the code passing the received packet is stripping the carriage returns.

The TCP/UDP packet sending code of JTAlert code used to send the UDP packet to Log4OM is identical to the code use to send logging data to DXKeeper, HRD and ACLog. All those loggers are correctly recording the Address with the carriage returns, so the TCP/UDP packet sending code of JTAlert is not stripping the carriage returns. The defect seems to be within Log4OM.

de Laurie, VK3AMA
VK3AMA
Advanced Class
Posts: 31
Joined: 01 Feb 2013, 22:36

Re: UDP Logging strips carriage returns from multiline Address

Post by VK3AMA »

Further testing reveals that the multiline "NOTE" log field is also have the carriage returns stripped when logged via the UDP interface.

de Laurie, VK3AMA
VK3AMA
Advanced Class
Posts: 31
Joined: 01 Feb 2013, 22:36

Re: UDP Logging strips carriage returns from multiline Address

Post by VK3AMA »

Can a Dev confirm if this is a defect within Log4OM?

If it is a defect, is there any idea on when a fix will be available?

If it is not a defect, what is the correct method of logging (via the API) multi-line data to avoid "Carriage Returns" being stripped from the data before being written to the log (both SQLIte and MySQL are affected).

de Laurie, VK3AMA
(JTAlert Author)
User avatar
G4POP
Log4OM Alpha Team
Posts: 10752
Joined: 21 Jan 2013, 14:55
Location: Burnham on Crouch, Essex UK

Re: UDP Logging strips carriage returns from multiline Address

Post by G4POP »

Hi Laurie,
I have asked Lele to respond to you and hope he will do so soon, but he is working away from home, in Warsaw Poland, so I am not sure when he will be able to get back to you.

Meanwhile my apologies for the delay but Lele is our only programmer so I am unable to assist
73 Terry G4POP
User avatar
IW3HMH
Site Admin
Posts: 2925
Joined: 21 Jan 2013, 14:20
Location: Quarto d'Altino - Venezia (ITA)
Contact:

Re: UDP Logging strips carriage returns from multiline Address

Post by IW3HMH »

Let me check the code Laurie...
i'll be back in a bit
Daniele Pistollato - IW3HMH
User avatar
IW3HMH
Site Admin
Posts: 2925
Joined: 21 Jan 2013, 14:20
Location: Quarto d'Altino - Venezia (ITA)
Contact:

Re: UDP Logging strips carriage returns from multiline Address

Post by IW3HMH »

At a first glance the string passed is not changed by Communicator.
There is a log of the provided string in the communicator log.
Search for text "Incoming TCP QSO " + adif

The adif is the one received without changes.

This is the code snippet responsible to read the UDP incoming data:

Code: Select all

               
               listener = new UdpClient(endpoint);

                running = true;
                LogWriter.Write("Starting Inbound TCP Listener...", LogWriter.Log4OmLogLevel.Info);
                while (running)
                {
                    byte[] receiveByteArray = listener.Receive(ref endpoint);
                    string receivedData = Encoding.ASCII.GetString(receiveByteArray, 0, receiveByteArray.Length);
                    try
                    {
                        if (receivedData.StartsWith("ADD "))
                        {
                            string adif = receivedData.Substring(4, receivedData.Length - 4);
                            LogWriter.Write("Incoming QSO from TCP Connection (ADD) " + adif, LogWriter.Log4OmLogLevel.Debug);
As you can see i'm directly to the sockect listener (framework), and the only activity i'm doing is to encode in ASCII and stripping "ADD " string from the code.

I'm investigating further...
Daniele Pistollato - IW3HMH
Locked