Re: Logging

2022-11-19 Thread Cameron Simpson
On 20Nov2022 12:36, Chris Angelico wrote: On Sun, 20 Nov 2022 at 12:27, Cameron Simpson wrote: But really, is there any problem which cannot be solved with a decorator? I've even got a @decorator decorator for my decorators. Do you have a @toomanydecorators decorator to reduce the number of

Re: Logging

2022-11-19 Thread Chris Angelico
On Sun, 20 Nov 2022 at 12:27, Cameron Simpson wrote: > > On 19Nov2022 18:26, Thomas Passin wrote: > >>The alternative is to just replace every calling function which uses > >>my_ugly_debug() to directly call a logging.whatever() call. > > > >Maybe a place for a decorator... > > Indeed, though I d

Re: Logging

2022-11-19 Thread Cameron Simpson
On 19Nov2022 18:26, Thomas Passin wrote: The alternative is to just replace every calling function which uses my_ugly_debug() to directly call a logging.whatever() call. Maybe a place for a decorator... Indeed, though I don't think the OP is up to decorators yet. But really, is there any pr

Re: Logging

2022-11-19 Thread Thomas Passin
On 11/19/2022 5:27 PM, Cameron Simpson wrote: On 19Nov2022 11:08, Stefan Ram wrote: writes: You are expected to implement logging feature to an existing code which uses the function below. [...] You are not allowed to make changes in my_ugly_debug, so find another way.  If found a solution

Re: Logging

2022-11-19 Thread Cameron Simpson
On 19Nov2022 11:08, Stefan Ram wrote: writes: You are expected to implement logging feature to an existing code which uses the function below. [...] You are not allowed to make changes in my_ugly_debug, so find another way. If found a solution that is even more ugly than your function. I

Re: Logging into single file from multiple modules in python when TimedRotatingFileHandler is used

2022-06-27 Thread Peter J. Holzer
On 2022-06-21 02:04:52 -0700, Chethan Kumar S wrote: > I have a main process which makes use of different other modules. And > these modules also use other modules. I need to log all the logs into > single log file. Due to use of TimedRotatingFileHandler, my log > behaves differently after midnight

Re: Logging into single file from multiple modules in python when TimedRotatingFileHandler is used

2022-06-22 Thread Dieter Maurer
Chethan Kumar S wrote at 2022-6-21 02:04 -0700: > ... >I have a main process which makes use of different other modules. And these >modules also use other modules. I need to log all the logs into single log >file. Due to use of TimedRotatingFileHandler, my log behaves differently after >midnight

Re: Logging into single file from multiple modules in python when TimedRotatingFileHandler is used

2022-06-22 Thread Lars Liedtke
The process that is writing the file must be told that rotation has happened for it to work. Other wise all the logs keep being write to the original file via the FD that the process has. logrotate's config include how to tell the process the log file needs reopening. Thanks for clearing.

Re: Logging into single file from multiple modules in python when TimedRotatingFileHandler is used

2022-06-22 Thread Barry Scott
> On 22 Jun 2022, at 11:06, Lars Liedtke wrote: > > Could be unrelated and only a part of a solution, but if you are on a unixoid > system, you could use logrotate, instead of TimedRotatingFileHandler. > logfrotate ensures that the logging service does not realize, its logs have > been rota

Re: Logging into single file from multiple modules in python when TimedRotatingFileHandler is used

2022-06-22 Thread Lars Liedtke
-- Lars Liedtke Software Entwickler Phone: Fax:+49 721 98993- E-mail: l...@solute.de solute GmbH Zeppelinstraße 15 76185 Karlsruhe Germany Marken der solute GmbH | brands of solute GmbH billiger.de | Shopping.de Geschäftsführe

Re: logging library python

2022-04-27 Thread Dan Stromberg
You probably want getLogger(__name__) ...or something close to it. ‪On Wed, Apr 27, 2022 at 12:58 PM ‫תמר ווסה‬‎ wrote:‬ > hello, > we have many scripts of one project. what is the right way to define the > logger to all scripts? we tried to create class that define the logger > configuration+g

Re: Logging user activity

2022-02-08 Thread Jack Dangler
On 2/7/22 5:09 PM, Peter J. Holzer wrote: On 2022-02-06 23:30:41 -0800, blessy carol wrote: I have this task where I have to create log files to record user activity whenever they make an entry or view something. Also, I have to create Database log file whenever someone accessed or manipulated

Re: Logging user activity

2022-02-07 Thread Cameron Simpson
On 06Feb2022 23:30, blessy carol wrote: >I have this task where I have to create log files to record user >activity whenever they make an entry or view something. Also, I have to >create Database log file whenever someone accessed or manipulated the >data in the database. The code is written py

Re: Logging user activity

2022-02-07 Thread Peter J. Holzer
On 2022-02-06 23:30:41 -0800, blessy carol wrote: > I have this task where I have to create log files to record user > activity whenever they make an entry or view something. Also, I have > to create Database log file whenever someone accessed or manipulated > the data in the database. The code is

Re: Logging with 2 process in application

2021-02-22 Thread gayatri funde
On Monday, February 22, 2021 at 4:14:53 PM UTC+5:30, Peter Otten wrote: > On 22/02/2021 06:57, gayatri funde wrote: > > On Monday, February 22, 2021 at 11:15:27 AM UTC+5:30, Chris Angelico wrote: > >> On Mon, Feb 22, 2021 at 4:41 PM gayatri funde wrote: > >>> > >>> On Monday, February 22, 2021

Re: Logging with 2 process in application

2021-02-22 Thread Peter Otten
On 22/02/2021 06:57, gayatri funde wrote: On Monday, February 22, 2021 at 11:15:27 AM UTC+5:30, Chris Angelico wrote: On Mon, Feb 22, 2021 at 4:41 PM gayatri funde wrote: On Monday, February 22, 2021 at 10:47:57 AM UTC+5:30, Dan Stromberg wrote: On Sun, Feb 21, 2021 at 9:10 PM gayatri funde

Re: Logging with 2 process in application

2021-02-21 Thread gayatri funde
On Monday, February 22, 2021 at 11:33:57 AM UTC+5:30, Chris Angelico wrote: > On Mon, Feb 22, 2021 at 5:01 PM gayatri funde wrote: > > I have 2 files mainModule.py and loggingModule.py files as below: > > In loggingModule.py file i am managing new log to create , which i am > > importing to mai

Re: Logging with 2 process in application

2021-02-21 Thread Chris Angelico
On Mon, Feb 22, 2021 at 5:01 PM gayatri funde wrote: > I have 2 files mainModule.py and loggingModule.py files as below: > In loggingModule.py file i am managing new log to create , which i am > importing to mainModule.py file. > > def child_Process(var1): > while True: > time.sleep(1

Re: Logging with 2 process in application

2021-02-21 Thread gayatri funde
On Monday, February 22, 2021 at 11:15:27 AM UTC+5:30, Chris Angelico wrote: > On Mon, Feb 22, 2021 at 4:41 PM gayatri funde wrote: > > > > On Monday, February 22, 2021 at 10:47:57 AM UTC+5:30, Dan Stromberg wrote: > > > On Sun, Feb 21, 2021 at 9:10 PM gayatri funde > > > wrote: > > > > Hello

Re: Logging with 2 process in application

2021-02-21 Thread gayatri funde
On Monday, February 22, 2021 at 10:49:36 AM UTC+5:30, Chris Angelico wrote: > On Mon, Feb 22, 2021 at 4:11 PM gayatri funde wrote: > > > > Hello, > > > > Greetings!! Have a good day! > > > > This is regarding logging issue i am facing in my application. My > > requirement is to create log o

Re: Logging with 2 process in application

2021-02-21 Thread Chris Angelico
On Mon, Feb 22, 2021 at 4:41 PM gayatri funde wrote: > > On Monday, February 22, 2021 at 10:47:57 AM UTC+5:30, Dan Stromberg wrote: > > On Sun, Feb 21, 2021 at 9:10 PM gayatri funde > > wrote: > > > Hello, > > > > > > Greetings!! Have a good day! > > > > > > This is regarding logging issue i am f

Re: Logging with 2 process in application

2021-02-21 Thread gayatri funde
On Monday, February 22, 2021 at 10:47:57 AM UTC+5:30, Dan Stromberg wrote: > On Sun, Feb 21, 2021 at 9:10 PM gayatri funde > wrote: > > Hello, > > > > Greetings!! Have a good day! > > > > This is regarding logging issue i am facing in my application. My > > requirement is to create log on da

Re: Logging with 2 process in application

2021-02-21 Thread Chris Angelico
On Mon, Feb 22, 2021 at 4:11 PM gayatri funde wrote: > > Hello, > > Greetings!! Have a good day! > > This is regarding logging issue i am facing in my application. My requirement > is to create log on daily basis while my application is running, So to do > this i am creating new log file at midn

Re: Logging with 2 process in application

2021-02-21 Thread Dan Stromberg
On Sun, Feb 21, 2021 at 9:10 PM gayatri funde wrote: > Hello, > > Greetings!! Have a good day! > > This is regarding logging issue i am facing in my application. My > requirement is to create log on daily basis while my application is > running, So to do this i am creating new log file at midnigh

Re: Logging lib doesn't work

2020-09-29 Thread Alexandre FOURNEL
Le mardi 29 septembre 2020 à 16:33:39 UTC+2, Barry Scott a écrit : > > On 29 Sep 2020, at 15:11, Alexandre FOURNEL > > wrote: > > > > Hi all ! > > > > I'm trying to use logging lib in my python program. > > > > To try this lib, I am using basic code like : > > > > "import logging > > log

Re: Logging lib doesn't work

2020-09-29 Thread Barry Scott
> On 29 Sep 2020, at 15:11, Alexandre FOURNEL > wrote: > > Hi all ! > > I'm trying to use logging lib in my python program. > > To try this lib, I am using basic code like : > > "import logging > logging.basicConfig(filename='pont.txt', filemode='w',format='%(asctime)s > %(message)s', d

Re: Logging all the requests into a specific file

2020-02-27 Thread DL Neil via Python-list
On 28/02/20 9:29 AM, valon.januza...@gmail.com wrote: I am new to python and all of this, I am using this FastAPI, to build API, I want when users hit any endpoint for ex /products, that to be written into a file , how do I do it? The Python Standard Library offers a Logging library. It has "

Re: Logging cf Reporting = Friday Filosofical Finking

2019-04-09 Thread Antoon Pardon
On 9/04/19 17:43, Skip Montanaro wrote: >>> Is logging an unpopular package? >> I've been writing Python applications for 20 years. On several >> occasions, I've sat down determined to use it. After a frustrating >> half a day or so trying to get it to do what I want (and failing), >> I've always

Re: Logging cf Reporting = Friday Filosofical Finking

2019-04-09 Thread Antoon Pardon
On 8/04/19 23:14, DL Neil wrote: > Is logging an unpopular package? I think it does too much and too litle. On the one hand, you are overwhelmed by the possibilities, most of which you don't need. On the other hand, you find that it is missing a number of levels in comparison with syslog. I als

Re: Logging cf Reporting = Friday Filosofical Finking

2019-04-09 Thread Skip Montanaro
> > Is logging an unpopular package? > > I've been writing Python applications for 20 years. On several > occasions, I've sat down determined to use it. After a frustrating > half a day or so trying to get it to do what I want (and failing), > I've always given up and gone back to writing my own

Re: Logging cf Reporting = Friday Filosofical Finking

2019-04-09 Thread Grant Edwards
On 2019-04-08, DL Neil wrote: > Is logging an unpopular package? I've been writing Python applications for 20 years. On several occasions, I've sat down determined to use it. After a frustrating half a day or so trying to get it to do what I want (and failing), I've always given up and gone ba

Re: Logging cf Reporting = Friday Filosofical Finking

2019-04-08 Thread DL Neil
Is logging an unpopular package? Is extending its use, as described, interesting/inappropriate/illogical/downright-crazy? On 5/04/19 8:34 AM, DL Neil wrote: Is the logging module an ideal means to provide (printed) user reports, or is it a 'bad fit' and not designed/fit for such a purpose?

Re: Logging cf Reporting = Friday Filosofical Finking

2019-04-05 Thread Ben Coleman
On 4/4/2019 3:34 PM, DL Neil wrote: > ("oh, and it would be nice if you could send the file to me by email..." > - they're always, um, never, (quite) satisfied...) I refer to this as the Heisenberg Principle of computer programming: the act of giving a user what he says he wants changes what he wa

Re: Logging module and datetime - oil & water for some reason?

2019-04-02 Thread DL Neil
Skip, On 2/04/19 9:54 AM, Skip Montanaro wrote: I assiduously avoided using Python's logging package for about the first dozen years of its existence. I eventually gave in and started I'm glad you're stepping-up! I'm never sure whether to be amazed or dismayed by the huge number of folk exp

Re: Logging - have logger use caller's function name and line number

2018-12-29 Thread David
On Sun, 30 Dec 2018 at 05:58, Malcolm Greene wrote: > > I have a class method that adds additional context to many of the > class's log messages. Rather than calling, for example, logger.info( > 'message ...' ) I would like to call my_object.log( 'message ...' ) so > that this additional context

Re: Logging - have logger use caller's function name and line number

2018-12-29 Thread Peter Otten
Malcolm Greene wrote: > I have a class method that adds additional context to many of the > class's log messages. Rather than calling, for example, logger.info( > 'message ...' ) I would like to call my_object.log( 'message ...' ) so > that this additional context is managed in a single place. I'

Re: logging output

2018-10-19 Thread Anders Wegge Keller
På Fri, 19 Oct 2018 08:05:28 -0700 (PDT) Sharan Basappa skrev: ... > delimiter=r'\s"') #data_df = pd.read_csv("BGL_MERGED.log") > logger.debug("data frame %s \n", data_df) Do this help? -- //Wegge -- http

Re: logging module - how to include method's class name when using %(funcName)

2018-09-11 Thread Peter Otten
Malcolm Greene wrote: > I'm using the Python logging module and looking for a way to include a > method's class name when using %(funcName). Is this possible? When you > have several related classes, just getting the function (method) name is > not enough information to provide context on the code

Re: logging module - how to include method's class name when using %(funcName)

2018-09-10 Thread dieter
Malcolm Greene writes: > I'm using the Python logging module and looking for a way to include a > method's class name when using %(funcName). Is this possible? If it does not happen automatically, the standard logging components will not let you do it (the name "funcName" is rather explicit; you

Re: logging from time critical tasks -- QueueListener().stop() takes the whole CPU

2018-07-16 Thread Cameron Simpson
On 16Jul2018 08:33, Thomas Jollans wrote: On 16/07/18 08:24, Gerlando Falauto wrote: On Monday, July 16, 2018 at 8:13:46 AM UTC+2, Thomas Jollans wrote: On 16/07/18 07:39, Gerlando Falauto wrote: On Monday, July 16, 2018 at 6:56:19 AM UTC+2, dieter wrote: ... Why is the main thread taking up

Re: logging from time critical tasks -- QueueListener().stop() takes the whole CPU

2018-07-15 Thread Thomas Jollans
On 16/07/18 08:24, Gerlando Falauto wrote: > On Monday, July 16, 2018 at 8:13:46 AM UTC+2, Thomas Jollans wrote: >> On 16/07/18 07:39, Gerlando Falauto wrote: >>> On Monday, July 16, 2018 at 6:56:19 AM UTC+2, dieter wrote: > ... > Why is the main thread taking up so much CPU? > I believ

Re: logging from time critical tasks -- QueueListener().stop() takes the whole CPU

2018-07-15 Thread Gerlando Falauto
On Monday, July 16, 2018 at 8:13:46 AM UTC+2, Thomas Jollans wrote: > On 16/07/18 07:39, Gerlando Falauto wrote: > > On Monday, July 16, 2018 at 6:56:19 AM UTC+2, dieter wrote: > >>> ... > >>> Why is the main thread taking up so much CPU? > >>> I believe at this point listener.stop() should only be

Re: logging from time critical tasks -- QueueListener().stop() takes the whole CPU

2018-07-15 Thread Thomas Jollans
On 16/07/18 07:39, Gerlando Falauto wrote: > On Monday, July 16, 2018 at 6:56:19 AM UTC+2, dieter wrote: >>> ... >>> Why is the main thread taking up so much CPU? >>> I believe at this point listener.stop() should only be waiting for the >>> helper thread to terminate, which I reckon would be impl

Re: logging from time critical tasks -- QueueListener().stop() takes the whole CPU

2018-07-15 Thread Gerlando Falauto
On Monday, July 16, 2018 at 6:56:19 AM UTC+2, dieter wrote: > > ... > > Why is the main thread taking up so much CPU? > > I believe at this point listener.stop() should only be waiting for the > > helper thread to terminate, which I reckon would be implemented by waiting > > on a semaphore or som

Re: logging from time critical tasks -- QueueListener().stop() takes the whole CPU

2018-07-15 Thread dieter
Gerlando Falauto writes: > ... > Why is the main thread taking up so much CPU? > I believe at this point listener.stop() should only be waiting for the helper > thread to terminate, which I reckon would be implemented by waiting on a > semaphore or something (i.e. iowait i.e. 0% CPU). Maybe, yo

Re: logging module

2018-07-01 Thread dieter
Sharan Basappa writes: > I am trying to use logging module and somehow I cannot make it work. > > A simple code that I am trying is below. The commented code line 5,6 are > other options I have tried but don't work > > #importing module > import logging > > #Create and configure logger > #loggi

Re: logging module

2018-07-01 Thread Steven D'Aprano
On Sun, 01 Jul 2018 06:05:48 -0700, Sharan Basappa wrote: > Folks, > > I am trying to use logging module and somehow I cannot make it work. > > A simple code that I am trying is below. The commented code line 5,6 are > other options I have tried but don't work > > #importing module > import log

Re: logging module

2018-07-01 Thread Bev in TX
> On Jul 1, 2018, at 8:05 AM, Sharan Basappa wrote: > > Folks, > > I am trying to use logging module and somehow I cannot make it work. Saying that something does not work does not provide enough information for anyone to assist you. You need to provide both the exact code that did not wo

RE: logging with multiprocessing

2018-06-08 Thread Schachner, Joseph
Multiprocessing, not multithreading. Different processes. This is pretty easy to do. I have done this from a Python script to run an analysis program on many sets of data, at once. To do it: 1) if there is going to be an output file, each output file must have a distinct name. 2) To use l

Re: Logging module stopped working

2017-10-17 Thread llanitedave
On Monday, October 16, 2017 at 11:58:12 PM UTC-7, Steve D'Aprano wrote: > On Tue, 17 Oct 2017 03:06 pm, llanitedave wrote: > > [...] > > I set up the logging code at the very beginning of the app, before any other > > work is done. Here's the relevant code: > > > > #!/usr/bin/env python3 > [...

Re: Logging module stopped working

2017-10-17 Thread llanitedave
Those are some good suggestions, I've found that I won't be able to work on it today, but I'll definitely follow up tomorrow. As for not showing all the code, the main window and its associated code are definitely there and working. I didn't post it because of all the setup code for fields and

Re: Logging module stopped working

2017-10-17 Thread Steve D'Aprano
On Tue, 17 Oct 2017 03:06 pm, llanitedave wrote: [...] > I set up the logging code at the very beginning of the app, before any other > work is done. Here's the relevant code: > > #!/usr/bin/env python3 [... snip imports ...] > class MainWindow(QMainWindow): > def __init__(self): > s

Re: Logging module stopped working

2017-10-16 Thread Chris Angelico
On Tue, Oct 17, 2017 at 3:06 PM, llanitedave wrote: > I'm building an application that contains some long-running operations in a > separate thread from the user interface. I've been using the logging module > writing logging.info() statements to a .log file to keep track of the data > interac

Re: Logging from files doesn't work

2017-10-12 Thread Andrew Z
Cameron, Peter, Thank you. Your comments were spot on. Changing root logger got the logs spitting into the file. And i now can org these logs into one directory, instead of the current mess. Thank you! On Oct 11, 2017 23:41, "Cameron Simpson" wrote: > On 11Oct2017 22:27, Andrew Z wrote: > >>

Re: Logging from files doesn't work

2017-10-12 Thread Peter Otten
Andrew Z wrote: > Hello, > > apparently my reading comprehension is nose diving these days. After > reading python cookbook and a few other tutorials i still can't get a > simple logging from a few files to work. > I suspected my file organization - all files are in the same directory, > causing

Re: Logging from files doesn't work

2017-10-11 Thread Cameron Simpson
On 11Oct2017 22:27, Andrew Z wrote: aha. So the issue is that main.py's __name__ attribute == "__main__" and test.py is "test1.test". Yeah. If you invoke a module as "python -m module_name" its __name__ field is "__main__". That makes the boilerplate work, but breaks your expectation that __

Re: Logging from files doesn't work

2017-10-11 Thread Andrew Z
aha. So the issue is that main.py's __name__ attribute == "__main__" and test.py is "test1.test". if i manually assign names: main.py - > log = logging.getLogger("MAIN") test.py - > log = logging.getLogger("MAIN.test1.test") then logging is working perfectly well. This brings me to the question

Re: Logging from files doesn't work

2017-10-11 Thread Andrew Z
if i change print statements in both files to print out "__name__": __main__ test1.test On Wed, Oct 11, 2017 at 10:02 PM, Andrew Z wrote: > Hello, > > apparently my reading comprehension is nose diving these days. After > reading python cookbook and a few other tutorials i still can't get a > s

Re: Logging function calls without changing code

2017-05-24 Thread Matt Wheeler
Hi Rajat, On Wed, 24 May 2017 at 20:05 Rajat Sharma wrote: > Is there a way to log all function calls of a class without changing > anything in that class. > Several... depending on what you want to achieve some may be more suited than others > What I mean to say is if I have written a class

Re: Logging from different python scripts to different output files

2017-03-29 Thread Peter Otten
James McMahon wrote: [Please keep the discussion on the list] > Thank you Peter. Is it necessary to employ a close() on the handlers and a > shutdown() on the loggers themselves? -Jim Not unless you run into problems with the default mechanism -- logging.shutdown() is scheduled via atexit.regis

Re: Logging from different python scripts to different output files

2017-03-28 Thread Peter Otten
James McMahon wrote: > I'm struggling with Python logging. Have tried to apply several examples I > have found in the open source literature, but can't get it to work. What I > need to do is this: I have two python scripts, a.py and b.py. Each is > called by NiFi ExecuteScript processor repeatedly

Re: logging TypeError: not all arguments converted during string formatting

2016-09-15 Thread Peter Otten
Daiyue Weng wrote: > Hi, I am trying to record memory and CPU usages and load a logger from an > external config file (logging.conf), [snip] One important debugging strategy is to try and find the minimal example that produces a problem. In this case you can provoke the the behaviour you are s

Re: logging TypeError: not all arguments converted during string formatting

2016-09-15 Thread MRAB
On 2016-09-15 15:57, Daiyue Weng wrote: Hi, I am trying to record memory and CPU usages and load a logger from an external config file (logging.conf), [snip] import logging import psutil logging.config.fileConfig('logging.conf') hardware_log = logging.getLogger(HARDWARELOGNAME) free_mem_g

Re: logging: getLogger() or getLogger(__name__)?

2016-07-28 Thread Malcolm Greene
Thank you Laurent! - Original message - From: Laurent Pointal With __name__ you will have one logger per source file (module), with corresponding filtering possibilities, and organized hierarchically as are packages (logging use . to built its loggers hierarchy). Without __name__, y

Re: logging: getLogger() or getLogger(__name__)?

2016-07-27 Thread Laurent Pointal
Malcolm Greene wrote: > I've read that best practice for logging is to place the following line > at the top of all modules: > > logger = getLogger(__name__) > > I'm curious why the following technique wouldn't be a better choice: > > logger = getLogger() > > Are there scenarios that favor

Re: Logging to a file from a C-extension

2015-08-26 Thread Stefan Behnel
Hi, welcome to Python (and to this list). The usual way to reply here is inline, after stripping anything that's not relevant to your reply. AllanPfalzgraf schrieb am 25.08.2015 um 15:03: > From: Stefan Behnel: >> Al Pfalzgraf schrieb am 18.08.2015 um 15:07: >>> If a logging file is opened at th

RE: Logging to a file from a C-extension

2015-08-25 Thread AllanPfalzgraf
ehnel [mailto:stefan...@behnel.de] Sent: Wednesday, August 19, 2015 2:51 PM Subject: Re: Logging to a file from a C-extension Al Pfalzgraf schrieb am 18.08.2015 um 15:07: > If a logging file is opened at the level of a Python application, how > would the log file name be communicated to a

Re: Logging to a file from a C-extension

2015-08-19 Thread Stefan Behnel
Al Pfalzgraf schrieb am 18.08.2015 um 15:07: > If a logging file is opened at the level of a Python application, how > would the log file name be communicated to a C-extension so that logging > from the extension would be sent to the same log file? Writing to the file directly (as was suggested) m

Re: Logging to a file from a C-extension

2015-08-19 Thread Laura Creighton
In a message of Tue, 18 Aug 2015 08:07:51 -0500, Al Pfalzgraf writes: > If a logging file is opened at the level of a Python application, how would > the log file name be communicated to a C-extension so that logging from the > extension would be sent to the same log file? To convert a file to a

Re: Logging Custom Levels?

2015-04-01 Thread Didymus
On Tuesday, March 31, 2015 at 1:37:29 PM UTC-4, Jean-Michel Pichavant wrote: > > A solution is pretty simple, do not use an intermediate log function pdebug. > > import logging > PDEBUG_NUM=20 > logging.addLevelName(PDEBUG_NUM, "PDEBUG") > > logger = logging.getLogger('foo') > logging.basicConf

Re: Logging Custom Levels?

2015-03-31 Thread Jean-Michel Pichavant
- Original Message - > From: "Didymus" > To: python-list@python.org > Sent: Tuesday, 31 March, 2015 5:20:52 PM > Subject: Logging Custom Levels? > > Hi, > > I've create a Python file called "log.py" and placed in the custom > levels: > > # Performance Debug... > logging.addLevelName(PDE

Re: Logging custom level not print module properly??

2015-03-03 Thread Ian Kelly
On Mar 3, 2015 8:16 AM, "Didymus" wrote: > I did find that if I changed the "self.log" to "self._log" it works correctly but gives me a pylint warning about acccess to a protected member _log.. > > def pwarning(self, message, *args, **kws): > """ Performance Warning Message Level """ > # Y

Re: Logging custom level not print module properly??

2015-03-03 Thread Didymus
On Tuesday, March 3, 2015 at 10:02:02 AM UTC-5, Peter Otten wrote: > Didymus wrote: > > > Hi, > > > > I have setup custom levels (with the help of the Python community) for > > logging. I set this up as a class in a module "log.py" below. The problem > > I'm seeing is that no matter the file the

Re: Logging custom level not print module properly??

2015-03-03 Thread Peter Otten
Didymus wrote: > Hi, > > I have setup custom levels (with the help of the Python community) for > logging. I set this up as a class in a module "log.py" below. The problem > I'm seeing is that no matter the file the the logging is happening in it > always prints the module as "log", I've rcreated

Re: Logging with Custom Levels not working

2015-02-20 Thread Didymus
On Friday, February 20, 2015 at 4:25:50 AM UTC-5, Ian wrote: > > On Wednesday, February 18, 2015 at 3:16:40 PM UTC-5, Ian wrote: > >> > def perror(self, message, *args, **kws): > >> > """ Performance Error Message Level """ > >> > # Yes, logger takes its '*args' as 'args'. > >> > self._

Re: Logging with Custom Levels not working

2015-02-20 Thread Ian Kelly
On Thu, Feb 19, 2015 at 11:16 AM, Didymus wrote: > On Wednesday, February 18, 2015 at 3:16:40 PM UTC-5, Ian wrote: >> > def perror(self, message, *args, **kws): >> > """ Performance Error Message Level """ >> > # Yes, logger takes its '*args' as 'args'. >> > self._log(PERROR_NUM, messa

Re: Logging with Custom Levels not working

2015-02-19 Thread Didymus
On Wednesday, February 18, 2015 at 3:16:40 PM UTC-5, Ian wrote: > > def perror(self, message, *args, **kws): > > """ Performance Error Message Level """ > > # Yes, logger takes its '*args' as 'args'. > > self._log(PERROR_NUM, message, args, **kws) > > > > logging.Logger.perror = perror

Re: Logging with Custom Levels not working

2015-02-18 Thread Ian Kelly
On Wed, Feb 18, 2015 at 6:49 AM, Didymus wrote: > def perror(self, message, *args, **kws): > """ Performance Error Message Level """ > # Yes, logger takes its '*args' as 'args'. > self._log(PERROR_NUM, message, args, **kws) > > logging.Logger.perror = perror I think you need to call s

Re: logging question

2015-02-07 Thread Automn
Hello, On 2014-08-13, Arulnambi Nandagoban wrote: > > My pc restarts regularly. Whenever it restarts I lose all the log since it > writes in the file once per day. Is there a way to log information in a > file as soon as it available. You can log in the /var/tmp directory instead of /tmp. The f

Re: Logging all uncaught exceptions

2014-07-14 Thread Steven D'Aprano
On Mon, 14 Jul 2014 19:21:44 +1000, Chris Angelico wrote: > On Mon, Jul 14, 2014 at 7:07 PM, Steven D'Aprano > wrote: >> but the exception info which should have been generated by >> mylogger.exception doesn't appear anywhere I can see. >> >> >> What am I doing wrong? > > I'm not specifically fa

Re: Logging all uncaught exceptions

2014-07-14 Thread Chris Angelico
On Mon, Jul 14, 2014 at 7:07 PM, Steven D'Aprano wrote: > but the exception info which should have been generated by > mylogger.exception doesn't appear anywhere I can see. > > > What am I doing wrong? I'm not specifically familiar with the logging module, but something I'd look at would be 'ls /

Re: Logging all uncaught exceptions

2014-07-14 Thread Steven D'Aprano
On Mon, 14 Jul 2014 06:09:32 +, Steven D'Aprano wrote: > I want to catch all uncaught exceptions in my application, log them, > then handle as normal. Which, in practice, means a traceback. Is this > the right way to do it? I think I've answered my own question, which leads to the next questi

Re: Logging

2014-03-04 Thread Peter Otten
Igor Korot wrote: > Hi, ALL, > Could someone please explain to me how the code in > http://docs.python.org/2/howto/logging#logging-from-multiple-modules > works? > In particular I'm interested in how the mylib.py knows about the > myapp.log. > > What I mean is: logging object is not passed to myl

RE: Logging from a multiprocess application

2014-02-06 Thread Joseph L. Casale
> Maybe check out logstash (http://logstash.net/). That looks pretty slick, I am constrained to using something provided by the packaged modules in this scenario. I think I have it pretty close except for the fact that the LogRecordStreamHandler from the cookbook excepts when the sending proces

Re: Logging from a multiprocess application

2014-02-06 Thread Mark Betz
On Thursday, February 6, 2014 1:24:17 PM UTC-5, Joseph L. Casale wrote: > I have a module that has one operation that benefits greatly from being > multiprocessed. > Its a console based module and as such I have a stream handler and filter > associated to > the console, obviously the mp based ins

Re: Logging data from Arduino using PySerial

2014-02-04 Thread MRAB
On 2014-02-04 04:07, Thomas wrote: I've written a script to log data from my Arduino to a csv file. The script works well enough but it's very, very slow. I'm quite new to Python and I just wanted to put this out there to see if any Python experts could help optimise my code. Here it is: [sn

Re: Logging data from Arduino using PySerial

2014-02-03 Thread Chris Angelico
On Tue, Feb 4, 2014 at 3:57 PM, Thomas wrote: > Wow...Thanks Chris! I really appreciate your suggestions (including the > stylistic ones). I'll definitely be revising my code as soon as I find the > time. As far as profiling goes, I've used timeit in the past but it's quite a > pain going throu

Re: Logging data from Arduino using PySerial

2014-02-03 Thread Thomas
Wow...Thanks Chris! I really appreciate your suggestions (including the stylistic ones). I'll definitely be revising my code as soon as I find the time. As far as profiling goes, I've used timeit in the past but it's quite a pain going through any program block by block. I wish there were a prog

Re: Logging data from Arduino using PySerial

2014-02-03 Thread Chris Angelico
On Tue, Feb 4, 2014 at 3:07 PM, Thomas wrote: > I've written a script to log data from my Arduino to a csv file. The script > works well enough but it's very, very slow. I'm quite new to Python and I > just wanted to put this out there to see if any Python experts could help > optimise my code.

Re: Logging to file and not to console

2013-10-27 Thread Johannes Findeisen
On Sun, 27 Oct 2013 11:09:08 +0100 Peter Otten wrote: > Johannes Findeisen wrote: > > > 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

Re: Logging to file and not to console

2013-10-27 Thread Johannes Findeisen
On Sun, 27 Oct 2013 11:09:08 +0100 Peter Otten wrote: > Johannes Findeisen wrote: > > > 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

Re: Logging to file and not to console

2013-10-27 Thread Peter Otten
Peter Otten wrote: > def levelnames(): > try: > names = logging._nameToLevel > except AttributeError: > names = (name for name in logging._levelNames if isinstance(name, > str)) Trainwreck alert :( I recommend that you use the following list "DEBUG INFO WARN ERROR CRITIC

Re: Logging to file and not to console

2013-10-27 Thread Peter Otten
Johannes Findeisen wrote: > 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

RE: Logging help

2013-08-04 Thread Joseph L. Casale
>Oh hai - as I was reading the documentation, look what I found: > >http://docs.python.org/2/library/logging.html#filter > >Methinks that should do exactly what you want. Hi Wayne, I was too hasty when I looked at filters as I didn't think they could do what I wanted. Turns out a logging object se

Re: Logging help

2013-08-03 Thread Wayne Werner
On Thu, 1 Aug 2013, Joseph L. Casale wrote: I have a couple handlers applied to a logger for a file and console destination. Default levels have been set for each, INFO+ to console and anything to file. How does one prevent logging.exception from going to a specific handler when it falls within

Re: improvements sought re. logging across modules

2013-04-24 Thread Dave Angel
On 04/24/2013 12:54 PM, The Night Tripper wrote: Hi all I have a small suite of python modules, say A.py B.py C.py which can be invoked in a variety of ways. eg. 1) A.py is invoked directly; this imports and uses B.py and C.py 2) B.py is invoked; this imports a

Re: improvements sought re. logging across modules

2013-04-24 Thread Chris “Kwpolska” Warrick
On Wed, Apr 24, 2013 at 6:54 PM, The Night Tripper wrote: > Hi all > I have a small suite of python modules, say > > A.py > B.py > C.py > > which can be invoked in a variety of ways. eg. > > 1) A.py is invoked directly; this imports and uses B.py and C.py > > 2) B.p

Re: improvements sought re. logging across modules

2013-04-24 Thread Fábio Santos
Maybe import mylogger.mylogger as gLog? I don't know what you mean by "missing a trick". Your example seems pretty pythonic to me, except for the fact that you use a singleton where you could have a couple of functions and use the module as the namespace. On 24 Apr 2013 17:58, "The Night Tripper"

improvements sought re. logging across modules

2013-04-24 Thread The Night Tripper
Hi all I have a small suite of python modules, say A.py B.py C.py which can be invoked in a variety of ways. eg. 1) A.py is invoked directly; this imports and uses B.py and C.py 2) B.py is invoked; this imports and uses A.py and C.py I use the logging module in

Re: Logging within a class

2013-02-11 Thread Jean-Michel Pichavant
- Original Message - > Within __init__ I setup a log with self.log = > logging.getLogger('foo') then add a > console and filehandler which requires the formatting to be > specified. There a few > methods I setup a local log object by calling getChild against the > global log object. > > >

  1   2   3   4   5   >