Loggin HTTP traffic in BC SaaS

AitorEGAitorEG Member Posts: 342
Hi all,

Is there any way to log the http traffic into a BC cloud tenant?

The thing is that I have created an integration with an external service. I'm sending a job with the related tasks and planning lines to that service.

Each entity creates an entry into the external Service, I know that the call via HTTP post is correct, because I can see all the created entries into the service. For each entry, the service returns to BC (http response) the entry no., that I need to save into a new field in the related job/task/job planning line. But sometimes, I found that the field is not loaded, although I don't get any error.

I must know what has happened, may be it can be a performance issue because of the quantity of HTTP calls, a timeout... I feel that I cannot control what his happening when HTTP calls come into play.

Any idea or hint on how to monitorize all those calls?

Thank you

Best Answers

Answers

  • AitorEGAitorEG Member Posts: 342
    Firsft of all, thnak ypu for your answer.
    That approach you are giving is the one I0ve been using. Not in a blob field, that's true. But I created a Log table, with a big text field, where I save data in different points of the development. This is because when something fails, we can't debug anything so I save that races. But here we found the main problem.
    Imagine that I make 50 request, with their 50 responses. If the process fails in one point, a rollback is made, so all the saved logs are deleted. And appart from that, saving a log in an extra table won't penalize the performance of the development?
    Anyway, I used commits when saving into the log table, but I found erros like "Already exists a log whit entry no. XXXX", probably due to the bad use of commits...

    Thank you again!
  • AitorEGAitorEG Member Posts: 342
    edited 2020-10-27
    Thanks for your answer @ftornero.
    That seems to be a solution to the rollback issue.
    Might be something like this?
    [TryFunction]
    local procedure SEND()
    begin
        //all the procedure and the call, saving the log?
    end;
    
    trigger OnRun()
    begin
        if SEND then
            //possitive log
        else
           //negativo log
    end;
    

    I must find the correct way to change the code to this new scenario

    Muchas gracias!
  • irasoelbaksirasoelbaks Member Posts: 119
    AitorEG wrote: »
    Firsft of all, thnak ypu for your answer.
    That approach you are giving is the one I0ve been using. Not in a blob field, that's true. But I created a Log table, with a big text field, where I save data in different points of the development. This is because when something fails, we can't debug anything so I save that races. But here we found the main problem.
    Imagine that I make 50 request, with their 50 responses. If the process fails in one point, a rollback is made, so all the saved logs are deleted. And appart from that, saving a log in an extra table won't penalize the performance of the development?
    Anyway, I used commits when saving into the log table, but I found erros like "Already exists a log whit entry no. XXXX", probably due to the bad use of commits...

    Thank you again!

    Try choosing another primary field in your Log table. In my Log Table I have 1 primary key field of type Integer. Also enable the AutoIncrement = True property. Now you don't have to worry about 'Already exists messages'
  • AitorEGAitorEG Member Posts: 342
    edited 2020-10-28
    AitorEG wrote: »
    Firsft of all, thnak ypu for your answer.
    That approach you are giving is the one I0ve been using. Not in a blob field, that's true. But I created a Log table, with a big text field, where I save data in different points of the development. This is because when something fails, we can't debug anything so I save that races. But here we found the main problem.
    Imagine that I make 50 request, with their 50 responses. If the process fails in one point, a rollback is made, so all the saved logs are deleted. And appart from that, saving a log in an extra table won't penalize the performance of the development?
    Anyway, I used commits when saving into the log table, but I found erros like "Already exists a log whit entry no. XXXX", probably due to the bad use of commits...

    Thank you again!

    Try choosing another primary field in your Log table. In my Log Table I have 1 primary key field of type Integer. Also enable the AutoIncrement = True property. Now you don't have to worry about 'Already exists messages'


    Thanks for your answer.

    Using autoincrement instead of calculating the new entryNo in the onInsert event?
Sign In or Register to comment.