Repository navigation
Description
Hi, I have problems when watching file with -f parameter. Everytime new log comes in, it is appended with extra empty record, after that line numbers does not comply with the real line numbers and makes the output disorganized.
Settings:
version v1.0.1-alpha
json format log files
custom config since time and level keys are different
input file log example:
when issuing jog -f <log_file>, the file had following record inside:
{"asctime":"2021-03-04T07:59:25+0100","levelname":"INFO","name":"some_component","filename":"some_file","message":"some_message"}
After a while I have manually added next log record on a next line:
{"asctime":"2021-03-04T08:02:46+0100","levelname":"CRITICAL","name":"other_component2","filename":"other_file2","message":"other_message2"}
Again after some time I have added the third line:
{"asctime":"2021-03-04T09:31:20+0100","levelname":"WARNING","name":"other_component","filename":"other_file","message":"other_message","exc_info":"optional_traceback"}
jog output:
while watching the file with -f mode

after quiting -f mode and starting it again

Config file
colorization: true
pattern: "${timestamp} - ${level} - ${app} - ${file}:${message}${stacktrace}${others}"
line-no:
print: true
color: FgRed
print-format: "\n%s"
unknown-line:
print: true
color: FgGray
fields:
others:
name:
color: FgYellow
separator:
label: =
color: FgDefault
value:
color: FgDefault
print-format: "\n%s"
level: # 'level' field is a hard-coded field used for level filter as well, so don't rename it
# And, it must be an enum.
print-format: "%s" # follows https://golang.org/pkg/fmt/
alias: "levelname"
case-sensitive: false
enums:
case-sensitive: false
NOTSET:
alias: notset,0
color: FgGray,OpBold
DEBUG:
alias: debug,10
color: FgGreen,OpBold
INFO:
alias: info,20,
color: FgBlue,OpBold,OpFuzzy
WARNING:
alias: warn,warning,30
color: FgYellow,OpBold
ERROR:
alias: error,err,40
color: FgMagenta,OpBold
CRITICAL:
alias: critical,50
color: FgRed,OpBold
app:
print: false
alias: "name"
case-sensitive: false
color: FgLightBlue
file:
alias: "filename"
case-sensitive: false
color: FgDefault
message:
alias: "message"
case-sensitive: false
color: FgCyan,OpItalic
print-format: "\n%s"
stacktrace:
alias: "exc_info"
case-sensitive: false
color: FgDefault
print-format: "\nStack trace: \n%s"
timestamp: # 'timestamp' field is a hard-coded field used for time range filter as well, so don't rename it
alias: "asctime"
case-sensitive: false
color: FgYellow
Activity
[-]Unexpected empty records while -f json format log[/-][+]Unexpected empty records while -f[/+]qiangyt commentedon Mar 19, 2021
confirmed.
fix issue #50: skip the tail \n
qiangyt commentedon Mar 20, 2021
Fixed and included in release v1.0.2.alpha
LukasJerabek commentedon Mar 20, 2021
Great, I really like jog and I really appreciate how quickly you respond and solve things. Thank you!