Example of Log Appenders when using OpenTelemetry JavaAgent
Such example was useful for me to explore how the log appending works when using JavaAgent and how to properly configure them. I was under the impression logger xml files can be used to configure them accordingly, but this is not the case.
My final goal was to achieve ability to control from properties and env vars the Logs Sending and Level.
There is my PoC implementation https://github.com/smoke/opentelemetry-java-examples/pull/1 that allows usage of these env vars or system properties defined in log4j2.xml:
LOG_LEVELenv var orlogLevelproperty - controls the log4j2 Root (and inherited) loggers levelOTEL_X_LOG_SENDING_DISABLEDenv var orotel.x.log_sending.disabledproperty - set to "true" to fully disable theOpenTelemetryAppenderOTEL_X_LOG_SENDING_LEVELenv var orotel.x.log_sending.levelproperty - defaults to "all", set to relevant log4j2 Level (off,fatal,error,warn,info,debug,trace,all) to additionally filter what goes to Otel Collector
@jeanbisutti Thanks for your review! I have made changes to address your remarks, please re-review.