On Mon, 28 Jul 2025 17:05:06 +0800 [email protected] wrote: > +#ifdef SXE_DPDK_DEBUG > +void sxe_log_stream_init(void) > +{ > + FILE *fp; > + struct timeval tv; > + struct tm *td; > + u8 len; > + s8 time[40]; > + > + if (is_log_created) > + return; > + > + memset(g_log_filename, 0, LOG_FILE_NAME_LEN); > + > + len = snprintf(g_log_filename, LOG_FILE_NAME_LEN, "%s%s.", > + LOG_FILE_PATH, LOG_FILE_PREFIX); > + > + gettimeofday(&tv, NULL); > + td = localtime(&tv.tv_sec); > + strftime(time, sizeof(time), "%Y-%m-%d-%H:%M:%S", td); > + > + snprintf(g_log_filename + len, LOG_FILE_NAME_LEN - len, > + "%s", time); > + > + fp = fopen(g_log_filename, "w+"); > + if (fp == NULL) { > + PMD_LOG_ERR(INIT, "open log file:%s fail, errno:%d %s.", > + g_log_filename, errno, strerror(errno)); > + return; > + } > + > + PMD_LOG_NOTICE(INIT, "log stream file:%s.", g_log_filename); > + > + rte_openlog_stream(fp); > + > + is_log_created = true; > +} > +#endif > +
Firm NAK to drivers manipulating log streams. We have a debug infrastructure, it should be used. In production code it is important to think how your driver will be used in an application, not just as a PMD developer. The application may live in a container and in the cloud, how would you debug it.

