#community-help

Issue Regarding Typesense Logging Output in Docker

TLDR Snorri queries why all logging output is directed to stderr when using Typesense in Docker containers. Kishore Nallan confirms this and speculates it could be because of a GLOG quirk. Snorri then creates an issue on GitHub.

Powered by Struct AI
face_palm1
Aug 19, 2021 (25 months ago)
Snorri
Photo of md5-36e9d6032b0f2664162d84a05d32ddc2
Snorri
03:06 PM
Hi, I just started using Typesense and I really like it.
I have one question. Why is all logging output directed to stderr?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
03:19 PM
👋 Glad to hear you like it. May I know on which environment you are running Typesense?
Snorri
Photo of md5-36e9d6032b0f2664162d84a05d32ddc2
Snorri
03:55 PM
I'm running docker containers on K8
03:55
Snorri
03:55 PM
But I confirmed this is also the case for the latest docker image
03:55
Snorri
03:55 PM
running locally
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
03:57 PM
🤔 How do you differentiate between stdout and stederr? If I am not wrong, docker logs shows both stdout and stderr.
04:00
Kishore Nallan
04:00 PM
Okay, I confirmed that docker logs is indeed full of only stderr!
04:02
Kishore Nallan
04:02 PM
Any idea why this would be the case? This is the Dockerfile used to build the container, fairly straightforward: https://github.com/typesense/typesense/blob/master/docker/deployment.Dockerfile
Snorri
Photo of md5-36e9d6032b0f2664162d84a05d32ddc2
Snorri
04:05 PM
No idea. I'll take a look
04:20
Snorri
04:20 PM
In typesense_server_utils.cpp
    if(log_dir.empty()) {
        // use console logger if log dir is not specified
        FLAGS_logtostderr = true;
    }
04:21
Snorri
04:21 PM
only stderr output flag set
face_palm1
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
04:22 PM
Thanks for catching that, but I think the reason I had to do this was because of some GLOG quirk. Let me look into it.
04:30
Kishore Nallan
04:30 PM
Frustrating, GLOG only has option to log to stderr only for console logging.
Snorri
Photo of md5-36e9d6032b0f2664162d84a05d32ddc2
Snorri
04:36 PM
Agreed, seems like a pretty terrible library and no way to configure it.
04:56
Snorri
04:56 PM
Created an issue on this.
08:57
Snorri
08:57 PM
And thank you for the quick response!