Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Feature request: ability to suppress logging of message fields
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Robert H  
View profile  
 More options Feb 17 2011, 7:10 pm
From: Robert H <robert.huff...@gmail.com>
Date: Thu, 17 Feb 2011 16:10:03 -0800 (PST)
Local: Thurs, Feb 17 2011 7:10 pm
Subject: Feature request: ability to suppress logging of message fields
If you use protobuf for confidential data, enabling debugt logging
exposes the data. It would be nice to have a field option that directs
the TextFormat class to not log a field.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
TJ Rothwell  
View profile  
 More options Feb 17 2011, 7:25 pm
From: TJ Rothwell <tj.rothw...@gmail.com>
Date: Thu, 17 Feb 2011 18:25:22 -0600
Local: Thurs, Feb 17 2011 7:25 pm
Subject: Re: [protobuf] Feature request: ability to suppress logging of message fields

I have a similar need but haven't looked into a solution. However, would
using "bytes" instead of "string" prevent the output? Or does the debug
logging also output the contents of the bytes?

-- TJ


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kenton Varda  
View profile  
 More options Feb 22 2011, 1:38 pm
From: Kenton Varda <ken...@google.com>
Date: Tue, 22 Feb 2011 10:38:33 -0800
Local: Tues, Feb 22 2011 1:38 pm
Subject: Re: [protobuf] Feature request: ability to suppress logging of message fields

You can always write custom code that formats messages any way you want for
your logs.  The TextFormat class is based purely on public interfaces, so
you can copy it and modify it.  You can define a custom option for flagging
fields that you want removed from the logs and use that custom option in
your modified TextFormat.

I don't think we want to implement this feature directly in the base
implementation.  There are too many little feature requests like this, and
if we implemented them all the library would get quite bloated.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robert H  
View profile  
 More options Feb 22 2011, 6:14 pm
From: Robert H <robert.huff...@gmail.com>
Date: Tue, 22 Feb 2011 15:14:13 -0800 (PST)
Local: Tues, Feb 22 2011 6:14 pm
Subject: Re: Feature request: ability to suppress logging of message fields
That makes perfect sense.

Yes, of course I know I can implement my own method to log messages,
and, in fact, that's what I'm doing. It would be nice if TextFormat
were written in such a way that I didn't have to copy the code. In
fact, if my logger is debug enabled, I construct a
java.lang.reflect.Proxy for the Message the delegates getAllFields,
but replaces the fields I want to suppress. It's a little hacky, but
it is the only way to take advantage of TextFormat without copying the
code. I want to avoid copying because who knows what you'll do on the
next version?

Anyway, thanks for considering it. And thanks for keeping protobuf
bloat-free!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
TJ Rothwell  
View profile  
 More options Feb 28 2011, 5:48 pm
From: TJ Rothwell <tj.rothw...@gmail.com>
Date: Mon, 28 Feb 2011 16:48:07 -0600
Local: Mon, Feb 28 2011 5:48 pm
Subject: Re: [protobuf] Re: Feature request: ability to suppress logging of message fields

Kenton,

I have a message that contains fields that should never be logged. It would
be great if there was a way that the Message.toString() did not
automatically convert everything to a text representation. I'd love it if it
were an opt-in for the TextFormat instead of trying never to use toString()
on those messages.

Since AbstractMessage.toString() currently calls the static method for
TextFormat, would it be too much bloat to have an SPI layer there to attach
a custom formatter? Or maybe just not have a toString() at all where
everyone must explicitly use TextFormat.

The extra conditional isn't a problem--it's the fact that somewhere in the
code there may be a string cast where the field may be converted is bad or
in new code from a developer that isn't aware that toString() will behave
that way.

Message myMessage;
log.debug("message={}", myMessage); // TextFormat.printToString()
if(log.isDebugEnabled()) {
  log.debug("message={}", MyTextFormat.printToString(myMessage));

}

Thanks,
-- TJ


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »