Re: Logging question

2009-09-23 Thread Vinay Sajip
x27;s also common to use the pattern logger = logging.getLogger(__name__) which will use the name of the module for a logger name, correctly getting the name of subpackages and submodules when used therein. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: Logging question

2009-09-23 Thread Vinay Sajip
uot;Who wants to know?". In trivial or command-line scripts, there's often just a one-to-one mapping (root logger -> console) or one-to-two (root logger -> console and file) but once your application gets more complex, then you usually have a good few loggers (based on application a

Re: DBHandler class for logging?

2009-09-23 Thread Vinay Sajip
, my answer is not so specific. It's not production quality code but it should get you started. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: logger module : Question about log message format

2009-09-08 Thread Vinay Sajip
jorma kala gmail.com> writes: > > > Hi,I've created a logger like this:    > LOG_FILENAME = 'test.txt' > fh=logging.FileHandler(LOG_FILENAME,'w') > logger1 = logging.getLogger('myLogger1') > logger1.addHandler(fh) > logger1.setLevel(logging.INFO)logger1.info('message from logger1') > > and wa

Re: Need help in configuration for TimedRotatingFileHandler

2009-08-11 Thread Vinay Sajip
a child process, an anti- virus scanner having the file open for scanning (anti-virus scanners often scan files which have just been written, like log files) and indexing software such as Google Desktop or Windows' own indexing service. I would advise using sysinternals tools such as FileMon and Handle to see what's holding the file open. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

ANN: gnupg v0.2.1 released

2009-08-08 Thread Vinay Sajip
7; >>> decrypted = gpg.decrypt(str(encrypted), passphrase='secret') >>> str(decrypted) 'Hello, world!' >>> signed = gpg.sign("Goodbye, world!", passphrase='secret') >>> verified = verified = gpg.verify(str(signed)) >>> print "Verified" if verified else "Not verified" 'Verified' For more information, visit http://code.google.com/p/python-gnupg/ - as always, your feedback is most welcome (especially bug reports, patches and suggestions for improvement). Enjoy! Cheers Vinay Sajip Red Dove Consultants Ltd. -- http://mail.python.org/mailman/listinfo/python-list

Re: Confused About Python Loggin

2009-08-01 Thread Vinay Sajip
leLogger =logging.getLogger('TESTHARNESS.FILE") # note the dotted name > logger =logging.getLogger('TESTHARNESS') > > Or maybe you have added a handler to the root logger... > > Using the propagate attribute is correct only between 2 loggers that are > meant to be parents. > > JM What you say is true, Jean-Michel, but the OP might be meaning the parent-child relationship both his loggers have with the mother of all loggers - the root logger ;-) Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: Confused About Python Loggin

2009-07-31 Thread Vinay Sajip
for example, calling basicConfig() configures the root logger (if it has no handlers) by adding a StreamHandler which outputs to sys.stderr. You shouldn't need to set propagate - the script in Peter's reply appears to do what you need. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: What is file.encoding convention?

2009-07-24 Thread Vinay Sajip
;\u0434\u043e \u0441\u0432\u0438\u0434\u0430\u043d\u0438\u044f' >>> print(u) до свидания >>> n = sys.stdout.write(u) до свидания>>> ^Z - Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: What is file.encoding convention?

2009-07-23 Thread Vinay Sajip
On Jul 23, 4:06 am, Naoki INADA wrote: > In document stdtypes.html#file.encoding>: > > >> The encoding that this file uses. When Unicode strings are written to a > >> file, > >> they will be converted to byte strings using this encoding. In addition, > >> when

Re: What is file.encoding convention?

2009-07-23 Thread Vinay Sajip
ut something to it which seemed to give the correct result, but then wrote to sys.stderr which gave a UnicodeEncodeError. What is the encoding of sys.stderr in your example? Also note that logging had to handle what appeared to be an oddity with terminals - they (at least sometimes) have an encoding attribute but appear to expect to have bytes written to them, and not Unicode. Hence the logging kludge, which should not be needed and so has been carefully commented. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

ANN: gnupg v0.2.0 released

2009-07-16 Thread Vinay Sajip
tr(decrypted) 'Hello, world!' >>> signed = gpg.sign("Goodbye, world!", passphrase='secret') >>> verified = verified = gpg.verify(str(signed)) >>> print "Verified" if verified else "Not verified" 'Verified' For more information, visit http://code.google.com/p/python-gnupg/ - as always, your feedback is most welcome (especially bug reports, patches and suggestions for improvement). Enjoy! Cheers Vinay Sajip Red Dove Consultants Ltd. -- http://mail.python.org/mailman/listinfo/python-list

Re: the ultimate logging facility for debugging code

2009-07-13 Thread Vinay Sajip
_log('Please log me')" line. > > As it is so useful, I bet there is a module that is doing this in a more > reliable way that I did. Anyone has heard of it ? > > Jean-Michel Check out the Python Decorator Library: http://wiki.python.org/moin/PythonDecoratorLibrary and y

ANN: A new version of the Python module which wraps GnuPG has been released.

2009-07-05 Thread Vinay Sajip
nux)\n \nhQIOA/6NHMDTXUwcEAf ... -END PGP MESSAGE-\n' >>> decrypted = gpg.decrypt(str(encrypted), passphrase='secret') >>> str(decrypted) 'Hello, world!' >>> signed = gpg.sign("Goodbye, world!", passphrase='secret')

Re: logging.fileConfig limitations?

2009-06-18 Thread Vinay Sajip
On Jun 17, 9:05 pm, Mani Ghasemlou wrote: > Hi all, > > C:\Documents and Settings\ßéäöÜ2\Local Settings\Application > Data\MyApp\MyApp.log > > Now it turns out that the logging module can't find "C:/Documents and > Settings/ßéäöÜ2/Local Settings/Application Data/MyApp/MyApp.log" > specified

Re: A simpler logging configuration file format?

2009-06-17 Thread Vinay Sajip
On Jun 5, 9:07 pm, geoff.ba...@gmail.com wrote: > Hi all, Some discussion about this has already taken place on the issue tracker: http://bugs.python.org/issue6136 and I thought I would summarise my comments there on this thread, for people who have no need to look at that issue. > At the momen

Problems with import hooks and encoding

2009-05-20 Thread Vinay Sajip
able, rather than any package provided with a host-installed version of Python? Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: pyinstaller and logging

2009-05-06 Thread Vinay Sajip
on between 1.5 and 2.4: http://www.pyinstaller.org/#Requirements So, you are using it in an unsupported environment. I see you've cross- posted this to the PyInstaller mailing list: http://groups.google.com/group/PyInstaller I hope someone on that list can help. An additional bit of informatio

Re: ValueError: I/O operation on closed file

2009-04-14 Thread Vinay Sajip
On Apr 14, 6:43 am, Dennis Lee Bieber wrote: > On Mon, 13 Apr 2009 16:44:44 -0700 (PDT), dj And Dennis' revised script works for me on Python 2.6 and [after converting print x to print(x)] Python 3.0 (both ActivePython installations). Regards, Vinay Sajip -- http://mail.python.org

Re: ValueError: I/O operation on closed file

2009-04-10 Thread Vinay Sajip
leHandler and a RotatingFileHandler with the same path, or have one of the log files open in an editor which locks the file. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: how to use logging.config.fileConfig ?

2009-04-10 Thread Vinay Sajip
mmatic configuration. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: logging - string formating problems

2009-04-06 Thread Vinay Sajip
all last): >    File "C:\Python25\lib\logging\__init__.py", line 290, in getMessage >      msg = msg % self.args > TypeError: not all arguments converted during string formatting > > As mentioned above, I know the above code is not good enough at all, but > I hope that m

Re: create a log level for python logging module

2009-03-30 Thread Vinay Sajip
s, an illustration of how to use custom logging levels in an application. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: logging.handlers.SocketHandler

2009-03-09 Thread Vinay Sajip
erver start-up cannot be tolerated. If it is important not to lose messages, then you will probably have to use some other handler which buffers log events and uses an always-up store-and-forward mechanism to guarantee delivery across periods of downtime. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: logging.handlers.SocketHandler

2009-03-06 Thread Vinay Sajip
oblem scenario. If either of these experiments yield some more information, it's probably worth taking that to the Twisted community, perhaps the twisted-python mailing list. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: logging.handlers.SocketHandler

2009-03-06 Thread Vinay Sajip
rue:" loop. What I observed on both Windows and Ubuntu was this: when I killed the socket receiver and restarted it, data from the client was received by the new receiver process after a short delay (of a few seconds). I had no need to restart the client to achieve this. Can you try testing wit

Re: logging.Handler not working with QThreads

2009-02-27 Thread Vinay Sajip
nds, so that I could show multiple threads interleaving their output with messages from main window/log window. Tested on Kubuntu (Hardy, KDE3) with SIP 4.7.9 and PyQt 4.4.4 running on Qt 4.3.4. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: logging.Handler not working with QThreads

2009-02-27 Thread Vinay Sajip
t;, s, i) self.sleep(1) With these changes (and replacing the appendPlainText with just plain append, the script worked fine. I was able to get messages from multiple running threads and the main window/log window into the single QTextEdit. My testing was conducted on Kubuntu Hardy

Re: logging and daemons

2009-02-16 Thread Vinay Sajip
you have C extensions or subprocesses which are C-based? Also, I assume you have a separate rotating log file per daemon - is that right? Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: Logging in Python

2009-02-10 Thread Vinay Sajip
like the cleanest implementation. > It's best not to dig into the implementation details, as these might change across versions of Python. Any of the suggestions that Robert and I made should be able to solve your problem in the right way. Best regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: Logging in Python

2009-02-10 Thread Vinay Sajip
ging in your main module, if there is one, and then the other modules just assume logging is configured and log away. If there isn't a main module, have all the modules import a common module which, when imported, configures logging how you want it. Under normal circumstances, the import code wi

Re: Logging help

2009-01-22 Thread Vinay Sajip
were extremely helpful. You're welcome. Best wishes, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: Logging help

2009-01-22 Thread Vinay Sajip
ogs/myapp-%Y-%m-%d-%H%M.log", time.localtime()), filemode="w") logging.debug("Hello, world!") Hopefully you can adapt this snippet to your needs. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: Logging help

2009-01-21 Thread Vinay Sajip
, why would it be called doRollover ? ;-) Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: Traceback in Logging

2009-01-07 Thread Vinay Sajip
ere is already support for tracebacks by using the Logger.exception method in an exception handler. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: Traceback in Logging

2009-01-06 Thread Vinay Sajip
g individual names for each > looks to be somewhat verbose - esp since the application is >10K LOC. > Don't the funcName and lineno arguments in the format string work for you? (See http://docs.python.org/library/logging.html#id1) Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: Traceback in Logging

2009-01-06 Thread Vinay Sajip
mation in exception handling, via use of the Logger.exception method in the exception handling code. > I use Python2.4, so LoggingAdapter is not there too. If you need LoggingAdapter, you can always copy and paste the relevant code from Python's SVN repository into your own application. Re

Re: AttributeError: 'module' object has no attribute 'DatagramHandler' (ubuntu-8.10, python 2.5.2)

2009-01-02 Thread Vinay Sajip
the > "classlogging.DatagramHandler" line in the docs is misleading to say the > least. Perhaps a docs bug should be filed... > This should now be fixed in the current docs - thanks to Georg Brandl (creator of the Python documentation system). Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: Python logging question

2009-01-02 Thread Vinay Sajip
ly adverse impact on process memory. That's when you use LoggerAdapters. I hope that's clearer. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: How to debug embeding Python?

2008-12-30 Thread Vinay Sajip
og is supported on Unix, as well as a host of other ways of getting information out of your application. See http://docs.python.org/library/logging.html#streamhandler This is a list of handlers included with the logging package, starting with StreamHandler. Regards, Vinay Sajip -- http://mail.

Re: AttributeError: 'module' object has no attribute 'DatagramHandler' (ubuntu-8.10, python 2.5.2)

2008-12-30 Thread Vinay Sajip
group. The documentation source markup for the class just says "DatagramHandler", and the "logging" prefix is added by Sphinx at HTML generation time. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: Select, interrupted system call, log rotation?

2008-12-07 Thread Vinay Sajip
een a reference somewhere > that it uses SIGALRM when log file reaches set size to stop and switch Python's logging package doesn't use signals, as it's cross-platform. The handler just checks when a log event is handled whether rotation should occur, and if it should, then the log files are rotated. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: multiple threads with Logging: ValueError: I/O operation on closed file

2008-11-10 Thread Vinay Sajip
#x27;, > filemode='w') > args = parseArgs() > > for i in range(args.threads): >logging.info('i=%d'%(i)) > children.append(Worker(i,args.duration)) > children[i].start() > time.sleep(0.1) Take a look at this example test script to see how to use logging in a multi-threaded environment: http://dpaste.com/hold/89734/ Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: Logging thread with Queue and multiple threads to log messages

2008-11-10 Thread Vinay Sajip
hildren = [] > args = parseArgs() > > for i in range(args.threads): > log('i=%d'%(i)) > children.append(Worker(i,args.duration)) > children[i].start() > time.sleep(0.1) Take a look at this example test script to see how to use logging in a multi-threaded environment: http://dpaste.com/hold/89734/ Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: multiple threads with Logging: ValueError: I/O operation on closed file

2008-11-10 Thread Vinay Sajip
if you could post a complete script which shows the problem. You should be doing a join for each of the threads spawned in the main thread, as otherwise the main thread will exit after the for loop and cause atexit processing to be done (which causes logging handlers to be closed). Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: how to use logging module to log an object like print()

2008-10-31 Thread Vinay Sajip
han the cost of formatting, viz. the computation of the values which get formatted. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: how to use logging module to log an object like print()

2008-10-29 Thread Vinay Sajip
tigate this using the pattern: if logger.isEnabledFor(logging.DEBUG): logger.debug("Message with variable data which may be expensive: %s", expensive_call()) Which will only make the expensive_call() and formatting when the logging call will actually do something. Regards, Vinay

Re: Logger / I get all messages 2 times

2008-10-24 Thread Vinay Sajip
ne and > > logger_root. You should only add it to root, or set propagate to false. > > > Diez > > What if I want to output only the specific logger to console and > ignore every other? Just add the handler to the logger you want and to no other logger. Then, events logged with the logger you want (and its child loggers) will be sent to the console. If you don't want the child loggers to log to console, set their propagate value to 0. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: Python equivalent for C module

2008-10-21 Thread Vinay Sajip
quick hack jobs. I'm surprised to hear you say that. All you need is import logging logging.warning("Message with %s data", "variable") # or debug, info, error and I'd like to know what simpler interface you think would be better/ easier to grok for quick hack jobs. Reg

Re: Python logging and ThreadingTCPServer

2008-10-17 Thread Vinay Sajip
own issue/bug? Are there any known workarounds? > > Thanks, > Daniel This has come up before. See for example http://groups.google.com/group/comp.lang.python/browse_thread/thread/3fbd36c89119f27f Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: SimpleXMLRPCServer -- turning off request log?

2008-09-26 Thread Vinay Sajip
ing." Did you try setting logRequests to false? Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: logging - how to use in a library?

2008-09-01 Thread Vinay Sajip
On Aug 29, 11:02 pm, Thomas Heller <[EMAIL PROTECTED]> wrote: > > BTW: Let me say that the more I useloggingthe more I like it.loggingis a > fantastic package! > Thank you, I can say the same for ctypes and py2exe :-) Regards, Vinay Sajip -- http://mail.python.org/mailm

Re: logging - how to use in a library?

2008-08-27 Thread Vinay Sajip
On Aug 27, 11:28 am, Thomas Heller <[EMAIL PROTECTED]> wrote: > Vinay Sajip schrieb: > > I came up with a workaround that seems to do what I want. I add a NULL > handler > to my top-level logger which is not the root logger but a logger named > 'comtype

Re: logging exceptions

2008-08-27 Thread Vinay Sajip
On Aug 27, 10:30 am, Rob Wolfe <[EMAIL PROTECTED]> wrote: > Vinay Sajip napisa³(a): > > > > > On Aug 26, 10:36 am, Alexandru Mosoi <[EMAIL PROTECTED]> wrote: > > > why doesn'tloggingthrow any exception when it should? how do I > > >

Re: logging - how to use in a library?

2008-08-27 Thread Vinay Sajip
ces we're particularly interested in warnings and errors. (A level of WARNING catches ERROR and CRITICAL events, too, of course.) Best Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: logging exceptions

2008-08-27 Thread Vinay Sajip
0 (default is 1). The raiseExceptions variable would normally be set to 0 in a production environment, where you don't want logging-related exceptions to bring an application down. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: Why do all my loggers start auto-disabled?

2008-08-25 Thread Vinay Sajip
rator. Best regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: Logging library unicode problem

2008-08-20 Thread Vinay Sajip
d be helpful for people who also encountered this > problem. > > Thanks. > Victor Lin. Hi Victor, Can you try modifying your patch to use the following logic instead of the print statement? if hasattr(self.stream, 'encoding'): self.stream.write(fs % msg.encode(self.stream.encoding)) else: self.stream.write(fs % msg) Does this work in your scenario? Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: Unusual Exception Behaviour

2008-07-20 Thread Vinay Sajip
rom func2 2008-07-20 14:47:05,625 logconftest.py 26 ERROR9. Problem in func1 Traceback (most recent call last): File "C:\Temp\logconftest.py", line 24, in f() File "C:\Temp\logconftest.py", line 11, in func1 raise Exception("Exception from func1") Exception: Exception from func1 -- end of sqlalchemy.log which is, from a quick scan, the expected result - all the expected exceptions are thrown. Note the absence of any handlers on the root logger. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: Unusual Exception Behaviour

2008-07-18 Thread Vinay Sajip
ging configuration functionality provided by fileConfig is all- or-nothing, i.e. it does not support incremental configuration. Do you know if any libraries you depend on use fileConfig? If you use programmatic configuration only, and don't use fileConfig at all, does everything wo

Re: Logging to different addressees

2008-07-16 Thread Vinay Sajip
> the answers from you personally ;-) > > Hope not to bother. > Use the propagate flag, which is mentioned in the documentation. In fact, please make sure you've reviewed all the documentation before posting, as the documentation is intended to answer the more straightforward

Re: How to package a logging.config file?

2008-07-15 Thread Vinay Sajip
On Jul 15, 3:04 pm, Matthew Wilson <[EMAIL PROTECTED]> wrote: > On Mon 14 Jul 2008 09:25:19 AM EDT, Vinay Sajip wrote: > > > Is your package a library or an application? If it's a library, you > > should avoid configuringloggingusing a config file - this is becau

Re: Logging to different addressees

2008-07-15 Thread Vinay Sajip
. This message appears in both admin sink and addressee sink. -- addressee.log -- This message appears in both admin sink and addressee sink. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: Logging in __del__()

2008-07-15 Thread Vinay Sajip
ng with a cycle detector, but the detector's behaviour is different if there are finalizers (__del__) - see http://www.python.org/doc/ext/refcounts.html Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: Logging to different addressees

2008-07-15 Thread Vinay Sajip
in sink. Add a handler to certain_logger to send to the addressee sink. If you added the admin sink handler to the root logger, you're done. Otherwise, you need to ensure that certain_logger is a child of common_logger. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: logging via SocketHandler and TCPserver

2008-07-15 Thread Vinay Sajip
and find them lacking examples, please provide more detail about the kind of examples you think are missing. And I can't speak for Twisted, but it does a lot more than logging - and I don't think there's enough complexity in Python logging to warrant a paid-for book. (No doubt people will tell me if they disagree!) Best regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: logging via SocketHandler and TCPserver

2008-07-14 Thread Vinay Sajip
On Jul 13, 9:25 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > Every time I look at theloggingmodule (up until now) I've given up and > continue to use my home-grown logger that I've been using for years. I'm not > giving up this time ;-) > > I find that I REALLY need to be able to monitor LOTS of

Re: How to package a logging.config file?

2008-07-14 Thread Vinay Sajip
If it's a library, you should avoid configuring logging using a config file - this is because logging configuration is process-wide, and if multiple libraries use fileConfig to configure their logging, you may get unexpected results. If it's an application, then Larry's advice is good. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: Custom log handler and logging.config.fileConfig()

2008-05-29 Thread Vinay Sajip
0, backupCount=3) > > # Register handler in the "logging.handlers" > namespacelogging.handlers.MySpecialHandler = MySpecialHandler > > # -- app.py --- > importlogging.handlers,logging.config > import myhandler > > logging.config.fileConfig("logging.ini") > ... Doing it the way you suggest should be fine. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: Custom log handler and logging.config.fileConfig()

2008-05-29 Thread Vinay Sajip
On May 28, 9:53 pm, "Lowell Alleman" <[EMAIL PROTECTED]> wrote: > Here is the situation: I wrote my own log handler class (derived > fromlogging.Handler) and I want to be able to use it from aloggingconfig > file, that is, a config file loaded with thelogging.config.fileConfig() > function. > >

Re: Logging ancestors ignored if config changes?

2008-04-26 Thread Vinay Sajip
approaches would be to defer creation of the loggers programmatically until after the configuration call, or else to name them explicitly in the configuration. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: Choosing log file destination in logging configuration file

2008-04-23 Thread Vinay Sajip
name, "args") > args = eval(args, vars(logging)) > h = apply(klass, args) > > Bah. I'll have to split them into two configuration files (or subclass > and have the respective file and rotating handlers lazy evaluate until > the actual log call is made). > Thanks though. Not sure if it's any help - the SVN version contains a new optional "delay" parameter for FileHandler and subclasses (including the rotating handlers) which delays opening the file until there's a need to, i.e. when an emit() call occurs. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: subprocess.Popen() output to logging.StreamHandler()

2008-04-10 Thread Vinay Sajip
ay 4096 2008-04-07 00:19 .wapi INFO:root:-rw--- 1 vinay vinay 121 2008-04-10 00:33 .Xauthority INFO:root:-rw-r--r-- 1 vinay vinay 146 2008-04-09 21:33 .xscreensaver-getimage.cache INFO:root:-rw-r--r-- 1 vinay vinay 5102 2008-04-10 17:31 .xsession- errors You should be able to adapt this t

Re: Python logging: Retrieving the last log record from a handler

2008-03-04 Thread Vinay Sajip
pare to be surprised ;-) Except for the MemoryHandler, which is designed specifically as a buffer for logging events, the handlers in the logging package do not store the last record they processed. (Neither do loggers, filters or formatters, all of which get to see records as they are processed.) Best r

Re: examples of logger using smtp

2008-01-18 Thread Vinay Sajip
nal argument ((user, password) tuple, defaulting to None) has been added. So if you are using Rob Wolfe's approach, it may be easier for you to use "credentials" because your code will not need to change when Python 2.6 appears. Best regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: handlers.SocketHandler and exceptions

2008-01-17 Thread Vinay Sajip
On Jan 17, 5:50 pm, writeson <[EMAIL PROTECTED]> wrote: > Vinay, > > Thanks for your reply, very interesting. We're currently running > Python2.3 (though we are getting ready to move to Python2.5), so I'm > guessing the code you're showing comes from Python2.5? I'm wondering > if I can edit the han

Re: handlers.SocketHandler and exceptions

2008-01-17 Thread Vinay Sajip
the socket. """ ei = record.exc_info if ei: dummy = self.format(record) # just to get traceback text into record.exc_text record.exc_info = None # to avoid Unpickleable error s = cPickle.dumps(record.__dict__, 1) if e

Re: problem with logging exceptions with non-ASCII __str__ result

2008-01-14 Thread Vinay Sajip
be made to work > reliably on other users machines. > > One could, of course, write code to specifically check for > this condition and manually pre-convert the message string > to unicode but that seems not as things should be. > > How can I cleanly handle this situation ? > > Should theloggingmodule internally use an encoding gotten > from the locale module rather than the default string encoding ? > > Karsten > -- > GPG key ID E4071346 @ wwwkeys.pgp.net > E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346 Please reduce to a minimal program which demonstrates the issue and log an issue on bugs.python.org. Best regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: Passing contextual information when logging

2008-01-08 Thread Vinay Sajip
On 8 Jan, 09:46, Antoine Pitrou <[EMAIL PROTECTED]> wrote: > One question : why does the exception() method call Logger.error() rather than > Logger.exception() ? exception() is a convenience method which adds the keyword argument exc_info=1 to append traceback information to the log. Both excepti

Passing contextual information when logging

2008-01-08 Thread Vinay Sajip
, of course, garbage collected in the normal way and so impose no particular memory burden. Best regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: logging.py: mutiple system users writing to same file getting permission errors.

2007-12-11 Thread Vinay Sajip
On Dec 10, 8:34 pm, evenrik <[EMAIL PROTECTED]> wrote: > On Dec 7, 12:46 pm, Vinay Sajip <[EMAIL PROTECTED]> wrote: > > > > > On Dec 6, 6:35 pm, evenrik <[EMAIL PROTECTED]> wrote: > > > > An a redhat box I have root, apache and other normal users ru

Re: logging.py: mutiple system users writing to same file getting permission errors.

2007-12-07 Thread Vinay Sajip
f your choosing which has the appropriate permissions to write to the log file. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: logging and propagation

2007-11-22 Thread Vinay Sajip
On Nov 22, 2:34 pm, Vinay Sajip <[EMAIL PROTECTED]> wrote: > On Nov 22, 9:18 am, oj <[EMAIL PROTECTED]> wrote: > > Why not apply the same filter to the parent loggers? Of course, you can apply filters at the loggers or the handlers. The filters at the logger are checked firs

Re: logging and propagation

2007-11-22 Thread Vinay Sajip
On Nov 22, 9:18 am, oj <[EMAIL PROTECTED]> wrote: > On Nov 22, 5:44 am, Vinay Sajip <[EMAIL PROTECTED]> wrote: > > > > > On Nov 21, 11:38 am, oj <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > I want to setuploggingwith two loggers: > &

Re: logging and propagation

2007-11-21 Thread Vinay Sajip
On Nov 21, 11:38 am, oj <[EMAIL PROTECTED]> wrote: > Hi, > > I want to setuploggingwith two loggers: > > The child logger is used when something different needs to be done > with the log record, and the log record will propagate and be logged > by the root logger as usual. > > However, there are ce

Re: logging.SocketHandler connections

2007-11-20 Thread Vinay Sajip
On Nov 20, 1:47 pm, oj <[EMAIL PROTECTED]> wrote: > On Nov 20, 12:26 pm, Vinay Sajip <[EMAIL PROTECTED]> wrote: > > > > > Can you confirm that if you add the while loop back in, all messages > > are seen by the server? It worked for me. > > Yes, it works

Re: logging.SocketHandler connections

2007-11-20 Thread Vinay Sajip
On Nov 20, 12:08 pm, oj <[EMAIL PROTECTED]> wrote: > On Nov 19, 5:30 pm, Vinay Sajip <[EMAIL PROTECTED]> wrote: > > > > > On Nov 19, 10:27 am, oj <[EMAIL PROTECTED]> wrote: > > > > On Nov 16, 2:31 pm, Vinay Sajip <[EMAIL PROTECTED]> wrote:

Re: logging.SocketHandler connections

2007-11-19 Thread Vinay Sajip
On Nov 19, 10:27 am, oj <[EMAIL PROTECTED]> wrote: > On Nov 16, 2:31 pm, Vinay Sajip <[EMAIL PROTECTED]> wrote: > > Here is the server code. Pretty much directly copied from the example, > aside from not having the the handler loop forever, and queing the > records

Re: logging.SocketHandler connections

2007-11-16 Thread Vinay Sajip
this a bug? Not sure yet - can you please post your test server code? Feel free to add it as a bug on bugs.python.org, with the code attached, and I'll look into it. Include "logging" in the subject/summary line. Thanks, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: python logging config file doesn't allow filters?

2007-10-29 Thread Vinay Sajip
figuration file format, and no plans to include them in the near future (your post is the first time configuring filters has been mentioned). However, if you would like to submit a patch, I'll certainly take a look at it! Best regards, Vinay sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: Write by logging.FileHandler to one file by many processess

2007-10-23 Thread Vinay Sajip
tHandler and a separate > listening process. The Python logging docs even contain a working example of such a listening process (receiver): http://www.python.org/doc/current/lib/network-logging.html Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: logging module - restricted mode error

2007-10-21 Thread Vinay Sajip
On 21 Oct, 07:50, Paul Rudin <[EMAIL PROTECTED]> wrote: > > Can you say a little bit more about the execution environment? For > > example, are you running under mod_python? If so, which version? > > I'm not running under mod_python - but this is using cherrypy. I also > do some passing of pickled

Re: logging module - restricted mode error

2007-10-20 Thread Vinay Sajip
or example, are you running under mod_python? If so, which version? When googling, did you search for the exact text of the error message? For example, did you see the following post? http://mail-archives.apache.org/mod_mbox/httpd-python-dev/200404.mbox/[EMAIL PROTECTED] Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: python logging module and custom handler specified in config file

2007-10-19 Thread Vinay Sajip
On 19 Oct, 12:04, Frank Aune <[EMAIL PROTECTED]> wrote: > On Thursday 18 October 2007 19:26:59 Vinay Sajip wrote: > > What if you want to datestamp filenames for filehandlers, say with todays date > for example? > > [handler_file] > class=FileHandler > level=NO

Re: python logging module and custom handler specified in config file

2007-10-18 Thread Vinay Sajip
lers = customhandlers # Bind your module to "custhandlers" in logging and then your logging configuration can refer to "custhandlers.DBHandler". Of course I merely used "custhandlers" and "customhandlers" to show how you can bind to an arbitrary name. The same technique applies to the arguments passed to the constructor. Hope this helps, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Version 0.3.7 of the config module has been released

2007-10-05 Thread Vinay Sajip
ves The above example just scratches the surface. There's more information about this module available at http://www.red-dove.com/python_config.html Comprehensive API documentation is available at http://www.red-dove.com/config/index.html As always, your feedback is most welcome (especially

Re: Overriding Logging Config FileHandler Filename

2007-09-25 Thread Vinay Sajip
o, remove one from the logger and add the other. I see you are using a rotating handler, which itself does rollover to new log files every so often. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: strange behavious of the logging module?

2007-09-25 Thread Vinay Sajip
On 25 Sep, 09:40, Peter Otten <[EMAIL PROTECTED]> wrote: > You could try setting > > logging._srcfile =logging.info.func_code.co_filename > > manually, but that might break other things. Or you recreate the pyc-files > of your distribution. Again, I don't know what might break... > Recreating .pyc

Re: strange behavious of the logging module?

2007-09-24 Thread Vinay Sajip
On Sep 24, 4:29 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > Vinay Sajip wrote: > > On Sep 24, 8:03 am, Peter Otten <[EMAIL PROTECTED]> wrote: > > >> It would still be a good idea to file a bug report. > > > Not sure where the bug is. The script below, wh

Re: strange behavious of the logging module?

2007-09-24 Thread Vinay Sajip
On Sep 24, 8:03 am, Peter Otten <[EMAIL PROTECTED]> wrote: > > It would still be a good idea to file a bug report. Not sure where the bug is. The script below, when called, prints "Information" to the console and "INFO some_func Information" to mc_rigid.log, as I would expect. (Python 2.5.1)

<    1   2   3   4   >