-
Notifications
You must be signed in to change notification settings - Fork 33
Logging using the Google Cloud Logging API #4
Comments
So using the LogEntry.builder means that we can remove the JSON formatting classes? I assume that there will be no local log file, unless configured in the users logging.properties and all logs will be consumed only by this API by default? Should we also remove the request log file? |
A bit concerned about the The Google Cloud Logging is The setup for Google Cloud Logging API seems to be based on setting up the Possible setup options:
In either setup, we would need to:
|
We need to make sure that the Jetty base image does not use |
Please consider GoogleCloudPlatform/appengine-java-vm-runtime#282 in new logging design |
Would it make sense to start out by making sure that the Jetty server log is directed to standard error? Standard out/error should automatically be picked up by Stackdriver Logging. |
we would still need java.util.logging, as without it, nothing from the google layers would ever show up in the stackdriver logs without it. the default jetty StdErrLog is multi-line, which the Stackdriver has had problems with in the past, hence all of the effort to make logging more stable with the json format, etc.. to fix StdErrLog would mean a fork of StdErrLog to something like GoogleStackdriverSystemErrLog just to conform to the limits of the Stackdriver standard out/error support that effort would be better spent in just implementing the java.util.logging layer properly to Google Cloud Logging. |
What do you have in mind when you say "google layers"?
There's work going on to automatically detect multi-line java stack traces in the logs. Is there anything else that's potentially multi-line in the Jetty server logs?
What limits are you referring to?
There are java.util.logging handlers in the Logging API. Beyond those handlers, what would our logging layer need to do? |
Multiline output it very common, and not just for stack traces. JSP produces multi-line, JSR365 (javax.websocket) does, most datasources, Jersey, Spring, and even the javax.servlet API does too (example: exceptions during startup / deployment are collected into a multi exception which is a single logging event that reports the main deployment concern, and then lists each deployment failure and possible stacktrace for that failure as well) This is the limits that we refer to with the naive stackdriver parsing of System.err and System.out. When I say "google layers" I mean any of the google or gcloud classes that operate on the server (or the webapp) would produce no output if using Jetty's default So, we have top level options, and multiple sub-options. Option 1: Standard Jetty LoggingThis would be Jetty setup for
Option 2: Jetty uses java.util.loggingTechnique A: Jetty uses its
Technique B: Jetty uses its
In either technique, since we are using java.util.logging now, using the Google Cloud Logging API is attainable, and preferred over the System.out and System.err parsing. However, as noted before, we still need to be careful to not allow the application to remove/reset/change the Google Cloud Logging Handlers at the java.util.logging root context. (configuring the Google Cloud Logging, such as setting the named logger levels is very much supported) Using the Google Cloud Logging API also means we have preliminary support for associating the HttpRequest (via the traceid or similar information), something that the Stackdriver support for system.out and system.err has historically never been able to do. |
For the sake of clarity, I think I should prepare a PR for Joakim's Option 1: all the logging in jetty stripped back to the minimal: no request log and stderr log for the container. I'll add a simple test webapp that generates errors and/or causes errors within the container and we can see how the logging looks in the cloud console. We can then see exactly what needs to be fixed and that will guide us in choosing between status quo, Technique A, Technique B, logging API or something else. |
Yes, sounds good! |
added google copyright
deleted jetty-loggin.properties file
@meltsufin I've been looking at the cloud logging API and have a number of questions: about it should be used in the Flex environment; and how we would like to set it up. So firstly, we need to know how traceid should be added to a Having added a traceid, it is not clear if that is sufficient, or if we should also add a So is there somebody we can talk to who can assist with these questions? if not, we can just experiment, but as the console is a moving target that may not be productive. Eitherway, we are going to need to add scoping information ( traceid and/or httprequest ) to every
I believe we should initially develop option 2., but with the intention of donating the log context code back to the API project once we happy it is fit for purpose. Finally, I assume we should be doing this logging using the async writer option? |
The trace id should be read from the
|
@meltsufin i think greg is asking where to put the traceId in the From my reading of the API, I think greg could use the |
I would think |
OK I will experiment... my reading of I hoping that by the lack of response regarding HttpRequest, that means we don't need to complete that object and associate it with LogEntries.... but I guess experimentation will reveal that. standby... |
I'm looking at testing the google logging APIs and the first thing I've noticed is how large the client library and their dependencies are! Over 21MB of jars in the dependencies listed below. I'm a bit concerned that this represents significant bloat in every image just to do logging! I'm sure the size and scope of these dependencies can be trimmed with maven exclusions, but such an approach is inherently fragile. We also will need to undertake extra efforts to sanitize the container classpath, specially as dependencies such as commons logging are included which have been historically problematic with classloading hiding. I guess we could use shading and hope that static dependency resolution will be sufficient? Anyway, just wanted to raise the issue of size early, as the current approach of pulling logs from a known file has the benefit of having the logging code external to the images. Making the images responsible for their own logging is going to result in lots of duplicate code in every instance.
|
21MB is a pittance in today's world. That's only 30% of the size of your average web page today! (60MB is the average amount of content a single web page downloads in 2016) That being said, there's seems to be a few obvious things in that list of dependencies that really are not needed to do logging. My take on not needed deps (for features in google cloud that are not logging):
and two that feel like they are possible not needed:
|
@gregw Did you ever figure out where to put the traceId in your LogEntry? Thanks! |
Fxed in #81 |
The Google Cloud Logging API or the stdout and stderr should be used to send logs to Stackdriver Logging.
The text was updated successfully, but these errors were encountered: