question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Logs displayed twice.

See original GitHub issue

I use python-livereload with flask.

@manager.command
def live():
    """
    Starts a development server with live reload enabled.
    """
    server = Server(app.wsgi_app)
    server.watch(module_path + '/static/**/*.*')
    server.watch(module_path + '/templates/*.*')
    server.serve(port=5000)

Unfortunately logs are displayed twice.

[I 150616 14:31:09 server:271] Serving on http://127.0.0.1:5000
Tue, 16 Jun 2015 14:31:09 | INFO     | Serving on http://127.0.0.1:5000
[I 150616 14:31:09 handlers:58] Start watching changes
Tue, 16 Jun 2015 14:31:09 | INFO     | Start watching changes
[I 150616 14:31:09 handlers:60] Start detecting changes
Tue, 16 Jun 2015 14:31:09 | INFO     | Start detecting changes

I can’t find any parameters to control logging. Any ideas how I can deal with this ?

Thank you. 😃

My logging tree before the serve method is called:

<--""
   Level INFO
   Handler Stream <open file '<stderr>', mode 'w' at 0x7f3c675ce1e0>
     Level DEBUG
     Formatter fmt='%(asctime)s | %(levelname)-8s | %(message)s' datefmt='%a, %d %b %Y %H:%M:%S'
   Handler RotatingFile '/home/tim/Workspace/thedotabot/memories/server_logs.txt' maxBytes=10485760 backupCount=0
     Level DEBUG
     Formatter fmt='%(asctime)s | %(levelname)-8s | %(message)s' datefmt='%a, %d %b %Y %H:%M:%S'
   |
   o<--"alembic"
   |   Level NOTSET so inherits level INFO
   |   Handler <logging.NullHandler object at 0x7f3c62aa6690>
   |   |
   |   o<--[alembic.autogenerate]
   |   |   |
   |   |   o<--"alembic.autogenerate.api"
   |   |   |   Level NOTSET so inherits level INFO
   |   |   |
   |   |   o<--"alembic.autogenerate.compare"
   |   |   |   Level NOTSET so inherits level INFO
   |   |   |
   |   |   o<--"alembic.autogenerate.render"
   |   |       Level NOTSET so inherits level INFO
   |   |
   |   o<--[alembic.ddl]
   |   |   |
   |   |   o<--"alembic.ddl.postgresql"
   |   |       Level NOTSET so inherits level INFO
   |   |
   |   o<--"alembic.migration"
   |   |   Level NOTSET so inherits level INFO
   |   |
   |   o<--"alembic.util"
   |       Level NOTSET so inherits level INFO
   |
   o<--[concurrent]
   |   |
   |   o<--"concurrent.futures"
   |       Level NOTSET so inherits level INFO
   |
   o<--[flask-admin]
   |   |
   |   o<--"flask-admin.sqla"
   |       Level NOTSET so inherits level INFO
   |
   o<--"livereload"
   |   Level NOTSET so inherits level INFO
   |
   o<--[oauth2client]
   |   |
   |   o<--"oauth2client.client"
   |   |   Level NOTSET so inherits level INFO
   |   |
   |   o<--"oauth2client.crypt"
   |   |   Level NOTSET so inherits level INFO
   |   |
   |   o<--"oauth2client.util"
   |       Level NOTSET so inherits level INFO
   |
   o<--"requests"
   |   Level NOTSET so inherits level INFO
   |   Handler <logging.NullHandler object at 0x7f3c611c7910>
   |   |
   |   o<--[requests.packages]
   |       |
   |       o<--"requests.packages.urllib3"
   |           Level NOTSET so inherits level INFO
   |           Handler <logging.NullHandler object at 0x7f3c611c7890>
   |           |
   |           o<--"requests.packages.urllib3.connectionpool"
   |           |   Level NOTSET so inherits level INFO
   |           |
   |           o<--"requests.packages.urllib3.poolmanager"
   |           |   Level NOTSET so inherits level INFO
   |           |
   |           o<--[requests.packages.urllib3.util]
   |               |
   |               o<--"requests.packages.urllib3.util.retry"
   |                   Level NOTSET so inherits level INFO
   |
   o<--"sqlalchemy"
   |   Level WARNING
   |   |
   |   o<--[sqlalchemy.dialects]
   |   |   |
   |   |   o<--"sqlalchemy.dialects.postgresql"
   |   |       Level NOTSET so inherits level WARNING
   |   |
   |   o<--[sqlalchemy.orm]
   |       |
   |       o<--[sqlalchemy.orm.dynamic]
   |       |   |
   |       |   o<--"sqlalchemy.orm.dynamic.DynaLoader"
   |       |       Level NOTSET so inherits level WARNING
   |       |
   |       o<--[sqlalchemy.orm.mapper]
   |       |   |
   |       |   o<--"sqlalchemy.orm.mapper.Mapper"
   |       |       Level NOTSET so inherits level WARNING
   |       |
   |       o<--"sqlalchemy.orm.path_registry"
   |       |   Level NOTSET so inherits level WARNING
   |       |
   |       o<--[sqlalchemy.orm.properties]
   |       |   |
   |       |   o<--"sqlalchemy.orm.properties.ColumnProperty"
   |       |       Level NOTSET so inherits level WARNING
   |       |
   |       o<--[sqlalchemy.orm.query]
   |       |   |
   |       |   o<--"sqlalchemy.orm.query.Query"
   |       |       Level NOTSET so inherits level WARNING
   |       |
   |       o<--[sqlalchemy.orm.relationships]
   |       |   |
   |       |   o<--"sqlalchemy.orm.relationships.RelationshipProperty"
   |       |       Level NOTSET so inherits level WARNING
   |       |
   |       o<--[sqlalchemy.orm.strategies]
   |           |
   |           o<--"sqlalchemy.orm.strategies.ColumnLoader"
   |           |   Level NOTSET so inherits level WARNING
   |           |
   |           o<--"sqlalchemy.orm.strategies.DeferredColumnLoader"
   |           |   Level NOTSET so inherits level WARNING
   |           |
   |           o<--"sqlalchemy.orm.strategies.JoinedLoader"
   |           |   Level NOTSET so inherits level WARNING
   |           |
   |           o<--"sqlalchemy.orm.strategies.LazyLoader"
   |           |   Level NOTSET so inherits level WARNING
   |           |
   |           o<--"sqlalchemy.orm.strategies.NoLoader"
   |           |   Level NOTSET so inherits level WARNING
   |           |
   |           o<--"sqlalchemy.orm.strategies.SubqueryLoader"
   |               Level NOTSET so inherits level WARNING
   |
   o<--"stripe"
   |   Level NOTSET so inherits level INFO
   |
   o<--[tornado]
       |
       o<--"tornado.access"
       |   Level NOTSET so inherits level INFO
       |
       o<--"tornado.application"
       |   Level NOTSET so inherits level INFO
       |
       o<--"tornado.general"
           Level NOTSET so inherits level INFO

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
noirbizarrecommented, Dec 29, 2016

I had the same issue. Fixed with:

logging.getLogger('livereload').propagate = False
logging.getLogger('tornado').propagate = False
0reactions
lepturecommented, Dec 30, 2016

@TimotheeJeannin A pull request is welcome.

Read more comments on GitHub >

github_iconTop Results From Across the Web

log messages appearing twice with Python Logging
I'd like to share here my experience: for a Flask application which I developed, the log messages were appearing MORE THAN TWICE. I'd...
Read more >
Duplicate Logging Messages in Python - jdhao's digital space
When I am working on a project, I find that the same message is printed twice. The following minimal code can reproduce this...
Read more >
Logging is printed twice · Issue #32 · SAP/cf-python ... - GitHub
Configures the JSON logger and it displays the message a second time. There are two options. remove the logging.basicConfig.... line; move the ...
Read more >
This Is Why React Prints All Console Logs Twice - YouTube
Full Video: https://youtu.be/XUwzASyHr4Q Sorry about the bad audio quality. My computer changed my mic to use my webcam mi … Show more.
Read more >
4.2 - Console.log outputting everything twice. - Codecademy
The reason everything prints twice is because you're looping over the cards' properties (which there are two of) and then printing the suit...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found