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

Logback encoders are not working with LoggingAppender #1131

Open
Khidala opened this issue Jul 16, 2023 · 1 comment
Open

Logback encoders are not working with LoggingAppender #1131

Khidala opened this issue Jul 16, 2023 · 1 comment
Assignees
Labels
api: logging Issues related to the googleapis/java-logging-logback API. priority: p3 Desirable enhancement or fix. May not be included in next release.

Comments

@Khidala
Copy link

Khidala commented Jul 16, 2023

Logback encoders are not working with LoggingAppender. Can encoders be used with LoggingAppender for layout/pattern usage?

Environment details

Need to use https://logback.qos.ch/manual/encoders.html with google-cloud-logging-logback, but it doesn't work when I use encoder with google-cloud-logging-logback version 0.130.17-alpha.

Steps to reproduce

  1. Use LoggingAppender in logback.xml
  2. Add encoder element to logback.xml.

Code example

Contents of logback.xml:

<configuration>
  <appender name="CLOUD" class="com.google.cloud.logging.logback.LoggingAppender">
    <!-- Optional : filter logs at or above a level -->
    <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
      <level>DEBUG</level>
    </filter>
    <log>application.log</log> <!-- Optional : default java.log -->
    <resourceType>gae_app</resourceType> <!-- Optional : default: auto-detected, fallback: global -->
    <enhancer>com.server.utils.LoggingEnhancerSimple</enhancer> <!-- Optional -->
    <flushLevel>WARN</flushLevel> <!-- Optional : default ERROR -->
    <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
      <pattern>%d %-5level [%thread] %logger{0}: %msg%n</pattern>
    </encoder>
  </appender>

  <root level="debug">
    <appender-ref ref="CLOUD" />
  </root>
</configuration>


Stack trace

In App Engine Standard Java 17 log I see this error at startup:
`ERROR in ch.qos.logback.core.joran.spi.Interpreter@12:16 - no applicable action for [pattern], current ElementPath  is [[configuration][appender][encoder][pattern]]`

External references such as API reference guides

https://github.com/googleapis/java-logging-logback
See "Usage" section which says encoders can be used with LoggingAppender.

@product-auto-label product-auto-label bot added the api: logging Issues related to the googleapis/java-logging-logback API. label Jul 16, 2023
@peterweb2005
Copy link

excuse me

how is the status? Reminded to migrate on January 30, 2024

thanks

@cindy-peng cindy-peng added the priority: p3 Desirable enhancement or fix. May not be included in next release. label Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: logging Issues related to the googleapis/java-logging-logback API. priority: p3 Desirable enhancement or fix. May not be included in next release.
Projects
None yet
Development

No branches or pull requests

4 participants