<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Priority</th>
          <td>high
          </td>
        </tr>

        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - syslog()-calls just before a program exit are not be recorded in the journal DB"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=69934">69934</a>
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>systemd-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>syslog()-calls just before a program exit are not be recorded in the journal DB
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>systemd-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>major
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>martin@thesofty.de
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>x86-64 (AMD64)
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>general
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>systemd
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When I have a statement like this in a C program

if (some error) {
    syslog(LOG_ERR | LOG_USER,"some error description"\n);
    exit(EXIT_FAILURE);
}

the error description will not be found in the journal DB.

Even a closelog()-call before exit() doesn't help.

The only way to get the description recorded is a code snippet like this:

if (some error) {
    syslog(LOG_ERR | LOG_USER,"some error description"\n);
    sleep(1);
    exit(EXIT_FAILURE);
}


When using syslog-ng instead

if (some error) {
    syslog(LOG_ERR | LOG_USER,"some error description"\n);
    exit(EXIT_FAILURE);
}

records the error message without any problems in /var/log/user.log

I'm using

Arch Linux x86-64
Kernel 3.11.1-1
Systemd 207</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>