Skip to content

Not working inside docker image #27

Description

@prakashpandey

Logger library is working as expected in Linux (Ubuntu 18.04 LTS) and in Mac os but
when I am running it in docker having alpine Linux as a base image, it is stuck at

logger.Init("foo", *verbose, true, lf)

I am using its latest version by downloading it using go get github.com/google/logger

It's blocking the entire application as the func logger.Init() is not returning.

My implementation:

func mustInitLogger() *logger.Logger {
	fmt.Printf("initializing x-microservice application log\n")
	lf, err  := os.OpenFile(logPath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644)
	if err != nil {
		panic(err)
	}
	fmt.Printf("log file created, initializing x-microservice logger instance\n")
	logr := logger.Init("x-microservice", true, true, lf)
	logger.SetFlags(log.LstdFlags)
	fmt.Printf("log initialization done\n")
	return logr
}

Update:

When I switched to version v1.0.1, I get this error:

unix syslog delivery error

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions