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

logger configuration overrides project's logger #24

Closed
helmanofer opened this issue Feb 23, 2015 · 2 comments
Closed

logger configuration overrides project's logger #24

helmanofer opened this issue Feb 23, 2015 · 2 comments

Comments

@helmanofer
Copy link

in my main code I configure:

logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)

But I get lda's logger configuration:

INFO:lda:<450> log likelihood: -111, per-word: -3.4701
INFO:lda:<460> log likelihood: -111, per-word: -3.4701
INFO:lda:<470> log likelihood: -111, per-word: -3.4701
INFO:lda:<480> log likelihood: -111, per-word: -3.4701

If in lda's init file I mark out line 11:

...
__version__ = pbr.version.VersionInfo('lda').version_string()

# logging.basicConfig(level=logging.INFO)
logger = logging.getLogger('lda')
logger.addHandler(logging.NullHandler())

I get the correct logger config:

2015-02-23 16:05:37,286 : INFO : <470> log likelihood: -111, per-word: -3.4701
2015-02-23 16:05:37,288 : INFO : <480> log likelihood: -111, per-word: -3.4701
2015-02-23 16:05:37,290 : INFO : <490> log likelihood: -111, per-word: -3.4701
2015-02-23 16:05:37,291 : INFO : <500> log likelihood: -111, per-word: -3.4701

I took this from gensim's init file.

@ariddell
Copy link
Contributor

Thanks. I've seen this problem in a few projects and would like to figure out what's the right way to setup logging properly. I'll look at the logging docs today.

@ariddell
Copy link
Contributor

Removing that line disables all logging, which isn't what we want.

Maybe the appropriate place to put basicConfig is in the __init__ for LDA.

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