Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NSLogger 1.7.0 and the kLoggerOption_LogToConsole option. #209

Closed
jgahide opened this issue Sep 13, 2016 · 7 comments
Closed

NSLogger 1.7.0 and the kLoggerOption_LogToConsole option. #209

jgahide opened this issue Sep 13, 2016 · 7 comments

Comments

@jgahide
Copy link

jgahide commented Sep 13, 2016

Hello,
we had an issue. We are sending the logs to the console and the NSLogger desktop app (logDesktop). At startup time, we have some logs in the xcode console but not in the logDesktop. After a bit of investigation, it seems the log queued before the connection to the logDesktop. I have found the code that causes our issue :

LoggerClient.m line 949 :

        if (logToConsole)
        {
            pthread_mutex_lock(&logger->logQueueMutex);
            while (CFArrayGetCount(logger->logQueue))
            {
                LoggerLogToConsole((CFDataRef)CFArrayGetValueAtIndex(logger->logQueue, 0));
                CFArrayRemoveValueAtIndex(logger->logQueue, 0);
            }
            pthread_mutex_unlock(&logger->logQueueMutex);
            pthread_cond_broadcast(&logger->logQueueEmpty);
        }

These piece of code flush the log to the console only, if kLoggerOption_LogToConsole is on and the connection not yet established. I think this is a bug as the documentation does not mention that ("NSLogger can now both log to system console and send the logs over the wire"). Right now I have solved this by commenting the while statement. Can you fix this ?

thanks,

@jgahide
Copy link
Author

jgahide commented Sep 13, 2016

Maybe I have been a little been too quick. If the application will never connect to an app, then the logs won't be displayed to the xcode console. But we are still experiencing our issue : "the logs are lost before the connection occurs.".

@fpillet
Copy link
Owner

fpillet commented Sep 13, 2016

I'm having the same issue, it's because of the change in the way console logs are being captured. I'll revert to the old code as this is affecting me and many others.

@jgahide
Copy link
Author

jgahide commented Sep 13, 2016

Thanks for your time.
I will upgrade our library as soon it is fixed.

Le 13 sept. 2016 à 14:28, Florent Pillet [email protected] a écrit :

I'm having the same issue, it's because of the change in the way console logs are being captured. I'll revert to the old code as this is affecting me and many others.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub #209 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/AT8I8-3EcWfHWPigpKoJwSBanwJdB03vks5qputBgaJpZM4J7-pi.

@nkanellopoulos
Copy link

@fpillet Hi Florent. I think we need to tweet the desktop viewer to add the option whether to display or not the console output. It can be very distracting at times. No way to turn it off now.

@fpillet
Copy link
Owner

fpillet commented Sep 13, 2016

@nkanellopoulos two things: 1. you can turn console logging off with log options, 2. you can filter these logs out by setting up a filter that excludes tags stderr and stdout

@fpillet
Copy link
Owner

fpillet commented Mar 25, 2017

Fixed the issue -- NSLogger 1.7.0 introduced a new way of capturing stdout/stderr (using dispatch sources) and this completely shut the mirroring that we could previously do to the connected console (Xcode...). I reverted the code to the previous version that was working well.

@fpillet fpillet closed this as completed Mar 25, 2017
@fpillet
Copy link
Owner

fpillet commented Mar 25, 2017

This is in HEAD and will be in 1.8.0 that I'll release imminently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants