Coder Social home page Coder Social logo

logging's Introduction

logging's People

Contributors

gujarats avatar iarief avatar maytripathi avatar qzaidi avatar renaldihusintkpd avatar somesh avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

logging's Issues

"-version" flag (and it's handler) won't work

To start from my understanding, it seems that tokopedia/logging tries to define its own buildhash build time info to get build information

flag.BoolVar(&versionFlag, "version", false, "binary version")

logging/init.go

Lines 60 to 63 in 41f21cd

if versionFlag {
fmt.Println(appVersion())
os.Exit(0)
}

logging/version.go

Lines 1 to 7 in 41f21cd

package logging
var buildhash string
func appVersion() string {
return buildhash
}

This won't work, since buildhash is injected during build time, so it could only be used on package main

as per build_debian_package roles
https://github.com/tokopedia/ansible-v2/blob/26ac51e1695816ad771b9e75c945cdda76e5313a/roles/build_debian_package/templates/debian-rules-file.j2#L77

doesn't play well with socketmaster

When we use socketmaster- the SIGHUP is sent to the socketmaster binary, which then forks a new child process. It then sends a SIGTERM to the old process. So the rotation code is never executed, because SIGHUP is never sent.

Thats not it - for some reason, the newly started binary actually has the wrong file opened as stderr, so the error logs keep going to the old file.

The solution could be to modify socketmaster, to use -USR1 signal for restarting the process, and making the -HUP passthrough, but there is still a problem.How do we indicate to upstart when we want an app reload and when we intend only a logrotation.

[IDEA] Closing stderr and stdout in sigterm

We couldn't use socketmaster reload for logrotate, this is caused by 1 and 2 fd is not closed since the fact that the main process (which is socketmaster) doesn't get terminated.
Socketmaster will send SIGTERM to the app on reload (SIGHUP to socketmaster), then we can add handler to close the 1 and 2 fd at that time.
So we don't have to restart the app every log rotate.

Do you think it's possible?

(still in the long week end vacation, will take a look by myself at monday)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.