Skip to content

Logging to root handler doesn't work #3220

Description

@papudesi

We use tomcat-runtime, and our logging.properties looks like this:

handlers = com.google.cloud.logging.LoggingHandler
.level = INFO

com.google.cloud.logging.LoggingHandler.level = INFO
com.google.cloud.logging.LoggingHandler.log = gae_app.log
com.google.cloud.logging.LoggingHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.SimpleFormatter.format = %3$s: %5$s%6$s

.handlers = com.google.cloud.logging.LoggingHandler

Adding something like org.apache.handlers works, just not for the root handler.

Activity

  1. self-assigned this
    on May 2, 2018
  2. added
    type: questionRequest for information or clarification. Not an issue.
    api: loggingIssues related to the Cloud Logging API.
    on May 2, 2018
  3. pongad commented on May 2, 2018

    @pongad
    Contributor

    I'm unable to reproduce this. Could you try doing this at startup?

    for (Handler handler : Logger.getLogger("").getHandlers()) {
        System.err.println(handler);
    }

    On my machine, this properly prints com.google.cloud.logging.LoggingHandler@6b0d80ed signifying that the handler is registered. (The 6b0d80ed is irrelevant here.)

  4. papudesi commented on May 3, 2018

    @papudesi
    Author

    @pongad verified there are no root loggers:

        Logger rootLogger = Logger.getLogger("");
        System.err.println("# Root handlers = " + rootLogger.getHandlers().length);
        for (Handler handler : rootLogger.getHandlers()) {
          System.err.println(handler);
        }
    

    And from the logs:

    # Root handlers = 0
    
  5. meltsufin commented on May 7, 2018

    @meltsufin
    Contributor

    Just to make sure, are you both running the same version of the google-cloud-logging library?

  6. pongad commented on May 7, 2018

    @pongad
    Contributor

    @meltsufin Thank you for taking a look. I am running 1.28.0. I'm confused how this is happening though, since IIUC the logic to read and logging configuration file isn't in google-cloud-logging. My current suspicion is that the tomcat runtime is doing something funny, but I'm completely willing to be told I'm wrong.

  7. meltsufin commented on May 7, 2018

    @meltsufin
    Contributor

    @pongad The logging configuration is loaded by Tomcat itself. The runtime is not really doing anything with it. We do have a sample app that actually registers a root handler that may aid with debugging.

  8. papudesi commented on May 7, 2018

    @papudesi
    Author

    @meltsufin @pongad I'm using 1.14.0 (on account of #3219) :)

  9. papudesi commented on May 9, 2018

    @papudesi
    Author

    @meltsufin @pongad seeing the same thing with 1.28.0 as well.

  10. pongad commented on May 21, 2018

    @pongad
    Contributor

    @papudesi From investigating this, I don't think the problem is with the client lib. Does this problem occur in any other runtime? (Tomcat was never GA and now deprecated; the runtime team encourages you to move to Jetty runtime.)

  11. removed their assignment
    on Jun 4, 2018
  12. self-assigned this
    on Jun 5, 2018
  13. yihanzhen commented on Jun 26, 2018

    @yihanzhen
    Contributor

    It seems the issue has been resolved here. Please ask for reopen if not.

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: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions