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

Not able to see the added logs #342

Closed
sridharjajoo opened this issue Dec 23, 2022 · 10 comments
Closed

Not able to see the added logs #342

sridharjajoo opened this issue Dec 23, 2022 · 10 comments

Comments

@sridharjajoo
Copy link

Hey,
I had a couple of questions :

  1. I am trying to explore the code base a little bit and was trying to put log statements in different files and then tried running the integration tests. But I am not able to see the log statement which I have added.
    I followed the guidelines mentioned, but am I missing anything here?

2.. Is there an LLD for this? Would love to understand how the classes are interacting with each other and how the actual rust code is getting triggered :)

Thanks!

@sansyrox
Copy link
Member

Hey @sridharjajoo 👋

Long time no see :D

I am trying to explore the code base a little bit and was trying to put log statements in different files and then tried running the integration tests. But I am not able to see the log statement which I have added.

Do you have a github link that I can have a look ? Where are you adding the log statements?

I followed the guidelines mentioned, but am I missing anything here?

Which guidelines, if I may ask 😅

2.. Is there an LLD for this? Would love to understand how the classes are interacting with each other and how the actual rust code is getting triggered

There's no LLD but I gave a talk that explains the architecture: https://www.youtube.com/watch?v=AutugvJNVkY

I hope this will be a bit helpful

@sridharjajoo
Copy link
Author

Hey,

So I followed the following steps :

  1. Added this logging.debug('Inside init_processpool: + str(self.router.get_routes())) here https://github.com/sansyrox/robyn/blob/main/robyn/__init__.py#L122, I wanted to see the routes which are being populated. I also tried using normal print() as well but couldn't really see anything.

  2. Used the command python3 integration_tests/base_routes.py and then went over to localhost:5000/

Which guidelines, if I may ask 😅

haha, guidelines as in the steps mentioned in the README.md for testing locally :)

@sansyrox
Copy link
Member

sansyrox commented Dec 23, 2022

Added this logging.debug('Inside init_processpool: + str(self.router.get_routes())) here https://github.com/sansyrox/robyn/blob/main/robyn/__init__.py#L122, I wanted to see the routes which are being populated. I also tried using normal print() as well but couldn't really see anything.

Logging should work. Did you run it as python app.py --log-level DEBUG ?

@sridharjajoo
Copy link
Author

Oh, I didn't really create a app.py file. I just ran the command python3 integration_tests/base_routes.py hoping the logs to show up.

@sansyrox
Copy link
Member

sansyrox commented Dec 23, 2022

@sridharjajoo , then it will be python3 integration_tests/base_routes.py --log-level DEBUG

@sridharjajoo
Copy link
Author

sridharjajoo commented Dec 23, 2022

Yeah, I tried this as well. I get the following :

Basically not able to see the logs which I had added

DEBUG:robyn:Add event Events.SHUTDOWN handler
DEBUG:robyn:Add event Events.STARTUP handler
INFO:robyn:Starting server at 127.0.0.1:5000 
INFO:robyn:Press Ctrl + C to stop 

DEBUG:robyn.server:The number of workers are 1
INFO:actix_server.builder:Starting 1 workers
INFO:actix_server.server:Actix runtime found; starting in Actix runtime
{'body': [], 'headers': {'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36', 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', 'upgrade-insecure-requests': '1', 'sec-fetch-site': 'none', 'sec-ch-ua-mobile': '?0', 'cache-control': 'max-age=0', 'accept-language': 'en-US,en;q=0.9', 'host': 'localhost:5000', 'accept-encoding': 'gzip, deflate, br', 'sec-ch-ua': '"Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108"', 'sec-fetch-user': '?1', 'sec-fetch-dest': 'document', 'sec-ch-ua-platform': '"macOS"', 'connection': 'keep-alive', 'sec-fetch-mode': 'navigate'}, 'params': {}, 'queries': {}}
DEBUG:robyn.server:This is the modified request {}
DEBUG:robyn.server:These are the request headers {"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", "upgrade-insecure-requests": "1", "sec-fetch-site": "none", "sec-ch-ua-mobile": "?0", "cache-control": "max-age=0", "accept-language": "en-US,en;q=0.9", "host": "localhost:5000", "accept-encoding": "gzip, deflate, br", "sec-ch-ua": "\"Not?A_Brand\";v=\"8\", \"Chromium\";v=\"108\", \"Google Chrome\";v=\"108\"", "sec-fetch-user": "?1", "sec-fetch-dest": "document", "sec-ch-ua-platform": "\"macOS\"", "connection": "keep-alive", "sec-fetch-mode": "navigate"}
Called 2 times {'body': [], 'params': {}, 'headers': {'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36', 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', 'upgrade-insecure-requests': '1', 'sec-fetch-site': 'none', 'sec-ch-ua-mobile': '?0', 'cache-control': 'max-age=0', 'accept-language': 'en-US,en;q=0.9', 'host': 'localhost:5000', 'accept-encoding': 'gzip, deflate, br', 'sec-ch-ua': '"Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108"', 'sec-fetch-user': '?1', 'sec-fetch-dest': 'document', 'sec-ch-ua-platform': '"macOS"', 'connection': 'keep-alive', 'sec-fetch-mode': 'navigate'}, 'queries': {}}
DEBUG:robyn.executors:This is the result of the code Py(0x1024c1500)
{'params': {}, 'headers': {'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36', 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', 'upgrade-insecure-requests': '1', 'sec-fetch-site': 'none', 'sec-ch-ua-mobile': '?0', 'cache-control': 'max-age=0', 'accept-language': 'en-US,en;q=0.9', 'host': 'localhost:5000', 'accept-encoding': 'gzip, deflate, br', 'sec-ch-ua': '"Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108"', 'sec-fetch-user': '?1', 'sec-fetch-dest': 'document', 'sec-ch-ua-platform': '"macOS"', 'connection': 'keep-alive', 'sec-fetch-mode': 'navigate'}, 'queries': {}, 'body': []}
DEBUG:robyn.server:This is the modified request {}
DEBUG:robyn.server:These are the request headers {"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", "upgrade-insecure-requests": "1", "sec-fetch-site": "none", "sec-ch-ua-mobile": "?0", "cache-control": "max-age=0", "accept-language": "en-US,en;q=0.9", "host": "localhost:5000", "accept-encoding": "gzip, deflate, br", "sec-ch-ua": "\"Not?A_Brand\";v=\"8\", \"Chromium\";v=\"108\", \"Google Chrome\";v=\"108\"", "sec-fetch-user": "?1", "sec-fetch-dest": "document", "sec-ch-ua-platform": "\"macOS\"", "connection": "keep-alive", "sec-fetch-mode": "navigate"}
DEBUG:robyn.server:Response: HttpResponse { error: None, res: 
Response HTTP/1.1 200 OK
  headers:
    "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
    "upgrade-insecure-requests": "1"
    "accept-language": "en-US,en;q=0.9"
    "server": "robyn"
    "sec-fetch-user": "?1"
    "sec-ch-ua-platform": "\"macOS\""
    "sec-ch-ua": "\"Not?A_Brand\";v=\"8\", \"Chromium\";v=\"108\", \"Google Chrome\";v=\"108\""
    "sec-fetch-site": "none"
    "cache-control": "max-age=0"
    "host": "localhost:5000"
    "accept-encoding": "gzip, deflate, br"
    "sec-ch-ua-mobile": "?0"
    "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
    "sec-fetch-dest": "document"
    "connection": "keep-alive"
    "sec-fetch-mode": "navigate"
  body: Sized(5)
 }
DEBUG:robyn.server:This is the modified request {}
DEBUG:robyn.server:These are the request headers {"sec-ch-ua": "\"Not?A_Brand\";v=\"8\", \"Chromium\";v=\"108\", \"Google Chrome\";v=\"108\"", "sec-fetch-mode": "no-cors", "sec-ch-ua-platform": "\"macOS\"", "referer": "http://localhost:5000/", "accept-encoding": "gzip, deflate, br", "sec-fetch-dest": "image", "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", "connection": "keep-alive", "sec-ch-ua-mobile": "?0", "accept-language": "en-US,en;q=0.9", "accept": "image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8", "sec-fetch-site": "same-origin", "host": "localhost:5000"}
DEBUG:robyn.server:This is the modified request {}
DEBUG:robyn.server:These are the request headers {"sec-ch-ua": "\"Not?A_Brand\";v=\"8\", \"Chromium\";v=\"108\", \"Google Chrome\";v=\"108\"", "sec-fetch-mode": "no-cors", "sec-ch-ua-platform": "\"macOS\"", "referer": "http://localhost:5000/", "accept-encoding": "gzip, deflate, br", "sec-fetch-dest": "image", "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", "connection": "keep-alive", "sec-ch-ua-mobile": "?0", "accept-language": "en-US,en;q=0.9", "accept": "image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8", "sec-fetch-site": "same-origin", "host": "localhost:5000"}
DEBUG:robyn.server:Response: HttpResponse { error: None, res: 
Response HTTP/1.1 200 OK
  headers:
    "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
    "accept-language": "en-US,en;q=0.9"
    "server": "robyn"
    "sec-ch-ua-platform": "\"macOS\""
    "sec-ch-ua": "\"Not?A_Brand\";v=\"8\", \"Chromium\";v=\"108\", \"Google Chrome\";v=\"108\""
    "sec-fetch-site": "same-origin"
    "referer": "http://localhost:5000/"
    "accept-encoding": "gzip, deflate, br"
    "sec-ch-ua-mobile": "?0"
    "host": "localhost:5000"
    "accept": "image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8"
    "sec-fetch-dest": "image"
    "sec-fetch-mode": "no-cors"
    "connection": "keep-alive"
  body: Sized(0)
 }

@sansyrox
Copy link
Member

@sridharjajoo , apologies for the late revert. The logs are working for me.

Screen Shot 2022-12-25 at 16 28 31

Screen Shot 2022-12-25 at 16 28 14

What is your logging statement?

@sridharjajoo
Copy link
Author

So i tried adding the same logging statement which you have added above :

Screenshot 2022-12-25 at 23 36 54

and this is what I get

Screenshot 2022-12-25 at 23 39 08

a bit strange tbh, I'll maybe try to create a separate package and try this again

@sansyrox
Copy link
Member

I have two questions:

  1. Can you check if you're not using a global package?
  2. Try recompiling the package? - maturin develop to recompile a package. You need to be inside a venv and install all the dependencies to run maturin

@sridharjajoo
Copy link
Author

ah, just missed the 2nd step altogether. Works now. Thanks for the help!

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

2 participants