Logs are used to record events. Therefore, the log content should include:
Event Date and Time:
Precision: Millisecond (the most common time unit in Java), microsecond (commonly used time units in other languages such as PHP), and nanoseconds;
Type: datetime, double, long ,,,
Event subject
Type: String
Event object
Type: String
Event Description
Type: String
Event Type
Type: int, String ,,,
Event level:
Type: int, string
IP address or name of the Log Data source:
Type: IP, string
Summary: int, long, double, String, IP, datetime
If you consider extreme values, you should
An integer greater than long, that is, bigint;
Supports floating-point numbers larger than double, that is, bigdecimal;
Consider the storage space.
Should support a smaller unit, byte, short
Finally, we should consider the complexity.
Use as few types as possible and as simple as possible:String, datetime, IP, Int, float ).
The maximum value does not appear normally. It can be treated as an exception! Or use string for processing.
Log System: Thoughts on field types-string, datetime, IP, Int, float)