logging - Is it good or bad to store log messages in a database table, rather than a file? -
i'm talking human-readable text logging, error messages web application.
do people commonly store these in database? there advantages using database table instead of file? or if not, why bad idea?
database
advantages:
- way easier search through logs
- clever queries, grouping , limiting example dates
- retrieving log messages of specific kind, log level or containing patterns
- filtering away unwanted noise when looking specific things
- easier manage in way if you're creating kind of user interface
some disadvantages:
- pollutes database stuff might not useful, depending on application
- can aid in far quicker database growth, might annoying in scenarios
- you need access database (which might require paper work or takes time), or write ui on top
text files
major advantages
- very easy, light weight, simple implement
- easy clean away when not needed anymore; no longer wasting disk space
disadvantages
- hard browse , query (depends on logging statements, file structures etc)
there's nothing inherently right or wrong logging database versus logging file; depends on needs. think through needs, decide. logging database convenient when debugging, might require more of you, team or application in long run.
Comments
Post a Comment