You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

For DCAE components using log4j as the logger, update the log4j.xml file CONSOLE appender layout accordingly:

<JsonLayout eventEOL="true" compact="true" stacktraceAsString="true" properties="true" propertiesAsList="true">
        <KeyValuePair key="logTimeStamp" value="$${date:yyyy-MM-dd HH:mm:ss:-null}" />
        <KeyValuePair key="logTypeName" value="$${event:Logger:-null}" />
        <KeyValuePair key="logLevel" value="$${event:Level:-null}" />
        <KeyValuePair key="traceId" value="${:-null}" />
        <KeyValuePair key="statusCode" value="${:-null}" />
        <KeyValuePair key="principalId" value="${:-vescollector}" />
        <KeyValuePair key="serviceName" value="${k8s:containerName:-vescollector}" />
        <KeyValuePair key="exception" value="$${event:Exception:-None}" />
        <KeyValuePair key="PID" value="$${sys:pid:-null}" />
 </JsonLayout>


The final block should look like:


The runtime dependencies needed in pom.xml should already be there if the project has log4j, but they can be found here – https://logging.apache.org/log4j/2.x/runtime-dependencies.html


Once the XML files are updated, you should be able to rebuild the application and see the logs reflected in STDOUT. 

  • No labels