Ignore:
Timestamp:
16/12/2006 20:27:44 (5 years ago)
Author:
chris
Message:

Change all logging to use the logging framework, as an example. (refs #3)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • box/chris/merge/bin/bbackupd/BackupDaemon.cpp

    r1222 r1226  
    1818#ifdef HAVE_SIGNAL_H 
    1919        #include <signal.h> 
    20 #endif 
    21 #ifdef HAVE_SYSLOG_H 
    22         #include <syslog.h> 
    2320#endif 
    2421#ifdef HAVE_SYS_PARAM_H 
     
    7774#include "Archive.h" 
    7875#include "Timer.h" 
     76#include "Logging.h" 
    7977 
    8078#include "MemLeakFindOn.h" 
     
    225223        if(GetConfiguration().KeyExists("CommandSocket")) 
    226224        { 
    227                 printf( 
     225                BOX_WARNING( 
    228226                                "==============================================================================\n" 
    229227                                "SECURITY WARNING: This platform cannot check the credentials of connections to\n" 
     
    279277                catch (BoxException &e) 
    280278                { 
    281                         ::syslog(LOG_ERR, "Failed to open command socket: %s", 
     279                        BOX_ERROR("Failed to open command socket" <<  
    282280                                e.what()); 
    283281                        SetTerminateWanted(); 
    284282                        break; // this is fatal to listening thread 
    285283                } 
    286                 catch (...) 
    287                 { 
    288                         ::syslog(LOG_ERR, "Failed to open command socket: " 
     284                catch(std::exception &e) 
     285                { 
     286                        BOX_ERROR("Failed to open command socket" << 
     287                                e.what()); 
     288                        SetTerminateWanted(); 
     289                        break; // this is fatal to listening thread 
     290                } 
     291                catch(...) 
     292                { 
     293                        BOX_ERROR("Failed to open command socket: " 
    289294                                "unknown error"); 
    290295                        SetTerminateWanted(); 
    291296                        break; // this is fatal to listening thread 
    292297                } 
    293                 } 
    294                 catch(std::exception &e) 
    295                 { 
    296                         ::syslog(LOG_ERR, "Failed to open command socket: " 
    297                                 "%s", e.what()); 
    298                         SetTerminateWanted(); 
    299                         break; // this is fatal to listening thread 
    300                 } 
    301                 catch(...) 
    302                 { 
    303                         ::syslog(LOG_ERR, "Failed to open command socket: " 
    304                                 "unknown error"); 
    305                         SetTerminateWanted(); 
    306                         break; // this is fatal to listening thread 
    307                 } 
    308298 
    309299                try 
     
    314304                        // This next section comes from Ben's original function 
    315305                        // Log 
    316                         ::syslog(LOG_INFO, "Connection from command socket"); 
     306                        BOX_INFO("Connection from command socket"); 
    317307 
    318308                        // Send a header line summarising the configuration  
     
    338328                                !IsTerminateWanted()) 
    339329                        { 
    340                                 TRACE1("Received command '%s' over " 
    341                                         "command socket\n", command.c_str()); 
     330                                BOX_TRACE("Received command '" << command  
     331                                        << "' over command socket"); 
    342332 
    343333                                bool sendOK = false; 
     
    380370                                else 
    381371                                { 
    382                                         ::syslog(LOG_ERR, "Received unknown command '%s' from client", command.c_str()); 
     372                                        BOX_ERROR("Received unknown command " 
     373                                                "'" << command << "' " 
     374                                                "from client"); 
    383375                                        sendResponse = true; 
    384376                                        sendOK = false; 
     
    405397                catch(BoxException &e) 
    406398                { 
    407                         ::syslog(LOG_ERR, "Communication error with " 
    408                                 "control client: %s", e.what()); 
     399                        BOX_ERROR("Communication error with " 
     400                                "control client: " << e.what()); 
    409401                } 
    410402                catch(std::exception &e) 
    411403                { 
    412                         ::syslog(LOG_ERR, "Internal error in command socket " 
    413                                 "thread: %s", e.what()); 
     404                        BOX_ERROR("Internal error in command socket " 
     405                                "thread: " << e.what()); 
    414406                } 
    415407                catch(...) 
    416408                { 
    417                         ::syslog(LOG_ERR, "Communication error with control client"); 
     409                        BOX_ERROR("Communication error with control client"); 
    418410                } 
    419411        } 
     
    474466                        catch(std::exception &e) 
    475467                        { 
    476                                 ::syslog(LOG_WARNING, "Internal error while " 
     468                                BOX_WARNING("Internal error while " 
    477469                                        "closing command socket after " 
    478                                         "another exception: %s", e.what()); 
     470                                        "another exception: " << e.what()); 
    479471                        } 
    480472                        catch(...) 
    481473                        { 
    482                                 ::syslog(LOG_WARNING, 
    483                                         "Error closing command socket " 
     474                                BOX_WARNING("Error closing command socket " 
    484475                                        "after exception, ignored."); 
    485476                        } 
     
    675666                                !DeleteStoreObjectInfo()) 
    676667                        { 
    677                                 ::syslog(LOG_ERR, "Failed to delete the " 
     668                                BOX_ERROR("Failed to delete the " 
    678669                                        "StoreObjectInfoFile, backup cannot " 
    679670                                        "continue safely."); 
     
    698689                                // Set state and log start 
    699690                                SetState(State_Connected); 
    700                                 ::syslog(LOG_INFO, "Beginning scan of local files"); 
     691                                BOX_INFO("Beginning scan of local files"); 
    701692 
    702693                                std::string extendedLogFile; 
     
    811802 
    812803                                // Log 
    813                                 ::syslog(LOG_INFO, "Finished scan of local files"); 
     804                                BOX_INFO("Finished scan of local files"); 
    814805 
    815806                                // -------------------------------------------------------------------------------------------- 
     
    835826                        catch(std::exception &e) 
    836827                        { 
    837                                 ::syslog(LOG_ERR, "Internal error during " 
    838                                         "backup run: %s", e.what()); 
     828                                BOX_ERROR("Internal error during " 
     829                                        "backup run: " << e.what()); 
    839830                                errorOccurred = true; 
    840831                        } 
     
    865856                                if(StopRun()) 
    866857                                { 
    867                                         ::syslog(LOG_INFO, "Exception (%d/%d) due to signal", errorCode, errorSubCode); 
     858                                        BOX_INFO("Exception (" << errorCode 
     859                                                << "/" << errorSubCode  
     860                                                << ") due to signal"); 
    868861                                        return; 
    869862                                } 
     
    872865                                if(isBerkelyDbFailure) 
    873866                                { 
    874                                         ::syslog(LOG_ERR, "Berkely db inode map files corrupted, deleting and restarting scan. Renamed files and directories will not be tracked until after this scan.\n"); 
     867                                        BOX_ERROR("Berkely db inode map files corrupted, deleting and restarting scan. Renamed files and directories will not be tracked until after this scan."); 
    875868                                        ::sleep(1); 
    876869                                } 
     
    879872                                        // Not restart/terminate, pause and retry 
    880873                                        SetState(State_Error); 
    881                                         ::syslog(LOG_ERR,  
    882                                                 "Exception caught (%s %d/%d), " 
    883                                                 "reset state and waiting " 
    884                                                 "to retry...",  
    885                                                 errorString, errorCode,  
    886                                                 errorSubCode); 
     874                                        BOX_ERROR("Exception caught (" 
     875                                                << errorString 
     876                                                << " " << errorCode 
     877                                                << "/" << errorSubCode 
     878                                                << "), reset state and " 
     879                                                "waiting to retry..."); 
    887880                                        ::sleep(10); 
    888881                                        nextSyncTime = currentSyncStartTime +  
     
    895888 
    896889                        // Log the stats 
    897                         ::syslog(LOG_INFO, "File statistics: total file size uploaded %lld, bytes already on server %lld, encoded size %lld", 
    898                                 BackupStoreFile::msStats.mBytesInEncodedFiles, BackupStoreFile::msStats.mBytesAlreadyOnServer, 
    899                                 BackupStoreFile::msStats.mTotalFileStreamSize); 
     890                        BOX_INFO("File statistics: total file size uploaded " 
     891                                << BackupStoreFile::msStats.mBytesInEncodedFiles 
     892                                << ", bytes already on server " 
     893                                << BackupStoreFile::msStats.mBytesAlreadyOnServer 
     894                                << ", encoded size " 
     895                                << BackupStoreFile::msStats.mTotalFileStreamSize); 
    900896                        BackupStoreFile::ResetStats(); 
    901897 
     
    967963                                catch(ConversionException &e) 
    968964                                { 
    969                                         ::syslog(LOG_ERR, "Invalid output " 
    970                                                 "from SyncAllowScript '%s': " 
    971                                                 "'%s'",  
    972                                                 conf.GetKeyValue("SyncAllowScript").c_str(), 
    973                                                 line.c_str()); 
     965                                        BOX_ERROR("Invalid output " 
     966                                                "from SyncAllowScript '" 
     967                                                << conf.GetKeyValue("SyncAllowScript") 
     968                                                << "': '" << line << "'"); 
    974969                                        throw; 
    975970                                } 
    976971 
    977                                 ::syslog(LOG_INFO, "Delaying sync by %d seconds (SyncAllowScript '%s')", waitInSeconds, conf.GetKeyValue("SyncAllowScript").c_str()); 
     972                                BOX_INFO("Delaying sync by " << waitInSeconds 
     973                                        << " seconds (SyncAllowScript '" 
     974                                        << conf.GetKeyValue("SyncAllowScript") 
     975                                        << "')"); 
    978976                        } 
    979977                } 
     
    982980        catch(std::exception &e) 
    983981        { 
    984                 ::syslog(LOG_ERR, "Internal error running SyncAllowScript: " 
    985                         "%s", e.what()); 
     982                BOX_ERROR("Internal error running SyncAllowScript: " 
     983                        << e.what()); 
    986984        } 
    987985        catch(...) 
     
    989987                // Ignore any exceptions 
    990988                // Log that something bad happened 
    991                 ::syslog(LOG_ERR, "Error running SyncAllowScript '%s'", conf.GetKeyValue("SyncAllowScript").c_str()); 
     989                BOX_ERROR("Error running SyncAllowScript '" 
     990                        << conf.GetKeyValue("SyncAllowScript") << "'"); 
    992991        } 
    993992 
     
    10411040        if(mpCommandSocketInfo == 0) {::sleep(1); return;} // failure case isn't too bad 
    10421041         
    1043         TRACE1("Wait on command socket, delay = %lld\n", RequiredDelay); 
     1042        BOX_TRACE("Wait on command socket, delay = " << RequiredDelay); 
    10441043         
    10451044        try 
     
    10671066#ifdef PLATFORM_CANNOT_FIND_PEER_UID_OF_UNIX_SOCKET 
    10681067                                bool uidOK = true; 
    1069                                 ::syslog(LOG_WARNING, "On this platform, no security check can be made on the credentials of peers connecting to the command socket. (bbackupctl)"); 
     1068                                BOX_WARNING("On this platform, no security check can be made on the credentials of peers connecting to the command socket. (bbackupctl)"); 
    10701069#else 
    10711070                                // Security check -- does the process connecting to this socket have 
     
    10921091                                { 
    10931092                                        // Dump the connection 
    1094                                         ::syslog(LOG_ERR, "Incoming command connection from peer had different user ID than this process, or security check could not be completed."); 
     1093                                        BOX_ERROR("Incoming command connection from peer had different user ID than this process, or security check could not be completed."); 
    10951094                                        mpCommandSocketInfo->mpConnectedSocket.reset(); 
    10961095                                        return; 
     
    10991098                                { 
    11001099                                        // Log 
    1101                                         ::syslog(LOG_INFO, "Connection from command socket"); 
     1100                                        BOX_INFO("Connection from command socket"); 
    11021101                                         
    11031102                                        // Send a header line summarising the configuration and current state 
     
    11371136                        && mpCommandSocketInfo->mpGetLine->GetLine(command, false /* no preprocessing */, timeout)) 
    11381137                { 
    1139                         TRACE1("Receiving command '%s' over command socket\n", command.c_str()); 
     1138                        BOX_TRACE("Receiving command '" << command  
     1139                                << "' over command socket"); 
    11401140                         
    11411141                        bool sendOK = false; 
     
    11941194        catch(std::exception &e) 
    11951195        { 
    1196                 ::syslog(LOG_ERR, "Internal error in command socket thread: " 
    1197                         "%s", e.what()); 
     1196                BOX_ERROR("Internal error in command socket thread: " 
     1197                        << e.what()); 
    11981198                // If an error occurs, and there is a connection active, just close that 
    11991199                // connection and continue. Otherwise, let the error propagate. 
     
    12391239        try 
    12401240        { 
    1241                 TRACE0("Closing command connection\n"); 
     1241                BOX_TRACE("Closing command connection"); 
    12421242                 
    12431243                if(mpCommandSocketInfo->mpGetLine) 
     
    12501250        catch(std::exception &e) 
    12511251        { 
    1252                 ::syslog(LOG_ERR, "Internal error while closing command " 
    1253                         "socket: %s", e.what()); 
     1252                BOX_ERROR("Internal error while closing command " 
     1253                        "socket: " << e.what()); 
    12541254        } 
    12551255        catch(...) 
     
    13001300                catch(std::exception &e) 
    13011301                { 
    1302                         ::syslog(LOG_ERR, "Internal error while sending to " 
    1303                                 "command socket client: %s", e.what()); 
     1302                        BOX_ERROR("Internal error while sending to " 
     1303                                "command socket client: " << e.what()); 
    13041304                        CloseCommandConnection(); 
    13051305                } 
     
    14041404                while((entry = ::getmntent(mountPointsFile)) != 0) 
    14051405                { 
    1406                         TRACE1("Found mount point at %s\n", entry->mnt_dir); 
     1406                        BOX_TRACE("Found mount point at " << entry->mnt_dir); 
    14071407                        mountPoints.insert(std::string(entry->mnt_dir)); 
    14081408                } 
     
    14261426        try 
    14271427        { 
    1428  
    14291428                // Read all the entries, and put them in the set 
    14301429                struct mnttab entry; 
    14311430                while(getmntent(mountPointsFile, &entry) == 0) 
    14321431                { 
    1433                         TRACE1("Found mount point at %s\n", entry.mnt_mountp); 
     1432                        BOX_TRACE("Found mount point at " << entry.mnt_mountp); 
    14341433                        mountPoints.insert(std::string(entry.mnt_mountp)); 
    14351434                } 
     
    14601459                i != rLocationsConf.mSubConfigurations.end(); ++i) 
    14611460        { 
    1462 TRACE0("new location\n"); 
     1461                BOX_TRACE("new location"); 
    14631462                // Create a record for it 
    14641463                Location *ploc = new Location; 
     
    14981497                                if(ploc->mPath[0] != '/') 
    14991498                                { 
    1500                                         ::syslog(LOG_ERR, "Location path '%s' isn't absolute", ploc->mPath.c_str()); 
     1499                                        BOX_WARNING("Location path '" 
     1500                                                << ploc->mPath  
     1501                                                << "' is not absolute"); 
    15011502                                } 
    15021503                                // Go through the mount points found, and find a suitable one 
     
    15041505                                { 
    15051506                                        std::set<std::string, mntLenCompare>::const_iterator i(mountPoints.begin()); 
    1506                                         TRACE1("%d potential mount points\n", mountPoints.size()); 
     1507                                        BOX_TRACE(mountPoints.size()  
     1508                                                << " potential mount points"); 
    15071509                                        for(; i != mountPoints.end(); ++i) 
    15081510                                        { 
     
    15101512                                                // If it matches, the file belongs in that mount point 
    15111513                                                // (sorting order ensures this) 
    1512                                                 TRACE1("checking against mount point %s\n", i->c_str()); 
     1514                                                BOX_TRACE("checking against mount point " << *i); 
    15131515                                                if(::strncmp(i->c_str(), ploc->mPath.c_str(), i->size()) == 0) 
    15141516                                                { 
     
    15181520                                                } 
    15191521                                        } 
    1520                                         TRACE2("mount point chosen for %s is %s\n", ploc->mPath.c_str(), mountName.c_str()); 
     1522                                        BOX_TRACE("mount point chosen for " 
     1523                                                << ploc->mPath << " is " 
     1524                                                << mountName); 
    15211525                                } 
    15221526 
     
    15721576                                catch (BoxException &e) 
    15731577                                { 
    1574                                         ::syslog(LOG_ERR, "Failed to get attributes for path " 
    1575                                                 "'%s', skipping.", ploc->mPath.c_str()); 
     1578                                        BOX_ERROR("Failed to get attributes " 
     1579                                                "for path '" << ploc->mPath 
     1580                                                << "', skipping."); 
    15761581                                        continue; 
    15771582                                } 
     
    15991604                        delete ploc; 
    16001605                        ploc = 0; 
    1601                         ::syslog(LOG_ERR, "Failed to setup location '%s' path '%s'", 
    1602                                 ploc->mName.c_str(), ploc->mPath.c_str()); 
     1606                        BOX_ERROR("Failed to setup location '" 
     1607                                << ploc->mName << "' path '" 
     1608                                << ploc->mPath << "'"); 
    16031609                        throw; 
    16041610                } 
     
    16081614        if(dir.GetNumberOfEntries() > 0) 
    16091615        { 
    1610                 ::syslog(LOG_INFO, "%d redundant locations in root directory found, will delete from store after %d seconds.", 
    1611                         dir.GetNumberOfEntries(), BACKUP_DELETE_UNUSED_ROOT_ENTRIES_AFTER); 
     1616                BOX_INFO(dir.GetNumberOfEntries() << " redundant locations " 
     1617                        "in root directory found, will delete from store " 
     1618                        "after " << BACKUP_DELETE_UNUSED_ROOT_ENTRIES_AFTER  
     1619                        << " seconds."); 
    16121620 
    16131621                // Store directories in list of things to delete 
     
    16221630                        mUnusedRootDirEntries.push_back(std::pair<int64_t,std::string>(en->GetObjectID(), name)); 
    16231631                        // Log this 
    1624                         ::syslog(LOG_INFO, "Unused location in root: %s", name.c_str()); 
     1632                        BOX_INFO("Unused location in root: " << name); 
    16251633                } 
    16261634                ASSERT(mUnusedRootDirEntries.size() > 0); 
     
    17391747                 
    17401748                // Delete the file 
    1741                 TRACE1("Deleting %s\n", filename.c_str()); 
     1749                BOX_TRACE("Deleting " << filename); 
    17421750                ::unlink(filename.c_str()); 
    17431751                 
     
    17461754 
    17471755                // Delete that too 
    1748                 TRACE1("Deleting %s\n", filename.c_str()); 
     1756                BOX_TRACE("Deleting " << filename); 
    17491757                ::unlink(filename.c_str()); 
    17501758        } 
     
    18261834                if(::rename(newmap.c_str(), target.c_str()) != 0) 
    18271835                { 
    1828                         ::syslog(LOG_ERR, "failed to rename ID map: " 
    1829                                 "%s to %s: %s", 
    1830                                 newmap.c_str(), target.c_str(), 
    1831                                 strerror(errno)); 
     1836                        BOX_ERROR("failed to rename ID map: " << newmap 
     1837                                << " to " << target << ": "  
     1838                                << strerror(errno)); 
    18321839                        THROW_EXCEPTION(CommonException, OSFileError) 
    18331840                } 
     
    19321939                catch(std::exception &e) 
    19331940                { 
    1934                         ::syslog(LOG_ERR, "Internal error while writing state " 
    1935                                 "to command socket: %s", e.what()); 
     1941                        BOX_ERROR("Internal error while writing state " 
     1942                                "to command socket: " << e.what()); 
    19361943                        CloseCommandConnection(); 
    19371944                } 
     
    19511958                catch(std::exception &e) 
    19521959                { 
    1953                         ::syslog(LOG_ERR, "Internal error while writing state " 
    1954                                 "to command socket: %s", e.what()); 
     1960                        BOX_ERROR("Internal error while writing state " 
     1961                                "to command socket: " << e.what()); 
    19551962                        CloseCommandConnection(); 
    19561963                } 
     
    19972004        static const char *sEventNames[] = {"store-full", "read-error", 0}; 
    19982005 
    1999         TRACE1("BackupDaemon::NotifySysadmin() called, event = %d\n", Event); 
     2006        BOX_TRACE("BackupDaemon::NotifySysadmin() called, event = " << Event); 
    20002007 
    20012008        if(Event < 0 || Event > NotifyEvent__MAX) 
     
    20152022        { 
    20162023                // Log, and then return 
    2017                 ::syslog(LOG_ERR, "Not notifying administrator about event %s -- set NotifyScript to do this in future", sEventNames[Event]); 
     2024                BOX_ERROR("Not notifying administrator about event " 
     2025                        << sEventNames[Event] << " -- set NotifyScript " 
     2026                        "to do this in future"); 
    20182027                return; 
    20192028        } 
     
    20232032         
    20242033        // Log what we're about to do 
    2025         ::syslog(LOG_INFO, "About to notify administrator about event %s, running script '%s'", sEventNames[Event], script.c_str()); 
     2034        BOX_INFO("About to notify administrator about event " 
     2035                << sEventNames[Event] << ", running script '" 
     2036                << script << "'"); 
    20262037         
    20272038        // Then do it 
    20282039        if(::system(script.c_str()) != 0) 
    20292040        { 
    2030                 ::syslog(LOG_ERR, "Notify script returned an error code. ('%s')", script.c_str()); 
     2041                BOX_ERROR("Notify script returned an error code. ('" 
     2042                        << script << "')"); 
    20312043        } 
    20322044 
     
    20602072 
    20612073        // Entries to delete, and it's the right time to do so... 
    2062         ::syslog(LOG_INFO, "Deleting unused locations from store root..."); 
     2074        BOX_INFO("Deleting unused locations from store root..."); 
    20632075        BackupProtocolClient &connection(rContext.GetConnection()); 
    20642076        for(std::vector<std::pair<int64_t,std::string> >::iterator i(mUnusedRootDirEntries.begin()); i != mUnusedRootDirEntries.end(); ++i) 
     
    20672079                 
    20682080                // Log this 
    2069                 ::syslog(LOG_INFO, "Deleted %s (ID %08llx) from store root", i->second.c_str(), i->first); 
     2081                BOX_INFO("Deleted " << i->second << " (ID " << i->first 
     2082                        << ") from store root"); 
    20702083        } 
    20712084 
     
    24072420                // 
    24082421                aFile.Close(); 
    2409                 ::syslog(LOG_INFO, "Saved store object info file '%s'",  
    2410                         StoreObjectInfoFile.c_str()); 
     2422                BOX_INFO("Saved store object info file: " 
     2423                        << StoreObjectInfoFile); 
    24112424        } 
    24122425        catch(std::exception &e) 
    24132426        { 
    2414                 ::syslog(LOG_ERR, "Internal error writing store object " 
    2415                         "info file (%s): %s", 
    2416                         StoreObjectInfoFile.c_str(), e.what()); 
     2427                BOX_ERROR("Internal error writing store object " 
     2428                        "info file (" << StoreObjectInfoFile << "): " 
     2429                        << e.what()); 
    24172430        } 
    24182431        catch(...) 
    24192432        { 
    2420                 ::syslog(LOG_ERR, "Internal error writing store object " 
    2421                         "info file (%s): unknown error", 
    2422                         StoreObjectInfoFile.c_str()); 
     2433                BOX_ERROR("Internal error writing store object " 
     2434                        "info file (" << StoreObjectInfoFile << "): " 
     2435                        "unknown error"); 
    24232436        } 
    24242437 
     
    24712484                if(iMagicValue != STOREOBJECTINFO_MAGIC_ID_VALUE) 
    24722485                { 
    2473                         ::syslog(LOG_WARNING, "Store object info file '%s' " 
     2486                        BOX_WARNING("Store object info file " 
    24742487                                "is not a valid or compatible serialised " 
    2475                                 "archive. Will re-cache from store.",  
    2476                                 StoreObjectInfoFile.c_str()); 
     2488                                "archive. Will re-cache from store. " 
     2489                                "(" << StoreObjectInfoFile << ")"); 
    24772490                        return false; 
    24782491                } 
     
    24862499                if(strMagicValue != STOREOBJECTINFO_MAGIC_ID_STRING) 
    24872500                { 
    2488                         ::syslog(LOG_WARNING, "Store object info file '%s' " 
     2501                        BOX_WARNING("Store object info file " 
    24892502                                "is not a valid or compatible serialised " 
    2490                                 "archive. Will re-cache from store.",  
    2491                                 StoreObjectInfoFile.c_str()); 
     2503                                "archive. Will re-cache from store. " 
     2504                                "(" << StoreObjectInfoFile << ")"); 
    24922505                        return false; 
    24932506                } 
     
    25022515                if(iVersion != STOREOBJECTINFO_VERSION) 
    25032516                { 
    2504                         ::syslog(LOG_WARNING, "Store object info file '%s' " 
    2505                                 "version %d unsupported. " 
    2506                                 "Will re-cache from store.",  
    2507                                 StoreObjectInfoFile.c_str(),  
    2508                                 iVersion); 
     2517                        BOX_WARNING("Store object info file " 
     2518                                "version " << iVersion << " unsupported. " 
     2519                                "Will re-cache from store. " 
     2520                                "(" << StoreObjectInfoFile << ")"); 
    25092521                        return false; 
    25102522                } 
     
    25192531                if(lastKnownConfigModTime != GetLoadedConfigModifiedTime()) 
    25202532                { 
    2521                         ::syslog(LOG_WARNING, "Store object info file '%s' " 
    2522                                 "out of date. Will re-cache from store",  
    2523                                 StoreObjectInfoFile.c_str()); 
     2533                        BOX_WARNING("Store object info file " 
     2534                                "out of date. Will re-cache from store. " 
     2535                                "(" << StoreObjectInfoFile << ")"); 
    25242536                        return false; 
    25252537                } 
     
    25682580                // 
    25692581                aFile.Close(); 
    2570                 ::syslog(LOG_INFO, "Loaded store object info file '%s', " 
    2571                         "version [%d]", StoreObjectInfoFile.c_str(),  
    2572                         iVersion); 
    2573  
     2582                BOX_INFO("Loaded store object info file version " << iVersion 
     2583                        << "(" << StoreObjectInfoFile << ")"); 
     2584                 
    25742585                return true; 
    25752586        }  
    25762587        catch(std::exception &e) 
    25772588        { 
    2578                 ::syslog(LOG_ERR, "Internal error reading store object " 
    2579                         "info file (%s): %s", 
    2580                         StoreObjectInfoFile.c_str(), e.what()); 
     2589                BOX_ERROR("Internal error reading store object info file: " 
     2590                        << StoreObjectInfoFile << ": " << e.what()); 
    25812591        } 
    25822592        catch(...) 
    25832593        { 
    2584                 ::syslog(LOG_ERR, "Internal error reading store object " 
    2585                         "info file (%s): unknown error", 
    2586                         StoreObjectInfoFile.c_str()); 
     2594                BOX_ERROR("Internal error reading store object info file: " 
     2595                        << StoreObjectInfoFile << ": unknown error"); 
    25872596        } 
    25882597 
     
    25932602        theNextSyncTime = 0; 
    25942603 
    2595         ::syslog(LOG_WARNING, "Requested store object info file '%s' " 
    2596                 "does not exist, not accessible, or inconsistent. " 
    2597                 "Will re-cache from store.",  
    2598                 StoreObjectInfoFile.c_str()); 
    2599  
     2604        BOX_WARNING("Store object info file is missing, not accessible, " 
     2605                "or inconsistent. Will re-cache from store. " 
     2606                "(" << StoreObjectInfoFile << ")"); 
     2607         
    26002608        return false; 
    26012609} 
     
    26252633        { 
    26262634                // File doesn't exist -- so can't be deleted. But something isn't quite right, so log a message 
    2627                 ::syslog(LOG_ERR, "Expected to be able to delete " 
    2628                         "store object info file '%s', but the file did not exist.", 
    2629                         storeObjectInfoFile.c_str()); 
     2635                BOX_WARNING("Store object info file did not exist when it " 
     2636                        "was supposed to. (" << storeObjectInfoFile << ")"); 
     2637 
    26302638                // Return true to stop things going around in a loop 
    26312639                return true; 
     
    26352643        if(::unlink(storeObjectInfoFile.c_str()) != 0) 
    26362644        { 
    2637                 ::syslog(LOG_ERR, "Failed to delete the old " 
    2638                         "store object info file '%s': %s", 
    2639                         storeObjectInfoFile.c_str(), strerror(errno)); 
     2645                BOX_ERROR("Failed to delete the old store object info file: " 
     2646                        << storeObjectInfoFile << ": "<< strerror(errno)); 
    26402647                return false; 
    26412648        } 
Note: See TracChangeset for help on using the changeset viewer.