logging both to console and logfile (feature request)

522 views
Skip to first unread message

Hanno Böck

unread,
Oct 30, 2015, 5:07:53 PM10/30/15
to address-sanitizer
Hi,

I was wondering if it would be possible to log the asan output both to
the console (stderr) and a log file.

It seems right now this is not possible (at least if I interpret the
code correctly). You can only have one or the other, not both.

Could this be added? E.g. one could imagine having a separator in the
log_path option in ASAN_OPTIONS that could be set to something like
log_path=/var/log/asan/asan-out;stderr

What do you think?

--
Hanno Böck
http://hboeck.de/

mail/jabber: ha...@hboeck.de
GPG: BBB51E42

Konstantin Serebryany

unread,
Oct 31, 2015, 2:06:43 AM10/31/15
to address-sanitizer
Hi Hanno! 


On Fri, Oct 30, 2015 at 2:08 PM, Hanno Böck <ha...@hboeck.de> wrote:
Hi,

I was wondering if it would be possible to log the asan output both to
the console (stderr) and a log file.

It seems right now this is not possible (at least if I interpret the
code correctly). You can only have one or the other, not both.

Could this be added? E.g. one could imagine having a separator in the
log_path option in ASAN_OPTIONS that could be set to something like
log_path=/var/log/asan/asan-out;stderr

What do you think?

Just curious, why would you need this? 
You are the first one to ask. 

If we were to implement it, I'd rather have another flag, e.g. also_log_to_stderr (ignored w/o log_path, false by default). 


--kcc 

Hanno Böck

unread,
Oct 31, 2015, 4:31:25 AM10/31/15
to address-...@googlegroups.com
On Fri, 30 Oct 2015 23:06:21 -0700
Konstantin Serebryany <konstantin....@gmail.com> wrote:

> You are the first one to ask.
>
> If we were to implement it, I'd rather have another flag, e.g.
> also_log_to_stderr (ignored w/o log_path, false by default).

I'm fine with that, too. Would be great if you could implement that.

The other solution would be a bit more flexible, as it could also
specify multiple log files, but I don't need that.

Konstantin Serebryany

unread,
Nov 1, 2015, 11:50:28 PM11/1/15
to address-sanitizer
On Sat, Oct 31, 2015 at 1:32 AM, Hanno Böck <ha...@hboeck.de> wrote:
On Fri, 30 Oct 2015 23:06:21 -0700
Konstantin Serebryany <konstantin....@gmail.com> wrote:

> You are the first one to ask.
>
> If we were to implement it, I'd rather have another flag, e.g.
> also_log_to_stderr (ignored w/o log_path, false by default).

I'm fine with that, too. Would be great if you could implement that.

The code is already too complicated. 
If we are to add any additional complexity, we at least need to understand why that's needed. 


 
The other solution would be a bit more flexible, as it could also
specify multiple log files, but I don't need that.

--
Hanno Böck
http://hboeck.de/

mail/jabber: ha...@hboeck.de
GPG: BBB51E42

--
You received this message because you are subscribed to the Google Groups "address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to address-saniti...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hanno Böck

unread,
Nov 2, 2015, 2:14:36 PM11/2/15
to address-...@googlegroups.com
On Sun, 1 Nov 2015 20:50:08 -0800
Konstantin Serebryany <konstantin....@gmail.com> wrote:

> The code is already too complicated.
> If we are to add any additional complexity, we at least need to
> understand why that's needed.

Had hoped it wouldn't require too much complexity.

Basically I'm currently trying to create a full linux system running
with asan. Usually I want apps to fail in front of me, so that I can
see the error right away.
But sometimes the output is hidden, because an app disables stderr or
because it's something happening forked away, caused by a gui app or
something else. In these cases I want to be able to recover the errors
that happened.

Therefore having both logging and stderr output is what I want.

I'd also find it considerable to just not disable stderr if a log file
is set. That would avoid introducing another flag. Not sure if that
breaks any other use case.

Evgenii Stepanov

unread,
Nov 2, 2015, 2:17:05 PM11/2/15
to address-sanitizer
Does logging to syslog instead of a file work for you?
That's what we do in a similar situation on Android. The flag may work
on linux already, if not it should be fixed.
Reply all
Reply to author
Forward
0 new messages