VirtualBox

Changeset 6407 in vbox


Ignore:
Timestamp:
Jan 21, 2008 1:08:07 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
27365
Message:

Default to RTLOGDEST_USER instead of RTLOGDEST_FILE when LOG_TO_BACKDOOR is specified. Also skip the headers log header.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/VBox/log-vbox.cpp

    r6273 r6407  
    185185        return g_pLogger;
    186186
    187     /* If we are doing backdoor logging then we do not want to
    188        create an additional log file inside the guest. */
    189 #ifdef LOG_TO_BACKDOOR
    190     return g_pLogger = NULL;
    191 #endif
    192187#ifdef IN_RING3
    193188    /*
     
    289284    PRTLOGGER pLogger;
    290285#ifdef IN_RING3
     286# ifndef LOG_TO_BACKDOOR
    291287    char szExecName[RTPATH_MAX];
    292288    if (!RTProcGetExecutableName(szExecName, sizeof(szExecName)))
     
    295291    RTTIME Time;
    296292    RTTimeExplode(&Time, RTTimeNow(&TimeSpec));
    297     int rc = RTLogCreate(&pLogger, 0, NULL, "VBOX_LOG", ELEMENTS(g_apszGroups), &g_apszGroups[0], RTLOGDEST_FILE,
     293    int rc = RTLogCreate(&pLogger, 0, NULL, "VBOX_LOG", RT_ELEMENTS(g_apszGroups), &g_apszGroups[0], RTLOGDEST_FILE,
    298294                         "./%04d-%02d-%02d-%02d-%02d-%02d.%03d-%s-%d.log",
    299295                         Time.i32Year, Time.u8Month, Time.u8MonthDay, Time.u8Hour, Time.u8Minute, Time.u8Second, Time.u32Nanosecond / 10000000,
     
    310306
    311307        /* executable and arguments - tricky and all platform specific. */
    312 # if defined(RT_OS_WINDOWS)
     308#  if defined(RT_OS_WINDOWS)
    313309        RTLogLoggerEx(pLogger, 0, ~0U, "Commandline: %ls\n", GetCommandLineW());
    314310
    315 # elif defined(RT_OS_SOLARIS)
     311#  elif defined(RT_OS_SOLARIS)
    316312        psinfo_t psi;
    317313        char szArgFileBuf[80];
     
    322318            if (fread(&psi, sizeof(psi), 1, pFile) == 1)
    323319            {
    324 if 0     /* 100% safe:*/
     320 if 0     /* 100% safe:*/
    325321                RTLogLoggerEx(pLogger, 0, ~0U, "Args: %s\n", psi.pr_psargs);
    326 else     /* probably safe: */
     322 else     /* probably safe: */
    327323                const char * const *argv = (const char * const *)psi.pr_argv;
    328324                for (int iArg = 0; iArg < psi.pr_argc; iArg++)
    329325                    RTLogLoggerEx(pLogger, 0, ~0U, "Arg[%d]: %s\n", iArg, argv[iArg]);
    330 endif
     326 endif
    331327
    332328            }
     
    334330        }
    335331
    336 # elif defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)
    337 ifdef RT_OS_LINUX
     332#  elif defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)
     333 ifdef RT_OS_LINUX
    338334        FILE *pFile = fopen("/proc/self/cmdline", "r");
    339 else /* RT_OS_FREEBSD: */
     335 else /* RT_OS_FREEBSD: */
    340336        FILE *pFile = fopen("/proc/curproc/cmdline", "r");
    341 endif
     337 endif
    342338        if (pFile)
    343339        {
     
    366362        }
    367363
    368 # elif defined(RT_OS_L4) || defined(RT_OS_OS2) || defined(RT_OS_DARWIN)
     364#  elif defined(RT_OS_L4) || defined(RT_OS_OS2) || defined(RT_OS_DARWIN)
    369365        /* commandline? */
     366#  else
     367#   error needs porting.
     368#  endif
     369    }
     370
     371# else  /* LOG_TO_BACKDOOR */
     372    /* The user destination is backdoor logging. */
     373    int rc = RTLogCreate(&pLogger, 0, NULL, "VBOX_LOG",
     374                         RT_ELEMENTS(g_apszGroups), &g_apszGroups[0],
     375                         RTLOGDEST_USER, "VBox.log");
     376# endif /* LOG_TO_BACKDOOR */
     377
     378#else /* IN_RING0 */
     379    int rc = RTLogCreate(&pLogger, 0, NULL, "VBOX_LOG", RT_ELEMENTS(g_apszGroups), &g_apszGroups[0],
     380# ifdef LOG_TO_BACKDOOR
     381                         RTLOGDEST_USER,
    370382# else
    371 #  error needs porting.
    372 #endif
    373     }
    374 
    375 
    376 #else /* IN_RING0 */
    377     int rc = RTLogCreate(&pLogger, 0, NULL, "VBOX_LOG", ELEMENTS(g_apszGroups), &g_apszGroups[0],
    378                          RTLOGDEST_FILE, "VBox-ring0.log");
     383                         RTLOGDEST_FILE,
     384# endif
     385                         "VBox-ring0.log");
    379386    if (RT_SUCCESS(rc))
    380387    {
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette