Skip to content

Unexpected empty records while -f #50

Closed

Description

@LukasJerabek

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
Screenshot from 2021-03-15 11-29-57

after quiting -f mode and starting it again
Screenshot from 2021-03-15 11-36-36

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

  1. changed the title [-]Unexpected empty records while -f json format log[/-] [+]Unexpected empty records while -f[/+] on Mar 15, 2021
  2. qiangyt commented on Mar 19, 2021

    @qiangyt
    Owner

    confirmed.

  3. added a commit that references this issue on Mar 20, 2021
  4. qiangyt commented on Mar 20, 2021

    @qiangyt
    Owner

    Fixed and included in release v1.0.2.alpha

  5. LukasJerabek commented on Mar 20, 2021

    @LukasJerabek
    Author

    Great, I really like jog and I really appreciate how quickly you respond and solve things. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ 换网址