What is the right way to log to app insights?

I have been searching this for a while. Im surprised that I don’t get a clear answer to my question. I am trying to log to application insights. My app is written in java running in a docker container in AKS on azure. It is not clear to me if I have to use the app-insights agent for this situation or if I should just configure a log4j logger to log to app-insights. What is the right way to do logging for a java app in a docker container running in AKS on azure? With or without app-insights agent?

Source: Docker Questions