Skip to content

Add ability to disable Cloud logging when running in Development sandbox #3551

Description

@shaileshaag

When running the application in development box, I get below error:

[INFO] 06:12:12,243 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [com.google.cloud.logging.logback.LoggingAppender]
[INFO] 06:12:12,249 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [CLOUD]
[INFO] 06:12:13,325 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@6:13 - RuntimeException in Action for tag [appender] java.lang.NullPointerException
[INFO] 	at java.lang.NullPointerException
[INFO] 	at 	at com.google.cloud.MetadataConfig.getZone(MetadataConfig.java:46)
[INFO] 	at 	at com.google.cloud.logging.MonitoredResourceUtil.getValue(MonitoredResourceUtil.java:154)
[INFO] 	at 	at com.google.cloud.logging.MonitoredResourceUtil.getResource(MonitoredResourceUtil.java:111)
[INFO] 	at 	at com.google.cloud.logging.logback.LoggingAppender.getMonitoredResource(LoggingAppender.java:134)
[INFO] 	at 	at com.google.cloud.logging.logback.LoggingAppender.start(LoggingAppender.java:180)
[INFO] 	at 	at ch.qos.logback.core.joran.action.AppenderAction.end(AppenderAction.java:90)
[INFO] 	at 	at ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Interpreter.java:309)
[INFO] 	at 	at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:193)
[INFO] 	at 	at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:179)
[INFO] 	at 	at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:62)
[INFO] 	at 	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:165)
[INFO] 	at 	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:152)
[INFO] 	at 	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:110)
[INFO] 	at 	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:53)
[INFO] 	at 	at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:75)
[INFO] 	at 	at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:150)
[INFO] 	at 	at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84)
[INFO] 	at 	at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
[INFO] 	at 	at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
[INFO] 	at 	at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
[INFO] 	at 	at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:412)
[INFO] 	at 	at ch.qos.logback.classic.util.StatusViaSLF4JLoggerFactory.addStatus(StatusViaSLF4JLoggerFactory.java:32)
[INFO] 	at 	at ch.qos.logback.classic.util.StatusViaSLF4JLoggerFactory.addInfo(StatusViaSLF4JLoggerFactory.java:20)
[INFO] 	at 	at ch.qos.logback.classic.servlet.LogbackServletContainerInitializer.onStartup(LogbackServletContainerInitializer.java:32)

At this point, I'm not really sure what should be the fix for this, but, IMHO, the library should be intelligent enough to back-off when not running in Cloud environment. Environment based logback configuration might not be possible under every circumstance.

Activity

  1. added
    type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
    api: loggingIssues related to the Cloud Logging API.
    priority: p2Moderately-important priority. Fix may not be included in next release.
    on Aug 10, 2018
  2. removed
    priority: p2Moderately-important priority. Fix may not be included in next release.
    on Oct 9, 2018
  3. ZacWolf commented on Dec 20, 2018

    @ZacWolf

    Any update on this? I'm getting this same error. I've tried adding the following environment variable in the server runtime settings:
    CLOUDSDK_COMPUTE_REGION
    CLOUDSDK_COMPUTE_ZONE

    But still getting this nullpointer exception.

  4. ajaaym commented on Jan 11, 2019

    @ajaaym
    Contributor

    This is fixed as part of #4289. Closing this issue. Please feel free to reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api: loggingIssues related to the Cloud Logging API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions