logback-gelf-appender icon indicating copy to clipboard operation
logback-gelf-appender copied to clipboard

Additional fields with "comma"

Open trajano opened this issue 6 years ago • 1 comments

I would like to pass a list of the active spring profiles via additional fields, but since there's a comma it does not work correctly.

<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="true">
  <include resource="org/springframework/boot/logging/logback/base.xml"/>
  <springProperty scope="context" name="name" source="spring.application.name"/>
  <springProperty scope="context" name="profiles" source="spring.profiles.active" defaultValue="default"/>

  <appender name="gelf" class="de.appelgriepsch.logback.GelfAppender">
    <server>192.168.1.113</server>
    <includeSource>true</includeSource>
    <includeMDC>true</includeMDC>
    <includeLevelName>true</includeLevelName>
    <additionalFields>profiles=${profiles},name=${name}</additionalFields>
  </appender>
  <root>
    <appender-ref ref="gelf"/>
  </root>
</configuration>

trajano avatar Dec 20 '18 02:12 trajano

Perhaps if we had

<additionalFields>
   <field name="profiles" value="${profiles}" />
</additionalFields>

or

<additionalFields>
   <profiles>${profiles}"</profiles>
</additionalFields>

Maybe even

<additionalFields>
   <profiles processor="CSVProcessor">${profiles}"</profiles>
</additionalFields>

Which will take the value and convert it to an array sent to GELF (If that's even possible)

trajano avatar Dec 20 '18 02:12 trajano