Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lyp830414 opened this issue Jan 8, 2019 · 0 comments
Open

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

lyp830414 opened this issue Jan 8, 2019 · 0 comments

Comments

@lyp830414
Copy link

lyp830414 commented Jan 8, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant