472,967 Members | 1,725 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,967 software developers and data experts.

logging package log_test3.py problem

My system:
MSW XP professional
Python 2.3.3
logging package: 0.4.9.2

My problem:
The log_test3.py script, provided with the logging package distribution,
generates an unexpected message:
No handlers could be found for logger "root"

Here is the complete trace from running the log_test3.py script:

========================================

C:\projects\logging-0.4.9.2\test>log_test3.py
Traceback (most recent call last):
File "C:\Python23\Lib\site-packages\logging\config.py", line 111, in
fileConfig
h = apply(klass, args)
File "C:\Python23\Lib\site-packages\logging\handlers.py", line 559, in
__init__
self._welu.AddSourceToRegistry(appname, dllname, logtype)
File "C:\Python23\Lib\site-packages\win32\lib\win32evtlogutil.py", line
35, in AddSourceToRegistry
"SYSTEM\\CurrentControlSet\\Services\\EventLog\\%s \\%s" % (eventLogType,
appName))
error: (5, 'RegCreateKey', 'Access is denied.')
---------------------------------------------------
-- Logging to root; messages appear on console only
---------------------------------------------------
No handlers could be found for logger "root"
----------------------------------------------------------------------
-- Logging to log02; messages appear on console and in file python.log
----------------------------------------------------------------------
--------------------------------------------------------------------------
-- Logging to log02.log03; messages appear on console, in file python.log,
-- and at logrecv.py tcp (if running. <= DEBUG messages will not appear).
--------------------------------------------------------------------------
-----------------------------------------------------------------------
-- Logging to log02.log03.log04; messages appear only at logrecv.py udp
-- (if running. <= INFO messages will not appear).
-----------------------------------------------------------------------
--------------------------------------------------------------------
-- Logging to log02.log03.log04.log05.log06; messages appear at
-- logrecv.py udp (if running. < CRITICAL messages will not appear).
--------------------------------------------------------------------
-- All done.

========================================

I expect the Windows NT EventLog handler to fail since I am running under an
account that does not have Windows Registry update privileges.

However, I did not expect to see the message:

No handlers could be found for logger "root"

Also, I have not been able to get a demo script to work that uses
logging.config.fileConfig with custom handlers I have written. Is this
permissable? If so, how? Here is a sample error I'm seeing:

NameError: name 'Details_Log' is not defined
-- jv

Jul 18 '05 #1
1 3646
> I expect the Windows NT EventLog handler to fail since I am running under an
account that does not have Windows Registry update privileges.

However, I did not expect to see the message:

No handlers could be found for logger "root"
This appears to be a bug in fileConfig exception handling. I'll look
into it.
Also, I have not been able to get a demo script to work that uses
logging.config.fileConfig with custom handlers I have written. Is this
permissable? If so, how? Here is a sample error I'm seeing:

NameError: name 'Details_Log' is not defined


If your custom handler Details_Log is defined in module "mymodule"
then in the config file, name the handler as e.g.
mymodule.Details_Log. Then, do

import logging
import mymodule

logging.mymodule = mymodule

Then fileConfig() should work. The reason for all this is that
fileConfig evaluates the string "mymodule.Details_Log" in the
namespace of the logging module. By adding the "logging.mymodule =
mymodule" line, you allow logging to know about the "mymodule" module.

Best regards
Vinay Sajip
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Logan | last post by:
Is there actually a good reason why the StreamHandler and the FileHandler are in the core package and all other handlers are in logging.handlers? I first did not realize this when reading the...
0
by: Robert.Schmitt | last post by:
I found that the configuration system of the new logging package of Python 2.3 has some unintuitive idiosyncracies that are worth mentioning because they can cost you quite some development time...
3
by: Jeff Shannon | last post by:
I'm having some difficulty getting my logging configuration set correctly. I'm using a config file (copied at end of post), with the intent of setting several loggers which write to a combination...
0
by: Joe Bloggs | last post by:
Hi all, I take the pleasure to inform that Dotnet Commons Logging has been released for use. Dotnet Commons Logging, a subproject of the Donet Commons project currently located under the...
23
by: Rotem | last post by:
Hi, while working on something in my current project I have made several improvements to the logging package in Python, two of them are worth mentioning: 1. addition of a logging record field...
12
by: Eric S. Johansson | last post by:
I need to to be able to conditionally log based on the method the log statement is in and one other factor like a log level. in order to do so, I need to be able to automatically find out the name...
2
by: Vinay Sajip | last post by:
Some users of the logging package have raised an issue regarding the difficulty of passing additional contextual information when logging. For example, the developer of a networked application may...
4
by: Matthew Wilson | last post by:
I'm working on a package that uses the standard library logging module along with a .cfg file. In my code, I use logging.config.fileConfig('/home/matt/mypackage/matt.cfg') to load in the...
6
by: Thomas Heller | last post by:
I'm using the logging module in my comtypes library to log 'interesting' things that happen. In other words, the idea is if the user of the library is interested in the details that happen in the...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.