18 votes

Where to ask Tildes dev questions?

If I have a quick Tildes dev question, where should I ask it?

For an example that is not actually just an example, but the actual question which drove me to post, where can I found logging output? Specifically, if I want to print out something every time a request comes in, how should I do so?

10 comments

  1. [7]
    Bauke
    Link
    Regarding your example, the Pyramid debug toolbar should be available where you can inspect a lot of stuff like requests, responses, SQL queries, etc. It looks like the docs link is broken so...

    Regarding your example, the Pyramid debug toolbar should be available where you can inspect a lot of stuff like requests, responses, SQL queries, etc.

    It looks like the docs link is broken so here's the correct one.

    6 votes
    1. [6]
      danwoz
      Link Parent
      Thanks, I just got the toolbar working, and it does indeed have a lot of information. However, I don't see the output of my logging statement anywhere. I've added a logging.info("hello") to the...

      Thanks, I just got the toolbar working, and it does indeed have a lot of information. However, I don't see the output of my logging statement anywhere. I've added a logging.info("hello") to the get_group_topics function, which I believe gets run every time a request is made for the home page. I see there is a "Logging" tab in the Pyramid debug toolbar, but it is disabled for me.

      I suppose logging doesn't get written to disk anywhere?

      2 votes
      1. [5]
        Bauke
        (edited )
        Link Parent
        I think the default log level is set too low for info to appear. I just did the same thing but with logging.error and logging.warn and they do appear in the Logging section of the debug toolbar....

        I think the default log level is set too low for info to appear. I just did the same thing but with logging.error and logging.warn and they do appear in the Logging section of the debug toolbar.

        I'm not sure how to change the log level, I think it's in alembic.ini but when I set any of the levels there to level = NOTSET or level = DEBUG the info logs still aren't coming through. @Deimos, what am I missing?

        4 votes
        1. [3]
          Deimos
          Link Parent
          It wouldn't be in alembic.ini, Alembic is the library that handles database migrations (adding new tables/columns, etc.). The way it's described in the Pyramid debugtoolbar docs is a little weird,...

          It wouldn't be in alembic.ini, Alembic is the library that handles database migrations (adding new tables/columns, etc.). The way it's described in the Pyramid debugtoolbar docs is a little weird, but it looks like you'd probably configure it as described here: https://docs.pylonsproject.org/projects/pyramid_debugtoolbar/en/latest/#disable-squashed-exception-information

          So that would probably be a couple of new sections to add to development.ini.

          (@danwoz)

          4 votes
          1. [2]
            Bauke
            (edited )
            Link Parent
            Aha, I've got it. After a bunch of Python exception reading I managed to figure it out, you have to add the whole spiel to get it logging. Adding the following sections to development.ini gets...

            Aha, I've got it. After a bunch of Python hieroglyphics decoding exception reading I managed to figure it out, you have to add the whole spiel to get it logging. Adding the following sections to development.ini gets info logs into the debug toolbar. It also makes the logs show up in journalctl -f.

            [loggers]
            keys = root,debugtoolbar
            
            [logger_root]
            level = NOTSET
            handlers = console
            
            [logger_debugtoolbar]
            level = NOTSET
            handlers = console
            qualname = pyramid_debugtoolbar
            
            [formatters]
            keys = generic
            
            [formatter_generic]
            format = %(levelname)-5.5s [%(name)s] %(message)s
            datefmt = %H:%M:%S
            
            [handlers]
            keys = console
            
            [handler_console]
            class = StreamHandler
            args = (sys.stderr,)
            level = NOTSET
            formatter = generic
            

            It may require a vagrant ssh --command "sudo systemctl restart gunicorn.socket" to get it to apply though, I don't think development.ini changes are automatically reloaded.

            5 votes
            1. danwoz
              Link Parent
              Nice work @Bauke! I'll give this a shot tonight.

              Nice work @Bauke! I'll give this a shot tonight.

              2 votes
        2. danwoz
          Link Parent
          logging.error did the trick. Thanks!

          logging.error did the trick. Thanks!

          3 votes
  2. [3]
    Algernon_Asimov
    Link
    Development on Tildes or on some other computer system? If it's about Tildes, then ~tildes is the right group for your question. If it's about some other computer system or software or programming...

    Development on Tildes or on some other computer system?

    If it's about Tildes, then ~tildes is the right group for your question.

    If it's about some other computer system or software or programming language, then ~comp is the best group for your question.

    5 votes
    1. [2]
      danwoz
      Link Parent
      Ah, sorry I wasn't clear. It's development for Tildes.

      Ah, sorry I wasn't clear. It's development for Tildes.

      3 votes
      1. Algernon_Asimov
        Link Parent
        I've edited the title of your topic accordingly.

        I've edited the title of your topic accordingly.