Registration and Debugging

Background: I inherited a web application designed to create on-the-fly connections between local and remote equipment. Recently, a huge number of moving parts have appeared: the application itself has changed a lot; development tools have just been updated; and both local and remote equipment have been “modified” to support these changes.

The bright side is that it has a reasonable logging system that will write debugging messages to a file and will be logged both in the file and in real time. I have the opportunity to rework the entire logging / debugging mechanism.

<strong> Examples:

  • All messages are time stamped and have a severity level prefix.
  • Magazines for the client. They record system responses to his / her requests.
  • Any journal that identifies a problem also offers a solution.
  • Debugs are intended for developers and technical support. They show the internal system of the system.
  • Debugs indicate the function and / or string that generated them.
  • The client can adjust the debugging level on the fly to establish verbosity.

Question: What are the best practices you have used as a developer or seen as a consumer that generate useful logs and debugs?


Edit: Many useful suggestions for now, thanks! To clarify: I'm more interested in what to register: content, format, etc. - and the reasons for this - than specific tools.

, , ?

!

+5
6

, , - "1 ", , , .

, .

(log4net, log4java, log4++)

, . , .

+6

, , , , , grep through, .

, , :

  • → , timestamped, ( )
  • → -, , .
  • / → , , , , / , , ..

, - / , grep -A 50 -B 50 'timestamp' tracing_file, .

EDIT: , , python, . - , . , , , .. 1 - , 2 - , 4 - , 7 3 ..

+6

, . , . , . , ...

Coding Horror guy , .

, , . . , , , . : , , .

, , :

  • ( log4)
  • , - .
  • , . , .

. , hudge, ( )...

+5

, , . / , 1-5, , ,

  1. : ,
  2. : ..
  3. : , ..
  4. :
  5. :

, " ".

+3

, :

  • requestID - (HTTP) , . , , , java- Mapped Diagnostic Context (MDC).
  • objectID. / - , . , - " ?" grep objectID , . () MDC.
  • , ? - , , /. , , , -, .

Java, API Java.

API

Simple Facging Facade Java (SLF4J) - , :

  • : (, commons-logging); .
  • Java (, log4j)
  • , API (log4j, commons-logging) SLF4J

SLF4J - logback - , API SLF4J.

+3

Use an existing logging format, such as that used by Apache, and then you can combine many of the tools available to analyze the format.

0
source

All Articles