Re: When is logging.getLogger(__name__) needed?

2023-04-05 Thread dn via Python-list
gparser.ConfigParser() if args.config_file is None: config_file = DEFAULT_CONFIG_FILE else: config_file = args.config_file config.read(config_file) logging.config.fileConfig(fname=config_file) logger = logging.getLogger(__name__)

Re: When is logging.getLogger(__name__) needed?

2023-04-05 Thread Loris Bennett
config_file = args.config_file >>>config.read(config_file) >>>logging.config.fileConfig(fname=config_file) >>>logger = logging.getLogger(__name__) >>>do_some_stuff() >>> my_class_instance = myprog.My

Re: When is logging.getLogger(__name__) needed?

2023-04-05 Thread Loris Bennett
args = parser.parse_args() >>config = configparser.ConfigParser() >>if args.config_file is None: >>config_file = DEFAULT_CONFIG_FILE >>else: >>config_file = args.config_file >>config.read(config_file) >>

Re: When is logging.getLogger(__name__) needed?

2023-04-04 Thread Loris Bennett
Peter Otten <__pete...@web.de> writes: > On 31/03/2023 15:01, Loris Bennett wrote: [snip (53 lines)] > Your problem has nothing to do with logging -- it's about visibility > ("scope") of names: > def use_name(): > print(name) > > def define_name(): > name = "Loris" > >

Re: When is logging.getLogger(__name__) needed?

2023-03-31 Thread dn via Python-list
nfigParser() if args.config_file is None: config_file = DEFAULT_CONFIG_FILE else: config_file = args.config_file config.read(config_file) logging.config.fileConfig(fname=config_file) logger = logging.getLogger(__name__) do_some_stuff() my_clas

Re: When is logging.getLogger(__name__) needed?

2023-03-31 Thread Peter Otten
nfigParser() if args.config_file is None: config_file = DEFAULT_CONFIG_FILE else: config_file = args.config_file config.read(config_file) logging.config.fileConfig(fname=config_file) logger = logging.getLogger(__name__) do_some_stuff() my_clas

When is logging.getLogger(__name__) needed?

2023-03-31 Thread Loris Bennett
onfig_file = DEFAULT_CONFIG_FILE else: config_file = args.config_file config.read(config_file) logging.config.fileConfig(fname=config_file) logger = logging.getLogger(__name__) do_some_stuff() my_class_instance = myprog.MyClass() def do_

Re: logging.getLogger( __name__ )

2011-12-29 Thread Ben Finney
Ram mobilebacku...@gmail.com writes: How does this line work? What line? Please present some code in an example that we can run. Make the example as small as possible so it's clear what you are asking about. -- \ “See, in my line of work you gotta keep repeating things over | `\

logging.getLogger( __name__ )

2011-12-28 Thread Ram
How does this line work? How do I get my logger to point to a file to be named as /tmp/modulename.log : I can do this using inspect, but there probably is a better way? Thanks, --Ram -- http://mail.python.org/mailman/listinfo/python-list

logging = logging.getLogger(__name__)

2010-06-15 Thread genkuro
Newbie here. I may be missing something obvious, in which case, please feel free to berate and laugh at me. Here's a dubious line of code: logging = logging.getLogger(__name__) How can I refer to the original logging package logging after this statement is run? Specifically, I'm trying to add

Re: logging = logging.getLogger(__name__)

2010-06-15 Thread Mark Lawrence
On 15/06/2010 16:35, genkuro wrote: Newbie here. I may be missing something obvious, in which case, please feel free to berate and laugh at me. Here's a dubious line of code: logging = logging.getLogger(__name__) How can I refer to the original logging package logging after this statement

Re: logging = logging.getLogger(__name__)

2010-06-15 Thread Peter Otten
genkuro wrote: Newbie here. I may be missing something obvious, in which case, please feel free to berate and laugh at me. Here's a dubious line of code: logging = logging.getLogger(__name__) Dubious indeed. As a workaround you can import the module again, preferably under another name

Re: logging = logging.getLogger(__name__)

2010-06-15 Thread Paul Rudin
Peter Otten __pete...@web.de writes: genkuro wrote: Newbie here. I may be missing something obvious, in which case, please feel free to berate and laugh at me. Here's a dubious line of code: logging = logging.getLogger(__name__) Dubious indeed. As a workaround you can import the module

Re: logging = logging.getLogger(__name__)

2010-06-15 Thread genkuro
On Jun 15, 8:49 am, Mark Lawrence breamore...@yahoo.co.uk wrote: On 15/06/2010 16:35, genkuro wrote: Newbie here.  I may be missing something obvious, in which case, please feel free to berate and laugh at me. Here's a dubious line of code: logging = logging.getLogger(__name__) How

Re: logging = logging.getLogger(__name__)

2010-06-15 Thread Dave Angel
genkuro wrote: Newbie here. I may be missing something obvious, in which case, please feel free to berate and laugh at me. Here's a dubious line of code: logging = logging.getLogger(__name__) How can I refer to the original logging package logging after this statement is run? Specifically

Re: logging = logging.getLogger(__name__)

2010-06-15 Thread Jean-Michel Pichavant
= logging.getLogger(__name__) How can I refer to the original logging package logging after this statement is run? Specifically, I'm trying to add a log handler with logging.addHandler(x) and it is of course failing. Thanks, Brian Change it to something like logger = logging.getLogger

Re: logging = logging.getLogger(__name__)

2010-06-15 Thread Mark Lawrence
= logging.getLogger(__name__) How can I refer to the original logging package logging after this statement is run? Specifically, I'm trying to add a log handler with logging.addHandler(x) and it is of course failing. Thanks, Brian Change it to something like logger = logging.getLogger(__name__

Re: logging = logging.getLogger(__name__)

2010-06-15 Thread Stephen Hansen
On 6/15/10 9:03 AM, genkuro wrote: I'm coming to Python from Java. I'm still getting a feel for scoping limits. For the sake of curiosity, is there another way to refer to a package besides name? The only way to refer to anything is by its name -- or, from a name and through subscript/dot