Currently Python's logging library has the Child-Separator hard-coded in Logger.getChild() as '.'. It would be useful to have the ability to preset this via an optional basicConfig() argument like 'child_sep=' and preset it to '.' to retain the current behaviour. In my case I will need to monkey-patch the getChild() method to use a different separator ('->') because I use '.' for different purposes within the loggers' names. The current behaviour would lead to ugly and mistakable output.
This is a change with wide-ranging ramifications. I don't propose to do this, as the use of '.' as a logging separator mirrors the separator used in the Python package namespace. Logger names are supposed to indicate the "where" of a logging event - nothing more.
I am using loggers and sub-loggers (getChild()) in classes, which contain sub-classes, wich contain sub-sub-classes and so on for complex data processing. Hence I was using the logging library with sub-loggers to see in which of the (sub-)classes things happen. Most classes are, however, instanced for different configuration and are represented by strings like {instance_config}@{class_name} where {instance_config} often contains dots as separators for IDs. Example: INFO 1000@TerminalsSyncer : Aggregating customer data: 1031002@Facebook INFO 1000@TerminalsSyncer : Aggregating virtual data: v60.1031002@Config INFO 1000@TerminalsSyncer : Aggregating virtual data: v60.1031002@Presentation WARNING 1000@TerminalsSyncer->1.1000@TerminalSyncer: Terminal 1.1000 is offline However, if you still think that this is not, what the logging library is meant for, I'd appreciate to know.
> However, if you still think that this is not, what the logging library is meant for, I'd appreciate to know. Confirmed. I would advise against using logger names in this way.
title: Add child seperator keyword to logging.basicConfig and use it in Logger.getChild() -> Add child separator keyword to logging.basicConfig and use it in Logger.getChild()