You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2022/04/12 03:50:47 UTC

[GitHub] [skywalking] ysy1418899560 opened a new issue, #8854: [Bug] python log_reporter_level='INFO' is not work when start with django uWSGI

ysy1418899560 opened a new issue, #8854:
URL: https://github.com/apache/skywalking/issues/8854

   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/skywalking/issues?q=is%3Aissue) and found no similar issues.
   
   
   ### Apache SkyWalking Component
   
   Python Agent (apache/skywalking-python)
   
   ### What happened
   
   The params log_reporter_level='INFO' is not work when start with django uWSGI,on the UI only collect ERROR log, but cant collect INFO log。
   python==3.7.9
   django==3.2.7
   uwsgi==2.0.19.1
   apache-skywalking==0.7.0
   skywalking version is 8.7.0
   
   This is my code:
   from skywalking import agent, config
   from uwsgidecorators import postfork
   
   
   @postfork
   def init_tracing():
       config.init(collector_address='127.0.0.1:11800', service_name='video_processor', log_reporter_active=True,
                   log_reporter_level='INFO', django_collect_http_params=True)
       agent.start()
   ![D840AF15-993A-442f-9094-447210C24595](https://user-images.githubusercontent.com/63773628/162875368-19acad4f-3017-4064-94f4-7f808b9e62f5.png)
   
   
   ### What you expected to happen
   
   I hope set the params log_reporter_level='INFO' can collect info level log, and clicking the trace id will jump to the tracking interface when statr with django uWSGI。
   
   ### How to reproduce
   
   python==3.7.9
   django==3.2.7
   uwsgi==2.0.19.1
   apache-skywalking==0.7.0
   skywalking version is 8.7.0
   
   Below is my code:
   from skywalking import agent, config
   from uwsgidecorators import postfork
   
   
   @postfork
   def init_tracing():
       config.init(collector_address='127.0.0.1:11800', service_name='video_processor', log_reporter_active=True,
                   log_reporter_level='INFO', django_collect_http_params=True)
       agent.start()
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [skywalking] Superskyyy commented on issue #8854: [Bug] python log_reporter_level='INFO' is not work when start with django uWSGI

Posted by GitBox <gi...@apache.org>.
Superskyyy commented on issue #8854:
URL: https://github.com/apache/skywalking/issues/8854#issuecomment-1096418760

   Todo for me: enhance document on the reporter level config. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [skywalking] Superskyyy commented on issue #8854: [Bug] python log_reporter_level='INFO' is not work when start with django uWSGI

Posted by GitBox <gi...@apache.org>.
Superskyyy commented on issue #8854:
URL: https://github.com/apache/skywalking/issues/8854#issuecomment-1096321246

   @ysy1418899560  Hello, I think I kinda know the cause, it is not quite related to SkyWalking agent, rather it is a behaviour when uwsgi causes the spawned workers to somehow "lose" logging handler abilities - that is a log record emitted in a uwsgi worker is entirely ignored (not even passed to the base handler). 
   
   The workaround is simply set in your postfork function for now.
   `logging.basicConfig(level='INFO')
   `
   
   I will need to understand the thing further to make a proper enhancement.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [skywalking] Superskyyy commented on issue #8854: [Bug] python log_reporter_level='INFO' is not work when start with django uWSGI

Posted by GitBox <gi...@apache.org>.
Superskyyy commented on issue #8854:
URL: https://github.com/apache/skywalking/issues/8854#issuecomment-1096130177

   Update: I reproduced the reported issue on uwsgi post forked agent. I will try to figure out what is the cause.
   Seems like anything below `WARNING` level is not reported regardless of the agent settings.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [skywalking] Superskyyy commented on issue #8854: [Bug] python log_reporter_level='INFO' is not work when start with django uWSGI

Posted by "Superskyyy (via GitHub)" <gi...@apache.org>.
Superskyyy commented on issue #8854:
URL: https://github.com/apache/skywalking/issues/8854#issuecomment-1416592456

   The invalid traceID problem is solved in https://github.com/apache/skywalking-python/pull/272 and other parts are coming in the pre-fork support. So closing this issue. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [skywalking] ysy1418899560 commented on issue #8854: [Bug] python log_reporter_level='INFO' is not work when start with django uWSGI

Posted by GitBox <gi...@apache.org>.
ysy1418899560 commented on issue #8854:
URL: https://github.com/apache/skywalking/issues/8854#issuecomment-1096364952

   Thanks for you,l will try this method。Please help to solve another issues that the trace id is inconsistency without uwsgi。Pages cannot jump to each other by trace id。


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [skywalking] Superskyyy commented on issue #8854: [Bug] python log_reporter_level='INFO' is not work when start with django uWSGI

Posted by GitBox <gi...@apache.org>.
Superskyyy commented on issue #8854:
URL: https://github.com/apache/skywalking/issues/8854#issuecomment-1096024023

   @ysy1418899560 Can you confirm that bare django without uwsgi works fine on your side? I just did a quick test without uwsgi and it is fine.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [skywalking] Superskyyy commented on issue #8854: [Bug] python log_reporter_level='INFO' is not work when start with django uWSGI

Posted by GitBox <gi...@apache.org>.
Superskyyy commented on issue #8854:
URL: https://github.com/apache/skywalking/issues/8854#issuecomment-1096090550

   > It can collects info level log without uwsgi on my side,but the generated trace id is different between on log interface and tracking interface。Trace id is '8074295ba1f11eca9c6f8281960ba1c' on tracking interfacee,but on log interface is 'ec28b995ba1f11ec91def8281960ba1c'。Pages cannot jump to each other。 ![1](https://user-images.githubusercontent.com/63773628/162887876-18fa383b-bd48-4453-8c81-1881ee1bdc33.png) ![2](https://user-images.githubusercontent.com/63773628/162887884-c4f63a08-9db1-44f4-b394-930d7cabbdc7.png)
   
   Thanks for the update, I'm looking into it now.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [skywalking] Superskyyy commented on issue #8854: [Bug] python log_reporter_level='INFO' is not work when start with django uWSGI

Posted by GitBox <gi...@apache.org>.
Superskyyy commented on issue #8854:
URL: https://github.com/apache/skywalking/issues/8854#issuecomment-1096000598

   @ysy1418899560 Hello, thank you for reporting the potential bug! I will be looking into this and try reproduce the problem.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [skywalking] Superskyyy commented on issue #8854: [Bug] python log_reporter_level='INFO' is not work when start with django uWSGI

Posted by GitBox <gi...@apache.org>.
Superskyyy commented on issue #8854:
URL: https://github.com/apache/skywalking/issues/8854#issuecomment-1097005563

   I think the empty related trace is due to the Django internal logger is not bind to any request handling mechanism and the internal logger is put into a new segment with another generated traceID other than the methods intercepted. Will look further into that. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [skywalking] ysy1418899560 commented on issue #8854: [Bug] python log_reporter_level='INFO' is not work when start with django uWSGI

Posted by GitBox <gi...@apache.org>.
ysy1418899560 commented on issue #8854:
URL: https://github.com/apache/skywalking/issues/8854#issuecomment-1096089412

   It can collects info level log without uwsgi on my side,but the generated trace id is different between on log interface and tracking interface。Trace id is '8074295ba1f11eca9c6f8281960ba1c' on tracking interfacee,but on log interface is 
   'ec28b995ba1f11ec91def8281960ba1c'。Pages cannot jump to each other。
   ![1](https://user-images.githubusercontent.com/63773628/162887876-18fa383b-bd48-4453-8c81-1881ee1bdc33.png)
   ![2](https://user-images.githubusercontent.com/63773628/162887884-c4f63a08-9db1-44f4-b394-930d7cabbdc7.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [skywalking] Superskyyy commented on issue #8854: [Bug] python log_reporter_level='INFO' is not work when start with django uWSGI

Posted by GitBox <gi...@apache.org>.
Superskyyy commented on issue #8854:
URL: https://github.com/apache/skywalking/issues/8854#issuecomment-1096408581

   > Thanks for you,l will try this method。Please help to solve another issues that the trace id is inconsistency without uwsgi。Pages cannot jump to each other by trace id。
   
   I will also look into this one. 
   
   BTW I just took another look at the level issue. And I realized that setting your logger to INFO level is a proper way not just a workaround, because you need to first let the logging.logger.handler receive the logRecord before it can be intercepted (this is how logging library is written). 
   
   The reason why it is acting differently inside uwsgi is that the particular logger in Django core code is disabled for some reason (performance I suppose), then nothing at the INFO level shows up anymore. In bare django settings, it will output much more INFO level logs (server logs) like here. So if you need these INFO level logs collected, you need to find a way to reenable the Django loggers, but this is not related to SkyWalking anymore.
   ![image](https://user-images.githubusercontent.com/26076517/162923317-34b0525b-d89e-4c99-ac98-b06f02855fa5.png)
   
   
   TLDR, the proper way to deal with this is to make your logger level at least the same as the level you set in agent so that it can be intercepted.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [skywalking] Superskyyy closed issue #8854: [Bug] python log_reporter_level='INFO' is not work when start with django uWSGI

Posted by "Superskyyy (via GitHub)" <gi...@apache.org>.
Superskyyy closed issue #8854: [Bug] python log_reporter_level='INFO' is not work when start with django uWSGI
URL: https://github.com/apache/skywalking/issues/8854


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org