~ubuntu-branches/ubuntu/trusty/net-snmp/trusty

« back to all changes in this revision

Viewing changes to snmplib/snmp_logging.c

  • Committer: Bazaar Package Importer
  • Author(s): Steve Kowalik
  • Date: 2007-05-10 22:20:23 UTC
  • mto: (1.4.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 11.
  • Revision ID: james.westby@ubuntu.com-20070510222023-3fr07xb9i17xvq32
Tags: upstream-5.3.1
ImportĀ upstreamĀ versionĀ 5.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
97
97
 
98
98
static char syslogname[64] = DEFAULT_LOG_ID;
99
99
 
 
100
void
 
101
netsnmp_enable_filelog(netsnmp_log_handler *logh, int dont_zero_log);
 
102
 
100
103
#ifndef HAVE_VSNPRINTF
101
104
                /*
102
105
                 * Need to use the UCD-provided one 
350
353
        if (logh) {
351
354
            logh->pri_max = pri_max;
352
355
            logh->token   = strdup(optarg);
 
356
            netsnmp_enable_filelog(logh,
 
357
                                   netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
 
358
                                                          NETSNMP_DS_LIB_APPEND_LOGFILES));
353
359
        }
354
360
        break;
355
361
 
580
586
    }
581
587
}
582
588
 
 
589
/*
 
590
 * close and reopen all file based logs, to allow logfile
 
591
 * rotation.
 
592
 */
 
593
void
 
594
netsnmp_logging_restart(void)
 
595
{
 
596
    netsnmp_log_handler *logh;
 
597
 
 
598
    for (logh = logh_head; logh; logh = logh->next) {
 
599
        if (0 == logh->enabled)
 
600
            continue;
 
601
        if (logh->type == NETSNMP_LOGHANDLER_SYSLOG) {
 
602
            snmp_disable_syslog_entry(logh);
 
603
            snmp_enable_syslog_ident(logh->token,(int)logh->magic);
 
604
        }
 
605
        else if (logh->type == NETSNMP_LOGHANDLER_FILE) {
 
606
            snmp_disable_filelog_entry(logh);
 
607
            /** hmm, don't zero status isn't saved.. i think it's
 
608
             * safer not to overwrite, in case a hup is just to
 
609
             * re-read config files...
 
610
             */
 
611
            netsnmp_enable_filelog(logh, 1);
 
612
        }
 
613
    }
 
614
}
 
615
 
583
616
/* ================================================== */
584
617
 
585
618
void
672
705
     * don't disable ALL filelogs whenever a new one is enabled.
673
706
     * this prevents '-Lf file' from working in snmpd, as the
674
707
     * call to set up /var/log/snmpd.log will disable the previous
675
 
     * log setup. again, this new linked list of log handlers
676
 
     * needs rethinking/cleanup. xxx-rks
 
708
     * log setup.
677
709
     * snmp_disable_filelog();
678
710
     */
679
711