473,387 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 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 3672
> 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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.