Skip to content

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

@shaileshaag

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.

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