Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No log produced when including <uuid/> #453

Closed
dcerbino opened this issue Dec 12, 2020 · 3 comments
Closed

No log produced when including <uuid/> #453

dcerbino opened this issue Dec 12, 2020 · 3 comments
Milestone

Comments

@dcerbino
Copy link

dcerbino commented Dec 12, 2020

Describe the bug
everitiing work well unless I add uuid inside providers in LoggingEventCompositeJsonEncoder

To Reproduce
Steps to reproduce the behavior:

  1. Use this
    logback-spring.xml.zip

  2. uncomment uuid line 55

  3. See unexpected output

20:40:23,722 |-INFO in ch.qos.logback.classic.joran.action.ContextNameAction - Setting logger context name as [D-C-P-T]
20:40:23,724 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
20:40:23,724 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [CONSOLE]
20:40:23,744 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.LoggingEventJsonProviders] for [providers] property
20:40:23,750 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.SequenceJsonProvider] for [sequence] property
20:40:23,751 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.LogstashVersionJsonProvider] for [version] property
20:40:23,751 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.ContextNameJsonProvider] for [contextName] property
20:40:23,763 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.LoggingEventFormattedTimestampJsonProvider] for [timestamp] property
20:40:23,765 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.LoggerNameJsonProvider] for [loggerName] property
20:40:23,766 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.LogLevelJsonProvider] for [logLevel] property
20:40:23,766 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.CallerDataJsonProvider] for [callerData] property
20:40:23,767 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.ThreadNameJsonProvider] for [threadName] property
20:40:23,767 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.MdcJsonProvider] for [mdc] property
20:40:23,768 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.ArgumentsJsonProvider] for [arguments] property
20:40:23,769 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.StackTraceJsonProvider] for [stackTrace] property
20:40:23,774 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.StackHashJsonProvider] for [stackHash] property
20:40:23,775 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.composite.loggingevent.MessageJsonProvider] for [message] property
20:40:23,803 |-WARN in Logger[org.springframework.boot.diagnostics.FailureAnalyzers] - No appenders present in context [D-C-P-T] for logger [org.springframework.boot.diagnostics.FailureAnalyzers].

Expected behavior
Normal log in json format.

  • what output did you expect
    "id": "(uuid)" on each event

Additional context
I'using Spring boot 2.4.0

  • logstash-logback-encoder 6.5
  • logback 1.2.3
  • jackson 2.11.3
  • java 11
@philsttr
Copy link
Collaborator

philsttr commented Dec 13, 2020

When I tried your configuration, the json output showed the uuid field correctly.

Ensure you have the following dependency on your classpath:

com.fasterxml.uuid:java-uuid-generator

If it still does not work for you, can you provide a simple application that reproduces the result (perhaps bootstrapped from start.spring.io)?

@dcerbino
Copy link
Author

dcerbino commented Dec 13, 2020

Thank @philsttr Now it works.
The question is why you do not declare it under your dependencies?

@philsttr
Copy link
Collaborator

Great!

It's an optional dependency since the only thing that needs it is the uuid provider, which is not used by many people. This keeps the logstash-logback-encoder dependency tree lean for users who do not use the uuid provider.

I updated the readme to mention the dependency.

@philsttr philsttr added this to the 6.6 milestone Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants