Hello guys,

I was wondering if we could uniquely identify a sync instance in the client, so we can cross client logs with server logs somehow.

For instance, the LogML.txt file has an entry for sync ID 307962

I. 2017-03-02 07:12:54. <307962> Request from "UL 16.0.2193" for: remote ID: 1018, user name: 1109, version: MSERIES.007.037.0000

Can we get this information in the client?

If don't, can you guys suggest another way to cross our logs with yours? This would be extremely helpful for a sync issue analysis.

asked 14 Mar '17, 17:26

Alex's gravatar image

Alex
1.1k274756
accept rate: 25%

edited 06 Apr '17, 07:40

The timestamp?

(15 Mar '17, 08:14) Breck Carter
Replies hidden

Sorry, not sure what you asked. I meant the id between '<' and '>'. The timestamp is not valid to identify a sync, since the device could be using a date in another region (timezone). Also, there is some gap between the client logging and the message being received and logged by Mobilink.

(15 Mar '17, 08:30) Alex

I haven't kept up with UltraLite, but... are you sure the <307962> uniquely identifies the sync instance, or the remote site itself? (because that's what the <thing> is for a SQL Anywhere client... it remains the same for successive syncs from the same remote).

(15 Mar '17, 09:38) Breck Carter

AFAIK, the sync ID is not the "remote_id" but specified here, for purposes to log and/pr profile the ML Server:

[Synchronization] number:
Identifies each synchronization. This number is assigned by the MobiLink server, not by the MobiLink Profiler, so it does not necessarily start at 1 in any given MobiLink Profiler session and is not necessarily received in numerical order. This number is the same as the synchronization number shown in MobiLink server warnings, errors, and logs. You can see the same number in the Synchronization Properties window. See Synchronization properties.

(15 Mar '17, 10:09) Volker Barth

Only the remote-id (which uniquely identifies the remote database) and the timestamp can be used to correlate entries in the MobiLink Server log with information in the MobiLink Client logs. The sync ID is not generated until the synchronization reaches the MObiLink Server, and this number is never passed down to the client.

There are options if you want to go peeking into HTTP headers, but none of those values are available in either MobiLink Server nor client logs.

Reg

permanent link

answered 15 Mar '17, 10:47

Reg%20Domaratzki's gravatar image

Reg Domaratzki
7.7k343118
accept rate: 37%

Hi @Reg, I appreciate your answer. I really don't mind this id be totally unique, all I want is ease the track of a sync issue from client to server. It'd be very helpful if you guys came up with a solution for this. Also, if ML server could send this sync ID info to the client, even after the sync is already started, it'd help too.

(15 Mar '17, 13:03) Alex
Replies hidden

There's a tag "product suggestion" (or alike) for that:)

(15 Mar '17, 13:24) Volker Barth

But just the synch ID is of no help if there are multiple ML Servers for the same backend system. Furthermore, the synch ID resets back to one when the ML Server is restarted, so that value isn't unique on the same ML Server either. We've always considered the timestamp and remote-id as pretty unique.

If that's not enough, you could easily implement something yourself by passing up an authentication parameter from the remote that is set to a unique GUID (or even the current timestamp at the remote) for each synchronization, and then print that information to the MobiLink log using a simple Java synchronization script (see below). Clearly, whatever value you use would also need to be put in your client side logs as well.

Reg

1) Execute the following SQL against the consolidated :

call ml_add_java_connection_script( 'v16', 'authenticate_parameters', 'Example.authParms' );

2) Create a file named Example.java with the following :

import ianywhere.ml.script.;
import java.sql.;
import java.util.*;

public class Example {

String              _remoteID;

public Example( DBConnectionContext cc ) throws SQLException {
    _remoteID = cc.getRemoteID();
}

public void authParms ( 
    ianywhere.ml.script.InOutInteger authStatus,
    String user,
    String ap1 
) throws java.sql.SQLException {
    System.out.println( "=== Remote ID : " + _remoteID + " Parm : " + ap1 );
}

}

3) Compile the Java Class

c:\JDK17\bin\javac -classpath %SQLANY16%\java\mlscript.jar Example.java

4) Add the following to the ML Server start line :

-sl java(-cp c:\path\to\Example.class)

(15 Mar '17, 13:53) Reg Domaratzki

Thank you very much, @Reg. This should work fine. Instead of using a Java class, I can force a warning inside the authentication script (I've tested that). However, can I access the authentication parameters inside this event?

(15 Mar '17, 14:30) Alex

I checked the doc and it seems I can use the parameters a.api1 in my procedure.

http://dcx.sap.com/index.html#sa160/en/mlserver/authenticate-parameters.html

(15 Mar '17, 14:33) Alex

If you want access to the authentication parameter in a SQL script, then you would use pass {ml a.1} into the stored procedure you have defined.

call ml_add_conenction_script( 'v16', 'authenticate_parameters', 'CALL my_auth_parm ( {ml s.authentication_status}, {ml s.remote_id}, {ml s.username}, {ml a.1} )' );

I like using Java over SQL for no other reason that the ability to write informational messages (not warnings) directly to the MobiLink Server log. The anal-rententive part of me does not like warnings that are not really warnings.

Reg

(15 Mar '17, 14:58) Reg Domaratzki

Agree. Thanks! :)

(15 Mar '17, 15:04) Alex
showing 1 of 7 show all flat view
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×371
×113
×84
×19
×7

question asked: 14 Mar '17, 17:26

question was seen: 1,749 times

last updated: 06 Apr '17, 07:40