-1

What type of logging should be used in production environment?

As we know that there are many types (level) of logging can be done on any application.

if we use 1 or 2 levels of log in production then it will become huge data within seconds.

Could you please anyone let us know here what level of prod. logging is done.

Thanks for the answer in advance.

  • Depends on what information you want to *get* from production. In the past I've generally logged Error and above to an email appender to the development team and Info and above to a database. If the database is getting too much unnecessary data, move it to Warn and above. If you need to get a lot of information to debug a production issue, temporarily move it to Info and above or Debug and above. – David Jul 23 '14 at 13:51

1 Answers1

1

This is so implementation specific that it's really hard to provide a one-size-fits-all answer.

The main question is: What are the logs going to be used for?

Do you need to capture information to provide some sort of complete audit trail in case the authorities stop by? Do you just need to know when something goes wrong? If you answer those questions, you've got your answers for your logging.

Regardless of the method you use, try to be flexible. If you can switch from ERROR+ to TRACE+ without too much hassle to investigate a certain edge case which happens only on production, that can be really useful.

Also, if you're worried about the amount of data, be smart in configuring the logs to rotate and store them on a large enough network drive. Don't just have one logfile with 300MB of data for a couple of weeks of usage. Rotating on a per-day basis is already a useful step and configure based on your requirements.

Is your application part of a broad web infrastructure with requests coming from different parties? In that case, you could even log per incoming hostname or something like that.

Analyze your requirements properly and find your answers.

Davio
  • 4,609
  • 2
  • 31
  • 58