Skip to content
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

can't redirect (debug) output of systemd-udevd #462

Closed
mbiebl opened this issue Jul 1, 2015 · 7 comments
Closed

can't redirect (debug) output of systemd-udevd #462

mbiebl opened this issue Jul 1, 2015 · 7 comments
Labels

Comments

@mbiebl
Copy link
Contributor

mbiebl commented Jul 1, 2015

I'm trying to run systemd-udevd in debug and redirecting the output to a file.
Reading the man page about --debug I tried the following:

/lib/systemd/systemd-udevd --debug 2> /tmp/udev.log

But that file just remains empty. Am I doing something wrong or is this a bug?

@kaysievers
Copy link
Contributor

The log should just end up in the journal because the redirect is not a tty anymore.
You should be able to add SYSTEMD_LOG_TARGET=console.

kaysievers added a commit that referenced this issue Jul 1, 2015
@kaysievers
Copy link
Contributor

Added log_set_target(LOG_TARGET_CONSOLE); to the code.

We should probably just remove the --debug option and document in the man page how to use the environment variables. No other systemd tool has this switch.

@mbiebl
Copy link
Contributor Author

mbiebl commented Jul 1, 2015

In this particular case I was running udev under sysvinit, so no journal is available.

@dvdhrm
Copy link
Contributor

dvdhrm commented Jul 1, 2015

For more details, see src/basic/log.c. The STDERR ("console") fallback is really the last option we chose by default. So if the journal is not available, we still try kmsg.

By setting SYSTEMD_LOG_TARGET appropriately, you can avoid this behavior, as Kay explained.

@mbiebl
Copy link
Contributor Author

mbiebl commented Jul 1, 2015

2015-07-01 23:14 GMT+02:00 David Herrmann notifications@github.com:

For more details, see src/basic/log.c. The STDERR ("console") fallback is
really the last option we chose by default. So if the journal is not
available, we still try kmsg.

By setting SYSTEMD_LOG_TARGET appropriately, you can avoid this behavior,
as Kay explained.

Is this behaviour of systemd-udevd documentend somewhere?

Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?

@zonque zonque added the udev label Jul 1, 2015
@dvdhrm
Copy link
Contributor

dvdhrm commented Jul 2, 2015

Hm, they environment variables are global for all systemd utilities. The only real reference I see is systemd(1).

@keszybz
Copy link
Member

keszybz commented Jul 5, 2015

systemd-active(1) has

    <title>Environment variables</title>
    <variablelist class='environment-variables'>
      <varlistentry>
        <term><varname>$LISTEN_FDS</varname></term>
        <term><varname>$LISTEN_PID</varname></term>

        <listitem><para>See
        <citerefentry><refentrytitle>sd_listen_fds</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para></listitem>
      </varlistentry>

      <varlistentry>
        <term><varname>$SYSTEMD_LOG_TARGET</varname></term>
        <term><varname>$SYSTEMD_LOG_LEVEL</varname></term>
        <term><varname>$SYSTEMD_LOG_COLOR</varname></term>
        <term><varname>$SYSTEMD_LOG_LOCATION</varname></term>

        <listitem><para>Same as in
        <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>.</para></listitem>
      </varlistentry>
    </variablelist>

Second half of this paragraph could be added to other man pages, probably as a xi:include.

Yamakuzure pushed a commit to elogind/elogind that referenced this issue Jan 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

5 participants