This is a question that I hear all the time. As an administrator, I write to a file, but I don’t write to log files. I write to the database, and I write to the console. I see this as a problem. I see it as a waste of space. I see it as a cost of doing our job. This is not to say that it can’t be done, but it can be done better.
It’s not just the amount of logging that you want to write, it’s how you do it. There is no “best” way to log to your database. It’s a question of how much logging you’re willing to accept. The answer is to write to your database using sqlalchemy instead of plain python logging.
We don’t see it as a waste of space, because logging doesn’t write to a file. Logging can (and should) be done from within the logger, but what you’re really doing is logging all at the same time.
SQLAlchemy makes it possible to create a database from a python class, which means you get to write to a database as if you were writing to a file. As a general rule, when making any kind of database change, it always pays to use the database directly from the database interface, but when writing data to your database the python interface is usually better.
The Python programming language (more specifically the logging module) is really powerful. You can easily set up your own logger that will be able to write to a file or database, and then it can also read from those files and databases. Having a logger that writes to a file is a great way to make sure you always have consistent data across all your log files. This would also make debugging your code much easier.
This is the second time I’ve been in the game, and I’ve been using Python for a couple of weeks. I was able to put my laptop in the middle of a meeting and start reading a bunch of files with different names. It was a real pleasure working with the Python debugger.
And if that wasn’t enough, python logging can also log the output of a function to a file, so your logger can write to an output file by default.
Ive just been reading the python logging documentation and I dont fully understand everything it says. But this makes me think that logging might actually be better than writing to a log file, because it doesn’t impact performance by writing to disk.
I think its a matter of how often you want to write to the log file. When you want to record the output of a function and want to log it, you can log it to a file in the usual way. But if you log everything to a log file, you can have more than one file in the same directory which can then be read by other programs.
It may be a matter of your logs being written to a file that is too huge for your system to handle, plus your system is probably slow anyway. If you want to record the output of a function and want to log it, you can log it to a file in the usual way. But if you log everything to a log file, you can have more than one file in the same directory which can then be read by other programs.