B4i Library iReleaseLogger - Read the logs in release mode

Discussion in 'iOS Libraries' started by Erel, Feb 25, 2015.

  1. Erel

    Erel Administrator Staff Member Licensed User

    iReleaseLogger combined with the desktop B4iLogger tool (written with B4J) allow you to monitor the app logs in release mode. This is useful when you encounter an error that you are unable to reproduce in debug mode.

    The release logger sends udp messages which the desktop logger prints.
    Depending on your firewall settings you may see a dialog such as this one when you first run the logger:


    You can also manually add an incoming rule for UDP connections on port 54323.

    In order to activate the logger you need to:
    1. Add a reference to iReleaseLogger and iNetwork libraries.
    2. Add this code to your app (with the desktop ip address):
    Private Sub Application_Start (Nav As NavigationController)
    Dim rl As ReleaseLogger
    Run the desktop tool with:
    java -jar B4iLogger.jar

    - The logs in release mode do not include all the information that is available in debug mode.
    - Do not try to upload your app with iReleaseLogger library included to the App Store. It will be rejected.
    - You can keep the desktop tool running for as long as needed.

    In case you are interested, the B4J code is:
    Sub Process_Globals
    Private usock As UDPSocket
    End Sub

    Sub AppStart (Args() As String)
    Dim port As Int = 54323
    Dim serv As ServerSocket 'ignore
       usock.Initialize("usock", port, 16000)
    Log($"My IP Address ${serv.GetMyIP}"$)
    Log($"Waiting on port ${port}"$)
    End Sub

    Sub usock_PacketArrived (Packet As UDPPacket)
    Log(BytesToString(Packet.Data, 0, Packet.Length, "UTF8"))
    End Sub
    It should be trivial to create a similar logging monitor in B4A or B4i (to read the logs on a different device).

    Attached Files:

    Last edited: Oct 14, 2019
    Star-Dust, naifnas, TnP and 5 others like this.
  2. Shay

    Shay Well-Known Member Licensed User

    Thanks for this, but since no more TestFlight, this can work only on my local phone
    if some tester has different phone with issue, how can I send him IPA so he can replicate his issue?
  3. Erel

    Erel Administrator Staff Member Licensed User

    The current tool is indeed intended for local usage, though it can be extended in the future to support the use case which you describe.
  4. omidaghakhani1368

    omidaghakhani1368 Well-Known Member Licensed User

    Thank you.You are best
  5. JanPRO

    JanPRO Well-Known Member Licensed User


    I'm using the hosted builder service, so I copied the xml file to the internal libraries folder, but the build failed. Any idea?

    Should I post the error logs, or?
  6. Erel

    Erel Administrator Staff Member Licensed User

    See point #1 above.
    JanPRO likes this.
  7. yonson

    yonson Active Member Licensed User

    Hi Erel

    great feature however I'm getting this error when running this :-

    C:\work\B4i>java -jar B4iLogger.jar
    main._appstart (java line: 48)
    java.net.BindException: Address already in use: Cannot bind
    at java.net.DualStackPlainDatagramSocketImpl.socketBind(Native Method)
    at java.net.DualStackPlainDatagramSocketImpl.bind0(Unknown Source)
    at java.net.AbstractPlainDatagramSocketImpl.bind(Unknown Source)
    at java.net.DatagramSocket.bind(Unknown Source)
    at java.net.DatagramSocket.<init>(Unknown Source)
    at java.net.DatagramSocket.<init>(Unknown Source)
    at java.net.DatagramSocket.<init>(Unknown Source)
    at anywheresoftware.b4a.objects.SocketWrapper$UDPSocket.Initialize(Socke
    at b4j.example.main._appstart(main.java:48)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
    at b4j.example.main.main(main.java:29)

    I've checked on netstat and nothing is showing up on this port. Any thoughts?
  8. JanPRO

    JanPRO Well-Known Member Licensed User

    Be shure to start B4iLogger.jar only once ;)

    Maybe in background B4iLogger.jar is already running ...
  9. Erel

    Erel Administrator Staff Member Licensed User

    You can switch to a different port by using the B4J source code.
  10. yonson

    yonson Active Member Licensed User

    just to help anyone who finds that port is already in use, the fix to kill whatever is on that port is :-

    1) view all port activity : netstat -a -n -o
    2) record the PID for the particular port in question (in my case UDP so 0:0:0:0:54323)
    3) goto task manager - > Details -> sort by PID
    4) find the rogue PID process and kill it.
    Erel likes this.
  11. stanmiller

    stanmiller Active Member Licensed User

    Instead of opening a command window and starting manually, I double clicked on B4iLogger.jar and it started running in the background detached from a console.

    I killed the java process with this command.

    c:\> wmic process where "name like '%java%'" delete

    Then opened a command window and started as advised:

    java -jar B4iLogger.jar

    The console remained opened and I could see log output.
  12. stanmiller

    stanmiller Active Member Licensed User

    Thanks for this tool!

    As a sanity check between the app and B4iLogger.jar could you send a startup packet like "-- iRelease Logger v1.0 -- " to the desktop logger when the object is initialized?

    Because the logger is using UDP, the packets could be blocked or tossed aside and you would never know.

    I couldn't tell if iReleaseLogger was communicating with the desktop until I received a "Can't find keyplane that supports type 8..." message. That's the only message I saw during testing - so it looks like I'm good.
  13. JackKirk

    JackKirk Well-Known Member Licensed User

    I have been quite happily B4iLogging away - until today.

    My PC has a static local IP address on the router of

    Up until today that is the address that B4iLogger was displaying.

    Now B4iLogger is displaying

    Router still says it is on

    All other devices on router (printer, NAS, Samsung S5, iPhone 5, laptop) are showing correct addresses.

    I have turned everything, including router, off/on - no effect, B4iLogger still showing 169....

    I used the 169... address in a test app:

    Dim rl As ReleaseLogger
    rl.Initialize("", 54323)

    But it doesn't log to B4iLogger showing that IP

    I tried correct 192... address of PC - can't log to that either.

    I am out of options - hence this call for help.
  14. Erel

    Erel Administrator Staff Member Licensed User

    The ip address displayed is not really important. It can show the wrong one if there are multiple ips available. Use the correct one.

    Make sure that the port is open in your firewall. Are you able to run the app in debug mode?
  15. JackKirk

    JackKirk Well-Known Member Licensed User

    Maybe this should be spelt out somewhere where a B4iLogger user will see it - say in its initial blurt - or can it spit out all possibilities?
    Yes - able to run in debug mode.

    I worked out what I was doing wrong - when the 169... stuff started coming out of B4iLogger I managed to confuse myself and ended up actually using the ip address of the iPhone not the ip address of the PC in the apps rl.Initialize("... statement.

    Is there an emoticon for banging head against wall...
  16. Sandman

    Sandman Well-Known Member Licensed User

    I just wanted to add that netcat also can receive the logs using this command:

    nc -l -u -p 54323
    Short description of what this does:
    • nc (that's what netcat is called)
    • -l = listen for incoming connections
    • -u = use udp
    • -p = use this port

    (This means that you don't need B4iLogger.jar if you do it like this.)
    Last edited: Aug 24, 2018
    stanmiller and moster67 like this.
  17. moster67

    moster67 Expert Licensed User

    Interesting. Will try it when I have an opportunity.
  18. janderkan

    janderkan Active Member Licensed User

    Create a log.bat file with this line
    cmd /C java -jar B4iLogger.jar
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice