We have a strange problem with our application logs getting written to a shared file storage in Azure. We write some deserialiszed object into a file using common-logging and log4j2 2.17.
The logs in shared drive sometime write few lines with NUL character and actual log lines are lost.
To check whether its shared drive issue, we started writing same log to another file within VM storage and logs in this VM file appear normal.
Log in shared drive appears like in notepad++ {correct log entry} NULNULNULUNULNULNUL {correct log entry}
The code to write logs is as following
` public class MyCustomLogger { private static Log LOGGER = LogFactory.getLog(MyCustomLogger.class);
public void logEvent(EventObject event) {
String result = null;
try {
result = ms_jsonObjectMapper.writeValueAsString(event);
} catch (Exception e) {
logger.myError("Error while serialising record" + event);
e.printStackTrace();
}
LOGGER.trace(result);
}
}`
I tried to see if there is connectivity issue in file share but Azure portal shows 100% availability and less success E2E latency. Tried to reproduce locally by reading same log file from few threads and one thread updating it.
I am expecting some pointers. What could be wrong here. Is it application issue or Infra or network issue?