question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

LogstashSocketAppender prefix example incorrect

See original GitHub issue

I have tried using the example given in the README with my SpringBoot (1.3.2) app

<configuration>
  <conversionRule conversionWord="syslogStart" converterClass="ch.qos.logback.classic.pattern.SyslogStartConverter"/>

  <appender name="stash" class="net.logstash.logback.appender.LogstashSocketAppender">
    <host>127.0.0.1</host>
    <port>514</port>
    <prefix class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
      <layout class="ch.qos.logback.classic.PatternLayout">
        <pattern>%syslogStart{LOCAL5}</pattern>
      </layout>
    </prefix>
  </appender>

  ...
</configuration>

but this results in an error

Application startup failed
java.lang.IllegalStateException: Logback configuration error detected: 
ERROR in ch.qos.logback.core.joran.util.PropertySetter@10d307f1 - A "ch.qos.logback.core.encoder.LayoutWrappingEncoder" object is not assignable to a "ch.qos.logback.core.Layout" variable.
ERROR in ch.qos.logback.core.joran.util.PropertySetter@10d307f1 - The class "ch.qos.logback.core.Layout" was loaded by 
ERROR in ch.qos.logback.core.joran.util.PropertySetter@10d307f1 - [sun.misc.Launcher$AppClassLoader@73d16e93] whereas object of type 
ERROR in ch.qos.logback.core.joran.util.PropertySetter@10d307f1 - "ch.qos.logback.core.encoder.LayoutWrappingEncoder" was loaded by [sun.misc.Launcher$AppClassLoader@73d16e93].

but if I remove the wrapping LayoutWrappingEncoder the code works.

  <appender name="JSON_SYSLOG" class="net.logstash.logback.appender.LogstashSocketAppender">
    <host>127.0.0.1</host>
    <port>514</port>
    <prefix class="ch.qos.logback.classic.PatternLayout">
       <pattern>%syslogStart{LOCAL5}</pattern>
    </prefix>
  </appender>

so I assume this example is incorrect.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

3reactions
philsttrcommented, Nov 10, 2018

Hi @onema,

Unfortunately, you’re running into a backwards incompatibility introduced in logback (LOGBACK-1326), as mentioned in logstash-logback-encoder #232.

I have submitted logback PR#383 to address this problem, but it has not gotten any attention in over a year (ping @ceki).

Please help out by voting for LOGBACK-1326 and adding a thumbs up to PR#383 to try to get this addressed in logback.

In the meantime, the only solution to get this working would be to downgrade logback-classic and logback-core to 1.2.0 (before the backwards incompatibility was introduced)

0reactions
linzhou-zhongcommented, Jun 11, 2019

As @philsttr said, going to downgrade the version of logback-classic and logback-core to 1.2.0 is an excellent but unique solution at this moment. Trying to verify if these two dependencies have been added in the pom.xml is also important. Anyway, thanks for @philsttr . 💪

Read more comments on GitHub >

github_iconTop Results From Across the Web

LogstashSocketAppender prefix example incorrect · Issue #158
I have tried using the example given in the README with my SpringBoot (1.3.2) app. ... LogstashSocketAppender prefix example incorrect #158.
Read more >
logback logstash encoder Syslog header not set
After a lot of head scratching it looks like it's an issue with the wrapping LayoutWrappingEncoder part of the example.
Read more >
Incorrect Prefixes and Suffixes - Nool - Ontario Tech University
Incorrect: The other team is so strong that our team is at an unadvantage. Correct: The other team is so strong that our...
Read more >
WORD PARTS: MOST COMMONLY USED PREFIXES
WORD PARTS: MOST COMMONLY USED PREFIXES. PREFIX. MEANING. EXAMPLE a (or ab) without or not amoral, abnormal ab away, from abhor, absent.
Read more >
Prefixes for English Language Learners - Yuba College
by part of speech, prefixes can attach to almost any word (for example, you'll see co- listed below as a prefix for verbs,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found