-
Notifications
You must be signed in to change notification settings - Fork 350
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
Stdout and Stderr Loggers #150
Conversation
Thanks for your pull request. t looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
I've signed it! |
CLAs look good, thanks! |
People likely rely on the current implementation. In order to not break people, please flag off this feature so that the default functionality is unchanged. If this is really what most people want, we can consider changing the default in a later release. |
@Carrotman42 I have add a flag with a default false value. |
logging/logging.go
Outdated
|
||
// LogDebugToStdout updates Verbose and Info logging to use stdout instead of stderr. | ||
func LogDebugToStdout() { | ||
logger := log.New(os.Stdout, "", log.LstdFlags) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is best way to do this 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty torn on this one too. I don't like that cloud_sql_proxy.go now has two different styles of overriding the logging style.
IMO it would probably be better if there was a "LogVerboseToNowhere" method in this package, and have line 394 of cloud_sql_proxy.go call that instead. Would you mind making that one last change?
Any idea when this will get merged? |
Sorry, I don't have write/merge access to this repo any more. (Ive moved
teams inside Google.)
…On Thu, Apr 5, 2018, 4:29 AM Daniel Winter ***@***.***> wrote:
Any idea when this will get merged?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#150 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAiy7063IUY_tdW0sosl5ZDL-ZYnwrQSks5tlf_6gaJpZM4SZqhO>
.
|
+1 anxiously waiting for this.. |
@@ -119,6 +120,9 @@ General: | |||
WARNING: this option disables ALL logging output (including connection | |||
errors), which will likely make debugging difficult. The -quiet flag takes | |||
precedence over the -verbose flag. | |||
-log_debug_stdout | |||
When explicitly set to true, verbose and info log messages will be directed | |||
stdout as a pose to the default stderr. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'to stdout as opposed to the default stderr'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just pushed a fix
👍 Need this too ! |
version = flag.Bool("version", false, "Print the version of the proxy and exit") | ||
verbose = flag.Bool("verbose", true, "If false, verbose output such as information about when connections are created/closed without error are suppressed") | ||
quiet = flag.Bool("quiet", false, "Disable log messages") | ||
logDebugStdout = flag.Bool("log_debug_stdout", false, "If true, log messages that are not errors will outout to stdout instead of stderr") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to not catch this earlier, but it says "outout" instead of output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to turn spell check on. Pushed a fix 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, and sorry for the nitpicking ;)
Do you know any workarounds? adding |
@krak3n I think we're good to go. Would you mind doing one last "little change" so that changing logging settings is a bit more consistent? Otherwise it looks good to me, so if you don't want to make that change, I can do it myself. |
Sure, I'm not at my computer this evening but will update tomorrow.
Thanks guys :)
On Sat, 21 Apr 2018, 21:29 Hsiu-Fan Wang, ***@***.***> wrote:
@krak3n <https://github.com/krak3n> I think we're good to go. Would you
mind doing one last "little change" so that changing logging settings is a
bit more consistent?
Otherwise it looks good to me, so if you don't want to make that change, I
can do it myself.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#150 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAG2wm7LN8D8yGCGPE0l5DwX7Et_OIbjks5tq5aLgaJpZM4SZqhO>
.
--
Chris Reeves | Senior Developer
…______________________________________________
M: +44 (0) 20 70000000 | T: +44 (0) 20 7190 9759
Second Floor, 16-24 Underwood Street, London N1 7JQ
Website <https://thisissoon.com/> | Twitter
<https://www.twitter.com/soonlondon> | Instagram
<https://www.instagram.com/soonpics/>
______________________________________________
New from SOON_
New site for ParalympicsGB
Check it out here <https://thisissoon.com/project/paralympics-site/>
|
logging/logging.go
Outdated
|
||
// Verbosef is called to write verbose logs, such as when a new connection is | ||
// established correctly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix these comments you deleted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Carrotman42 sorry this took so long, I've pushed a fix 👍
@krak3n are you planning to proceed with this? |
@gytisgreitai yes I do, I'll try and get the fixes requested in ASAP, life / work is currently very busy 😬 |
LGTM. Sorry for the delay, I didn't realize there had been updates pushed. |
Related issues: #106 #138 #149
We noticed that debug messages from our Cloud SQL proxy would be considered as errors in stack driver since all log messages are sent to
stderr
as is defined by the default logger in the go log package: https://golang.org/src/log/log.go?#L73This Pull requests sets up two new loggers, one for verbose / info messages which log to
stdout
and one for error messages which log tostderr
.I believe this should fix the problems as described in #138