Thanks to visit codestin.com
Credit goes to github.com

Skip to content

It seems that seelog cannot work well under daemon process #166

@lyp830414

Description

@lyp830414

Hi, we found such problem for seelog, can anyone help us?

We did such actions:

           1.  We import the seelog in our main package  
           2.  In our main() function, we did daemon() to let the father process exit itself, and the child process be as the new process to do the works.
           3. In the new process, we use such code:
                     logger, err := log.LoggerFromConfigAsFile("seelog.xml")
                     if err != nil {
                           panic(err)
                      }
    
                        log.ReplaceLogger(logger)
                        defer log.Flush() 
          4.  In later codes in main(),  we need to use log.Errorf("....")  to do more logs        
          5.  Then we found that the log cannot be dumpped then since point 4 and then on.
          6.   Then I found that the seelog has one mechanism that it has the NewAsyncLoopLogger to do the asnLoopLogger.processQueue, which supervises the message queue's log and dump them finally.
                Then, I found the issue should be the  NewAsyncLoopLogger  should belongs to the father process ,  but in daemon  the father process should exit. 
                 So in child process the NewAsyncLoopLogger  cannot works , so it leads the later log cannot be dumped to log files.
          7.  I tried more case then: I made a new package named "test", and let the daemon function to be called in "test" package,   and let main package import "test" at the very beginning which more earlier than import "seelog",  but it still had the same issue, that the log could not be dumped (I found that the message has been sent to queue due to I add some printings and found "addMsgToQueue" had been called, but the handler of queue did not be called then) .

So can anyone help us? Thanks

Note:
1. If we do not use daemon process, seelog can works well then.
2. Does seelog provides some Api like "Re-init" to initialize again( includes re-init the timer, log supervisor, log dumper, etc..) ? Then we can reinitialize the seelog in our daemon process.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions