0

We are facing a recurring issue where log4j log file is getting written some binary information which turns it into a binary file.

I found similar question on stackoverflow , but I didn't find the answer conclusive.

Is it possible to turn off the gc logs and get rid of this issue?

Thanks

  • 1
    GC logs don't usually go into the log4j file, unless somehow explicitly configured for that and they tend to not be binary (possibly wrong encoding, but that's not quite the same thing). Can you give an example of what the faulty data looks like (maybe a hexdump if it's pure unreadable gibberish)? Also: how reliably can you reproduce this issue? – Joachim Sauer Jun 07 '21 at 06:46
  • It's like this '^@^@^@^@^@'. It's only on the first line. I don't know how to reproduce this issue. – Hrushikesh Salunkhe Jun 07 '21 at 06:59
  • 2
    `^@` is often used to represent a NUL-byte (ASCII 0 or Unicode U+0000). That can indicate either a file system problem, or some other reason why an unfilled buffer was written to the file. Does the "real" content start normally after those characters or is the beginning of the file overwritten with that? I.e. is the first character after this a valid start of a new log line? – Joachim Sauer Jun 07 '21 at 07:32
  • First line is overwritten it seems. – Hrushikesh Salunkhe Jun 07 '21 at 07:43
  • @HrushikeshSalunkhe are you sure JVM is writing GC logs to that file? are you logging GC to the same file where log4j is also writing? this can be easily found by inspecting value of -Xloggc or -Xlog flag that you are using to start JVM. If you are not seeing any of them, then GC logging is not your problem. – suv3ndu Jun 14 '21 at 18:48

0 Answers0