VirtualBox

Changeset 77557 in vbox for trunk/src


Ignore:
Timestamp:
Mar 4, 2019 3:58:23 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
129162
Message:

IPRT: Moved the RTLogSetGroupLimit() functionality into the RTLogCreateEx() call, adding an env var for overriding it (suffix '_MAX_PER_GROUP', e.g. 'export VBOX_RELEASE_LOG_MAX_PER_GROUP=0' for no limit).

Location:
trunk/src/VBox
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxTray.cpp

    r76553 r77557  
    570570                           "VBOXTRAY_RELEASE_LOG",
    571571#endif
    572                            RT_ELEMENTS(s_apszGroups), s_apszGroups, RTLOGDEST_STDOUT,
     572                           RT_ELEMENTS(s_apszGroups), s_apszGroups, UINT32_MAX, RTLOGDEST_STDOUT,
    573573                           vboxTrayLogHeaderFooter, g_cHistory, g_uHistoryFileSize, g_uHistoryFileTime,
    574574                           RTErrInfoInitStatic(&ErrInfo), pszLogFile);
  • trunk/src/VBox/Additions/common/VBoxService/VBoxService.cpp

    r76553 r77557  
    318318                           "VBOXSERVICE_RELEASE_LOG",
    319319#endif
    320                            RT_ELEMENTS(s_apszGroups), s_apszGroups,
     320                           RT_ELEMENTS(s_apszGroups), s_apszGroups, UINT32_MAX /*cMaxEntriesPerGroup*/,
    321321                           RTLOGDEST_STDOUT | RTLOGDEST_USER,
    322322                           vgsvcLogHeaderFooter, g_cHistory, g_uHistoryFileSize, g_uHistoryFileTime,
  • trunk/src/VBox/Additions/linux/lightdm-greeter/vbox-greeter.cpp

    r76553 r77557  
    935935    fFlags |= RTLOGFLAGS_USECRLF;
    936936#endif
    937     int rc = RTLogCreateEx(&g_pLoggerRelease, fFlags, "all",
    938                            "VBOXGREETER_RELEASE_LOG", RT_ELEMENTS(s_apszGroups), s_apszGroups,
    939                            RTLOGDEST_STDOUT,
     937    int rc = RTLogCreateEx(&g_pLoggerRelease, fFlags, "all", "VBOXGREETER_RELEASE_LOG",
     938                           RT_ELEMENTS(s_apszGroups), s_apszGroups, UINT32_MAX /*cMaxEntriesPerGroup*/, RTLOGDEST_STDOUT,
    940939                           vboxGreeterLogHeaderFooter, g_cHistory, g_uHistoryFileSize, g_uHistoryFileTime,
    941940                           NULL /*pErrInfo*/, pszLogFile);
  • trunk/src/VBox/HostServices/SharedOpenGL/OpenGLTest/OpenGLTestApp.cpp

    r76553 r77557  
    132132
    133133    int vrc = RTLogCreateEx(&loggerRelease, fFlags, "all",
    134                             "VBOX_RELEASE_LOG", RT_ELEMENTS(s_apszGroups), s_apszGroups, enmLogDest,
     134                            "VBOX_RELEASE_LOG", RT_ELEMENTS(s_apszGroups), s_apszGroups, UINT32_MAX, enmLogDest,
    135135                            NULL /* pfnBeginEnd */, 0 /* cHistory */, 0 /* cbHistoryFileMax */, 0 /* uHistoryTimeMax */,
    136136                            NULL /* pErrInfo */, pszFilenameFmt, pszFilename, RTTimeMilliTS());
  • trunk/src/VBox/Main/glue/VBoxLogRelCreate.cpp

    r77555 r77557  
    150150#endif
    151151    g_pszLogEntity = pcszEntity;
    152     int vrc = RTLogCreateEx(&pReleaseLogger, fFlags, pcszGroupSettings,
    153                             pcszEnvVarBase, RT_ELEMENTS(s_apszGroups), s_apszGroups, fDestFlags,
     152    int vrc = RTLogCreateEx(&pReleaseLogger, fFlags, pcszGroupSettings, pcszEnvVarBase,
     153                            RT_ELEMENTS(s_apszGroups), s_apszGroups, cMaxEntriesPerGroup, fDestFlags,
    154154                            vboxHeaderFooter, cHistory, uHistoryFileSize, uHistoryFileTime,
    155155                            pErrInfo, pcszLogFile ? "%s" : NULL, pcszLogFile);
    156156    if (RT_SUCCESS(vrc))
    157157    {
    158         /* make sure that we don't flood logfiles */
    159         RTLogSetGroupLimit(pReleaseLogger, cMaxEntriesPerGroup);
    160 
    161158        /* explicitly flush the log, to have some info when buffering */
    162159        RTLogFlush(pReleaseLogger);
  • trunk/src/VBox/Runtime/common/log/log.cpp

    r76553 r77557  
    782782
    783783
    784 RTDECL(int) RTLogCreateExV(PRTLOGGER *ppLogger, uint32_t fFlags, const char *pszGroupSettings,
    785                            const char *pszEnvVarBase, unsigned cGroups, const char * const *papszGroups,
     784RTDECL(int) RTLogCreateExV(PRTLOGGER *ppLogger, uint32_t fFlags, const char *pszGroupSettings, const char *pszEnvVarBase,
     785                           unsigned cGroups, const char * const *papszGroups, uint32_t cMaxEntriesPerGroup,
    786786                           uint32_t fDestFlags, PFNRTLOGPHASE pfnPhase, uint32_t cHistory,
    787787                           uint64_t cbHistoryFileMax, uint32_t cSecsHistoryTimeSlot,
     
    841841        else
    842842            pLogger->pInt->pacEntriesPerGroup   = NULL;
    843         pLogger->pInt->cMaxEntriesPerGroup      = UINT32_MAX;
     843        pLogger->pInt->cMaxEntriesPerGroup      = cMaxEntriesPerGroup ? cMaxEntriesPerGroup : UINT32_MAX;
    844844# ifdef IN_RING3
    845845        pLogger->pInt->pfnPhase                 = pfnPhase;
     
    939939                if (pszValue)
    940940                    RTLogGroupSettings(pLogger, pszValue);
     941
     942                /*
     943                 * Group limit.
     944                 */
     945                strcpy(pszEnvVar + cchEnvVarBase, "_MAX_PER_GROUP");
     946                pszValue = RTEnvGet(pszEnvVar);
     947                if (pszValue)
     948                {
     949                    uint32_t cMax;
     950                    rc = RTStrToUInt32Full(pszValue, 0, &cMax);
     951                    if (RT_SUCCESS(rc))
     952                        pLogger->pInt->cMaxEntriesPerGroup = cMax ? cMax : UINT32_MAX;
     953                    else
     954                        AssertMsgFailed(("Invalid group limit! %s=%s\n", pszEnvVar, pszValue));
     955                }
     956
    941957            }
    942958# else  /* !IN_RING3 */
     
    10171033
    10181034    va_start(args, pszFilenameFmt);
    1019     rc = RTLogCreateExV(ppLogger, fFlags, pszGroupSettings, pszEnvVarBase, cGroups, papszGroups,
    1020                         fDestFlags, NULL /*pfnPhase*/, 0 /*cHistory*/, 0 /*cbHistoryFileMax*/, 0 /*cSecsHistoryTimeSlot*/,
     1035    rc = RTLogCreateExV(ppLogger, fFlags, pszGroupSettings, pszEnvVarBase,
     1036                        cGroups, papszGroups, UINT32_MAX /*cMaxEntriesPerGroup*/, fDestFlags,
     1037                        NULL /*pfnPhase*/, 0 /*cHistory*/, 0 /*cbHistoryFileMax*/, 0 /*cSecsHistoryTimeSlot*/,
    10211038                        NULL /*pErrInfo*/, pszFilenameFmt, args);
    10221039    va_end(args);
     
    10261043
    10271044
    1028 RTDECL(int) RTLogCreateEx(PRTLOGGER *ppLogger, uint32_t fFlags, const char *pszGroupSettings,
    1029                           const char *pszEnvVarBase, unsigned cGroups, const char * const * papszGroups,
     1045RTDECL(int) RTLogCreateEx(PRTLOGGER *ppLogger, uint32_t fFlags, const char *pszGroupSettings, const char *pszEnvVarBase,
     1046                          unsigned cGroups, const char * const *papszGroups, uint32_t cMaxEntriesPerGroup,
    10301047                          uint32_t fDestFlags, PFNRTLOGPHASE pfnPhase, uint32_t cHistory,
    10311048                          uint64_t cbHistoryFileMax, uint32_t cSecsHistoryTimeSlot,
     
    10361053
    10371054    va_start(args, pszFilenameFmt);
    1038     rc = RTLogCreateExV(ppLogger, fFlags, pszGroupSettings, pszEnvVarBase, cGroups, papszGroups,
     1055    rc = RTLogCreateExV(ppLogger, fFlags, pszGroupSettings, pszEnvVarBase, cGroups, papszGroups, cMaxEntriesPerGroup,
    10391056                        fDestFlags, pfnPhase, cHistory, cbHistoryFileMax, cSecsHistoryTimeSlot,
    10401057                        pErrInfo, pszFilenameFmt, args);
Note: See TracChangeset for help on using the changeset viewer.

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