Merge pull request #2407 from alexpevzner/devel

LogFile=- redirects log to stdout, which is useful for debugging
This commit is contained in:
matt335672 2022-12-12 20:33:04 +00:00 committed by GitHub
commit cce78b0698
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 5 deletions

View File

@ -28,6 +28,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <time.h>
#include <unistd.h>
#include "list.h"
#include "file.h"
#include "os_calls.h"
@ -61,8 +62,15 @@ internal_log_file_open(const char *fname)
if (fname != NULL)
{
ret = open(fname, O_WRONLY | O_CREAT | O_APPEND | O_SYNC,
S_IRUSR | S_IWUSR);
if (g_strcmp(fname, "<stdout>") != 0)
{
ret = open(fname, O_WRONLY | O_CREAT | O_APPEND | O_SYNC,
S_IRUSR | S_IWUSR);
}
else
{
ret = dup(1);
}
}
#ifdef FD_CLOEXEC
@ -321,7 +329,7 @@ internal_config_read_logging(int file,
if (lc->log_file != NULL)
{
if (lc->log_file[0] != '/')
if (lc->log_file[0] != '/' && g_strcmp(lc->log_file, "<stdout>") != 0)
{
temp_buf = (char *)g_malloc(512, 0);
g_snprintf(temp_buf, 511, "%s/%s", XRDP_LOG_PATH, lc->log_file);

View File

@ -97,7 +97,10 @@ sections.
.TP
\fBLogFile\fR=\fIfilename\fR
Log file path. It can be either absolute or relative. If not specified,
defaults to \fI./sesman.log\fR It is ignored in the [ChansrvLogging] section
defaults to \fI./sesman.log\fR. If set to \fB<stdout>\fR, log will go to
stdout. Use for debugging only\fR
It is ignored in the [ChansrvLogging] section
since the channel server creates one log file per display and instead uses the
following log file naming convention \fIxrdp-chansrv.${DISPLAY}.log\fR

View File

@ -230,7 +230,7 @@ The following parameters can be used in the \fB[Logging]\fR section:
.TP
\fBLogFile\fR=\fI@localstatedir@/log/xrdp.log\fR
This options contains the path to logfile. It can be either absolute or relative.\fR
This options contains the path to logfile. It can be either absolute or relative. If set to \fB<stdout>\fR, log will go to stdout. Use for debugging only\fR
.TP
\fBLogLevel\fR=\fIlevel\fR