reliable unit test logging

Vyacheslav Maslov vmaslov at swsoft.com
Wed Oct 3 10:37:57 EDT 2007


Ben Finney wrote:
> Vyacheslav Maslov <vmaslov at swsoft.com> writes:
> 
>> I understand your opinion
> 
> Hopefully you mean "explanation", not "opinion". I gave what appear to
> me to be facts, not opinion, about the definition of a unit test.
Yes, i meant "explanation".

I have one more question related to logging module, not unit test. I use 
FileHandler to append information to file log, in fact location of log 
file depends on some external factor and is calculated during 
initialization. Furthermore i want to use configuration file because it 
is comfortable way. So i need way to define in configuration file some 
variable which should evaluated during logging system initialization, i 
try following way:

[handler_hand02]
class=FileHandler
level=NOTSET
formatter=form01
args=(logFileDir+"myfile.log","a",)
logFileDir is defined in scope of module which call 
logging.config.fileConfig()

and it produces "name 'logFileDir' is not defined" exception. As i 
understand this happens because inside logging module variable 
logFileDir is not visible. How i can avoid this?

Thanks!



-- 



More information about the Python-list mailing list