Log liberasurecode errors to stderr in addition to syslog

Issue #7 resolved
Tushar Gohad repo owner created an issue

Log liberasurecode errors to stderr in addition to syslog

Comments (11)

  1. Tushar Gohad reporter

    @bloodeagle40234 ok let's unify pyeclib/liberasurecode logs. To double check - if pyeclib and liberasurecode run in the swift context and log to stderr, those messages will be sent to swift.log, correct?

  2. Kota Tsuyuzaki

    @tsg- Not tested yet, but looks fine so Swift will capture and transfer the log from stderr into swift.log. I'll make sure the commit in this weekend-sh.

  3. Tushar Gohad reporter

    @bloodeagle40234 thanks! verifying that the logs messages end up in swift logs will be much appreciated.

  4. Kota Tsuyuzaki

    Hi, @tsg- . I tested Swift to log the error or not, today but stderr output from liberasurecode never appeared. Swift definitely capture the outputs from sys.stdout and sys.stderr so that i think we might have to do something like passing the stderr output from python C API to native python implementation at "PyECLib" layer. I'm not sure about them but I am going to make a time to find a way to do that during next week.

  5. Tushar Gohad reporter

    cc: @kmgreen2

    @bloodeagle40234, you need to trigger liberasurecode errors from Swift .. which you won't get with the normal swift unit test code. :) Did you change any of the unit tests to recreate the error conditions?

  6. Kota Tsuyuzaki

    cc: @kmgreen2

    @tsg-, I deployed the failure code to running swift (based on feature/ec branch) in my lab env. It must be successful to install liberasurecode supports stderr output because when I restarted proxy sever with invalid arguments (e.g. set not available backend there), I got the error message at stderr as follows:

    Signal proxy-server  pid: 369  signal: 15
    proxy-server (369) appears to have stopped
    Starting proxy-server...(/etc/swift/proxy-server.conf)
    liberasurecode[707]: liberasurecode_backend_open: dynamic linking error libshss.so: cannot open shared object file: No such file or directory
    Error trying to load config from /etc/swift/proxy-server.conf: Invalid arguments passed to liberasurecode_instance_create
    

    Swift initialize binary showed the error at the stderr in my console. However, the message "cannot open shared object file" didn't appear at my swift logs.

    To make sure the reason, I tired to another test at the same running swift environment. The test is as follows:

    • Added following code to healthcheck middleware, and then, deployed
    # fail at the environment that shss unavailable
    try:
        driver = ECDriver(k=10, m=4, ec_type='shss')
    except:
        pass
    
    • restarted swift
    • did curl http://localhost/healthcheck

    I think, we can expect the last procedure call makes ECDriverError (and suppress it at "except" syntax), and then, "cannot open shared object file" message appears at my swift logs because swift must capture stderr and transfer them to swift logs. However, I didn't get the expected result.

    Sorry, right now, I'm still in a fog but I guess the redirection from Python C API to Python with something like PyErr_Print() or so might be needed...

  7. Kota Tsuyuzaki

    Hi, @tsg- I dug around the output of stderr yesterday and noticed it doesn't seem to hook any stderr of <stdio.h> (C API) on Python layer. (not sure but seems not easy way)

    I wrote more minimal code for the testing at http://goo.gl/h1SlHT. It was written as same way as Swift to capture stderr. It absolutely hook stderr outputs on Python programs. However, I couldn't retrieve the stderr from PyECLib on the way.

    I'm not sure but I guess c api call like as "fprintf(stderr, "something")" and "log_error("something")" doesn't go stderr at console via sys.stderr on Python.

    On my second thought, I wish we could pass the log facility of swift log to liberasurecode. If so, liberasurecode could open to the way to syslog with the same facility as Swift. (i.e. it will allow to write to swift.log directly)

  8. Log in to comment