Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How to log remote ip address

    SmartClient_v91p_2014-03-04_PowerEdition

    In the server side log I can see entries like :
    === 2014-04-03 17:00:06,176 [c-40] DEBUG IDACall - remote user: prasad

    Is there any way I can configure logging such that clients IP address is also logged?

    #2
    There's not a way to configure the builtin SmartGWT logging to capture the remote IP, but you can either add your own subclass of the IDACall that does the logging you want, or use the logs from your web server or app server, which often contain the remote IP.

    Comment


      #3
      Is there an example of how to extend the IDACall somewhere? Which method do I override?

      Comment


        #4
        IDACall is a servlet, so it's just a matter of creating an ordinary Java subclass and registering it in web.xml in lieu of IDACall.

        Docs are here.

        Comment


          #5
          I have extended IDACall and I am able to get the remote IP address in the logs. But is it possible to get the log with the request number like it does in SmartClient generated log statements? e.g. the c-28 request number in the below line which is generated by SmartClient.

          === 2014-04-05 11:27:14,982 [c-28]

          Comment


            #6
            That's not a request number, that's actually the thread name, and there is a standard way to get this in Java.

            Comment


              #7
              http-nio-9763-exec-43 is what I got using String.format("[%s]",
              Thread.currentThread().getName())

              So are you trimming it down to c-43 or is it something else?

              Comment


                #8
                We are providing config to log4j that we want a 3-character-wide thread name, and it appears to reliably log enough information for the thread names to be uniquely discernible.

                Comment

                Working...
                X