logging - Python / How to get logger with absolute path? -
I try to use Python logging:
import logging log = Logging.getlogger (__name__) logInstall = logging.getLogger ('/ var / log / install.log') log.info ("Everything works great") logInstall.info ("Why is not the log file hidden?" )
In the log's log file, everything works and prints: "Everything works great"
but / var /log/install.log
, I do not see anything.
What do I do?
Where have you seen that the logic for logging.getLogger ()
The file path was ??? This is just a name for your logger object:
logging.getLogger ([name])
Return a logger with the specified name or, if no name was specified If returned, a logger who is the root logger of the hierarchy is specified, then the name is usually a hierarchical name different from the dot like "a", "ab" or "abcd". The selection of these names is completely dependent on the developer who is entering.
Where / how this logger logs (file, stderr, syslog, mail, network call, whatever) depends on How do you configure logging for your own app - The issue is that you can double logger (in Libs) use logger config (in the app).
Note that you have to use the __ name __
as usual so you can get a logarithm hierarchy that mimics the package / module hierarchy.
Comments
Post a Comment