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

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -