Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8065133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:34:31+00:00 2026-06-05T11:34:31+00:00

I successfully tested the following syslog hello world example on ubuntu 12.04: // gcc

  • 0

I successfully tested the following syslog “hello world” example on ubuntu 12.04:

// gcc giuspexample.c -o giuspexample

#include <syslog.h>

int  main()
{
    setlogmask(LOG_UPTO (LOG_NOTICE));

    openlog("atm", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL0);

    syslog(LOG_NOTICE, "Program started by User %d", getuid ());
    syslog(LOG_INFO, "A tree falls in a forest");

    closelog();
    return 0;
}

and I can read the entry in /var/log/syslog.
I followed the instructions on http://www.codealias.info/technotes/syslog_simple_example on how to change the destination filepath

echo "local0.*  /var/log/mylog" >> /etc/syslog.conf

but trying to run

sudo /etc/init.d/syslog restart

doesn’t work (command not found) and rebooting the pc anyway doesn’t start to write on /var/log/mylog but still on /var/log/syslog.
Does anybody know what’s wrong?
Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T11:34:32+00:00Added an answer on June 5, 2026 at 11:34 am

    In the /etc/rsyslog.d directory, there are two files:

    1. 20-ufw.conf
    2. 50-default.conf

    I added the file /etc/rsyslog.d/30-mycustomname.conf with sudo nano, with the following content:

    # Log QSD Centro generated log messages to file
    if $programname == 'centro' then /var/log/centro.log
    # Uncomment the following to stop logging anything that matches the last rule.
    & ~
    

    Then I check that the file /var/log/centro.log does not exist

    sudo rm -f /var/log/centro.log
    

    Then I restart the service

    sudo service rsyslog restart
    

    Finally The following code works:

    // gcc centro.c -o centro
    
    #include <stdio.h>
    #include <syslog.h>
    
    int  main(int argc, char *argv[])
    {
        openlog(NULL, 0, LOG_USER);
    
        syslog(LOG_INFO, "MORTACCI TUA!!!");
    
        closelog();
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I successfully compiled the following program simple.cc: #include <gtkmm.h> int main (int argc, char
Consider the following code: #include<iostream> #include<utility> struct Base { int baseint; }; struct Der1
Ive developed an app for iPhone. Ive successfully tested it in the iPhone Simulator,
I've successfully built and tested a vb.net app in VS 2008 that uses a
i have made my custom Static Library (.a) successfully. i have tested it in
I've successfully tested a connection via PHP's odbc_connect() to a SQL Server 2005 Express
i have tested following code which might print 0 and 2 but it print
Given is the following example: class Foo(object): def __init__(self, value=0): self.value=value def __int__(self): return
I have a jquery mobile website that has simple select. I have successfully tested
I've recently (2 weeks ago) tested successfully the In-App Pruchase functionality with some iPad

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.