log: added path for when --prefix is used

ulab-next
Jay Sorg 12 years ago
parent 3fad514c02
commit 099a421c77

@ -5,7 +5,8 @@ AM_CFLAGS = \
-DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\"
-DXRDP_PID_PATH=\"${localstatedir}/run\" \
-DXRDP_LOG_PATH=\"${localstatedir}/log\"
lib_LTLIBRARIES = \
libcommon.la

@ -313,6 +313,7 @@ internal_config_read_logging(int file, struct log_config* lc,
{
int i;
char* buf;
char* temp_buf;
list_clear(param_v);
list_clear(param_n);
@ -332,6 +333,16 @@ internal_config_read_logging(int file, struct log_config* lc,
if (0 == g_strcasecmp(buf, SESMAN_CFG_LOG_FILE))
{
lc->log_file = g_strdup((char*)list_get_item(param_v, i));
if (lc->log_file != NULL)
{
if (lc->log_file[0] != '/')
{
temp_buf = (char*)g_malloc(512, 0);
g_snprintf(temp_buf, 511, "%s/%s", XRDP_LOG_PATH, lc->log_file);
g_free(lc->log_file);
lc->log_file = temp_buf;
}
}
}
if (0 == g_strcasecmp(buf, SESMAN_CFG_LOG_LEVEL))
{
@ -352,6 +363,9 @@ internal_config_read_logging(int file, struct log_config* lc,
lc->log_file = g_strdup("./sesman.log");
}
/* try to create path if not exist */
g_create_path(lc->log_file);
g_printf("logging configuration:\r\n");
g_printf("\tLogFile: %s\r\n", lc->log_file);
g_printf("\tLogLevel: %i\r\n", lc->log_level);
@ -423,7 +437,8 @@ log_start_from_param(const struct log_config* iniParams)
ret = internalInitAndAllocStruct();
if (ret != LOG_STARTUP_OK)
{
return ret;
g_writeln("internalInitAndAllocStruct failed");
return ret;
}
staticLogConfig->enable_syslog = iniParams->enable_syslog;
staticLogConfig->fd = iniParams->fd;

@ -252,20 +252,20 @@ main(int argc, char** argv)
}
g_snprintf(cfg_file,255,"%s/sesman.ini",XRDP_CFG_PATH);
/* starting logging subsystem */
error = log_start(cfg_file,"XRDP-sesman");
if (error != LOG_STARTUP_OK)
{
char buf[256] ;
switch (error)
{
case LOG_ERROR_MALLOC:
g_printf("error on malloc. cannot start logging. quitting.\n");
g_writeln("error on malloc. cannot start logging. quitting.");
break;
case LOG_ERROR_FILE_OPEN:
g_printf("error opening log file [%s]. quitting.\n", getLogFile(buf,255));
g_writeln("error opening log file [%s]. quitting.",
getLogFile(text, 255));
break;
}
g_deinit();
@ -368,4 +368,3 @@ main(int argc, char** argv)
g_deinit();
return 0;
}

@ -19,7 +19,7 @@ IdleTimeLimit=0
DisconnectedTimeLimit=0
[Logging]
LogFile=/var/log/xrdp-sesman.log
LogFile=xrdp-sesman.log
LogLevel=DEBUG
EnableSyslog=1
SyslogLevel=DEBUG

@ -314,16 +314,17 @@ main(int argc, char** argv)
if (error != LOG_STARTUP_OK)
{
char buf[256] ;
switch (error)
{
case LOG_ERROR_MALLOC:
g_printf("error on malloc. cannot start logging. quitting.\n");
g_writeln("error on malloc. cannot start logging. quitting.");
break;
case LOG_ERROR_FILE_OPEN:
g_printf("error opening log file [%s]. quitting.\n", getLogFile(buf,255));
g_writeln("error opening log file [%s]. quitting.",
getLogFile(text, 255));
break;
}
g_deinit();
g_exit(1);
}

@ -20,7 +20,7 @@ fork=yes
#hidelogwindow=yes
[Logging]
LogFile=/var/log/xrdp.log
LogFile=xrdp.log
LogLevel=DEBUG
EnableSyslog=1
SyslogLevel=DEBUG

Loading…
Cancel
Save