Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #57728 > unrolled thread

Logging to file and not to console

Started byJohannes Findeisen <mailman@hanez.org>
First post2013-10-27 02:04 +0200
Last post2013-10-27 02:04 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  Logging to file and not to console Johannes Findeisen <mailman@hanez.org> - 2013-10-27 02:04 +0200

#57728 — Logging to file and not to console

FromJohannes Findeisen <mailman@hanez.org>
Date2013-10-27 02:04 +0200
SubjectLogging to file and not to console
Message-ID<mailman.1642.1382859279.18130.python-list@python.org>
Hi all,

I am going crazy with logging. I have an application which sets up
logging after parsing the args in the main() funktion. It needs to be
setup after parsing the args because I can set the loglevel via
commandline flags.

I have tried many variants on how to do that but every time with an
weird result.

What I want is logging in from all libs and really understand that doing
this should be enough there:

from logging import getLogger
logger = getLogger(__name__)

But, I need to setup the logger in the main() function to log only to a
file and not to console because my application has an own shell
interface which should not be spammed with log messages - never a
message should show up there.

I think it should be only some few lines of code but I can't figure
that out. The logger should be configured to have a max file size and
rotate logfiles.

Can someone help me with this?

Thanks in advance,
Johannes  

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web