NSLogger icon indicating copy to clipboard operation
NSLogger copied to clipboard

Unable to view logs after upgrading to El Capitan

Open tonyxiao opened this issue 9 years ago • 28 comments
trafficstars

Tried to fix it myself by building desktop viewer from source, but that didn't work either. (I don't have an active mac developer certificate right now for signing, which probably affects it).

screen shot 2015-12-01 at 11 22 13 am

It shows more than 1267 active connections! This is my logger configuration.

    let logger = LoggerInit()

    init(viewerHostName: String?) {
        let hostName = NSProcessInfo().environment["NSLoggerViewerHost"] ?? viewerHostName ?? "localhost"
        let bonjourName = NSProcessInfo().environment["NSLoggerBonjourName"] ?? "taylr-nslogger"
        LoggerSetViewerHost(logger, hostName, 50000)
        LoggerSetupBonjour(logger, nil, bonjourName)
        LoggerSetOptions(logger, UInt32(
            kLoggerOption_BufferLogsUntilConnection |
            kLoggerOption_UseSSL |
            kLoggerOption_BrowseBonjour |
            kLoggerOption_BrowseOnlyLocalDomain
        ))
        LoggerStart(logger)

tonyxiao avatar Dec 01 '15 19:12 tonyxiao

Weird issue but this may come from the fact that your build is not properly signed. Email me directly to get a test build if you're willing to try one (my email address is all over the source code).

fpillet avatar Dec 01 '15 21:12 fpillet

@fpillet emailed, will post updates here.

tonyxiao avatar Dec 01 '15 23:12 tonyxiao

Hi, I'm just trying NSLogger for the first time today, and I also saw this '1267 active Connections' when trying to connect directly over TCP from client to desktop viewer... iOS 9.1 app and El Capitan here...

When I try a bonjour connection, that does not exhibit this problem, but alas I can't use that connection type at the moment due to some other constraints

ghost avatar Dec 07 '15 21:12 ghost

Hrm there's something fishy with direct connections -- thanks for the additional input!

fpillet avatar Dec 07 '15 21:12 fpillet

I think you're not seeing the same issue. I have isolated Tony's issue to something reported a while ago by @0xced and that I didn't properly fix -- targeted Bonjour connection with restriction to the destination log viewer doesn't work correctly.

The issue with direct TCP connections must be something else.

fpillet avatar Dec 07 '15 22:12 fpillet

My specific issue seems to be related to SSL. Bonjour only works in non-secure mode also.

tonyxiao avatar Dec 07 '15 23:12 tonyxiao

This is a tricky one, as I can't seem to be able to reproduce it on my build of El Cap. This may be due to local conditions on my machine (beta build previously installed) as it's not even asking for permission to accept connections. Will keep you updated (I pushed a few fixes for both client and desktop but I don't think it will fix your issues yet)

fpillet avatar Dec 07 '15 23:12 fpillet

Hello there! I'm facing the same issue Sad story I can't debug my app now :'(

olivierto avatar Dec 30 '15 10:12 olivierto

Have you tried the latest binary?

I can't seem to repro the issue on my setup of El Capitan so this makes things complicated. Maybe if you have the skills to trace both sides at the same time, this would help tremendously -- right now all I can do is guess at what the issue could be...

One thing @tonyxiao did to "fix it" is to turn off SSL - there is an option for that in the NSLogger client. Let me know if turning it off helps (oh and also, you are logging from iOS, right?)

fpillet avatar Dec 30 '15 10:12 fpillet

@fpillet yeah I just cloned the lastest source code and build the mac client.
I don't see any options, documentations or API to turn off SSL on the client :s could you please give me further instructions? Thanks.

olivierto avatar Dec 30 '15 11:12 olivierto

Use LoggerSetOptions() on the client side, the options are in LoggerClient.h (see https://github.com/fpillet/NSLogger/blob/master/Client%20Logger/iOS/LoggerClient.h#L64)

fpillet avatar Dec 30 '15 12:12 fpillet

Also you can turn off SSL on the desktop side, that should work too I think -- check Preferences > Network

fpillet avatar Dec 30 '15 12:12 fpillet

Hello there! Ok.. so i tried to configure the logger without using SSL but unfortunately it doesn't seems to work. Here is my init code :

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    Logger *logger = LoggerInit();
    NSString * hostName = @"localhost";
    NSString * bonjourName = @"oli-nslogger";
    LoggerSetViewerHost(logger, (__bridge CFStringRef)(hostName), 50000);
    LoggerSetupBonjour(logger, nil, (__bridge CFStringRef)(bonjourName));
    LoggerSetOptions(logger,kLoggerOption_BufferLogsUntilConnection |
                            kLoggerOption_BrowseBonjour |
                            kLoggerOption_BrowseOnlyLocalDomain
                     );
    LoggerStart(logger);
    LOG_APP(0, @"Application did finish launching with options: %@", launchOptions);
...

I don't see any option on the Mac client for disabling SSL, but here is a screenshot of his network setup. capture d ecran 2015-12-31 a 10 56 34

The logger client doesn't fire as usual when the app start... Am I missing something? Thanks

olivierto avatar Dec 31 '15 09:12 olivierto

Ok after investigations it seems that the version installed via cocoapods is 1.5.1. I tried to set the flag '~>1.6' but it turns cocoapods into errors :s

olivierto avatar Dec 31 '15 10:12 olivierto

Right, the podfile is not yes pushed to the Cocoapods repo -- I'm having podlint issues with watchOS. For the time being, if you need 1.6 please point your podfile directly to the repo here.

fpillet avatar Dec 31 '15 11:12 fpillet

Yeah i wrote this : pod "NSLogger", :git => 'https://github.com/fpillet/NSLogger.git' But the issue with the logger is still not resolved :(

olivierto avatar Dec 31 '15 11:12 olivierto

Now I'm starting to have the same issue, so I can finally investigate !

fpillet avatar May 27 '16 14:05 fpillet

@olivierto would you mind checking out the latest master (viewer + client code) and try it out? it may help with this issue (fingers crossed)

fpillet avatar May 30 '16 20:05 fpillet

@fpillet Hey !

  • I've checked out the master branch of the logger
  • built the desktop app.
  • Updated client logger on my app via cocoa pods. Installing NSLogger 1.7.0 (was 1.6.1)
  • Mac and Iphone debug session USB + same wifi network --> OK 👍 😎
  • Mac and Iphone debug session only via USB --> KO 👎 May be it's the expected behavior?

olivierto avatar May 31 '16 07:05 olivierto

@olivierto Yes you need networking enabled on the device, NSLogger doesn't hijack the USB connection to send the logs back to desktop!

Ok so it's good news. Looks like my latest tweaks for TLS support seem to be working, at last!

Just to verify, can you test again with previous 1.6.1 client code and previous 1.6 viewer and verify that it doesn't work? Thanks!

fpillet avatar May 31 '16 07:05 fpillet

@olivierto oh an also make sure you use the latest client code from master (not 1.7.0), and also make sure that your client is not configured to not use SSL. I specifically want to verify whether SSL connections work for you now!

fpillet avatar May 31 '16 07:05 fpillet

@fpillet since i've upgraded to version 1.7.0 via cocoapods, downgrade via cocopods is not possible :s

olivierto avatar Jun 01 '16 09:06 olivierto

@olivierto: Yes you can: pod 'NSLogger', '1.5.1'

fpillet avatar Jun 01 '16 09:06 fpillet

Hi, any progress in this?

I have the latest NSlogger from git built into my iOS app and using Version 1.8.3 Mac App installed. The Mac app configured to accept both TCP and Bonjour connections (SLL enabled) Bonjour works fine, but the TCP connection does not, the ios device can not connect to the MAc app using TCP (does not matter if USB is connect or not, btw, I'm interesting in NON usb connection)

Both device are on the same WiFi network in the same segment, see each other fine (as I mentioned bonjour works fine)

The Mac App automatically added to the MacOS firawall exceptions (as it was correctly codesigned) and allowed to accept incoming connections.

Seems something on the ios device blocks the connection... Any clue?

TIA!

HofiOne avatar May 26 '17 14:05 HofiOne

@HofiOne this issue should not happen anymore with 1.8.3, we fixed the issue with SSL. Can you enable LOGGER_DEBUG (set it to 1) in LoggerClient.m and copy-paste the output you get in the Xcode console ?

fpillet avatar May 26 '17 15:05 fpillet

thanks! seems it's something on my work machine only as things on my personal macbook works like a charm. I'll try to figure out what could cause this on my other machine

HofiOne avatar May 30 '17 06:05 HofiOne

Let me know what you find. Enabling internal logging to console (like I suggested above) and pasting the result here could possibly help troubleshoot this issue.

fpillet avatar May 30 '17 07:05 fpillet

it should be some corporate firewall rulz, nothing interesting, it simply timeouted in connnect

-> Trying to open direct connection to host "my_correct_IP" port "my_correct_port" LoggerConfigureAndOpenStream configuring and opening log stream -> configuring SSL -> stream open attempt, waiting for open completion 2017-05-30 15:05:52.665434+0200 Test App iOS[2151:1117938] [] nw_connection_get_connected_socket_block_invoke 27 Connection has no connected handler Logger stream error: Error Domain=NSPOSIXErrorDomain Code=60 "Operation timed out" UserInfo={_kCFStreamErrorCodeKey=60, _kCFStreamErrorDomainKey=1} LoggerWriteStreamTerminated called -> disposing the write stream

I can telnet "my_correct_IP" "my_correct_port" perfectly

HofiOne avatar May 30 '17 13:05 HofiOne