# Configure Wrapper Log for single-line messages

**URL:** <https://forum.inductiveautomation.com/t/configure-wrapper-log-for-single-line-messages/46198>\
**Category:** Ignition\
**Created:** [April 30, 2021, 1:22pm UTC](https://forum.inductiveautomation.com/t/configure-wrapper-log-for-single-line-messages/46198 "2021-04-30T13:22:52Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![joshua.rowlison](https://avatars.discourse-cdn.com/v4/letter/j/258eb7/32.png) [@joshua.rowlison](https://forum.inductiveautomation.com/u/joshua.rowlison)\
**Post date:** [March 16, 2022, 12:19pm UTC](https://forum.inductiveautomation.com/t/configure-wrapper-log-for-single-line-messages/46198/21 "2022-03-16T12:19:17Z")

</div>

Just because I noticed this thread got referenced and it jogged my memory  
We ended up using the below for our appender and after getting CirrusLink to fix a bug in the logs on a module, we saw great success getting the useful lines of a stack trace. Note that because we’re digesting the logs in another system and because we’ve gone _rounds_ with the log formatting above, we’ve got start, section and end markers in the pattern to make it obvious which part of the template is or is not responsible for each part.

It’s important to note that you can adjust the logging for modules that are too noisy in the Logs settings on the gateway itself and it _does_ make changes to the volume coming through logback. This ended up being our ultimate way to get a handle on anything that we find generating too much volume. This makes it less critical if a given log type has bad interactions with logback.

```auto
 <appender name="SysoutAppender" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
     <pattern>%p |M: %m |S: %replace(%ex{short}){'[\r\n]+', ''}%nopex | END %n</pattern>

    </encoder>
  </appender>

```

---

<div class="post-metadata">

**Author:** ![bfuson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bfuson/32/4597_2.png) [@bfuson](https://forum.inductiveautomation.com/u/bfuson)\
**Post date:** [September 8, 2023, 8:48pm UTC](https://forum.inductiveautomation.com/t/configure-wrapper-log-for-single-line-messages/46198/22 "2023-09-08T20:48:35Z")

</div>

This thread was a big help to me in understanding the layers involved in Ignition logging. I was able to get external logging working with our centralized Seq logging server using GELF.

All I needed was an Seq GELF plugin and a Logback GELF appender:

- Install the Seq plugin [Seq.Input.Gelf](https://www.nuget.org/packages/Seq.Input.Gelf)
- Place the jar for the [Logback GELF appender](https://github.com/osiegmar/logback-gelf) into `C:\Program Files\Inductive Automation\Ignition\lib\core\common` on my gateway server.
- Configure the appender in `logback.xml`:

```auto
...
  <appender name="SeqGelfInput" class="de.siegmar.logbackgelf.GelfUdpAppender">
    <graylogHost>1.2.3.4</graylogHost>
    <graylogPort>12201</graylogPort>
  </appender>
  <root level="WARN">
    <appender-ref ref="SeqGelfInput" />
  </root>
...

```

- Restart Ignition and peep those nice, structured logs (with stack traces!)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/9/797b544371396ca6719b5a6d686b24cbbfc50a3a.png)

We'll also be using Seq to send SMTP email notifications whenever any of our gateways throw errors.

---

<div class="post-metadata">

**Author:** ![Sulivann\_BROUTIN](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sulivann_broutin/32/4450_2.png) [@Sulivann\_BROUTIN](https://forum.inductiveautomation.com/u/Sulivann_BROUTIN)\
**Post date:** [November 3, 2023, 10:36am UTC](https://forum.inductiveautomation.com/t/configure-wrapper-log-for-single-line-messages/46198/23 "2023-11-03T10:36:54Z")

</div>

Thank you very much for the detailled answers. It helped a lot and it is working like a charm.  
On the top of this, I would like to set an additionnal syslogAppender that would only log DEBUG level message from a specific logger (in that case ignition.UserSourceManager.Wrapper). The idea is to save loggin attemps (success and failures) to syslog.  
My guess is to use the Filter setting for that but I cannot find how to (it seems that one can filter on the message content but not on the logger).  
Has anyone an idea that could help me on this point ?  
Thanks.

---

<div class="post-metadata">

**Author:** ![kcollins](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kcollins/32/19646_2.png) [@kcollins](https://forum.inductiveautomation.com/u/kcollins)\
**Post date:** [November 3, 2023, 5:22pm UTC](https://forum.inductiveautomation.com/t/configure-wrapper-log-for-single-line-messages/46198/24 "2023-11-03T17:22:26Z")

</div>

Here is a supplement to `logback.xml` to [include](https://logback.qos.ch/manual/configuration.html#fileInclusion) a separate configuration file (that will contain our additions):

```xml
  ...
  <!-- Add this to your `data/logback.xml` file -->
  <include file="data/logback-custom.xml" />
</configuration>

```

And then, in `data/logback-custom.xml` place the following contents:

```xml
<included>
  <appender name="GatewayAuth" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>logs/gateway-auth.log</file>
    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
      <!-- Rollover each day and keep 30 days history -->
      <fileNamePattern>logs/gateway-auth.%d{yyyy-MM-dd}.log</fileNamePattern>
      <maxHistory>30</maxHistory>
    </rollingPolicy>
    <encoder>
      <pattern>%date{ISO8601} [%-30c{1}] [%-5p]: %m %X%n</pattern>
    </encoder>
  </appender>
  <logger name="gateway.AuthenticationRoutes" level="DEBUG" additivity="false">
    <appender-ref ref="GatewayAuth"/>
  </logger>
  <logger name="ignition.UserSourceManager.Wrapper" level="DEBUG" additivity="false">
    <appender-ref ref="GatewayAuth"/>
  </logger>
  <logger name="UserSource.Internal" level="INFO">
    <appender-ref ref="GatewayAuth"/>
  </logger>
</included>

```

The example above uses a [RollingFileAppender](https://logback.qos.ch/manual/configuration.html#fileInclusion), but you can substitute what you like here. Note the [`additivity`](https://logback.qos.ch/manual/configuration.html#overridingCumulativity) setting (which defaults to `true` when omitted) on the supplemental loggers that we use to force these specific loggers to _only_ be applied to our specified appender (instead of also to the root, which we let happen for `UserSource.Internal` at `INFO` level).

---

<div class="post-metadata">

**Author:** ![Sulivann\_BROUTIN](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sulivann_broutin/32/4450_2.png) [@Sulivann\_BROUTIN](https://forum.inductiveautomation.com/u/Sulivann_BROUTIN)\
**Post date:** [November 6, 2023, 5:00pm UTC](https://forum.inductiveautomation.com/t/configure-wrapper-log-for-single-line-messages/46198/25 "2023-11-06T17:00:13Z")

</div>

Thank you very much for the cristal clear reply.

[Previous page](https://forum.inductiveautomation.com/t/configure-wrapper-log-for-single-line-messages/46198.md?page=1)
