fix for bug 108

remotes/origin/master-1.0.x
Anoop Saldanha 16 years ago committed by Victor Julien
parent 098af1f734
commit 9e94768385

@ -410,6 +410,8 @@ int main(int argc, char **argv)
} }
#endif #endif
SCLogInfo("This is %s version %s", PROG_NAME, PROG_VER);
/* initialize the logging subsys */ /* initialize the logging subsys */
SCLogInitLogModule(NULL); SCLogInitLogModule(NULL);
@ -587,7 +589,6 @@ int main(int argc, char **argv)
} }
SetBpfString(optind, argv); SetBpfString(optind, argv);
SCLogInfo("This is %s version %s", PROG_NAME, PROG_VER);
UtilCpuPrintSummary(); UtilCpuPrintSummary();
#ifdef __SC_CUDA_SUPPORT__ #ifdef __SC_CUDA_SUPPORT__

@ -644,9 +644,9 @@ static inline void SCLogSetLogLevel(SCLogInitData *sc_lid, SCLogConfig *sc_lc)
SCLogLevel log_level = SC_LOG_NOTSET; SCLogLevel log_level = SC_LOG_NOTSET;
const char *s = NULL; const char *s = NULL;
if (sc_lid != NULL) if (sc_lid != NULL) {
log_level = sc_lid->global_log_level; log_level = sc_lid->global_log_level;
else { } else {
s = getenv(SC_LOG_ENV_LOG_LEVEL); s = getenv(SC_LOG_ENV_LOG_LEVEL);
if (s != NULL) if (s != NULL)
log_level = SCMapEnumNameToValue(s, sc_log_level_map); log_level = SCMapEnumNameToValue(s, sc_log_level_map);
@ -658,9 +658,11 @@ static inline void SCLogSetLogLevel(SCLogInitData *sc_lid, SCLogConfig *sc_lc)
else { else {
sc_lc->log_level = SC_LOG_DEF_LOG_LEVEL; sc_lc->log_level = SC_LOG_DEF_LOG_LEVEL;
#ifndef UNITTESTS #ifndef UNITTESTS
printf("Warning: Invalid global_log_level assigned by user. Falling " if (sc_lid != NULL) {
"back on the default_log_level \"%s\"\n", printf("Warning: Invalid/No global_log_level assigned by user. Falling "
SCMapEnumValueToName(sc_lc->log_level, sc_log_level_map)); "back on the default_log_level \"%s\"\n",
SCMapEnumValueToName(sc_lc->log_level, sc_log_level_map));
}
#endif #endif
} }
@ -694,15 +696,16 @@ static inline void SCLogSetLogFormat(SCLogInitData *sc_lid, SCLogConfig *sc_lc)
if (format == NULL || strlen(format) > SC_LOG_MAX_LOG_FORMAT_LEN) { if (format == NULL || strlen(format) > SC_LOG_MAX_LOG_FORMAT_LEN) {
format = SC_LOG_DEF_LOG_FORMAT; format = SC_LOG_DEF_LOG_FORMAT;
#ifndef UNITTESTS #ifndef UNITTESTS
printf("Warning: Invalid global_log_format supplied by user or format " if (sc_lid != NULL) {
"length exceeded limit of \"%d\" characters. Falling back on " printf("Warning: Invalid/No global_log_format supplied by user or format "
"default log_format \"%s\"\n", SC_LOG_MAX_LOG_FORMAT_LEN, "length exceeded limit of \"%d\" characters. Falling back on "
format); "default log_format \"%s\"\n", SC_LOG_MAX_LOG_FORMAT_LEN,
format);
}
#endif #endif
} }
if (format != NULL && if (format != NULL && (sc_lc->log_format = strdup(format)) == NULL) {
(sc_lc->log_format = strdup(format)) == NULL) {
printf("Error allocating memory\n"); printf("Error allocating memory\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -731,8 +734,7 @@ static inline void SCLogSetOPIface(SCLogInitData *sc_lid, SCLogConfig *sc_lc)
sc_lc->op_ifaces = sc_lid->op_ifaces; sc_lc->op_ifaces = sc_lid->op_ifaces;
sc_lid->op_ifaces = NULL; sc_lid->op_ifaces = NULL;
sc_lc->op_ifaces_cnt = sc_lid->op_ifaces_cnt; sc_lc->op_ifaces_cnt = sc_lid->op_ifaces_cnt;
} } else {
else {
s = getenv(SC_LOG_ENV_LOG_OP_IFACE); s = getenv(SC_LOG_ENV_LOG_OP_IFACE);
if (s != NULL) { if (s != NULL) {
op_iface = SCMapEnumNameToValue(s, sc_log_op_iface_map); op_iface = SCMapEnumNameToValue(s, sc_log_op_iface_map);
@ -749,9 +751,11 @@ static inline void SCLogSetOPIface(SCLogInitData *sc_lid, SCLogConfig *sc_lc)
else { else {
op_iface = SC_LOG_DEF_LOG_OP_IFACE; op_iface = SC_LOG_DEF_LOG_OP_IFACE;
#ifndef UNITTESTS #ifndef UNITTESTS
printf("Warning: Output_interface not supplied by user. Falling " if (sc_lid != NULL) {
"back on default_output_interface \"%s\"\n", printf("Warning: Output_interface not supplied by user. Falling "
SCMapEnumValueToName(op_iface, sc_log_op_iface_map)); "back on default_output_interface \"%s\"\n",
SCMapEnumValueToName(op_iface, sc_log_op_iface_map));
}
#endif #endif
} }
@ -968,9 +972,11 @@ SCLogOPIfaceCtx *SCLogInitOPIfaceCtx(const char *iface_name,
} }
/** /**
* \brief Initializes the logging module * \brief Initializes the logging module.
* *
* \param sc_did The initialization data for the logging module * \param sc_lid The initialization data for the logging module. If sc_lid is
* NULL, we would stick to the default configuration for the
* logging subsystem.
* *
*/ */
void SCLogInitLogModule(SCLogInitData *sc_lid) void SCLogInitLogModule(SCLogInitData *sc_lid)

Loading…
Cancel
Save