Skip to content
This repository has been archived by the owner on Oct 18, 2022. It is now read-only.

requestLog is not being sent #19

Open
madmuffin1 opened this issue Jun 9, 2016 · 5 comments
Open

requestLog is not being sent #19

madmuffin1 opened this issue Jun 9, 2016 · 5 comments
Assignees

Comments

@madmuffin1
Copy link

madmuffin1 commented Jun 9, 2016

Hi,

I am trying to also send the requestLog to our graylog server. Unfortunately, it does not work (messages are dropped silently). The instance is created correctly but messages cause a NPE in LogbackLogEvent.getCalleeStackTraceElement:74 since the callerDataArray in LogbackLogEvent.loggingEvent.getCallerData() is null.

My entries in the config section:

server:
  type: default # must be set, otherwise requestLog cannot be configured
  requestLog:
    appenders:
      - type: console
      - type: gelf
        host: udp:my.graylog.host
        port: 12201
        additionalFields:
          environment: ${ENVIRONMENT}
          type: access

Versions: Dropwizard 0.9.2, Dropwizard-GELF 0.9.2-4

@Trundle
Copy link
Contributor

Trundle commented Jun 13, 2016

Hi,

I can confirm that there is a NPE in that case. Note that it's not because callerData is null, but rather due to loggerContext being null. I'm unsure yet whose fault that is.

Note that dropwizard-gelf comes with its own request logger (GelfLoggingFilter). To use it, add the following lines to your App#run() method:

environment.servlets()
    .addFilter("request-logs", new GelfLoggingFilter())
    .addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");

@Trundle Trundle self-assigned this Jun 13, 2016
@kevinmic
Copy link

kevinmic commented Dec 6, 2016

Debugging trying to figure out why my http requests aren't showing up in my logging server I found that the ch.qos.logback.core.AppenderBase is throwing a ClassCastException.

java.lang.ClassCastException: ch.qos.logback.access.spi.AccessEvent cannot be cast to ch.qos.logback.classic.spi.ILoggingEvent
	at biz.paluch.logging.gelf.logback.GelfLogbackAppender.append(GelfLogbackAppender.java:71)
	at ch.qos.logback.core.AppenderBase.doAppend(AppenderBase.java:82)
	at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:48)
	at ch.qos.logback.core.AsyncAppenderBase$Worker.run(AsyncAppenderBase.java:265)

So it appears that thad the RequestLog is sending an AccessEvent but the underlying logging structure can't handle that.

@joschi
Copy link
Contributor

joschi commented Dec 7, 2016

@kevinmic Which version of Dropwizard are you using?

@kevinmic
Copy link

kevinmic commented Dec 7, 2016

io.dropwizard:dropwizard-core:jar:1.0.0

@lennartkoopmann
Copy link

I'm seeing the same issue. Dropwizard v1.1.2.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants