howto wirte unix solaris syslog?

Posted on 2009-04-25
Last Modified: 2013-12-27
i have got a c code running on a unix os.
i have also personal log files. example a.log
in my program i want to write some of my logs to unix (var/log/syslog) and some to a.log
if (a=1)
write syslog
write alog.
something like this
can anyone help me , it should be a c program
Question by:230409
    LVL 40

    Accepted Solution

    LVL 61

    Assisted Solution

    see "man logger"
    normally as simple as:
    logger "Process started?"
    logger "Proccess finished!"
    LVL 4

    Assisted Solution

    logger is useful for testing that you have the syslog.conf file setup appropriately.

    Calling syslog programmatically...

    openlog( message_id_string, flags, facility);
    syslog( priority, message_string);

         openlog( "My Test Program", LOG_NDELAY, LOG_LOCAL0); // no delay in logging; user local facility
         syslog( LOG_INFO, "This is my message");                             // LOG_INFO priority

    The syslog.conf may need to be adjusted as appropriate to enable logging of your messages.


    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Suggested Solutions

    Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. Please see for the updated article. It is avail…
    Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
    The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
    The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now