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


Groups > comp.lang.python > #75692

Re: creating log file with Python logging module

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.06; 'subject:file': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'restart': 0.09; 'subject:module': 0.09; 'logger': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'subject:log': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'skip:% 10': 0.24; 'skip:l 30': 0.24; 'sorry,': 0.24; 'header:X-Complaints-To:1': 0.27; 'tried': 0.27; 'statement': 0.30; 'file': 0.32; 'problem': 0.35; 'subject:with': 0.35; 'but': 0.35; 'level': 0.37; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'system.': 0.39; 'received:org': 0.40; 'skip:t 30': 0.61; 'otten': 0.84; 'replicate': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Peter Otten <__peter__@web.de>
Subject Re: creating log file with Python logging module
Date Mon, 04 Aug 2014 16:03:29 +0200
Organization None
References <003d01cfafe2$e0668ac0$a133a040$@traxens.com> <lro1j7$r2d$1@ger.gmane.org> <lro39e$f7u$1@ger.gmane.org>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Gmane-NNTP-Posting-Host p57bda464.dip0.t-ipconnect.de
User-Agent KNode/4.11.5
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.12643.1407161038.18130.python-list@python.org> (permalink)
Lines 23
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1407161038 news.xs4all.nl 2916 [2001:888:2000:d::a6]:47105
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:75692

Show key headers only | View raw


Peter Otten wrote:

> Peter Otten wrote:
> 
>> You won't see a rollover if you restart it.
> 
> Sorry, I tried it and the above statement is wrong.

[Arulnambi Nandagoban]

> logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s -
> %(message)s', datefmt='%a, %d %b %Y %H:%M:%S', level = logging.DEBUG,
> filename=Ffilename, filemode='w')
> 
> logger = logging.getLogger(__name__)
> 
> hdlr = TimedRotatingFileHandler(Ffilename, when='midnight')

My alternative theory about what might be going wrong: you are using the 
same file in logging.basicConfig() and the TimedRotatingFileHandler.

But I cannot replicate the problem on my (linux) system.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: creating log file with Python logging module Peter Otten <__peter__@web.de> - 2014-08-04 16:03 +0200

csiph-web