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

Reinit warning suppression #198

Merged
merged 2 commits into from
Oct 3, 2017
Merged

Conversation

mgalgs
Copy link
Contributor

@mgalgs mgalgs commented Sep 25, 2017

Currently if you call rollbar.init() twice you see a warning about the
re-init. This is annoying in configurations where init() is expected
to be called twice. One such configuration is a Django project where the
rollbar middleware is installed (which calls rollbar.init() internally),
but the project also needs to be able to run without the middleware (from
headless scripts, etc.), which requires that you call rollbar.init().

The current recommendation [1] is to just live with the warning message.
I've personally taken that approach for the past year but have finally
grown weary enough of the warning message to warrant some action :).

Without this change my logs have the re-init warning scattered about:

WARNING:rollbar:Rollbar already initialized. Ignoring re-init.
Performing system checks...

System check identified no issues (0 silenced).
September 25, 2017 - 14:29:19
Django version 1.9.10, using settings 'unicorn.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
WARNING:rollbar:Rollbar already initialized. Ignoring re-init.

With this change, no more warnings:

Performing system checks...

System check identified no issues (0 silenced).
September 25, 2017 - 14:30:56
Django version 1.9.10, using settings 'unicorn.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.

Related to #100 and #145

[1] #100 (comment)

There's a superfluous </dd> floating around.  Rip it out.
Currently if you call `rollbar.init()` twice you see a warning about the
re-init.  This is annoying in configurations where `init()` is _expected_
to be called twice.  One such configuration is a Django project where the
rollbar middleware is installed (which calls `rollbar.init()` internally),
but the project also needs to be able to run without the middleware (from
headless scripts, etc.), which requires that you call `rollbar.init()`.

The current recommendation [1] is to just live with the warning message.
I've personally taken that approach for the past year but have finally
grown weary enough of the warning message to warrant some action :).

Without this change my logs have the re-init warning scattered about:

    WARNING:rollbar:Rollbar already initialized. Ignoring re-init.
    Performing system checks...

    System check identified no issues (0 silenced).
    September 25, 2017 - 14:29:19
    Django version 1.9.10, using settings 'unicorn.settings'
    Starting development server at http://0.0.0.0:8000/
    Quit the server with CONTROL-C.
    WARNING:rollbar:Rollbar already initialized. Ignoring re-init.

With this change, no more warnings:

    Performing system checks...

    System check identified no issues (0 silenced).
    September 25, 2017 - 14:30:56
    Django version 1.9.10, using settings 'unicorn.settings'
    Starting development server at http://0.0.0.0:8000/
    Quit the server with CONTROL-C.

Related to rollbar#100 and rollbar#145

[1] rollbar#100 (comment)
@rokob
Copy link
Contributor

rokob commented Oct 3, 2017

Seems reasonable

@rokob rokob merged commit eaf3b76 into rollbar:master Oct 3, 2017
@mgalgs mgalgs deleted the reinit-warning-suppression branch October 3, 2017 20:29
jwalgran added a commit to opensupplyhub/open-apparel-registry that referenced this pull request Jul 2, 2019
Removes a warning in the Django log output. The PR to pyrollbar that introduced
this flag explains how, in our situation, calling init twice is expected.

> Currently if you call rollbar.init() twice you see a warning about the
> re-init. This is annoying in configurations where init() is expected to be
> called twice. One such configuration is a Django project where the rollbar
> middleware is installed (which calls rollbar.init() internally), but the
> project also needs to be able to run without the middleware (from headless
> scripts, etc.), which requires that you call rollbar.init().

rollbar/pyrollbar#198
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

Successfully merging this pull request may close these issues.

2 participants